0
0
Fork 0

perf: add QBtn in CardDescriptor instead each ModuleDescriptor

This commit is contained in:
Javier Segarra 2024-06-28 11:07:32 +02:00
parent 6bf2a8c2f6
commit 68552b8da9
9 changed files with 24 additions and 125 deletions

View File

@ -78,13 +78,36 @@ async function getData() {
} }
} }
const emit = defineEmits(['onFetch']); const emit = defineEmits(['onFetch']);
const iconModule = computed(() => route.matched[1].meta.icon);
const toModule = computed(() =>
route.matched[1].path.split('/').length > 2
? route.matched[1].redirect
: route.matched[1].children[0].redirect
);
</script> </script>
<template> <template>
<div class="descriptor"> <div class="descriptor">
<template v-if="entity && !isLoading"> <template v-if="entity && !isLoading">
<div class="header bg-primary q-pa-sm justify-between"> <div class="header bg-primary q-pa-sm justify-between">
<slot name="header-extra-action" /> <slot name="header-extra-action"
><QBtn
round
flat
dense
size="md"
:icon="iconModule"
color="white"
class="link"
:to="toModule"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}
</QTooltip>
</QBtn></slot
>
<QBtn <QBtn
@click.stop="viewSummary(entity.id, $props.summary)" @click.stop="viewSummary(entity.id, $props.summary)"
round round

View File

@ -49,20 +49,6 @@ const hasAccount = ref(false);
:title="data.title" :title="data.title"
:subtitle="data.subtitle" :subtitle="data.subtitle"
> >
<template #header-extra-action>
<QBtn
round
flat
size="md"
color="white"
icon="face"
:to="{ name: 'AccountList' }"
>
<QTooltip>
{{ t('Go to module index') }}
</QTooltip>
</QBtn>
</template>
<template #menu> <template #menu>
<AccountDescriptorMenu :has-account="hasAccount" /> <AccountDescriptorMenu :has-account="hasAccount" />
</template> </template>

View File

@ -28,22 +28,6 @@ const card = computed(() => store.data);
:title="card?.name" :title="card?.name"
:subtitle="props.id" :subtitle="props.id"
> >
<template #header-extra-action>
<QBtn
round
flat
dense
size="md"
icon="garage_home"
color="white"
class="link"
:to="{ name: 'RouteList' }"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}
</QTooltip>
</QBtn>
</template>
<template #body="{ entity: agency }"> <template #body="{ entity: agency }">
<VnLv :label="t('globals.name')" :value="agency.name" /> <VnLv :label="t('globals.name')" :value="agency.name" />
</template> </template>

View File

@ -61,22 +61,6 @@ onMounted(async () => {
@on-fetch="setData" @on-fetch="setData"
data-key="Claim" data-key="Claim"
> >
<template #header-extra-action>
<QBtn
round
flat
dense
size="md"
icon="vn:claims"
color="white"
class="link"
:to="{ name: 'ClaimList' }"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}
</QTooltip>
</QBtn>
</template>
<template #menu="{ entity }"> <template #menu="{ entity }">
<ClaimDescriptorMenu :claim="entity" /> <ClaimDescriptorMenu :claim="entity" />
</template> </template>

View File

@ -51,20 +51,6 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
@on-fetch="setData" @on-fetch="setData"
data-key="entry" data-key="entry"
> >
<template #header-extra-action>
<QBtn
round
flat
size="sm"
icon="vn:item"
color="white"
:to="{ name: 'ItemTypeList' }"
>
<QTooltip>
{{ t('Go to module index') }}
</QTooltip>
</QBtn>
</template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('shared.code')" :value="entity.code" /> <VnLv :label="t('shared.code')" :value="entity.code" />
<VnLv :label="t('shared.name')" :value="entity.name" /> <VnLv :label="t('shared.name')" :value="entity.name" />

View File

@ -87,22 +87,6 @@ const total = ref(null);
@on-fetch="setData" @on-fetch="setData"
data-key="orderData" data-key="orderData"
> >
<template #header-extra-action>
<QBtn
round
flat
dense
size="md"
icon="vn:basket"
color="white"
class="link"
:to="{ name: 'OrderList' }"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}
</QTooltip>
</QBtn>
</template>
<template #menu="{ entity }"> <template #menu="{ entity }">
<OrderDescriptorMenu :order="entity" /> <OrderDescriptorMenu :order="entity" />
</template> </template>

View File

@ -39,22 +39,6 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
data-key="Roadmap" data-key="Roadmap"
@on-fetch="setData" @on-fetch="setData"
> >
<template #header-extra-action>
<QBtn
round
flat
dense
size="md"
icon="vn:troncales"
color="white"
class="link"
:to="{ name: 'RouteList' }"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}
</QTooltip>
</QBtn>
</template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('Roadmap')" :value="entity?.name" /> <VnLv :label="t('Roadmap')" :value="entity?.name" />
<VnLv :label="t('ETD')" :value="toDateHourMin(entity?.etd)" /> <VnLv :label="t('ETD')" :value="toDateHourMin(entity?.etd)" />

View File

@ -53,22 +53,6 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
@on-fetch="setData" @on-fetch="setData"
:summary="$attrs" :summary="$attrs"
> >
<template #header-extra-action>
<QBtn
round
flat
dense
size="md"
icon="vn:inventory"
color="white"
class="link"
:to="{ name: 'ShelvingList' }"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}
</QTooltip>
</QBtn>
</template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('shelving.summary.code')" :value="entity.code" /> <VnLv :label="t('shelving.summary.code')" :value="entity.code" />
<VnLv :label="t('shelving.summary.parking')" :value="entity.parking?.code" /> <VnLv :label="t('shelving.summary.parking')" :value="entity.parking?.code" />

View File

@ -112,22 +112,6 @@ const getEntryQueryParams = (supplier) => {
data-key="supplier" data-key="supplier"
:summary="$props.summary" :summary="$props.summary"
> >
<template #header-extra-action>
<QBtn
round
flat
dense
size="md"
icon="vn:supplier"
color="white"
class="link"
:to="{ name: 'SupplierList' }"
>
<QTooltip>
{{ t('Go to module index') }}
</QTooltip>
</QBtn>
</template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('supplier.summary.taxNumber')" :value="entity.nif" /> <VnLv :label="t('supplier.summary.taxNumber')" :value="entity.nif" />
<VnLv label="Alias" :value="entity.nickname" /> <VnLv label="Alias" :value="entity.nickname" />