fix: redirect to default view when breadcrumbs are clicked
This commit is contained in:
parent
25e2b1a293
commit
9a14261026
@ -159,12 +159,14 @@ import {
|
|||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { contactsStore } from '@/stores/contacts'
|
import { contactsStore } from '@/stores/contacts'
|
||||||
|
import { viewsStore } from '@/stores/views'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { contacts, getContact, getLeadContact } = contactsStore()
|
const { contacts, getContact, getLeadContact } = contactsStore()
|
||||||
|
const { getDefaultView } = viewsStore()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
callLogId: {
|
callLogId: {
|
||||||
@ -238,13 +240,19 @@ function createLead() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const breadcrumbs = computed(() => [
|
const breadcrumbs = computed(() => {
|
||||||
{ label: 'Call Logs', route: { name: 'Call Logs' } },
|
let defaultView = getDefaultView()
|
||||||
{
|
let route = { name: 'Call Logs' }
|
||||||
|
if (defaultView?.route_name == 'Call Logs' && defaultView?.is_view) {
|
||||||
|
route = { name: 'Call Logs', query: { view: defaultView.name } }
|
||||||
|
}
|
||||||
|
let items = [{ label: 'Call Logs', route: route }]
|
||||||
|
items.push({
|
||||||
label: callLog.data?.caller.label,
|
label: callLog.data?.caller.label,
|
||||||
route: { name: 'Call Log', params: { callLogId: props.callLogId } },
|
route: { name: 'Call Log', params: { callLogId: props.callLogId } },
|
||||||
},
|
})
|
||||||
])
|
return items
|
||||||
|
})
|
||||||
|
|
||||||
const statusLabelMap = {
|
const statusLabelMap = {
|
||||||
Completed: 'Completed',
|
Completed: 'Completed',
|
||||||
|
|||||||
@ -226,6 +226,7 @@ import { usersStore } from '@/stores/users.js'
|
|||||||
import { contactsStore } from '@/stores/contacts.js'
|
import { contactsStore } from '@/stores/contacts.js'
|
||||||
import { organizationsStore } from '@/stores/organizations.js'
|
import { organizationsStore } from '@/stores/organizations.js'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
|
import { viewsStore } from '@/stores/views'
|
||||||
import { ref, computed, h } from 'vue'
|
import { ref, computed, h } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
@ -235,6 +236,7 @@ const { getContactByName, contacts } = contactsStore()
|
|||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { getOrganization } = organizationsStore()
|
const { getOrganization } = organizationsStore()
|
||||||
const { getDealStatus } = statusesStore()
|
const { getDealStatus } = statusesStore()
|
||||||
|
const { getDefaultView } = viewsStore()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
contactId: {
|
contactId: {
|
||||||
@ -251,7 +253,12 @@ const showContactModal = ref(false)
|
|||||||
const detailMode = ref(false)
|
const detailMode = ref(false)
|
||||||
|
|
||||||
const breadcrumbs = computed(() => {
|
const breadcrumbs = computed(() => {
|
||||||
let items = [{ label: 'Contacts', route: { name: 'Contacts' } }]
|
let defaultView = getDefaultView()
|
||||||
|
let route = { name: 'Contacts' }
|
||||||
|
if (defaultView?.route_name == 'Contacts' && defaultView?.is_view) {
|
||||||
|
route = { name: 'Contacts', query: { view: defaultView.name } }
|
||||||
|
}
|
||||||
|
let items = [{ label: 'Contacts', route: route }]
|
||||||
items.push({
|
items.push({
|
||||||
label: contact.value.full_name,
|
label: contact.value.full_name,
|
||||||
route: { name: 'Contact', params: { contactId: contact.value.name } },
|
route: { name: 'Contact', params: { contactId: contact.value.name } },
|
||||||
|
|||||||
@ -316,6 +316,7 @@ import { globalStore } from '@/stores/global'
|
|||||||
import { contactsStore } from '@/stores/contacts'
|
import { contactsStore } from '@/stores/contacts'
|
||||||
import { organizationsStore } from '@/stores/organizations'
|
import { organizationsStore } from '@/stores/organizations'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
|
import { viewsStore } from '@/stores/views'
|
||||||
import {
|
import {
|
||||||
createResource,
|
createResource,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
@ -332,6 +333,7 @@ const { $dialog, makeCall } = globalStore()
|
|||||||
const { getContactByName, contacts } = contactsStore()
|
const { getContactByName, contacts } = contactsStore()
|
||||||
const { organizations, getOrganization } = organizationsStore()
|
const { organizations, getOrganization } = organizationsStore()
|
||||||
const { statusOptions, getDealStatus } = statusesStore()
|
const { statusOptions, getDealStatus } = statusesStore()
|
||||||
|
const { getDefaultView } = viewsStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -420,7 +422,12 @@ function validateRequired(fieldname, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const breadcrumbs = computed(() => {
|
const breadcrumbs = computed(() => {
|
||||||
let items = [{ label: 'Deals', route: { name: 'Deals' } }]
|
let defaultView = getDefaultView()
|
||||||
|
let route = { name: 'Deals' }
|
||||||
|
if (defaultView?.route_name == 'Deals' && defaultView?.is_view) {
|
||||||
|
route = { name: 'Deals', query: { view: defaultView.name } }
|
||||||
|
}
|
||||||
|
let items = [{ label: 'Deals', route: route }]
|
||||||
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 } },
|
||||||
|
|||||||
@ -279,6 +279,7 @@ import { globalStore } from '@/stores/global'
|
|||||||
import { contactsStore } from '@/stores/contacts'
|
import { contactsStore } from '@/stores/contacts'
|
||||||
import { organizationsStore } from '@/stores/organizations'
|
import { organizationsStore } from '@/stores/organizations'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
|
import { viewsStore } from '@/stores/views'
|
||||||
import {
|
import {
|
||||||
createResource,
|
createResource,
|
||||||
FileUploader,
|
FileUploader,
|
||||||
@ -297,6 +298,7 @@ const { $dialog, makeCall } = globalStore()
|
|||||||
const { getContactByName, contacts } = contactsStore()
|
const { getContactByName, contacts } = contactsStore()
|
||||||
const { organizations } = organizationsStore()
|
const { organizations } = organizationsStore()
|
||||||
const { statusOptions, getLeadStatus } = statusesStore()
|
const { statusOptions, getLeadStatus } = statusesStore()
|
||||||
|
const { getDefaultView } = viewsStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -378,7 +380,12 @@ function validateRequired(fieldname, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const breadcrumbs = computed(() => {
|
const breadcrumbs = computed(() => {
|
||||||
let items = [{ label: 'Leads', route: { name: 'Leads' } }]
|
let defaultView = getDefaultView()
|
||||||
|
let route = { name: 'Leads' }
|
||||||
|
if (defaultView?.route_name == 'Leads' && defaultView?.is_view) {
|
||||||
|
route = { name: 'Leads', query: { view: defaultView.name } }
|
||||||
|
}
|
||||||
|
let items = [{ label: 'Leads', route: route }]
|
||||||
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 } },
|
||||||
|
|||||||
@ -255,6 +255,7 @@ import { globalStore } from '@/stores/global'
|
|||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { organizationsStore } from '@/stores/organizations.js'
|
import { organizationsStore } from '@/stores/organizations.js'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
|
import { viewsStore } from '@/stores/views'
|
||||||
import {
|
import {
|
||||||
dateFormat,
|
dateFormat,
|
||||||
dateTooltipFormat,
|
dateTooltipFormat,
|
||||||
@ -274,6 +275,7 @@ const props = defineProps({
|
|||||||
const { $dialog } = globalStore()
|
const { $dialog } = globalStore()
|
||||||
const { organizations, getOrganization } = organizationsStore()
|
const { organizations, getOrganization } = organizationsStore()
|
||||||
const { getLeadStatus, getDealStatus } = statusesStore()
|
const { getLeadStatus, getDealStatus } = statusesStore()
|
||||||
|
const { getDefaultView } = viewsStore()
|
||||||
const showOrganizationModal = ref(false)
|
const showOrganizationModal = ref(false)
|
||||||
const detailMode = ref(false)
|
const detailMode = ref(false)
|
||||||
|
|
||||||
@ -282,7 +284,12 @@ const router = useRouter()
|
|||||||
const organization = computed(() => getOrganization(props.organizationId))
|
const organization = computed(() => getOrganization(props.organizationId))
|
||||||
|
|
||||||
const breadcrumbs = computed(() => {
|
const breadcrumbs = computed(() => {
|
||||||
let items = [{ label: 'Organizations', route: { name: 'Organizations' } }]
|
let defaultView = getDefaultView()
|
||||||
|
let route = { name: 'Organizations' }
|
||||||
|
if (defaultView?.route_name == 'Organizations' && defaultView?.is_view) {
|
||||||
|
route = { name: 'Organizations', query: { view: defaultView.name } }
|
||||||
|
}
|
||||||
|
let items = [{ label: 'Organizations', route: route }]
|
||||||
items.push({
|
items.push({
|
||||||
label: props.organizationId,
|
label: props.organizationId,
|
||||||
route: {
|
route: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user