feat: refactor for path support

This commit is contained in:
Methapon2001 2024-07-08 14:08:57 +07:00
parent 4d8e22d64e
commit e631ed9c47
8 changed files with 44 additions and 23 deletions

View file

@ -35,6 +35,7 @@ defineProps<{
@click="$emit('open')" @click="$emit('open')"
> >
<div class="branch-card__header"> <div class="branch-card__header">
<div class="branch-card__wrapper">
<div class="branch-card__icon"> <div class="branch-card__icon">
<q-icon <q-icon
size="md" size="md"
@ -42,6 +43,7 @@ defineProps<{
name="mdi-office-building-outline" name="mdi-office-building-outline"
/> />
</div> </div>
</div>
<div class="branch-card__name"> <div class="branch-card__name">
<b>{{ data.branchLabelName }}</b> <b>{{ data.branchLabelName }}</b>
<small class="branch-card__code">{{ data.branchLabelCode }}</small> <small class="branch-card__code">{{ data.branchLabelCode }}</small>
@ -96,6 +98,7 @@ defineProps<{
padding: var(--size-1); padding: var(--size-1);
position: relative; position: relative;
transform: rotate(45deg); transform: rotate(45deg);
aspect-ratio: 1;
&::after { &::after {
content: ' '; content: ' ';

View file

@ -259,13 +259,20 @@ onMounted(async () => {
: 'Jobs Worker Service' : 'Jobs Worker Service'
}} }}
</span> </span>
<span class="text-caption"> <div class="flex items-center" style="gap: var(--size-1)">
{{ <template v-for="(item, i) in utilsStore.currentTitle.path">
utilsStore.currentTitle?.caption <span
? $t(utilsStore.currentTitle?.caption) class="text-caption cursor-pointer"
: '' @click="item.handler?.()"
}} >
{{ item.text ? $t(item.text) : '' }}
</span> </span>
<q-icon
name="mdi-chevron-right"
v-if="i + 1 !== utilsStore.currentTitle.path.length"
/>
</template>
</div>
</div> </div>
<div class="row q-gutter-x-md items-center" style="margin-left: auto"> <div class="row q-gutter-x-md items-center" style="margin-left: auto">

View file

@ -151,7 +151,7 @@ async function calculateStats() {
onMounted(async () => { onMounted(async () => {
utilsStore.currentTitle.title = 'branchManagement'; utilsStore.currentTitle.title = 'branchManagement';
utilsStore.currentTitle.caption = 'branchManagementCaption'; utilsStore.currentTitle.path = [{ text: 'branchManagementCaption' }];
await branchStore.fetchList({ pageSize: 99999 }); await branchStore.fetchList({ pageSize: 99999 });
await calculateStats(); await calculateStats();

View file

@ -453,7 +453,7 @@ async function assignFormData(idEdit: string) {
onMounted(async () => { onMounted(async () => {
utilsStore.currentTitle.title = 'personnelManagement'; utilsStore.currentTitle.title = 'personnelManagement';
utilsStore.currentTitle.caption = 'personnelManagementCaption'; utilsStore.currentTitle.path = [{ text: 'personnelManagementCaption' }];
await fetchUserList(); await fetchUserList();

View file

@ -1240,7 +1240,7 @@ async function fetchListStatsEmployeeGender() {
onMounted(async () => { onMounted(async () => {
utilsStore.currentTitle.title = 'customerManagement'; utilsStore.currentTitle.title = 'customerManagement';
utilsStore.currentTitle.caption = 'customerManagementCaption'; utilsStore.currentTitle.path = [{ text: 'customerManagementCaption' }];
const resultStats = await getStatsCustomer(); const resultStats = await getStatsCustomer();
@ -1493,7 +1493,10 @@ watch([inputSearch, currentStatus], async () => {
</div> </div>
<!-- main --> <!-- main -->
<div class="surface-1 bordered rounded col column"> <div
class="surface-1 bordered rounded col column"
style="overflow: hidden"
>
<!-- tabs --> <!-- tabs -->
<div class="column"> <div class="column">
<div <div

View file

@ -1012,7 +1012,7 @@ function cloneData() {
onMounted(async () => { onMounted(async () => {
utilsStore.currentTitle.title = 'mainProductTitle'; utilsStore.currentTitle.title = 'mainProductTitle';
utilsStore.currentTitle.caption = 'mainProductCaption'; utilsStore.currentTitle.path = [{ text: 'mainProductCaption' }];
calculateStats(); calculateStats();
await fetchListGroups(); await fetchListGroups();
@ -1229,7 +1229,7 @@ watch(inputSearchProductAndService, async () => {
v-if="productMode === 'group' || productMode === 'type'" v-if="productMode === 'group' || productMode === 'type'"
class="surface-1 col bordered rounded column no-wrap" class="surface-1 col bordered rounded column no-wrap"
> >
<div class="row surface-2 bordered-b q-px-md q-py-sm"> <div class="row surface-2 bordered-b q-px-md q-py-sm items-center">
<div v-if="productMode === 'type'" class="text-h6 text-weight-bold"> <div v-if="productMode === 'type'" class="text-h6 text-weight-bold">
{{ $t('productAndServiceType') }} {{ $t('productAndServiceType') }}
</div> </div>
@ -1433,7 +1433,7 @@ watch(inputSearchProductAndService, async () => {
<template v-else> <template v-else>
<div <div
v-if="productMode === 'group'" v-if="productMode === 'group'"
class="row items-center justify-between" class="row items-center justify-between q-px-md q-py-sm"
> >
<div class="col-4"> <div class="col-4">
<div class="row items-center"> <div class="row items-center">

View file

@ -99,7 +99,7 @@ const menu = [
onMounted(() => { onMounted(() => {
utilsStore.currentTitle.title = ''; utilsStore.currentTitle.title = '';
utilsStore.currentTitle.caption = ''; utilsStore.currentTitle.path = [{ text: '' }];
}); });
</script> </script>

View file

@ -95,9 +95,17 @@ export function formatNumberDecimal(num: number, point: number): string {
} }
const useUtilsStore = defineStore('utilsStore', () => { const useUtilsStore = defineStore('utilsStore', () => {
const currentTitle = ref<{ title: string; caption: string }>({ const currentTitle = ref<{
title: string;
path: { text: string; handler?: () => unknown }[];
}>({
title: '', title: '',
caption: '', path: [
{
text: '',
handler: () => {},
},
],
}); });
return { return {