fix: added translation in Lead Page

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

View File

@ -33,7 +33,7 @@
</template> </template>
</Dropdown> </Dropdown>
<Button <Button
label="Convert to Deal" :label="__('Convert to Deal')"
variant="solid" variant="solid"
@click="showConvertToDealModal = true" @click="showConvertToDealModal = true"
/> />
@ -44,7 +44,7 @@
<Activities <Activities
ref="activities" ref="activities"
doctype="CRM Lead" doctype="CRM Lead"
:title="tab.label" :title="tab.name"
v-model:reload="reload" v-model:reload="reload"
v-model="lead" v-model="lead"
/> />
@ -53,7 +53,7 @@
<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 Lead {{ __('About this Lead') }}
</div> </div>
<FileUploader <FileUploader
@success="(file) => updateField('image', file.file_url)" @success="(file) => updateField('image', file.file_url)"
@ -77,13 +77,13 @@
{ {
icon: 'upload', icon: 'upload',
label: lead.data.image label: lead.data.image
? 'Change image' ? __('Change image')
: 'Upload image', : __('Upload image'),
onClick: openFileSelector, onClick: openFileSelector,
}, },
{ {
icon: 'trash-2', icon: 'trash-2',
label: 'Remove image', label: __('Remove image'),
onClick: () => updateField('image', ''), onClick: () => updateField('image', ''),
}, },
], ],
@ -110,45 +110,45 @@
</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 <Button
class="h-7 w-7" class="h-7 w-7"
@click=" @click="
() => () =>
lead.data.mobile_no lead.data.mobile_no
? makeCall(lead.data.mobile_no) ? makeCall(lead.data.mobile_no)
: errorMessage('No phone number set') : errorMessage(__('No phone number set'))
" "
> >
<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="
lead.data.email lead.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="
lead.data.website lead.data.website
? openWebsite(lead.data.website) ? openWebsite(lead.data.website)
: errorMessage('No website set') : errorMessage(__('No website set'))
" "
/> />
</Button> </Button>
</Tooltip> </Tooltip>
</div> </div>
<ErrorMessage :message="error" /> <ErrorMessage :message="__(error)" />
</div> </div>
</div> </div>
</template> </template>
@ -190,11 +190,11 @@
<Dialog <Dialog
v-model="showConvertToDealModal" v-model="showConvertToDealModal"
:options="{ :options="{
title: 'Convert to Deal', title: __('Convert to Deal'),
size: 'xl', size: 'xl',
actions: [ actions: [
{ {
label: 'Convert', label: __('Convert'),
variant: 'solid', variant: 'solid',
onClick: convertToDeal, onClick: convertToDeal,
}, },
@ -204,11 +204,11 @@
<template #body-content> <template #body-content>
<div class="mb-4 flex items-center gap-2 text-gray-600"> <div class="mb-4 flex items-center gap-2 text-gray-600">
<OrganizationsIcon class="h-4 w-4" /> <OrganizationsIcon class="h-4 w-4" />
<label class="block text-base"> Organization </label> <label class="block text-base">{{ __('Organization') }}</label>
</div> </div>
<div class="ml-6"> <div class="ml-6">
<div class="flex items-center justify-between text-base"> <div class="flex items-center justify-between text-base">
<div>Choose Existing</div> <div>{{ __('Choose Existing') }}</div>
<Switch v-model="existingOrganizationChecked" /> <Switch v-model="existingOrganizationChecked" />
</div> </div>
<Link <Link
@ -221,17 +221,21 @@
@change="(data) => (existingOrganization = data)" @change="(data) => (existingOrganization = data)"
/> />
<div v-else class="mt-2.5 text-base"> <div v-else class="mt-2.5 text-base">
New organization will be created based on the data in details section {{
__(
'New organization will be created based on the data in details section'
)
}}
</div> </div>
</div> </div>
<div class="mb-4 mt-6 flex items-center gap-2 text-gray-600"> <div class="mb-4 mt-6 flex items-center gap-2 text-gray-600">
<ContactsIcon class="h-4 w-4" /> <ContactsIcon class="h-4 w-4" />
<label class="block text-base"> Contact </label> <label class="block text-base">{{ __('Contact') }}</label>
</div> </div>
<div class="ml-6"> <div class="ml-6">
<div class="flex items-center justify-between text-base"> <div class="flex items-center justify-between text-base">
<div>Choose Existing</div> <div>{{ __('Choose Existing') }}</div>
<Switch v-model="existingContactChecked" /> <Switch v-model="existingContactChecked" />
</div> </div>
<Link <Link
@ -244,7 +248,7 @@
@change="(data) => (existingContact = data)" @change="(data) => (existingContact = data)"
/> />
<div v-else class="mt-2.5 text-base"> <div v-else class="mt-2.5 text-base">
New contact will be created based on the person's details {{ __("New contact will be created based on the person's details") }}
</div> </div>
</div> </div>
</template> </template>
@ -352,7 +356,7 @@ function updateLead(fieldname, value, callback) {
lead.reload() lead.reload()
reload.value = true reload.value = true
createToast({ createToast({
title: 'Lead updated', title: __('Lead updated'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -360,8 +364,8 @@ function updateLead(fieldname, value, callback) {
}, },
onError: (err) => { onError: (err) => {
createToast({ createToast({
title: 'Error updating lead', title: __('Error updating lead'),
text: err.messages?.[0], text: __(err.messages?.[0]),
icon: 'x', icon: 'x',
iconClasses: 'text-red-600', iconClasses: 'text-red-600',
}) })
@ -373,8 +377,8 @@ function validateRequired(fieldname, value) {
let meta = lead.data.all_fields || {} let meta = lead.data.all_fields || {}
if (meta[fieldname]?.reqd && !value) { if (meta[fieldname]?.reqd && !value) {
createToast({ createToast({
title: 'Error Updating Lead', title: __('Error Updating Lead'),
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',
}) })
@ -384,9 +388,9 @@ function validateRequired(fieldname, value) {
} }
const breadcrumbs = computed(() => { const breadcrumbs = computed(() => {
let items = [{ label: 'Leads', route: { name: 'Leads' } }] let items = [{ label: __('Leads'), route: { name: 'Leads' } }]
items.push({ items.push({
label: lead.data.lead_name, label: __(lead.data.lead_name),
route: { name: 'Lead', params: { leadId: lead.data.name } }, route: { name: 'Lead', params: { leadId: lead.data.name } },
}) })
return items return items
@ -395,23 +399,28 @@ const breadcrumbs = computed(() => {
const tabIndex = ref(0) const tabIndex = ref(0)
const tabs = [ const tabs = [
{ {
label: 'Activity', name: 'Activity',
label: __('Activity'),
icon: ActivityIcon, icon: ActivityIcon,
}, },
{ {
label: 'Emails', name: 'Emails',
label: __('Emails'),
icon: EmailIcon, icon: EmailIcon,
}, },
{ {
label: 'Calls', name: 'Calls',
label: __('Calls'),
icon: PhoneIcon, icon: PhoneIcon,
}, },
{ {
label: 'Tasks', name: 'Tasks',
label: __('Tasks'),
icon: TaskIcon, icon: TaskIcon,
}, },
{ {
label: 'Notes', name: 'Notes',
label: __('Notes'),
icon: NoteIcon, icon: NoteIcon,
}, },
] ]
@ -419,7 +428,7 @@ const tabs = [
function validateFile(file) { function validateFile(file) {
let extn = file.name.split('.').pop().toLowerCase() let extn = file.name.split('.').pop().toLowerCase()
if (!['png', 'jpg', 'jpeg'].includes(extn)) { if (!['png', 'jpg', 'jpeg'].includes(extn)) {
return 'Only PNG and JPG images are allowed' return __('Only PNG and JPG images are allowed')
} }
} }
@ -457,8 +466,8 @@ async function convertToDeal(updated) {
if (existingContactChecked.value && !existingContact.value) { if (existingContactChecked.value && !existingContact.value) {
createToast({ createToast({
title: 'Error', title: __('Error'),
text: 'Please select an existing contact', text: __('Please select an existing contact'),
icon: 'x', icon: 'x',
iconClasses: 'text-red-600', iconClasses: 'text-red-600',
}) })
@ -467,8 +476,8 @@ async function convertToDeal(updated) {
if (existingOrganizationChecked.value && !existingOrganization.value) { if (existingOrganizationChecked.value && !existingOrganization.value) {
createToast({ createToast({
title: 'Error', title: __('Error'),
text: 'Please select an existing organization', text: __('Please select an existing organization'),
icon: 'x', icon: 'x',
iconClasses: 'text-red-600', iconClasses: 'text-red-600',
}) })