1
0
forked from test/crm

fix: show title value if exist in breadcrumbs or name

This commit is contained in:
Shariq Ansari 2025-03-14 15:02:58 +05:30
parent 83b944bf21
commit 58cb9b5fb8
8 changed files with 72 additions and 20 deletions

View File

@ -209,6 +209,7 @@ const { $dialog, makeCall } = globalStore()
const { getUser } = usersStore() const { getUser } = usersStore()
const { getOrganization } = organizationsStore() const { getOrganization } = organizationsStore()
const { getDealStatus } = statusesStore() const { getDealStatus } = statusesStore()
const { doctypeMeta } = getMeta('Contact')
const props = defineProps({ const props = defineProps({
contactId: { contactId: {
@ -257,15 +258,20 @@ const breadcrumbs = computed(() => {
} }
items.push({ items.push({
label: contact.data?.full_name, label: title.value,
route: { name: 'Contact', params: { contactId: props.contactId } }, route: { name: 'Contact', params: { contactId: props.contactId } },
}) })
return items return items
}) })
const title = computed(() => {
let t = doctypeMeta['Contact']?.title_field || 'name'
return contact.data?.[t] || props.contactId
})
usePageMeta(() => { usePageMeta(() => {
return { return {
title: contact.data?.full_name || contact.data?.name, title: title.value,
icon: brand.favicon, icon: brand.favicon,
} }
}) })

View File

@ -62,7 +62,7 @@
<Avatar <Avatar
size="3xl" size="3xl"
class="size-12" class="size-12"
:label="organization.data?.name || __('Untitled')" :label="title"
:image="organization.data?.organization_logo" :image="organization.data?.organization_logo"
/> />
</div> </div>
@ -70,7 +70,7 @@
<div class="flex flex-col gap-2.5 truncate text-ink-gray-9"> <div class="flex flex-col gap-2.5 truncate text-ink-gray-9">
<Tooltip :text="organization.data?.name || __('Set an organization')"> <Tooltip :text="organization.data?.name || __('Set an organization')">
<div class="truncate text-2xl font-medium"> <div class="truncate text-2xl font-medium">
{{ organization.data?.name || __('Untitled') }} {{ title }}
</div> </div>
</Tooltip> </Tooltip>
<div class="flex gap-1.5"> <div class="flex gap-1.5">
@ -329,6 +329,7 @@ import { getView } from '@/utils/view'
import { getSettings } from '@/stores/settings' import { getSettings } from '@/stores/settings'
import { globalStore } from '@/stores/global' import { globalStore } from '@/stores/global'
import { statusesStore } from '@/stores/statuses' import { statusesStore } from '@/stores/statuses'
import { getMeta } from '@/stores/meta'
import { whatsappEnabled, callEnabled } from '@/composables/settings' import { whatsappEnabled, callEnabled } from '@/composables/settings'
import { import {
createResource, createResource,
@ -347,6 +348,7 @@ import { useActiveTabManager } from '@/composables/useActiveTabManager'
const { brand } = getSettings() const { brand } = getSettings()
const { $dialog, $socket, makeCall } = globalStore() const { $dialog, $socket, makeCall } = globalStore()
const { statusOptions, getDealStatus } = statusesStore() const { statusOptions, getDealStatus } = statusesStore()
const { doctypeMeta } = getMeta('CRM Deal')
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
@ -486,15 +488,20 @@ const breadcrumbs = computed(() => {
} }
items.push({ items.push({
label: organization.data?.name || __('Untitled'), label: title.value,
route: { name: 'Deal', params: { dealId: deal.data.name } }, route: { name: 'Deal', params: { dealId: deal.data.name } },
}) })
return items return items
}) })
const title = computed(() => {
let t = doctypeMeta['CRM Deal']?.title_field || 'name'
return deal.data?.[t] || props.dealId
})
usePageMeta(() => { usePageMeta(() => {
return { return {
title: organization.data?.name || deal.data?.name, title: title.value,
icon: brand.favicon, icon: brand.favicon,
} }
}) })

View File

