From 58cb9b5fb8fbf38bdfa1f84edf93ac8ef57d303d Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 14 Mar 2025 15:02:58 +0530 Subject: [PATCH] fix: show title value if exist in breadcrumbs or name --- frontend/src/pages/Contact.vue | 10 ++++++++-- frontend/src/pages/Deal.vue | 15 +++++++++++---- frontend/src/pages/Lead.vue | 15 +++++++++++---- frontend/src/pages/MobileContact.vue | 10 ++++++++-- frontend/src/pages/MobileDeal.vue | 11 +++++++++-- frontend/src/pages/MobileLead.vue | 11 +++++++++-- frontend/src/pages/MobileOrganization.vue | 10 ++++++++-- frontend/src/pages/Organization.vue | 10 ++++++++-- 8 files changed, 72 insertions(+), 20 deletions(-) diff --git a/frontend/src/pages/Contact.vue b/frontend/src/pages/Contact.vue index 92f919a1..a888b2a5 100644 --- a/frontend/src/pages/Contact.vue +++ b/frontend/src/pages/Contact.vue @@ -209,6 +209,7 @@ const { $dialog, makeCall } = globalStore() const { getUser } = usersStore() const { getOrganization } = organizationsStore() const { getDealStatus } = statusesStore() +const { doctypeMeta } = getMeta('Contact') const props = defineProps({ contactId: { @@ -257,15 +258,20 @@ const breadcrumbs = computed(() => { } items.push({ - label: contact.data?.full_name, + label: title.value, route: { name: 'Contact', params: { contactId: props.contactId } }, }) return items }) +const title = computed(() => { + let t = doctypeMeta['Contact']?.title_field || 'name' + return contact.data?.[t] || props.contactId +}) + usePageMeta(() => { return { - title: contact.data?.full_name || contact.data?.name, + title: title.value, icon: brand.favicon, } }) diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue index cd83158a..2554e811 100644 --- a/frontend/src/pages/Deal.vue +++ b/frontend/src/pages/Deal.vue @@ -62,7 +62,7 @@ @@ -70,7 +70,7 @@
- {{ organization.data?.name || __('Untitled') }} + {{ title }}
@@ -329,6 +329,7 @@ import { getView } from '@/utils/view' import { getSettings } from '@/stores/settings' import { globalStore } from '@/stores/global' import { statusesStore } from '@/stores/statuses' +import { getMeta } from '@/stores/meta' import { whatsappEnabled, callEnabled } from '@/composables/settings' import { createResource, @@ -347,6 +348,7 @@ import { useActiveTabManager } from '@/composables/useActiveTabManager' const { brand } = getSettings() const { $dialog, $socket, makeCall } = globalStore() const { statusOptions, getDealStatus } = statusesStore() +const { doctypeMeta } = getMeta('CRM Deal') const route = useRoute() const router = useRouter() @@ -486,15 +488,20 @@ const breadcrumbs = computed(() => { } items.push({ - label: organization.data?.name || __('Untitled'), + label: title.value, route: { name: 'Deal', params: { dealId: deal.data.name } }, }) return items }) +const title = computed(() => { + let t = doctypeMeta['CRM Deal']?.title_field || 'name' + return deal.data?.[t] || props.dealId +}) + usePageMeta(() => { return { - title: organization.data?.name || deal.data?.name, + title: title.value, icon: brand.favicon, } }) diff --git a/frontend/src/pages/Lead.vue b/frontend/src/pages/Lead.vue index 1e8d728b..f68e5c53 100644 --- a/frontend/src/pages/Lead.vue +++ b/frontend/src/pages/Lead.vue @@ -71,7 +71,7 @@
- {{ lead.data.lead_name || __('Untitled') }} + {{ title }}
@@ -343,6 +343,7 @@ import { usersStore } from '@/stores/users' import { globalStore } from '@/stores/global' import { contactsStore } from '@/stores/contacts' import { statusesStore } from '@/stores/statuses' +import { getMeta } from '@/stores/meta' import { whatsappEnabled, callEnabled, @@ -370,6 +371,7 @@ const { isManager } = usersStore() const { $dialog, $socket, makeCall } = globalStore() const { getContactByName, contacts } = contactsStore() const { statusOptions, getLeadStatus, getDealStatus } = statusesStore() +const { doctypeMeta } = getMeta('CRM Lead') const route = useRoute() const router = useRouter() @@ -476,15 +478,20 @@ const breadcrumbs = computed(() => { } items.push({ - label: lead.data.lead_name || __('Untitled'), + label: title.value, route: { name: 'Lead', params: { leadId: lead.data.name } }, }) return items }) +const title = computed(() => { + let t = doctypeMeta['CRM Lead']?.title_field || 'name' + return lead.data?.[t] || props.leadId +}) + usePageMeta(() => { return { - title: lead.data?.lead_name || lead.data?.name, + title: title.value, icon: brand.favicon, } }) diff --git a/frontend/src/pages/MobileContact.vue b/frontend/src/pages/MobileContact.vue index a3caf365..728ebc16 100644 --- a/frontend/src/pages/MobileContact.vue +++ b/frontend/src/pages/MobileContact.vue @@ -200,6 +200,7 @@ const { $dialog, makeCall } = globalStore() const { getUser } = usersStore() const { getOrganization } = organizationsStore() const { getDealStatus } = statusesStore() +const { doctypeMeta } = getMeta('Contact') const props = defineProps({ contactId: { @@ -250,15 +251,20 @@ const breadcrumbs = computed(() => { } items.push({ - label: contact.data?.full_name, + label: title.value, route: { name: 'Contact', params: { contactId: props.contactId } }, }) return items }) +const title = computed(() => { + let t = doctypeMeta['Contact']?.title_field || 'name' + return contact.data?.[t] || props.contactId +}) + usePageMeta(() => { return { - title: contact.data?.full_name || contact.data?.name, + title: title.value, icon: brand.favicon, } }) diff --git a/frontend/src/pages/MobileDeal.vue b/frontend/src/pages/MobileDeal.vue index b4fc37e5..c41ee341 100644 --- a/frontend/src/pages/MobileDeal.vue +++ b/frontend/src/pages/MobileDeal.vue @@ -262,6 +262,7 @@ import { getView } from '@/utils/view' import { getSettings } from '@/stores/settings' import { globalStore } from '@/stores/global' import { statusesStore } from '@/stores/statuses' +import { getMeta } from '@/stores/meta' import { whatsappEnabled, callEnabled, @@ -285,6 +286,7 @@ import { useRoute, useRouter } from 'vue-router' const { brand } = getSettings() const { $dialog, $socket } = globalStore() const { statusOptions, getDealStatus } = statusesStore() +const { doctypeMeta } = getMeta('CRM Deal') const route = useRoute() const router = useRouter() @@ -408,15 +410,20 @@ const breadcrumbs = computed(() => { } items.push({ - label: organization.data?.name || __('Untitled'), + label: title.value, route: { name: 'Deal', params: { dealId: deal.data.name } }, }) return items }) +const title = computed(() => { + let t = doctypeMeta['CRM Deal']?.title_field || 'name' + return deal.data?.[t] || props.dealId +}) + usePageMeta(() => { return { - title: organization.data?.name || deal.data?.name, + title: title.value, icon: brand.favicon, } }) diff --git a/frontend/src/pages/MobileLead.vue b/frontend/src/pages/MobileLead.vue index df9d0df8..437d65a4 100644 --- a/frontend/src/pages/MobileLead.vue +++ b/frontend/src/pages/MobileLead.vue @@ -180,6 +180,7 @@ import { getSettings } from '@/stores/settings' import { globalStore } from '@/stores/global' import { contactsStore } from '@/stores/contacts' import { statusesStore } from '@/stores/statuses' +import { getMeta } from '@/stores/meta' import { whatsappEnabled, callEnabled, @@ -204,6 +205,7 @@ const { brand } = getSettings() const { $dialog, $socket } = globalStore() const { getContactByName, contacts } = contactsStore() const { statusOptions, getLeadStatus } = statusesStore() +const { doctypeMeta } = getMeta('CRM Lead') const route = useRoute() const router = useRouter() @@ -312,15 +314,20 @@ const breadcrumbs = computed(() => { } items.push({ - label: lead.data.lead_name || __('Untitled'), + label: title.value, route: { name: 'Lead', params: { leadId: lead.data.name } }, }) return items }) +const title = computed(() => { + let t = doctypeMeta['CRM Lead']?.title_field || 'name' + return lead.data?.[t] || props.leadId +}) + usePageMeta(() => { return { - title: lead.data?.lead_name || lead.data?.name, + title: title.value, icon: brand.favicon, } }) diff --git a/frontend/src/pages/MobileOrganization.vue b/frontend/src/pages/MobileOrganization.vue index 721a952e..ba91553b 100644 --- a/frontend/src/pages/MobileOrganization.vue +++ b/frontend/src/pages/MobileOrganization.vue @@ -195,6 +195,7 @@ const { brand } = getSettings() const { getUser } = usersStore() const { $dialog } = globalStore() const { getDealStatus } = statusesStore() +const { doctypeMeta } = getMeta('CRM Organization') const route = useRoute() const router = useRouter() @@ -241,7 +242,7 @@ const breadcrumbs = computed(() => { } items.push({ - label: props.organizationId, + label: title.value, route: { name: 'Organization', params: { organizationId: props.organizationId }, @@ -250,9 +251,14 @@ const breadcrumbs = computed(() => { return items }) +const title = computed(() => { + let t = doctypeMeta['CRM Organization']?.title_field || 'name' + return organization.doc?.[t] || props.organizationId +}) + usePageMeta(() => { return { - title: props.organizationId, + title: title.value, icon: brand.favicon, } }) diff --git a/frontend/src/pages/Organization.vue b/frontend/src/pages/Organization.vue index 74fd9c6f..eeb95afa 100644 --- a/frontend/src/pages/Organization.vue +++ b/frontend/src/pages/Organization.vue @@ -215,6 +215,7 @@ const { brand } = getSettings() const { getUser } = usersStore() const { $dialog } = globalStore() const { getDealStatus } = statusesStore() +const { doctypeMeta } = getMeta('CRM Organization') const showQuickEntryModal = ref(false) const route = useRoute() @@ -262,7 +263,7 @@ const breadcrumbs = computed(() => { } items.push({ - label: props.organizationId, + label: title.value, route: { name: 'Organization', params: { organizationId: props.organizationId }, @@ -271,9 +272,14 @@ const breadcrumbs = computed(() => { return items }) +const title = computed(() => { + let t = doctypeMeta['CRM Organization']?.title_field || 'name' + return organization.doc?.[t] || props.organizationId +}) + usePageMeta(() => { return { - title: props.organizationId, + title: title.value, icon: brand.favicon, } })