0
0
Fork 0

Merge branch 'dev' into feature/Monitors

This commit is contained in:
Javier Segarra 2024-05-13 17:59:39 +02:00
commit 32e715ce6b
24 changed files with 554 additions and 269 deletions

View File

@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- (Worker) => Se crea la sección Taquilla
### Fixed ### Fixed
- (General) => Se vuelven a mostrar los parámetros en la url al aplicar un filtro - (General) => Se vuelven a mostrar los parámetros en la url al aplicar un filtro

View File

@ -156,9 +156,12 @@ const startFormWatcher = () => {
async function fetch() { async function fetch() {
try { try {
const { data } = await axios.get($props.url, { let { data } = await axios.get($props.url, {
params: { filter: JSON.stringify($props.filter) }, params: { filter: JSON.stringify($props.filter) },
}); });
if (Array.isArray(data)) data = data[0] ?? {};
state.set($props.model, data); state.set($props.model, data);
originalData.value = data && JSON.parse(JSON.stringify(data)); originalData.value = data && JSON.parse(JSON.stringify(data));

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onBeforeMount, computed } from 'vue'; import { onBeforeMount, computed, watchEffect } from 'vue';
import { useRoute, onBeforeRouteUpdate } from 'vue-router'; import { useRoute, onBeforeRouteUpdate } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
@ -47,6 +47,11 @@ if (props.baseUrl) {
} }
}); });
} }
watchEffect(() => {
if (Array.isArray(arrayData.store.data))
arrayData.store.data = arrayData.store.data[0];
});
</script> </script>
<template> <template>
<Teleport <Teleport

View File

@ -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);
} }

View File

@ -827,6 +827,7 @@ worker:
log: Log log: Log
calendar: Calendar calendar: Calendar
timeControl: Time control timeControl: Time control
locker: Locker
list: list:
name: Name name: Name
email: Email email: Email

View File

@ -825,6 +825,7 @@ worker:
log: Historial log: Historial
calendar: Calendario calendar: Calendario
timeControl: Control de horario timeControl: Control de horario
locker: Taquilla
list: list:
name: Nombre name: Nombre
email: Email email: Email

View File

@ -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(

View File

@ -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)

View File

@ -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(

View File

@ -0,0 +1,64 @@
<script setup>
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { useRole } from 'src/composables/useRole';
import FormModel from 'components/FormModel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import { useArrayData } from 'src/composables/useArrayData';
import FetchData from 'components/FetchData.vue';
const { hasAny } = useRole();
const { t } = useI18n();
const fetchData = ref();
const originaLockerId = ref();
const lockers = ref([]);
const { store } = useArrayData('Worker');
const entityId = computed(() => useRoute().params.id);
const filter = computed(() => ({
where: {
gender: store.data?.sex,
or: [{ workerFk: null }, { workerFk: entityId.value }],
},
}));
const save = async (data) => {
const lockerId = data.id ?? originaLockerId.value;
const workerFk = lockerId == originaLockerId.value ? null : entityId.value;
await axios.patch(`Lockers/${lockerId}`, { workerFk });
};
const init = async (data) => {
await fetchData.value.fetch();
originaLockerId.value = data.id;
};
</script>
<template>
<FetchData
ref="fetchData"
url="Lockers/codes"
:filter="filter"
@on-fetch="(data) => (lockers = data)"
/>
<FormModel
:url="`Workers/${entityId}/locker`"
model="worker"
auto-load
:save-fn="save"
@on-fetch="init"
>
<template #form="{ data }">
<VnSelect
:label="t('Locker')"
v-model="data.id"
:options="lockers"
option-label="code"
option-value="id"
hide-selected
:readonly="!hasAny(['productionBoss', 'hr'])"
/>
</template>
</FormModel>
</template>

View File

@ -1,2 +1,3 @@
Search worker: Buscar trabajador Search worker: Buscar trabajador
You can search by worker id or name: Puedes buscar por id o nombre del trabajador You can search by worker id or name: Puedes buscar por id o nombre del trabajador
Locker: Taquilla

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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>

View File

@ -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
<template #body="{ rows }"> data-key="ZoneList"
<CardList url="Zones"
v-for="row of rows" :filter="{
:key="row.id" include: { relation: 'agencyMode', scope: { fields: ['name'] } },
:title="(row.label || '').toString()" }"
:id="row.id" :limit="20"
@click="navigate(row.id)" auto-load
> >
<template #list-items> <template #body="{ rows }">
<VnLv <div class="q-pa-md">
:label="t('zone.list.id')" <QTable
:title-label="t('zone.list.id')" :rows="rows"
:value="row.id" :columns="columns"
/> row-key="clientId"
<VnLv :label="t('zone.list.name')" :value="row?.name" /> class="full-width"
<VnLv @row-click="redirectToZoneSummary"
:label="t('zone.list.agency')" >
:options="agencyOptions" <template #header="props">
option-value="id" <QTr :props="props" class="bg">
option-label="name" <QTh
:value="row?.agencyFk" v-for="col in props.cols"
/> :key="col.name"
<VnLv :props="props"
:label="t('zone.list.close')" >
:value="toTimeFormat(row?.hour)" {{ t(col.label) }}
/> <QTooltip v-if="col.tooltip">{{
<VnLv :label="t('zone.list.price')" :value="row?.price" /> col.tooltip
}}</QTooltip>
</QTh>
</QTr>
</template> </template>
<template #actions>
<QBtn <template #body-cell="props">
:label="t('components.smartCard.openCard')" <QTd :props="props">
@click.stop="navigate(row.id)" <QTr :props="props" class="cursor-pointer">
outline {{ props.value }}
/> </QTr>
<QBtn </QTd>
:label="t('zone.list.openSummary')"
@click.stop="viewSummary(row.id, ZoneSummary)"
color="primary"
style="margin-top: 15px"
/>
<!--AQUI PONER BOTÓN CLONAR-->
<QBtn
:label="t('zone.list.clone')"
@click.stop="remove(row)"
color="primary"
style="margin-top: 15px"
/>
</template> </template>
</CardList> <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> </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>