@ -71,7 +71,7 @@
<Avatar <Avatar
size="3xl" size="3xl"
class="size-12" class="size-12"
:label="lead.data.first_name || __('Untitled')" :label="title"
:image="lead.data.image" :image="lead.data.image"
/> />
<component <component
@ -112,7 +112,7 @@
<div class="flex flex-col gap-2.5 truncate"> <div class="flex flex-col gap-2.5 truncate">
<Tooltip :text="lead.data.lead_name || __('Set first name')"> <Tooltip :text="lead.data.lead_name || __('Set first name')">
<div class="truncate text-2xl font-medium text-ink-gray-9"> <div class="truncate text-2xl font-medium text-ink-gray-9">
{{ lead.data.lead_name || __('Untitled') }} {{ title }}
</div> </div>
</Tooltip> </Tooltip>
<div class="flex gap-1.5"> <div class="flex gap-1.5">
@ -343,6 +343,7 @@ import { usersStore } from '@/stores/users'
import { globalStore } from '@/stores/global' import { globalStore } from '@/stores/global'
import { contactsStore } from '@/stores/contacts' import { contactsStore } from '@/stores/contacts'
import { statusesStore } from '@/stores/statuses' import { statusesStore } from '@/stores/statuses'
import { getMeta } from '@/stores/meta'
import { import {
whatsappEnabled, whatsappEnabled,
callEnabled, callEnabled,
@ -370,6 +371,7 @@ const { isManager } = usersStore()
const { $dialog, $socket, makeCall } = globalStore() const { $dialog, $socket, makeCall } = globalStore()
const { getContactByName, contacts } = contactsStore() const { getContactByName, contacts } = contactsStore()
const { statusOptions, getLeadStatus, getDealStatus } = statusesStore() const { statusOptions, getLeadStatus, getDealStatus } = statusesStore()
const { doctypeMeta } = getMeta('CRM Lead')
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
@ -476,15 +478,20 @@ const breadcrumbs = computed(() => {
} }
items.push({ items.push({
label: lead.data.lead_name || __('Untitled'), label: title.value,
route: { name: 'Lead', params: { leadId: lead.data.name } }, route: { name: 'Lead', params: { leadId: lead.data.name } },
}) })
return items return items
}) })
const title = computed(() => {
let t = doctypeMeta['CRM Lead']?.title_field || 'name'
return lead.data?.[t] || props.leadId
})
usePageMeta(() => { usePageMeta(() => {
return { return {
title: lead.data?.lead_name || lead.data?.name, title: title.value,
icon: brand.favicon, icon: brand.favicon,
} }
}) })

View File

@ -200,6 +200,7 @@ const { $dialog, makeCall } = globalStore()
const { getUser } = usersStore() const { getUser } = usersStore()
const { getOrganization } = organizationsStore() const { getOrganization } = organizationsStore()
const { getDealStatus } = statusesStore() const { getDealStatus } = statusesStore()
const { doctypeMeta } = getMeta('Contact')
const props = defineProps({ const props = defineProps({
contactId: { contactId: {
@ -250,15 +251,20 @@ const breadcrumbs = computed(() => {
} }
items.push({ items.push({
label: contact.data?.full_name, label: title.value,
route: { name: 'Contact', params: { contactId: props.contactId } }, route: { name: 'Contact', params: { contactId: props.contactId } },
}) })
return items return items
}) })
const title = computed(() => {
let t = doctypeMeta['Contact']?.title_field || 'name'
return contact.data?.[t] || props.contactId
})
usePageMeta(() => { usePageMeta(() => {
return { return {
title: contact.data?.full_name || contact.data?.name, title: title.value,
icon: brand.favicon, icon: brand.favicon,
} }
}) })

View File

@ -262,6 +262,7 @@ import { getView } from '@/utils/view'
import { getSettings } from '@/stores/settings' import { getSettings } from '@/stores/settings'
import { globalStore } from '@/stores/global' import { globalStore } from '@/stores/global'
import { statusesStore } from '@/stores/statuses' import { statusesStore } from '@/stores/statuses'
import { getMeta } from '@/stores/meta'
import { import {
whatsappEnabled, whatsappEnabled,
callEnabled, callEnabled,
@ -285,6 +286,7 @@ import { useRoute, useRouter } from 'vue-router'
const { brand } = getSettings() const { brand } = getSettings()
const { $dialog, $socket } = globalStore() const { $dialog, $socket } = globalStore()
const { statusOptions, getDealStatus } = statusesStore() const { statusOptions, getDealStatus } = statusesStore()
const { doctypeMeta } = getMeta('CRM Deal')
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
@ -408,15 +410,20 @@ const breadcrumbs = computed(() => {
} }
items.push({ items.push({
label: organization.data?.name || __('Untitled'), label: title.value,
route: { name: 'Deal', params: { dealId: deal.data.name } }, route: { name: 'Deal', params: { dealId: deal.data.name } },
}) })
return items return items
}) })
const title = computed(() => {
let t = doctypeMeta['CRM Deal']?.title_field || 'name'
return deal.data?.[t] || props.dealId
})
usePageMeta(() => { usePageMeta(() => {
return { return {
title: organization.data?.name || deal.data?.name, title: title.value,
icon: brand.favicon, icon: brand.favicon,
} }
}) })

