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

View File

@ -8,7 +8,11 @@
v-if="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>
</Button>
</template>
@ -45,8 +49,8 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
>
<LeadsIcon class="h-10 w-10" />
<span>No Leads Found</span>
<Button label="Create" @click="showNewDialog = true">
<span>{{ __('No Leads Found') }}</span>
<Button :label="__('Create')" @click="showNewDialog = true">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button>
</div>
@ -55,8 +59,7 @@
v-model="showNewDialog"
:options="{
size: '3xl',
title: 'New Lead',
actions: [{ label: 'Save', variant: 'solid' }],
title: __('New Lead'),
}"
>
<template #body-content>
@ -64,7 +67,11 @@
</template>
<template #actions="{ close }">
<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>
</template>
</Dialog>
@ -80,12 +87,18 @@ import ViewControls from '@/components/ViewControls.vue'
import { usersStore } from '@/stores/users'
import { organizationsStore } from '@/stores/organizations'
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 { useRouter } from 'vue-router'
import { ref, computed, reactive } from 'vue'
const breadcrumbs = [{ label: 'Leads', route: { name: 'Leads' } }]
const breadcrumbs = [{ label: __('Leads'), route: { name: 'Leads' } }]
const { getUser } = usersStore()
const { getOrganization } = organizationsStore()
@ -219,7 +232,13 @@ function createNewLead(close) {
.submit(newLead, {
validate() {
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) {