View File

@ -1,6 +1,10 @@
zone: zone:
list: pageTitles:
volume: Volume zones: Zone
zonesList: Zones
deliveryList: Delivery days
upcomingList: Upcoming deliveries
list:
clone: Clone clone: Clone
id: Id id: Id
name: Name name: Name
@ -9,11 +13,28 @@ zone:
price: Price price: Price
create: Create zone create: Create zone
openSummary: Details openSummary: Details
create: confirmCloneTitle: All it's properties will be copied
confirmCloneSubtitle: Do you want to clone this zone?
searchZone: Search zones
searchInfo: Search zone by id or name
create:
name: Name name: Name
agency: Agency agency: Agency
close: Close close: Close
price: Price price: Price
type: type:
submit: Save submit: Save
reset: Reset 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

View File

@ -1,6 +1,10 @@
zone: zone:
list: pageTitles:
volume: Volumen zones: Zonas
zonesList: Zonas
deliveryList: Días de entrega
upcomingList: Próximos repartos
list:
clone: Clonar clone: Clonar
id: Id id: Id
name: Nombre name: Nombre
@ -9,11 +13,30 @@ zone:
price: Precio price: Precio
create: Crear zona create: Crear zona
openSummary: Detalles openSummary: Detalles
create: confirmCloneTitle: Todas sus propiedades serán copiadas
confirmCloneSubtitle: ¿Seguro que quieres clonar esta zona?
searchZone: Buscar zonas
searchInfo: Buscar zonas por identificador o nombre
create:
name: Nombre name: Nombre
agency: Agencia agency: Agencia
close: Cierre close: Cierre
price: Precio price: Precio
type: type:
submit: Guardar submit: Guardar
reset: Reiniciar 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

View File

@ -22,6 +22,7 @@ export default {
'WorkerCalendar', 'WorkerCalendar',
'WorkerDms', 'WorkerDms',
'WorkerTimeControl', 'WorkerTimeControl',
'WorkerLocker',
], ],
departmentCard: ['BasicData'], departmentCard: ['BasicData'],
}, },
@ -167,6 +168,15 @@ export default {
component: () => component: () =>
import('src/pages/Worker/Card/WorkerTimeControl.vue'), import('src/pages/Worker/Card/WorkerTimeControl.vue'),
}, },
{
name: 'WorkerLocker',
path: 'locker',
meta: {
title: 'locker',
icon: 'lock',
},
component: () => import('src/pages/Worker/Card/WorkerLocker.vue'),
},
], ],
}, },
], ],

View File

@ -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',

View File

@ -0,0 +1,19 @@
describe('WorkerList', () => {
const workerId = 1110;
const lockerCode = '200A';
const input = '.q-card input';
const firstOpt = '[role="listbox"] .q-item:nth-child(1)';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('productionBoss');
cy.visit(`/#/worker/${workerId}/locker`);
});
it('should allocates a locker', () => {
cy.get(input).click();
cy.get(input).type(lockerCode);
cy.get(firstOpt).click();
cy.saveCard();
cy.get(input).invoke('val').should('eq', lockerCode);
});
});