View File

@ -180,6 +180,7 @@ import { getSettings } from '@/stores/settings'
import { globalStore } from '@/stores/global' import { globalStore } from '@/stores/global'
import { contactsStore } from '@/stores/contacts' import { contactsStore } from '@/stores/contacts'
import { statusesStore } from '@/stores/statuses' import { statusesStore } from '@/stores/statuses'
import { getMeta } from '@/stores/meta'
import { import {
whatsappEnabled, whatsappEnabled,
callEnabled, callEnabled,
@ -204,6 +205,7 @@ const { brand } = getSettings()
const { $dialog, $socket } = globalStore() const { $dialog, $socket } = globalStore()
const { getContactByName, contacts } = contactsStore() const { getContactByName, contacts } = contactsStore()
const { statusOptions, getLeadStatus } = statusesStore() const { statusOptions, getLeadStatus } = statusesStore()
const { doctypeMeta } = getMeta('CRM Lead')
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
@ -312,15 +314,20 @@ const breadcrumbs = computed(() => {
} }
items.push({ items.push({
label: lead.data.lead_name || __('Untitled'), label: title.value,
route: { name: 'Lead', params: { leadId: lead.data.name } }, route: { name: 'Lead', params: { leadId: lead.data.name } },
}) })
return items return items
}) })
const title = computed(() => {
let t = doctypeMeta['CRM Lead']?.title_field || 'name'
return lead.data?.[t] || props.leadId
})
usePageMeta(() => { usePageMeta(() => {
return { return {
title: lead.data?.lead_name || lead.data?.name, title: title.value,
icon: brand.favicon, icon: brand.favicon,
} }
}) })

View File

@ -195,6 +195,7 @@ const { brand } = getSettings()
const { getUser } = usersStore() const { getUser } = usersStore()
const { $dialog } = globalStore() const { $dialog } = globalStore()
const { getDealStatus } = statusesStore() const { getDealStatus } = statusesStore()
const { doctypeMeta } = getMeta('CRM Organization')
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
@ -241,7 +242,7 @@ const breadcrumbs = computed(() => {
} }
items.push({ items.push({
label: props.organizationId, label: title.value,
route: { route: {
name: 'Organization', name: 'Organization',
params: { organizationId: props.organizationId }, params: { organizationId: props.organizationId },
@ -250,9 +251,14 @@ const breadcrumbs = computed(() => {
return items return items
}) })
const title = computed(() => {
let t = doctypeMeta['CRM Organization']?.title_field || 'name'
return organization.doc?.[t] || props.organizationId
})
usePageMeta(() => { usePageMeta(() => {
return { return {
title: props.organizationId, title: title.value,
icon: brand.favicon, icon: brand.favicon,
} }
}) })

View File

@ -215,6 +215,7 @@ const { brand } = getSettings()
const { getUser } = usersStore() const { getUser } = usersStore()
const { $dialog } = globalStore() const { $dialog } = globalStore()
const { getDealStatus } = statusesStore() const { getDealStatus } = statusesStore()
const { doctypeMeta } = getMeta('CRM Organization')
const showQuickEntryModal = ref(false) const showQuickEntryModal = ref(false)
const route = useRoute() const route = useRoute()
@ -262,7 +263,7 @@ const breadcrumbs = computed(() => {
} }
items.push({ items.push({
label: props.organizationId, label: title.value,
route: { route: {
name: 'Organization', name: 'Organization',
params: { organizationId: props.organizationId }, params: { organizationId: props.organizationId },
@ -271,9 +272,14 @@ const breadcrumbs = computed(() => {
return items return items
}) })
const title = computed(() => {
let t = doctypeMeta['CRM Organization']?.title_field || 'name'
return organization.doc?.[t] || props.organizationId
})
usePageMeta(() => { usePageMeta(() => {
return { return {
title: props.organizationId, title: title.value,
icon: brand.favicon, icon: brand.favicon,
} }
}) })