fix: added translation in Deal Page

This commit is contained in:
Shariq Ansari 2024-04-15 19:36:13 +05:30
parent 29855132cf
commit fb089a56c7

View File

@ -39,7 +39,7 @@
<Activities <Activities
ref="activities" ref="activities"
doctype="CRM Deal" doctype="CRM Deal"
:title="tab.label" :title="tab.name"
v-model:reload="reload" v-model:reload="reload"
v-model="deal" v-model="deal"
/> />
@ -48,10 +48,10 @@
<div <div
class="flex h-10.5 items-center border-b px-5 py-2.5 text-lg font-semibold" class="flex h-10.5 items-center border-b px-5 py-2.5 text-lg font-semibold"
> >
About this Deal {{ __('About this Deal') }}
</div> </div>
<div class="flex items-center justify-start gap-5 border-b p-5"> <div class="flex items-center justify-start gap-5 border-b p-5">
<Tooltip text="Organization logo"> <Tooltip :text="__('Organization logo')">
<div class="group relative h-[88px] w-[88px]"> <div class="group relative h-[88px] w-[88px]">
<Avatar <Avatar
size="3xl" size="3xl"
@ -68,31 +68,31 @@
</div> </div>
</Tooltip> </Tooltip>
<div class="flex gap-1.5"> <div class="flex gap-1.5">
<Tooltip text="Make a call"> <Tooltip :text="__('Make a call')">
<Button class="h-7 w-7" @click="triggerCall"> <Button class="h-7 w-7" @click="triggerCall">
<PhoneIcon class="h-4 w-4" /> <PhoneIcon class="h-4 w-4" />
</Button> </Button>
</Tooltip> </Tooltip>
<Tooltip text="Send an email"> <Tooltip :text="__('Send an email')">
<Button class="h-7 w-7"> <Button class="h-7 w-7">
<EmailIcon <EmailIcon
class="h-4 w-4" class="h-4 w-4"
@click=" @click="
deal.data.email deal.data.email
? openEmailBox() ? openEmailBox()
: errorMessage('No email set') : errorMessage(__('No email set'))
" "
/> />
</Button> </Button>
</Tooltip> </Tooltip>
<Tooltip text="Go to website"> <Tooltip :text="__('Go to website')">
<Button class="h-7 w-7"> <Button class="h-7 w-7">
<LinkIcon <LinkIcon
class="h-4 w-4" class="h-4 w-4"
@click=" @click="
deal.data.website deal.data.website
? openWebsite(deal.data.website) ? openWebsite(deal.data.website)
: errorMessage('No website set') : errorMessage(__('No website set'))
" "
/> />
</Button> </Button>
@ -137,7 +137,7 @@
<template #target="{ togglePopover }"> <template #target="{ togglePopover }">
<Button <Button
class="h-7 px-3" class="h-7 px-3"
label="Add Contact" :label="__('Add Contact')"
@click="togglePopover()" @click="togglePopover()"
> >
<template #prefix> <template #prefix>
@ -162,7 +162,7 @@
class="flex min-h-20 flex-1 items-center justify-center gap-3 text-base text-gray-500" class="flex min-h-20 flex-1 items-center justify-center gap-3 text-base text-gray-500"
> >
<LoadingIndicator class="h-4 w-4" /> <LoadingIndicator class="h-4 w-4" />
<span>Loading...</span> <span>{{ __('Loading...') }}</span>
</div> </div>
<div <div
v-else-if="section.contacts.length" v-else-if="section.contacts.length"
@ -194,7 +194,7 @@
v-if="contact.is_primary" v-if="contact.is_primary"
class="ml-2" class="ml-2"
variant="outline" variant="outline"
label="Primary" :label="__('Primary')"
theme="green" theme="green"
/> />
</div> </div>
@ -251,7 +251,7 @@
v-else v-else
class="flex h-20 items-center justify-center text-base text-gray-600" class="flex h-20 items-center justify-center text-base text-gray-600"
> >
No contacts added {{ __('No contacts added') }}
</div> </div>
</div> </div>
</Section> </Section>
@ -392,7 +392,7 @@ function updateDeal(fieldname, value, callback) {
deal.reload() deal.reload()
reload.value = true reload.value = true
createToast({ createToast({
title: 'Deal updated', title: __('Deal updated'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -400,8 +400,8 @@ function updateDeal(fieldname, value, callback) {
}, },
onError: (err) => { onError: (err) => {
createToast({ createToast({
title: 'Error updating deal', title: __('Error updating deal'),
text: err.messages?.[0], text: __(err.messages?.[0]),
icon: 'x', icon: 'x',
iconClasses: 'text-red-600', iconClasses: 'text-red-600',
}) })
@ -413,8 +413,8 @@ function validateRequired(fieldname, value) {
let meta = deal.data.all_fields || {} let meta = deal.data.all_fields || {}
if (meta[fieldname]?.reqd && !value) { if (meta[fieldname]?.reqd && !value) {
createToast({ createToast({
title: 'Error Updating Deal', title: __('Error Updating Deal'),
text: `${meta[fieldname].label} is a required field`, text: __('{0} is a required field', [meta[fieldname].label]),
icon: 'x', icon: 'x',
iconClasses: 'text-red-600', iconClasses: 'text-red-600',
}) })
@ -424,9 +424,9 @@ function validateRequired(fieldname, value) {
} }
const breadcrumbs = computed(() => { const breadcrumbs = computed(() => {
let items = [{ label: 'Deals', route: { name: 'Deals' } }] let items = [{ label: __('Deals'), route: { name: 'Deals' } }]
items.push({ items.push({
label: organization.value?.name, label: __(organization.value?.name),
route: { name: 'Deal', params: { dealId: deal.data.name } }, route: { name: 'Deal', params: { dealId: deal.data.name } },
}) })
return items return items
@ -435,22 +435,27 @@ const breadcrumbs = computed(() => {
const tabIndex = ref(0) const tabIndex = ref(0)
const tabs = [ const tabs = [
{ {
name: 'Activity',
label: 'Activity', label: 'Activity',
icon: ActivityIcon, icon: ActivityIcon,
}, },
{ {
name: 'Emails',
label: 'Emails', label: 'Emails',
icon: EmailIcon, icon: EmailIcon,
}, },
{ {
name: 'Calls',
label: 'Calls', label: 'Calls',
icon: PhoneIcon, icon: PhoneIcon,
}, },
{ {
name: 'Tasks',
label: 'Tasks', label: 'Tasks',
icon: TaskIcon, icon: TaskIcon,
}, },
{ {
name: 'Notes',
label: 'Notes', label: 'Notes',
icon: NoteIcon, icon: NoteIcon,
}, },
@ -504,7 +509,7 @@ const _contact = ref({})
function contactOptions(contact) { function contactOptions(contact) {
let options = [ let options = [
{ {
label: 'Delete', label: __('Delete'),
icon: 'trash-2', icon: 'trash-2',
onClick: () => removeContact(contact), onClick: () => removeContact(contact),
}, },
@ -512,7 +517,7 @@ function contactOptions(contact) {
if (!contact.is_primary) { if (!contact.is_primary) {
options.push({ options.push({
label: 'Set as Primary Contact', label: __('Set as Primary Contact'),
icon: h(SuccessIcon, { class: 'h-4 w-4' }), icon: h(SuccessIcon, { class: 'h-4 w-4' }),
onClick: () => setPrimaryContact(contact), onClick: () => setPrimaryContact(contact),
}) })
@ -529,7 +534,7 @@ async function addContact(contact) {
if (d) { if (d) {
deal_contacts.reload() deal_contacts.reload()
createToast({ createToast({
title: 'Contact added', title: __('Contact added'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -544,7 +549,7 @@ async function removeContact(contact) {
if (d) { if (d) {
deal_contacts.reload() deal_contacts.reload()
createToast({ createToast({
title: 'Contact removed', title: __('Contact removed'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -559,7 +564,7 @@ async function setPrimaryContact(contact) {
if (d) { if (d) {
deal_contacts.reload() deal_contacts.reload()
createToast({ createToast({
title: 'Primary contact set', title: __('Primary contact set'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -578,12 +583,12 @@ function triggerCall() {
let mobile_no = primaryContact.mobile_no || null let mobile_no = primaryContact.mobile_no || null
if (!primaryContact) { if (!primaryContact) {
errorMessage('No primary contact set') errorMessage(__('No primary contact set'))
return return
} }
if (!mobile_no) { if (!mobile_no) {
errorMessage('No mobile number set') errorMessage(__('No mobile number set'))
return return
} }