refactor: refs #7354 Zone migration changes
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-07-09 12:51:01 +02:00
parent 90da150d63
commit 8c744fac5a
10 changed files with 91 additions and 130 deletions

View File

@ -52,7 +52,6 @@ const setData = (entity) => {
:filter="filter" :filter="filter"
@on-fetch="setData" @on-fetch="setData"
data-key="zoneData" data-key="zoneData"
:summary="$attrs"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<ZoneDescriptorMenuItems :zone="entity" /> <ZoneDescriptorMenuItems :zone="entity" />

View File

@ -40,7 +40,7 @@ const actions = {
}, },
remove: async () => { remove: async () => {
try { try {
await axios.post(`Zones/${zoneId}/setDeleted`); await axios.delete(`Zones/${zoneId}`);
notify({ message: t('Zone deleted'), type: 'positive' }); notify({ message: t('Zone deleted'), type: 'positive' });
notify({ notify({

View File

@ -116,6 +116,7 @@ const closeForm = () => emit('closeForm');
const refetchEvents = async () => { const refetchEvents = async () => {
await arrayData.refresh({ append: false }); await arrayData.refresh({ append: false });
closeForm(); closeForm();
// window.location.reload();
}; };
onMounted(() => { onMounted(() => {

View File

@ -13,8 +13,8 @@ import { reactive } from 'vue';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
const firstDay = ref(null); const firstDay = ref();
const lastDay = ref(null); const lastDay = ref();
const events = ref([]); const events = ref([]);
const formModeName = ref('include'); const formModeName = ref('include');

View File

@ -113,13 +113,7 @@ onMounted(async () => {
</template> </template>
</VnSelect> </VnSelect>
<VnSelect <VnSelect
:label=" :label="t('deliveryPanel.agency')"
t(
deliveryMethodFk === 'delivery'
? 'deliveryPanel.agency'
: 'deliveryPanel.warehouse'
)
"
v-model="formData.agencyModeFk" v-model="formData.agencyModeFk"
url="AgencyModes/isActive" url="AgencyModes/isActive"
:fields="['id', 'name']" :fields="['id', 'name']"

View File

@ -1,73 +1,95 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { onMounted, computed } from 'vue'; import { computed, ref } from 'vue';
import axios from 'axios';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toTimeFormat } from 'src/filters/date'; import { toTimeFormat } from 'src/filters/date';
import { useVnConfirm } from 'composables/useVnConfirm'; import { useVnConfirm } from 'composables/useVnConfirm';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { useStateStore } from 'stores/useStateStore'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import axios from 'axios'; import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
import ZoneFilterPanel from './ZoneFilterPanel.vue';
const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const router = useRouter(); const router = useRouter();
const { notify } = useNotify(); const { notify } = useNotify();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const tableRef = ref();
const redirectToZoneSummary = (event, { id }) => { const tableFilter = ref({
router.push({ name: 'ZoneSummary', params: { id } }); include: [
}; {
relation: 'agencyMode',
scope: {
fields: ['id', 'name'],
},
},
],
});
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'ID',
label: t('list.id'),
field: (row) => row.id,
sortable: true,
align: 'left', align: 'left',
name: 'id',
label: t('list.id'),
chip: {
condition: () => true,
},
isId: true,
}, },
{ {
align: 'left',
name: 'name', name: 'name',
label: t('list.name'), label: t('list.name'),
field: (row) => row.name, isTitle: true,
sortable: true,
align: 'left',
}, },
{ {
name: 'agency', align: 'left',
name: 'agencyModeFk',
label: t('list.agency'), label: t('list.agency'),
field: (row) => row?.agencyMode?.name, cardVisible: true,
sortable: true, component: 'select',
align: 'left', attrs: {
url: 'agencyModes',
fields: ['id', 'name'],
},
columnField: {
component: null,
},
format: (row) => row?.agencyMode?.name,
}, },
{ {
name: 'close', align: 'left',
name: 'hour',
label: t('list.close'), label: t('list.close'),
field: (row) => (row?.hour ? toTimeFormat(row?.hour) : '-'), cardVisible: true,
sortable: true, format: (row) => toTimeFormat(row.hour),
align: 'left',
}, },
{ {
align: 'left',
name: 'price', name: 'price',
label: t('list.price'), label: t('list.price'),
field: (row) => (row?.price ? toCurrency(row.price) : '-'), cardVisible: true,
sortable: true, format: (row) => toCurrency(row.price),
align: 'left',
}, },
{ {
name: 'actions',
label: '',
sortable: false,
align: 'right', align: 'right',
name: 'tableActions',
actions: [
{
title: t('ZoneSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, ZoneSummary),
},
{
title: t('globals.clone'),
icon: 'vn:clone',
action: (row) => handleClone(row.id),
isPrimary: true,
},
],
}, },
]); ]);
@ -83,88 +105,23 @@ const handleClone = (id) => {
() => clone(id) () => clone(id)
); );
}; };
onMounted(() => (stateStore.rightDrawer = true));
</script> </script>
<template> <template>
<RightMenu> <VnTable
<template #right-panel> ref="tableRef"
<ZoneFilterPanel data-key="ZoneList" :expr-builder="exprBuilder" /> data-key="ZoneList"
</template> url="Zones"
</RightMenu> :filter="tableFilter"
<QPage class="column items-center q-pa-md"> :columns="columns"
<div class="vn-card-list"> default-mode="table"
<VnPaginate redirect="zone"
data-key="ZoneList" :use-model="true"
url="Zones" auto-load
:filter="{ />
include: { relation: 'agencyMode', scope: { fields: ['name'] } }, <QPageSticky position="bottom-right" :offset="[18, 18]" style="z-index: 2">
}" <QBtn :to="{ path: `/zone/create` }" fab icon="add" color="primary">
:limit="20" <QTooltip>{{ t('list.create') }}</QTooltip>
auto-load </QBtn>
> </QPageSticky>
<template #body="{ rows }">
<div class="q-pa-md">
<QTable
:rows="rows"
:columns="columns"
row-key="clientId"
class="full-width"
@row-click="redirectToZoneSummary"
>
<template #header="props">
<QTr :props="props" class="bg">
<QTh
v-for="col in props.cols"
:key="col.name"
:props="props"
>
{{ t(col.label) }}
<QTooltip v-if="col.tooltip">{{
col.tooltip
}}</QTooltip>
</QTh>
</QTr>
</template>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
{{ props.value }}
</QTr>
</QTd>
</template>
<template #body-cell-actions="props">
<QTd :props="props" class="q-gutter-x-sm">
<QIcon
name="vn:clone"
size="sm"
color="primary"
@click.stop="handleClone(props.row.id)"
>
<QTooltip>{{ t('globals.clone') }}</QTooltip>
</QIcon>
<QIcon
name="preview"
size="sm"
color="primary"
@click.stop="
viewSummary(props.row.id, ZoneSummary)
"
>
<QTooltip>{{ t('Preview') }}</QTooltip>
</QIcon>
</QTd>
</template>
</QTable>
</div>
</template>
</VnPaginate>
</div>
<QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn :to="{ path: `/zone/create` }" fab icon="add" color="primary">
<QTooltip>{{ t('list.create') }}</QTooltip>
</QBtn>
</QPageSticky>
</QPage>
</template> </template>

View File

@ -39,7 +39,7 @@ const exprBuilder = (param, value) => {
<template> <template>
<VnSearchbar <VnSearchbar
data-key="ZoneList" data-key="Zones"
url="Zones" url="Zones"
:filter="{ :filter="{
include: { relation: 'agencyMode', scope: { fields: ['name'] } }, include: { relation: 'agencyMode', scope: { fields: ['name'] } },

View File

@ -63,7 +63,13 @@ onMounted(() => weekdayStore.initStore());
<span class="header"> <span class="header">
{{ getHeaderTitle(detail.shipped) }} {{ getHeaderTitle(detail.shipped) }}
</span> </span>
<QTable flat :columns="columns" :rows="detail.lines" class="full-width" /> <QTable
flat
:columns="columns"
:rows="detail.lines"
class="full-width"
style="text-align: center"
/>
</div> </div>
</QCard> </QCard>
</QPage> </QPage>

View File

@ -30,6 +30,8 @@ create:
price: Price price: Price
bonus: Bonus bonus: Bonus
volumetric: Volumetric volumetric: Volumetric
itemMaxSize: Max m³
inflation: Inflation
summary: summary:
agency: Agency agency: Agency
price: Price price: Price

View File

@ -30,6 +30,8 @@ create:
price: Precio price: Precio
bonus: Bonificación bonus: Bonificación
volumetric: Volumétrico volumetric: Volumétrico
itemMaxSize: Medida máxima
inflation: Inflación
summary: summary:
agency: Agencia agency: Agencia
price: Precio price: Precio