fix: moved view selector to header in breadcrumbs
This commit is contained in:
parent
48a76c6438
commit
0ee97b0d1b
@ -3,43 +3,6 @@
|
|||||||
v-if="isMobileView"
|
v-if="isMobileView"
|
||||||
class="flex flex-col justify-between gap-2 sm:px-5 px-3 py-4"
|
class="flex flex-col justify-between gap-2 sm:px-5 px-3 py-4"
|
||||||
>
|
>
|
||||||
<div class="flex items-center justify-between gap-2 overflow-x-auto">
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<Dropdown :options="viewsDropdownOptions">
|
|
||||||
<template #default="{ open }">
|
|
||||||
<Button :label="__(currentView.label)">
|
|
||||||
<template #prefix>
|
|
||||||
<div v-if="isEmoji(currentView.icon)">
|
|
||||||
{{ currentView.icon }}
|
|
||||||
</div>
|
|
||||||
<FeatherIcon
|
|
||||||
v-else-if="typeof currentView.icon == 'string'"
|
|
||||||
:name="currentView.icon"
|
|
||||||
class="h-4"
|
|
||||||
/>
|
|
||||||
<component v-else :is="currentView.icon" class="h-4" />
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<FeatherIcon
|
|
||||||
:name="open ? 'chevron-up' : 'chevron-down'"
|
|
||||||
class="h-4 text-gray-600"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Dropdown>
|
|
||||||
<Dropdown :options="viewActions">
|
|
||||||
<template #default>
|
|
||||||
<Button icon="more-horizontal" />
|
|
||||||
</template>
|
|
||||||
</Dropdown>
|
|
||||||
</div>
|
|
||||||
<Button :label="__('Refresh')" @click="reload()" :loading="isLoading">
|
|
||||||
<template #icon>
|
|
||||||
<RefreshIcon class="h-4 w-4" />
|
|
||||||
</template>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<div class="flex items-center justify-between gap-2 overflow-x-auto">
|
<div class="flex items-center justify-between gap-2 overflow-x-auto">
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
@ -59,6 +22,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
|
<Button :label="__('Refresh')" @click="reload()" :loading="isLoading">
|
||||||
|
<template #icon>
|
||||||
|
<RefreshIcon class="h-4 w-4" />
|
||||||
|
</template>
|
||||||
|
</Button>
|
||||||
<SortBy
|
<SortBy
|
||||||
v-if="route.params.viewType !== 'kanban'"
|
v-if="route.params.viewType !== 'kanban'"
|
||||||
v-model="list"
|
v-model="list"
|
||||||
@ -91,37 +59,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="flex items-center justify-between gap-2 px-5 py-4">
|
<div v-else class="flex items-center justify-between gap-2 px-5 py-4">
|
||||||
<div class="flex items-center gap-2">
|
<!-- <Dropdown :options="viewActions">
|
||||||
<Dropdown :options="viewsDropdownOptions">
|
|
||||||
<template #default="{ open }">
|
|
||||||
<Button :label="__(currentView.label)">
|
|
||||||
<template #prefix>
|
|
||||||
<div v-if="isEmoji(currentView.icon)">{{ currentView.icon }}</div>
|
|
||||||
<FeatherIcon
|
|
||||||
v-else-if="typeof currentView.icon == 'string'"
|
|
||||||
:name="currentView.icon"
|
|
||||||
class="h-4"
|
|
||||||
/>
|
|
||||||
<component v-else :is="currentView.icon" class="h-4" />
|
|
||||||
</template>
|
|
||||||
<template #suffix>
|
|
||||||
<FeatherIcon
|
|
||||||
:name="open ? 'chevron-up' : 'chevron-down'"
|
|
||||||
class="h-4 text-gray-600"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</Button>
|
|
||||||
</template>
|
|
||||||
</Dropdown>
|
|
||||||
<Dropdown :options="viewActions">
|
|
||||||
<template #default>
|
<template #default>
|
||||||
<Button icon="more-horizontal" />
|
<Button icon="more-horizontal" />
|
||||||
</template>
|
</template>
|
||||||
</Dropdown>
|
</Dropdown> -->
|
||||||
</div>
|
|
||||||
<div class="-mr-2 h-[70%] border-l" />
|
|
||||||
<FadedScrollableDiv
|
<FadedScrollableDiv
|
||||||
class="flex flex-1 items-center overflow-x-auto px-1"
|
class="flex flex-1 items-center overflow-x-auto -ml-1"
|
||||||
orientation="horizontal"
|
orientation="horizontal"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -268,8 +212,9 @@
|
|||||||
</Dialog>
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import DetailsIcon from '@/components/Icons/DetailsIcon.vue'
|
import ListIcon from '@/components/Icons/ListIcon.vue'
|
||||||
import KanbanIcon from '@/components/Icons/KanbanIcon.vue'
|
import KanbanIcon from '@/components/Icons/KanbanIcon.vue'
|
||||||
|
import GroupByIcon from '@/components/Icons/GroupByIcon.vue'
|
||||||
import QuickFilterField from '@/components/QuickFilterField.vue'
|
import QuickFilterField from '@/components/QuickFilterField.vue'
|
||||||
import RefreshIcon from '@/components/Icons/RefreshIcon.vue'
|
import RefreshIcon from '@/components/Icons/RefreshIcon.vue'
|
||||||
import EditIcon from '@/components/Icons/EditIcon.vue'
|
import EditIcon from '@/components/Icons/EditIcon.vue'
|
||||||
@ -340,15 +285,15 @@ function getViewType() {
|
|||||||
let viewType = route.params.viewType || 'list'
|
let viewType = route.params.viewType || 'list'
|
||||||
let types = {
|
let types = {
|
||||||
list: {
|
list: {
|
||||||
label: __('List View'),
|
label: __('List'),
|
||||||
icon: 'list',
|
icon: markRaw(ListIcon),
|
||||||
},
|
},
|
||||||
group_by: {
|
group_by: {
|
||||||
label: __('Group By View'),
|
label: __('Group By'),
|
||||||
icon: markRaw(DetailsIcon),
|
icon: markRaw(GroupByIcon),
|
||||||
},
|
},
|
||||||
kanban: {
|
kanban: {
|
||||||
label: __('Kanban View'),
|
label: __('Kanban'),
|
||||||
icon: markRaw(KanbanIcon),
|
icon: markRaw(KanbanIcon),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -531,27 +476,17 @@ let allowedViews = props.options.allowedViews || ['list']
|
|||||||
|
|
||||||
if (allowedViews.includes('list')) {
|
if (allowedViews.includes('list')) {
|
||||||
defaultViews.push({
|
defaultViews.push({
|
||||||
label: __(props.options?.defaultViewName) || __('List View'),
|
label: __(props.options?.defaultViewName) || __('List'),
|
||||||
icon: 'list',
|
icon: markRaw(ListIcon),
|
||||||
onClick() {
|
onClick() {
|
||||||
viewUpdated.value = false
|
viewUpdated.value = false
|
||||||
router.push({ name: route.name })
|
router.push({ name: route.name })
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (allowedViews.includes('group_by')) {
|
|
||||||
defaultViews.push({
|
|
||||||
label: __(props.options?.defaultViewName) || __('Group By View'),
|
|
||||||
icon: markRaw(DetailsIcon),
|
|
||||||
onClick() {
|
|
||||||
viewUpdated.value = false
|
|
||||||
router.push({ name: route.name, params: { viewType: 'group_by' } })
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (allowedViews.includes('kanban')) {
|
if (allowedViews.includes('kanban')) {
|
||||||
defaultViews.push({
|
defaultViews.push({
|
||||||
label: __(props.options?.defaultViewName) || __('Kanban View'),
|
label: __(props.options?.defaultViewName) || __('Kanban'),
|
||||||
icon: markRaw(KanbanIcon),
|
icon: markRaw(KanbanIcon),
|
||||||
onClick() {
|
onClick() {
|
||||||
viewUpdated.value = false
|
viewUpdated.value = false
|
||||||
@ -559,14 +494,26 @@ if (allowedViews.includes('kanban')) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (allowedViews.includes('group_by')) {
|
||||||
|
defaultViews.push({
|
||||||
|
label: __(props.options?.defaultViewName) || __('Group By'),
|
||||||
|
icon: markRaw(GroupByIcon),
|
||||||
|
onClick() {
|
||||||
|
viewUpdated.value = false
|
||||||
|
router.push({ name: route.name, params: { viewType: 'group_by' } })
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function getIcon(icon, type) {
|
function getIcon(icon, type) {
|
||||||
if (isEmoji(icon)) {
|
if (isEmoji(icon)) {
|
||||||
return h('div', icon)
|
return h('div', icon)
|
||||||
} else if (!icon && type === 'group_by') {
|
} else if (!icon && type === 'group_by') {
|
||||||
return markRaw(DetailsIcon)
|
return markRaw(GroupByIcon)
|
||||||
|
} else if (!icon && type === 'kanban') {
|
||||||
|
return markRaw(KanbanIcon)
|
||||||
}
|
}
|
||||||
return icon || 'list'
|
return icon || markRaw(ListIcon)
|
||||||
}
|
}
|
||||||
|
|
||||||
const viewsDropdownOptions = computed(() => {
|
const viewsDropdownOptions = computed(() => {
|
||||||
@ -1119,6 +1066,8 @@ defineExpose({
|
|||||||
likeDoc,
|
likeDoc,
|
||||||
updateKanbanSettings,
|
updateKanbanSettings,
|
||||||
loadMoreKanban,
|
loadMoreKanban,
|
||||||
|
viewsDropdownOptions,
|
||||||
|
currentView,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Watchers
|
// Watchers
|
||||||
|
|||||||
@ -1,7 +1,51 @@
|
|||||||
<template>
|
<template>
|
||||||
<LayoutHeader>
|
<LayoutHeader>
|
||||||
<template #left-header>
|
<template #left-header>
|
||||||
<Breadcrumbs :items="breadcrumbs" />
|
<div class="flex items-center">
|
||||||
|
<router-link
|
||||||
|
:to="{ name: 'Leads' }"
|
||||||
|
class="px-0.5 py-1 text-lg font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-400 text-gray-600 hover:text-gray-700"
|
||||||
|
>
|
||||||
|
{{ __('Leads') }}
|
||||||
|
</router-link>
|
||||||
|
<span class="mx-0.5 text-base text-gray-500" aria-hidden="true">
|
||||||
|
/
|
||||||
|
</span>
|
||||||
|
<Dropdown
|
||||||
|
v-if="viewControls"
|
||||||
|
:options="viewControls.viewsDropdownOptions"
|
||||||
|
>
|
||||||
|
<template #default="{ open }">
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
class="text-lg font-medium"
|
||||||
|
:label="__(viewControls.currentView.label)"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<div v-if="isEmoji(viewControls.currentView.icon)">
|
||||||
|
{{ viewControls.currentView.icon }}
|
||||||
|
</div>
|
||||||
|
<FeatherIcon
|
||||||
|
v-else-if="typeof viewControls.currentView.icon == 'string'"
|
||||||
|
:name="viewControls.currentView.icon"
|
||||||
|
class="h-4"
|
||||||
|
/>
|
||||||
|
<component
|
||||||
|
v-else
|
||||||
|
:is="viewControls.currentView.icon"
|
||||||
|
class="h-4"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #suffix>
|
||||||
|
<FeatherIcon
|
||||||
|
:name="open ? 'chevron-up' : 'chevron-down'"
|
||||||
|
class="h-4 text-gray-800"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</Button>
|
||||||
|
</template>
|
||||||
|
</Dropdown>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #right-header>
|
<template #right-header>
|
||||||
<CustomActions
|
<CustomActions
|
||||||
@ -303,13 +347,17 @@ 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 { dateFormat, dateTooltipFormat, timeAgo, formatTime } from '@/utils'
|
import {
|
||||||
import { Breadcrumbs, Avatar, Tooltip, Dropdown } from 'frappe-ui'
|
dateFormat,
|
||||||
|
dateTooltipFormat,
|
||||||
|
timeAgo,
|
||||||
|
formatTime,
|
||||||
|
isEmoji,
|
||||||
|
} from '@/utils'
|
||||||
|
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'
|
||||||
|
|
||||||
const breadcrumbs = [{ label: __('Leads'), route: { name: 'Leads' } }]
|
|
||||||
|
|
||||||
const { makeCall } = globalStore()
|
const { makeCall } = globalStore()
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { getOrganization } = organizationsStore()
|
const { getOrganization } = organizationsStore()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user