fix: also show view in lead page breadcrumb
This commit is contained in:
parent
c6f2f82940
commit
2b85de294c
@ -4,14 +4,21 @@
|
|||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
:options="{
|
:options="{
|
||||||
getRowRoute: (row) => ({ name: 'Lead', params: { leadId: row.name } }),
|
getRowRoute: (row) => ({
|
||||||
|
name: 'Lead',
|
||||||
|
params: { leadId: row.name },
|
||||||
|
query: { view: route.query.view, viewType: route.params.viewType },
|
||||||
|
}),
|
||||||
selectable: options.selectable,
|
selectable: options.selectable,
|
||||||
showTooltip: options.showTooltip,
|
showTooltip: options.showTooltip,
|
||||||
resizeColumn: options.resizeColumn,
|
resizeColumn: options.resizeColumn,
|
||||||
}"
|
}"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
>
|
>
|
||||||
<ListHeader class="sm:mx-5 mx-3" @columnWidthUpdated="emit('columnWidthUpdated')">
|
<ListHeader
|
||||||
|
class="sm:mx-5 mx-3"
|
||||||
|
@columnWidthUpdated="emit('columnWidthUpdated')"
|
||||||
|
>
|
||||||
<ListHeaderItem
|
<ListHeaderItem
|
||||||
v-for="column in columns"
|
v-for="column in columns"
|
||||||
:key="column.key"
|
:key="column.key"
|
||||||
@ -217,6 +224,7 @@ import {
|
|||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { sessionStore } from '@/stores/session'
|
import { sessionStore } from '@/stores/session'
|
||||||
import { ref, computed, watch } from 'vue'
|
import { ref, computed, watch } from 'vue'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
@ -248,6 +256,8 @@ const emit = defineEmits([
|
|||||||
'likeDoc',
|
'likeDoc',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|
||||||
@ -273,7 +283,7 @@ const listBulkActionsRef = ref(null)
|
|||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
customListActions: computed(
|
customListActions: computed(
|
||||||
() => listBulkActionsRef.value?.customListActions
|
() => listBulkActionsRef.value?.customListActions,
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<LayoutHeader v-if="lead.data">
|
<LayoutHeader v-if="lead.data">
|
||||||
<template #left-header>
|
<template #left-header>
|
||||||
<Breadcrumbs :items="breadcrumbs" />
|
<Breadcrumbs :items="breadcrumbs">
|
||||||
|
<template #prefix="{ item }">
|
||||||
|
<Icon v-if="item.icon" :icon="item.icon" class="mr-2 h-4" />
|
||||||
|
</template>
|
||||||
|
</Breadcrumbs>
|
||||||
</template>
|
</template>
|
||||||
<template #right-header>
|
<template #right-header>
|
||||||
<CustomActions
|
<CustomActions
|
||||||
@ -273,6 +277,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import Icon from '@/components/Icon.vue'
|
||||||
import Resizer from '@/components/Resizer.vue'
|
import Resizer from '@/components/Resizer.vue'
|
||||||
import EditIcon from '@/components/Icons/EditIcon.vue'
|
import EditIcon from '@/components/Icons/EditIcon.vue'
|
||||||
import ActivityIcon from '@/components/Icons/ActivityIcon.vue'
|
import ActivityIcon from '@/components/Icons/ActivityIcon.vue'
|
||||||
@ -306,6 +311,7 @@ import {
|
|||||||
errorMessage,
|
errorMessage,
|
||||||
copyToClipboard,
|
copyToClipboard,
|
||||||
} from '@/utils'
|
} from '@/utils'
|
||||||
|
import { getView } from '@/utils/view'
|
||||||
import { globalStore } from '@/stores/global'
|
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'
|
||||||
@ -421,6 +427,22 @@ function validateRequired(fieldname, value) {
|
|||||||
|
|
||||||
const breadcrumbs = computed(() => {
|
const breadcrumbs = computed(() => {
|
||||||
let items = [{ label: __('Leads'), route: { name: 'Leads' } }]
|
let items = [{ label: __('Leads'), route: { name: 'Leads' } }]
|
||||||
|
|
||||||
|
if (route.query.view || route.query.viewType) {
|
||||||
|
let view = getView(route.query.view, route.query.viewType, 'CRM Lead')
|
||||||
|
if (view) {
|
||||||
|
items.push({
|
||||||
|
label: __(view.label),
|
||||||
|
icon: view.icon,
|
||||||
|
route: {
|
||||||
|
name: 'Leads',
|
||||||
|
params: { viewType: route.query.viewType },
|
||||||
|
query: { view: route.query.view },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
items.push({
|
items.push({
|
||||||
label: lead.data.lead_name || __('Untitled'),
|
label: lead.data.lead_name || __('Untitled'),
|
||||||
route: { name: 'Lead', params: { leadId: lead.data.name } },
|
route: { name: 'Lead', params: { leadId: lead.data.name } },
|
||||||
|
|||||||
@ -65,7 +65,11 @@
|
|||||||
v-if="route.params.viewType == 'kanban'"
|
v-if="route.params.viewType == 'kanban'"
|
||||||
v-model="leads"
|
v-model="leads"
|
||||||
:options="{
|
:options="{
|
||||||
getRoute: (row) => ({ name: 'Lead', params: { leadId: row.name } }),
|
getRoute: (row) => ({
|
||||||
|
name: 'Lead',
|
||||||
|
params: { leadId: row.name },
|
||||||
|
query: { view: route.query.view, viewType: route.params.viewType },
|
||||||
|
}),
|
||||||
onNewClick: (column) => onNewClick(column),
|
onNewClick: (column) => onNewClick(column),
|
||||||
}"
|
}"
|
||||||
@update="(data) => viewControls.updateKanbanSettings(data)"
|
@update="(data) => viewControls.updateKanbanSettings(data)"
|
||||||
@ -313,6 +317,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import Icon from '@/components/Icon.vue'
|
||||||
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
||||||
import CustomActions from '@/components/CustomActions.vue'
|
import CustomActions from '@/components/CustomActions.vue'
|
||||||
import EmailAtIcon from '@/components/Icons/EmailAtIcon.vue'
|
import EmailAtIcon from '@/components/Icons/EmailAtIcon.vue'
|
||||||
@ -335,13 +340,7 @@ import { usersStore } from '@/stores/users'
|
|||||||
import { organizationsStore } from '@/stores/organizations'
|
import { organizationsStore } from '@/stores/organizations'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
import { callEnabled } from '@/composables/settings'
|
import { callEnabled } from '@/composables/settings'
|
||||||
import {
|
import { dateFormat, dateTooltipFormat, timeAgo, formatTime } from '@/utils'
|
||||||
dateFormat,
|
|
||||||
dateTooltipFormat,
|
|
||||||
timeAgo,
|
|
||||||
formatTime,
|
|
||||||
isEmoji,
|
|
||||||
} from '@/utils'
|
|
||||||
import { Avatar, Tooltip, Dropdown } from 'frappe-ui'
|
import { Avatar, Tooltip, Dropdown } from 'frappe-ui'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { ref, computed, reactive, h } from 'vue'
|
import { ref, computed, reactive, h } from 'vue'
|
||||||
|
|||||||
35
frontend/src/utils/view.js
Normal file
35
frontend/src/utils/view.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import ListIcon from '@/components/Icons/ListIcon.vue'
|
||||||
|
import GroupByIcon from '@/components/Icons/GroupByIcon.vue'
|
||||||
|
import KanbanIcon from '@/components/Icons/KanbanIcon.vue'
|
||||||
|
import { viewsStore } from '@/stores/views'
|
||||||
|
import { markRaw } from 'vue'
|
||||||
|
|
||||||
|
const { getView: getViewDetails } = viewsStore()
|
||||||
|
|
||||||
|
function defaultView(type) {
|
||||||
|
let types = {
|
||||||
|
list: {
|
||||||
|
label: __('List'),
|
||||||
|
icon: markRaw(ListIcon),
|
||||||
|
},
|
||||||
|
group_by: {
|
||||||
|
label: __('Group By'),
|
||||||
|
icon: markRaw(GroupByIcon),
|
||||||
|
},
|
||||||
|
kanban: {
|
||||||
|
label: __('Kanban'),
|
||||||
|
icon: markRaw(KanbanIcon),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return types[type]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getView(view, type, doctype) {
|
||||||
|
let viewType = type || 'list'
|
||||||
|
let viewDetails = getViewDetails(view, viewType, doctype)
|
||||||
|
if (viewDetails && !viewDetails.icon) {
|
||||||
|
viewDetails.icon = defaultView(viewType).icon
|
||||||
|
}
|
||||||
|
return viewDetails || defaultView(viewType)
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user