ZoneList and ZoneSummary #365
|
@ -147,7 +147,7 @@ const customTags = computed(() =>
|
||||||
|
|
||||||
async function remove(key) {
|
async function remove(key) {
|
||||||
userParams.value[key] = null;
|
userParams.value[key] = null;
|
||||||
await search();
|
await arrayData.applyFilter({ params: userParams.value });
|
||||||
emit('remove', key);
|
emit('remove', key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1234,12 +1234,6 @@ item/itemType:
|
||||||
itemType: Item type
|
itemType: Item type
|
||||||
basicData: Basic data
|
basicData: Basic data
|
||||||
summary: Summary
|
summary: Summary
|
||||||
zone:
|
|
||||||
pageTitles:
|
|
||||||
zones: Zone
|
|
||||||
zonesList: Zones
|
|
||||||
deliveryList: Delivery days
|
|
||||||
upcomingList: Upcoming deliveries
|
|
||||||
components:
|
components:
|
||||||
topbar: {}
|
topbar: {}
|
||||||
itemsFilterPanel:
|
itemsFilterPanel:
|
||||||
|
|
|
@ -1233,12 +1233,7 @@ item/itemType:
|
||||||
itemType: Familia
|
itemType: Familia
|
||||||
basicData: Datos básicos
|
basicData: Datos básicos
|
||||||
summary: Resumen
|
summary: Resumen
|
||||||
zone:
|
|
||||||
pageTitles:
|
|
||||||
zones: Zona
|
|
||||||
zonesList: Zonas
|
|
||||||
deliveryList: Días de entrega
|
|
||||||
upcomingList: Próximos repartos
|
|
||||||
components:
|
components:
|
||||||
topbar: {}
|
topbar: {}
|
||||||
itemsFilterPanel:
|
itemsFilterPanel:
|
||||||
|
|
|
@ -280,7 +280,7 @@ function navigateToRouteSummary(event, row) {
|
||||||
<div class="table-actions">
|
<div class="table-actions">
|
||||||
<QIcon
|
<QIcon
|
||||||
name="preview"
|
name="preview"
|
||||||
size="xs"
|
size="sm"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click.stop="
|
@click.stop="
|
||||||
viewSummary(
|
viewSummary(
|
||||||
|
|
|
@ -422,7 +422,7 @@ const openTicketsDialog = (id) => {
|
||||||
<div class="flex items-center no-wrap table-actions">
|
<div class="flex items-center no-wrap table-actions">
|
||||||
<QIcon
|
<QIcon
|
||||||
name="vn:ticketAdd"
|
name="vn:ticketAdd"
|
||||||
size="xs"
|
size="sm"
|
||||||
color="primary"
|
color="primary"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click="openTicketsDialog(props?.row?.id)"
|
@click="openTicketsDialog(props?.row?.id)"
|
||||||
|
@ -431,7 +431,7 @@ const openTicketsDialog = (id) => {
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
name="preview"
|
name="preview"
|
||||||
size="xs"
|
size="sm"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="
|
@click="
|
||||||
viewSummary(props?.row?.id, RouteSummary)
|
viewSummary(props?.row?.id, RouteSummary)
|
||||||
|
|
|
@ -242,7 +242,7 @@ function navigateToRoadmapSummary(event, row) {
|
||||||
<div class="flex items-center table-actions">
|
<div class="flex items-center table-actions">
|
||||||
<QIcon
|
<QIcon
|
||||||
name="preview"
|
name="preview"
|
||||||
size="xs"
|
size="sm"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click.stop="
|
@click.stop="
|
||||||
viewSummary(
|
viewSummary(
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
|
import ZoneDescriptor from './ZoneDescriptor.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard data-key="Zone" base-url="Zones" />
|
<VnCard
|
||||||
|
data-key="Zone"
|
||||||
|
base-url="Zones"
|
||||||
|
:descriptor="ZoneDescriptor"
|
||||||
|
searchbar-data-key="ZoneList"
|
||||||
|
searchbar-url="Zones/filter"
|
||||||
|
searchbar-label="Search zones"
|
||||||
|
searchbar-info="You can search by zone reference"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import { toTimeFormat } from 'src/filters/date';
|
import { toTimeFormat } from 'src/filters/date';
|
||||||
|
import { toCurrency } from 'filters/index';
|
||||||
|
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
|
|
||||||
|
@ -73,24 +74,11 @@ const setData = (entity) => {
|
||||||
</template> -->
|
</template> -->
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
{{ console.log('entity', entity) }}
|
{{ console.log('entity', entity) }}
|
||||||
<VnLv :label="t('Agency')" :value="entity.agencyMode.name" />
|
<VnLv :label="t('summary.agency')" :value="entity.agencyMode.name" />
|
||||||
<VnLv :label="t('Closing hour')" :value="toTimeFormat(entity.hour)" />
|
<VnLv :label="t('summary.closeHour')" :value="toTimeFormat(entity.hour)" />
|
||||||
<VnLv :label="t('zoneing days')" :value="entity.zoneingDays" />
|
<VnLv :label="t('summary.travelingDays')" :value="entity.travelingDays" />
|
||||||
<VnLv :label="t('Price')" :value="entity.price" />
|
<VnLv :label="t('summary.price')" :value="toCurrency(entity.price)" />
|
||||||
<VnLv :label="t('Bonus')" :value="entity.bonus" />
|
<VnLv :label="t('summary.bonus')" :value="toCurrency(entity.bonus)" />
|
||||||
</template>
|
</template>
|
||||||
</CardDescriptor>
|
</CardDescriptor>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
|
||||||
es:
|
|
||||||
Summary: Detalles
|
|
||||||
The zone will be deleted: El envío será eliminado
|
|
||||||
Do you want to delete this zone?: ¿Quieres eliminar este envío?
|
|
||||||
All zones with current agency: Todos los envíos con la agencia actual
|
|
||||||
Agency: Agencia
|
|
||||||
Closing hour: Hora de cierre
|
|
||||||
zoneing days: Días de viaje
|
|
||||||
Price: Precio
|
|
||||||
Bonus: Bonificación
|
|
||||||
</i18n>
|
|
||||||
|
|
|
@ -2,14 +2,16 @@
|
||||||
import { ref, onMounted, computed } from 'vue';
|
import { ref, onMounted, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
|
||||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
|
|
||||||
|
import { getUrl } from 'src/composables/getUrl';
|
||||||
|
import { toCurrency } from 'filters/index';
|
||||||
|
import { toTimeFormat } from 'src/filters/date';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -23,71 +25,84 @@ const $props = defineProps({
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const zoneUrl = ref();
|
const zoneUrl = ref();
|
||||||
|
|
||||||
onMounted(async () => {
|
const filter = computed(() => {
|
||||||
zoneUrl.value = (await getUrl('')) + `zone/${entityId.value}/`;
|
const filter = {
|
||||||
|
include: {
|
||||||
|
relation: 'agencyMode',
|
||||||
|
fields: ['name'],
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: route.params.id,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return filter;
|
||||||
});
|
});
|
||||||
|
|
||||||
const filter = computed(() => {
|
const columns = computed(() => [
|
||||||
return { where: { id: entityId.value } };
|
{
|
||||||
|
label: t('summary.name'),
|
||||||
|
name: 'name',
|
||||||
|
field: 'warehouse',
|
||||||
|
align: 'left',
|
||||||
|
format: (val) => val.name,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const warehouses = ref([]);
|
||||||
|
|
||||||
|
const getWarehouses = async () => {
|
||||||
|
const params = {
|
||||||
|
filter: {
|
||||||
|
include: {
|
||||||
|
relation: 'warehouse',
|
||||||
|
fields: ['name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await axios.get(`Zones/${entityId.value}/warehouses`, { params });
|
||||||
|
warehouses.value = data;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
zoneUrl.value = (await getUrl('')) + `zone/${entityId.value}/`;
|
||||||
|
await getWarehouses();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
data-key="zoneData"
|
data-key="ZoneSummary"
|
||||||
ref="summary"
|
ref="summary"
|
||||||
:url="`Zones/summary`"
|
url="Zones/findOne"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
>
|
>
|
||||||
<template #header="{ entity }">
|
<template #header="{ entity }">
|
||||||
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
|
<div>#{{ entity.id }} - {{ entity.name }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity: zone }">
|
<template #body="{ entity: zone }">
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle
|
<VnTitle :url="zoneUrl + `basic-data`" :text="t('summary.basicData')" />
|
||||||
:url="zoneUrl + `basic-data`"
|
<VnLv :label="t('summary.agency')" :value="zone.agencyMode?.name" />
|
||||||
:text="t('zone.summary.basicData')"
|
<VnLv :label="t('summary.price')" :value="toCurrency(zone.price)" />
|
||||||
/>
|
<VnLv :label="t('summary.bonus')" :value="toCurrency(zone.bonus)" />
|
||||||
<VnLv :label="t('zone.card.name')" :value="zone.user?.nickname" />
|
|
||||||
<VnLv
|
|
||||||
:label="t('zone.list.department')"
|
|
||||||
:value="zone.department?.department?.name"
|
|
||||||
/>
|
|
||||||
<VnLv :label="t('zone.list.email')" :value="zone.user.email" copy />
|
|
||||||
<VnLv :label="t('zone.summary.boss')" link>
|
|
||||||
<template #value>
|
|
||||||
<VnUserLink
|
|
||||||
v-if="zone.boss"
|
|
||||||
:name="dashIfEmpty(zone.boss?.name)"
|
|
||||||
:zone-id="zone.bossFk"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</VnLv>
|
|
||||||
<VnLv :value="zone.mobileExtension">
|
|
||||||
<template #label>
|
|
||||||
{{ t('zone.summary.phoneExtension') }}
|
|
||||||
<VnLinkPhone :phone-number="zone.mobileExtension" />
|
|
||||||
</template>
|
|
||||||
</VnLv>
|
|
||||||
<VnLv :value="zone.phone">
|
|
||||||
<template #label>
|
|
||||||
{{ t('zone.summary.entPhone') }}
|
|
||||||
<VnLinkPhone :phone-number="zone.phone" />
|
|
||||||
</template>
|
|
||||||
</VnLv>
|
|
||||||
<VnLv :label="t('zone.summary.locker')" :value="zone.locker" />
|
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle :text="t('zone.summary.userData')" />
|
<VnTitle :url="zoneUrl + `basic-data`" :text="t('summary.basicData')" />
|
||||||
<VnLv :label="t('zone.summary.userId')" :value="zone.user.id" />
|
<VnLv :label="t('summary.closeHour')" :value="toTimeFormat(zone.hour)" />
|
||||||
<VnLv :label="t('zone.card.name')" :value="zone.user.nickname" />
|
<VnLv :label="t('summary.travelingDays')" :value="zone.travelingDays" />
|
||||||
<VnLv :label="t('zone.summary.role')" :value="zone.user.role.name" />
|
<QCheckbox
|
||||||
<VnLv :value="zone?.sip?.extension">
|
:label="t('summary.volumetric')"
|
||||||
<template #label>
|
v-model="zone.isVolumetric"
|
||||||
{{ t('zone.summary.sipExtension') }}
|
:disable="true"
|
||||||
<VnLinkPhone :phone-number="zone?.sip?.extension" />
|
/>
|
||||||
</template>
|
</QCard>
|
||||||
</VnLv>
|
<QCard class="full-width">
|
||||||
|
<VnTitle :url="zoneUrl + `warehouses`" :text="t('summary.warehouse')" />
|
||||||
|
<QTable
|
||||||
|
:columns="columns"
|
||||||
|
:rows="warehouses"
|
||||||
|
:no-data-label="t('globals.noResults')"
|
||||||
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
|
|
|
@ -63,7 +63,7 @@ async function remove(row) {
|
||||||
outline
|
outline
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('zone.list.remove')"
|
:label="t('list.remove')"
|
||||||
@click.stop="remove(row)"
|
@click.stop="remove(row)"
|
||||||
color="primary"
|
color="primary"
|
||||||
style="margin-top: 15px"
|
style="margin-top: 15px"
|
||||||
|
|
|
@ -63,7 +63,7 @@ async function remove(row) {
|
||||||
outline
|
outline
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('zone.list.remove')"
|
:label="t('list.remove')"
|
||||||
@click.stop="remove(row)"
|
@click.stop="remove(row)"
|
||||||
color="primary"
|
color="primary"
|
||||||
style="margin-top: 15px"
|
style="margin-top: 15px"
|
||||||
|
|
|
@ -96,7 +96,7 @@ function filterType(val, update) {
|
||||||
<QInput
|
<QInput
|
||||||
filled
|
filled
|
||||||
v-model="zone.label"
|
v-model="zone.label"
|
||||||
:label="t('zone.create.name')"
|
:label="t('create.name')"
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
:rules="[(val) => !!val || t('zone.warnings.labelNotEmpty')]"
|
:rules="[(val) => !!val || t('zone.warnings.labelNotEmpty')]"
|
||||||
|
@ -106,7 +106,7 @@ function filterType(val, update) {
|
||||||
<VnInput
|
<VnInput
|
||||||
filled
|
filled
|
||||||
v-model="zone.plate"
|
v-model="zone.plate"
|
||||||
:label="t('zone.create.agency')"
|
:label="t('create.agency')"
|
||||||
:rules="[(val) => !!val || t('zone.warnings.plateNotEmpty')]"
|
:rules="[(val) => !!val || t('zone.warnings.plateNotEmpty')]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -116,7 +116,7 @@ function filterType(val, update) {
|
||||||
<QInput
|
<QInput
|
||||||
filled
|
filled
|
||||||
v-model="zone.volume"
|
v-model="zone.volume"
|
||||||
:label="t('zone.create.close')"
|
:label="t('create.close')"
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
:rules="[(val) => !!val || t('zone.warnings.volumeNotEmpty')]"
|
:rules="[(val) => !!val || t('zone.warnings.volumeNotEmpty')]"
|
||||||
|
@ -134,7 +134,7 @@ function filterType(val, update) {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
:label="t('zone.create.price')"
|
:label="t('create.price')"
|
||||||
:options="filteredZoneTypes"
|
:options="filteredZoneTypes"
|
||||||
:rules="[(val) => !!val || t('zone.warnings.typeNotEmpty')]"
|
:rules="[(val) => !!val || t('zone.warnings.typeNotEmpty')]"
|
||||||
@filter="filterType"
|
@filter="filterType"
|
||||||
|
@ -158,9 +158,9 @@ function filterType(val, update) {
|
||||||
</div>
|
</div>
|
||||||
</QCard>
|
</QCard>
|
||||||
<div class="q-mt-md">
|
<div class="q-mt-md">
|
||||||
<QBtn :label="t('zone.type.submit')" type="submit" color="primary" />
|
<QBtn :label="t('type.submit')" type="submit" color="primary" />
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('zone.type.reset')"
|
:label="t('type.reset')"
|
||||||
type="reset"
|
type="reset"
|
||||||
color="primary"
|
color="primary"
|
||||||
flat
|
flat
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -17,37 +17,47 @@ const props = defineProps({
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const agencies = ref([]);
|
const agencies = ref([]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData url="agencies" @on-fetch="(data) => (agencies = data)" auto-load />
|
||||||
url="agencies"
|
<VnFilterPanel
|
||||||
limit="30"
|
:data-key="props.dataKey"
|
||||||
@on-fetch="(data) => (agencies = data)"
|
:search-button="true"
|
||||||
auto-load
|
:hidden-tags="['search']"
|
||||||
/>
|
>
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
<template #tags="{ tag }">
|
||||||
<template #body="{ params }">
|
<div class="q-gutter-x-xs">
|
||||||
|
<strong>{{ t(`filterPanel.${tag.label}`) }}: </strong>
|
||||||
|
<span>{{ tag.value }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #body="{ params, searchFn }">
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('Name')" v-model="params.name" is-outlined />
|
<VnInput
|
||||||
|
:label="t('filterPanel.name')"
|
||||||
|
v-model="params.name"
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelectFilter
|
<VnSelect
|
||||||
:label="t('Agency')"
|
:label="t('filterPanel.agencyModeFk')"
|
||||||
v-model="params.agencyModefK"
|
v-model="params.agencyModeFk"
|
||||||
:options="agencies"
|
:options="agencies"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
@input-value="agencies.fetch()"
|
@update:model-value="searchFn()"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
>
|
>
|
||||||
</VnSelectFilter>
|
</VnSelect>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,111 +1,219 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
|
||||||
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 { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||||
|
|
||||||
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import CardList from 'components/ui/CardList.vue';
|
import CardList from 'components/ui/CardList.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue';
|
||||||
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
|
import ZoneFilterPanel from './ZoneFilterPanel.vue';
|
||||||
|
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import { toTimeFormat } from 'src/filters/date';
|
import { toTimeFormat } from 'src/filters/date';
|
||||||
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const stateStore = useStateStore();
|
||||||
const arrayData = useArrayData('ZoneList');
|
|
||||||
const store = arrayData.store;
|
|
||||||
const router = useRouter();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const router = useRouter();
|
||||||
|
const { notify } = useNotify();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
|
||||||
function navigate(id) {
|
const redirectToZoneSummary = (event, { id }) => {
|
||||||
router.push({ path: `/zone/${id}/edit` });
|
router.push({ name: 'ZoneSummary', params: { id } });
|
||||||
}
|
};
|
||||||
|
|
||||||
function create() {
|
function redirectToCreateView() {
|
||||||
router.push({ path: `/zone/create` });
|
router.push({ path: `/zone/create` });
|
||||||
}
|
}
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
name: 'ID',
|
||||||
|
label: t('list.id'),
|
||||||
|
field: (row) => row.id,
|
||||||
|
sortable: true,
|
||||||
|
align: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
label: t('list.name'),
|
||||||
|
field: (row) => row.name,
|
||||||
|
sortable: true,
|
||||||
|
align: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'agency',
|
||||||
|
label: t('list.agency'),
|
||||||
|
field: (row) => row?.agencyMode?.name,
|
||||||
|
sortable: true,
|
||||||
|
align: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'close',
|
||||||
|
label: t('list.close'),
|
||||||
|
field: (row) => (row?.hour ? toTimeFormat(row?.hour) : '-'),
|
||||||
|
sortable: true,
|
||||||
|
align: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'price',
|
||||||
|
label: t('list.price'),
|
||||||
|
field: (row) => (row?.price ? toCurrency(row.price) : '-'),
|
||||||
|
sortable: true,
|
||||||
|
align: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'actions',
|
||||||
|
label: '',
|
||||||
|
sortable: false,
|
||||||
|
align: 'right',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
async function remove(row) {
|
const exprBuilder = (param, value) => {
|
||||||
try {
|
switch (param) {
|
||||||
await axios.delete(`Zones/${row.id}`).then(async () => {
|
case 'name':
|
||||||
quasar.notify({
|
return {
|
||||||
message: t('zone.list.removeItem'),
|
name: { like: `%${value}%` },
|
||||||
type: 'positive',
|
};
|
||||||
});
|
case 'code':
|
||||||
store.data.splice(store.data.indexOf(row), 1);
|
return {
|
||||||
});
|
code: { like: `%${value}%` },
|
||||||
} catch (error) {
|
};
|
||||||
//
|
case 'agencyModeFk':
|
||||||
|
return {
|
||||||
|
agencyModeFk: value,
|
||||||
|
};
|
||||||
|
case 'search':
|
||||||
|
if (value) {
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return { id: value };
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
name: {
|
||||||
|
like: `%${value}%`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async function clone(id) {
|
||||||
|
const { data } = await axios.post(`Zones/${id}/clone`);
|
||||||
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
router.push({ name: 'ZoneBasicData', params: { id: data.id } });
|
||||||
}
|
}
|
||||||
|
const handleClone = (id) => {
|
||||||
|
openConfirmationModal(
|
||||||
|
t('list.confirmCloneTitle'),
|
||||||
|
t('list.confirmCloneSubtitle'),
|
||||||
|
() => clone(id)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
onMounted(async () => {
|
||||||
|
stateStore.rightDrawer = true;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<template v-if="stateStore.isHeaderMounted()">
|
||||||
url="/Agencies"
|
<Teleport to="#searchbar">
|
||||||
@on-fetch="(data) => (agencyOptions = data)"
|
<VnSearchbar
|
||||||
:filter="{ fields: ['id', 'name'] }"
|
data-key="ZoneList"
|
||||||
auto-load
|
url="Zones"
|
||||||
/>
|
:filter="{
|
||||||
|
include: { relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||||
|
}"
|
||||||
|
:expr-builder="exprBuilder"
|
||||||
|
:label="t('list.searchZone')"
|
||||||
|
:info="t('list.searchInfo')"
|
||||||
|
/>
|
||||||
|
</Teleport>
|
||||||
|
</template>
|
||||||
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
|
<QScrollArea class="fit text-grey-8">
|
||||||
|
<ZoneFilterPanel data-key="ZoneList" :expr-builder="exprBuilder" />
|
||||||
|
</QScrollArea>
|
||||||
|
</QDrawer>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<div class="vn-card-list">
|
<div class="vn-card-list">
|
||||||
<VnPaginate data-key="ZoneList" url="/Zones" order="id DESC" auto-load>
|
<VnPaginate
|
||||||
|
data-key="ZoneList"
|
||||||
|
url="Zones"
|
||||||
|
:filter="{
|
||||||
|
include: { relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||||
|
}"
|
||||||
|
:limit="20"
|
||||||
|
auto-load
|
||||||
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<CardList
|
<div class="q-pa-md">
|
||||||
v-for="row of rows"
|
<QTable
|
||||||
:key="row.id"
|
:rows="rows"
|
||||||
:title="(row.label || '').toString()"
|
:columns="columns"
|
||||||
:id="row.id"
|
row-key="clientId"
|
||||||
@click="navigate(row.id)"
|
class="full-width"
|
||||||
>
|
@row-click="redirectToZoneSummary"
|
||||||
<template #list-items>
|
>
|
||||||
<VnLv
|
<template #header="props">
|
||||||
:label="t('zone.list.id')"
|
<QTr :props="props" class="bg">
|
||||||
:title-label="t('zone.list.id')"
|
<QTh
|
||||||
:value="row.id"
|
v-for="col in props.cols"
|
||||||
/>
|
:key="col.name"
|
||||||
<VnLv :label="t('zone.list.name')" :value="row?.name" />
|
:props="props"
|
||||||
<VnLv
|
>
|
||||||
:label="t('zone.list.agency')"
|
{{ t(col.label) }}
|
||||||
:options="agencyOptions"
|
<QTooltip v-if="col.tooltip">{{
|
||||||
option-value="id"
|
col.tooltip
|
||||||
option-label="name"
|
}}</QTooltip>
|
||||||
:value="row?.agencyFk"
|
</QTh>
|
||||||
/>
|
</QTr>
|
||||||
<VnLv
|
</template>
|
||||||
:label="t('zone.list.close')"
|
|
||||||
:value="toTimeFormat(row?.hour)"
|
<template #body-cell="props">
|
||||||
/>
|
<QTd :props="props">
|
||||||
<VnLv :label="t('zone.list.price')" :value="row?.price" />
|
<QTr :props="props" class="cursor-pointer">
|
||||||
</template>
|
{{ props.value }}
|
||||||
<template #actions>
|
</QTr>
|
||||||
<QBtn
|
</QTd>
|
||||||
:label="t('components.smartCard.openCard')"
|
</template>
|
||||||
@click.stop="navigate(row.id)"
|
<template #body-cell-actions="props">
|
||||||
outline
|
<QTd :props="props" class="q-gutter-x-sm">
|
||||||
/>
|
<QIcon
|
||||||
<QBtn
|
name="vn:clone"
|
||||||
:label="t('zone.list.openSummary')"
|
size="sm"
|
||||||
@click.stop="viewSummary(row.id, ZoneSummary)"
|
color="primary"
|
||||||
color="primary"
|
@click.stop="handleClone(props.row.id)"
|
||||||
style="margin-top: 15px"
|
>
|
||||||
/>
|
<QTooltip>{{ t('globals.clone') }}</QTooltip>
|
||||||
<!--AQUI PONER BOTÓN CLONAR-->
|
</QIcon>
|
||||||
<QBtn
|
<QIcon
|
||||||
:label="t('zone.list.clone')"
|
name="preview"
|
||||||
@click.stop="remove(row)"
|
size="sm"
|
||||||
color="primary"
|
color="primary"
|
||||||
style="margin-top: 15px"
|
@click.stop="
|
||||||
/>
|
viewSummary(props.row.id, ZoneSummary)
|
||||||
</template>
|
"
|
||||||
</CardList>
|
>
|
||||||
|
<QTooltip>{{ t('Preview') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
|
</QTable>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VnPaginate>
|
</VnPaginate>
|
||||||
</div>
|
</div>
|
||||||
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
||||||
<QBtn @click="create" fab icon="add" color="primary">
|
<QBtn @click="redirectToCreateView()" fab icon="add" color="primary">
|
||||||
<QTooltip>{{ t('zone.list.create') }}</QTooltip>
|
<QTooltip>{{ t('list.create') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</QPage>
|
</QPage>
|
||||||
|
|
|
@ -1,19 +1,40 @@
|
||||||
zone:
|
zone:
|
||||||
list:
|
pageTitles:
|
||||||
volume: Volume
|
zones: Zone
|
||||||
clone: Clone
|
zonesList: Zones
|
||||||
id: Id
|
deliveryList: Delivery days
|
||||||
name: Name
|
upcomingList: Upcoming deliveries
|
||||||
agency: Agency
|
list:
|
||||||
close: Close
|
clone: Clone
|
||||||
price: Price
|
id: Id
|
||||||
create: Create zone
|
name: Name
|
||||||
openSummary: Details
|
agency: Agency
|
||||||
create:
|
close: Close
|
||||||
name: Name
|
price: Price
|
||||||
agency: Agency
|
create: Create zone
|
||||||
close: Close
|
openSummary: Details
|
||||||
price: Price
|
confirmCloneTitle: All it's properties will be copied
|
||||||
type:
|
confirmCloneSubtitle: Do you want to clone this zone?
|
||||||
submit: Save
|
searchZone: Search zones
|
||||||
reset: Reset
|
searchInfo: Search zone by id or name
|
||||||
|
create:
|
||||||
|
name: Name
|
||||||
|
agency: Agency
|
||||||
|
close: Close
|
||||||
|
price: Price
|
||||||
|
type:
|
||||||
|
submit: Save
|
||||||
|
reset: Reset
|
||||||
|
summary:
|
||||||
|
agency: Agency
|
||||||
|
price: Price
|
||||||
|
basicData: Basic data
|
||||||
|
bonus: Bonus
|
||||||
|
closeHour: Close hour
|
||||||
|
travelingDays: Traveling days
|
||||||
|
volumetric: Volumetric
|
||||||
|
warehouse: Warehouse
|
||||||
|
name: Name
|
||||||
|
filterPanel:
|
||||||
|
name: Name
|
||||||
|
agencyModeFk: Agency
|
||||||
|
|
|
@ -1,19 +1,42 @@
|
||||||
zone:
|
zone:
|
||||||
list:
|
pageTitles:
|
||||||
volume: Volumen
|
zones: Zonas
|
||||||
clone: Clonar
|
zonesList: Zonas
|
||||||
id: Id
|
deliveryList: Días de entrega
|
||||||
name: Nombre
|
upcomingList: Próximos repartos
|
||||||
agency: Agencia
|
list:
|
||||||
close: Cierre
|
clone: Clonar
|
||||||
price: Precio
|
id: Id
|
||||||
create: Crear zona
|
name: Nombre
|
||||||
openSummary: Detalles
|
agency: Agencia
|
||||||
create:
|
close: Cierre
|
||||||
name: Nombre
|
price: Precio
|
||||||
agency: Agencia
|
create: Crear zona
|
||||||
close: Cierre
|
openSummary: Detalles
|
||||||
price: Precio
|
confirmCloneTitle: Todas sus propiedades serán copiadas
|
||||||
type:
|
confirmCloneSubtitle: ¿Seguro que quieres clonar esta zona?
|
||||||
submit: Guardar
|
searchZone: Buscar zonas
|
||||||
reset: Reiniciar
|
searchInfo: Buscar zonas por identificador o nombre
|
||||||
|
create:
|
||||||
|
name: Nombre
|
||||||
|
agency: Agencia
|
||||||
|
close: Cierre
|
||||||
|
price: Precio
|
||||||
|
type:
|
||||||
|
submit: Guardar
|
||||||
|
reset: Reiniciar
|
||||||
|
summary:
|
||||||
|
agency: Agencia
|
||||||
|
price: Precio
|
||||||
|
basicData: Datos básicos
|
||||||
|
bonus: Bonificación
|
||||||
|
closeHour: Hora de cierre
|
||||||
|
travelingDays: Días de viaje
|
||||||
|
volumetric: Volumétrico
|
||||||
|
warehouse: Almacén
|
||||||
|
name: Nombre
|
||||||
|
filterPanel:
|
||||||
|
name: Nombre
|
||||||
|
agencyModeFk: Agencia
|
||||||
|
Search zones: Buscar zonas
|
||||||
|
You can search by zone reference: Puedes buscar por referencia de la zona
|
||||||
|
|
|
@ -11,58 +11,54 @@ export default {
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'ZoneMain' },
|
redirect: { name: 'ZoneMain' },
|
||||||
menus: {
|
menus: {
|
||||||
main: [
|
main: ['ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'],
|
||||||
/*'ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'*/
|
card: ['ZoneBasicData'],
|
||||||
],
|
|
||||||
card: [
|
|
||||||
//
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: '/zone',
|
path: '/zone',
|
||||||
// name: 'ZoneMain',
|
name: 'ZoneMain',
|
||||||
// component: () => import('src/pages/Zone/ZoneMain.vue'),
|
component: () => import('src/pages/Zone/ZoneMain.vue'),
|
||||||
// redirect: { name: 'ZoneList' },
|
redirect: { name: 'ZoneList' },
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'list',
|
path: 'list',
|
||||||
// name: 'ZoneList',
|
name: 'ZoneList',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'zonesList',
|
title: 'zonesList',
|
||||||
// icon: 'vn:zone',
|
icon: 'vn:zone',
|
||||||
// },
|
},
|
||||||
// component: () => import('src/pages/Zone/ZoneList.vue'),
|
component: () => import('src/pages/Zone/ZoneList.vue'),
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: 'create',
|
path: 'create',
|
||||||
// name: 'ZoneCreate',
|
name: 'ZoneCreate',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'zoneCreate',
|
title: 'zoneCreate',
|
||||||
// icon: 'create',
|
icon: 'create',
|
||||||
// },
|
},
|
||||||
// component: () => import('src/pages/Zone/ZoneCreate.vue'),
|
component: () => import('src/pages/Zone/ZoneCreate.vue'),
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: ':id/edit',
|
path: ':id/edit',
|
||||||
// name: 'ZoneEdit',
|
name: 'ZoneEdit',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'zoneEdit',
|
title: 'zoneEdit',
|
||||||
// icon: 'edit',
|
icon: 'edit',
|
||||||
// },
|
},
|
||||||
// component: () => import('src/pages/Zone/ZoneCreate.vue'),
|
component: () => import('src/pages/Zone/ZoneCreate.vue'),
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: 'counter',
|
path: 'counter',
|
||||||
// name: 'ZoneCounter',
|
name: 'ZoneCounter',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'zoneCounter',
|
title: 'zoneCounter',
|
||||||
// icon: 'add_circle',
|
icon: 'add_circle',
|
||||||
// },
|
},
|
||||||
// component: () => import('src/pages/Zone/ZoneCounter.vue'),
|
component: () => import('src/pages/Zone/ZoneCounter.vue'),
|
||||||
// },
|
},
|
||||||
// ],
|
],
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
name: 'ZoneCard',
|
name: 'ZoneCard',
|
||||||
path: ':id',
|
path: ':id',
|
||||||
|
@ -78,6 +74,15 @@ export default {
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Zone/Card/ZoneSummary.vue'),
|
component: () => import('src/pages/Zone/Card/ZoneSummary.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'ZoneBasicData',
|
||||||
|
path: 'basic-data',
|
||||||
|
meta: {
|
||||||
|
title: 'basicData',
|
||||||
|
icon: 'vn:settings',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Zone/Card/ZoneBasicData.vue'),
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// path: '/zone/delivery',
|
// path: '/zone/delivery',
|
||||||
// name: 'ZoneDeliveryMain',
|
// name: 'ZoneDeliveryMain',
|
||||||
|
|
Loading…
Reference in New Issue