fix: added translation in Leads Listview

This commit is contained in:
Shariq Ansari 2024-04-15 16:34:31 +05:30
parent 97edec317a
commit 6dcc34ed2c
2 changed files with 35 additions and 18 deletions

View File

@ -212,14 +212,12 @@ function editValues(selections, unselectAll) {
function deleteValues(selections, unselectAll) { function deleteValues(selections, unselectAll) {
$dialog({ $dialog({
title: 'Delete', title: __('Delete'),
message: `Are you sure you want to delete ${selections.size} item${ message: __('Are you sure you want to delete {0} item(s)?', [selections.size]),
selections.size > 1 ? 's' : ''
}?`,
variant: 'danger', variant: 'danger',
actions: [ actions: [
{ {
label: 'Delete', label: __('Delete'),
variant: 'solid', variant: 'solid',
theme: 'red', theme: 'red',
onClick: (close) => { onClick: (close) => {
@ -228,7 +226,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'CRM Lead', doctype: 'CRM Lead',
}).then(() => { }).then(() => {
createToast({ createToast({
title: 'Deleted successfully', title: __('Deleted successfully'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -248,17 +246,17 @@ const customListActions = ref([])
function bulkActions(selections, unselectAll) { function bulkActions(selections, unselectAll) {
let actions = [ let actions = [
{ {
label: 'Edit', label: __('Edit'),
onClick: () => editValues(selections, unselectAll), onClick: () => editValues(selections, unselectAll),
}, },
{ {
label: 'Delete', label: __('Delete'),
onClick: () => deleteValues(selections, unselectAll), onClick: () => deleteValues(selections, unselectAll),
}, },
] ]
customBulkActions.value.forEach((action) => { customBulkActions.value.forEach((action) => {
actions.push({ actions.push({
label: action.label, label: __(action.label),
onClick: () => onClick: () =>
action.onClick({ action.onClick({
list: list.value, list: list.value,

View File

@ -8,7 +8,11 @@
v-if="leadsListView?.customListActions" v-if="leadsListView?.customListActions"
:actions="leadsListView.customListActions" :actions="leadsListView.customListActions"
/> />
<Button variant="solid" label="Create" @click="showNewDialog = true"> <Button
variant="solid"
:label="__('Create')"
@click="showNewDialog = true"
>
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</template> </template>
@ -45,8 +49,8 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500" class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
> >
<LeadsIcon class="h-10 w-10" /> <LeadsIcon class="h-10 w-10" />
<span>No Leads Found</span> <span>{{ __('No Leads Found') }}</span>
<Button label="Create" @click="showNewDialog = true"> <Button :label="__('Create')" @click="showNewDialog = true">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</div> </div>
@ -55,8 +59,7 @@
v-model="showNewDialog" v-model="showNewDialog"
:options="{ :options="{
size: '3xl', size: '3xl',
title: 'New Lead', title: __('New Lead'),
actions: [{ label: 'Save', variant: 'solid' }],
}" }"
> >
<template #body-content> <template #body-content>
@ -64,7 +67,11 @@
</template> </template>
<template #actions="{ close }"> <template #actions="{ close }">
<div class="flex flex-row-reverse gap-2"> <div class="flex flex-row-reverse gap-2">
<Button variant="solid" label="Save" @click="createNewLead(close)" /> <Button
variant="solid"
:label="__('Save')"
@click="createNewLead(close)"
/>
</div> </div>
</template> </template>
</Dialog> </Dialog>
@ -80,12 +87,18 @@ import ViewControls from '@/components/ViewControls.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { organizationsStore } from '@/stores/organizations' import { organizationsStore } from '@/stores/organizations'
import { statusesStore } from '@/stores/statuses' import { statusesStore } from '@/stores/statuses'
import { dateFormat, dateTooltipFormat, timeAgo, formatTime } from '@/utils' import {
dateFormat,
dateTooltipFormat,
timeAgo,
formatTime,
createToast,
} from '@/utils'
import { createResource, Breadcrumbs } from 'frappe-ui' import { createResource, Breadcrumbs } from 'frappe-ui'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { ref, computed, reactive } from 'vue' import { ref, computed, reactive } from 'vue'
const breadcrumbs = [{ label: 'Leads', route: { name: 'Leads' } }] const breadcrumbs = [{ label: __('Leads'), route: { name: 'Leads' } }]
const { getUser } = usersStore() const { getUser } = usersStore()
const { getOrganization } = organizationsStore() const { getOrganization } = organizationsStore()
@ -219,7 +232,13 @@ function createNewLead(close) {
.submit(newLead, { .submit(newLead, {
validate() { validate() {
if (!newLead.first_name) { if (!newLead.first_name) {
return 'First name is required' createToast({
title: __('Error creating lead'),
text: __('First name is required'),
icon: 'x',
iconClasses: 'text-red-600',
})
return __('First name is required')
} }
}, },
onSuccess(data) { onSuccess(data) {