forked from verdnatura/salix-front
Merge branch 'dev' into feature/Monitors
This commit is contained in:
commit
32e715ce6b
|
@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Added
|
||||
|
||||
- (Worker) => Se crea la sección Taquilla
|
||||
|
||||
### Fixed
|
||||
|
||||
- (General) => Se vuelven a mostrar los parámetros en la url al aplicar un filtro
|
||||
|
|
|
@ -156,9 +156,12 @@ const startFormWatcher = () => {
|
|||
|
||||
async function fetch() {
|
||||
try {
|
||||
const { data } = await axios.get($props.url, {
|
||||
let { data } = await axios.get($props.url, {
|
||||
params: { filter: JSON.stringify($props.filter) },
|
||||
});
|
||||
|
||||
if (Array.isArray(data)) data = data[0] ?? {};
|
||||
|
||||
state.set($props.model, data);
|
||||
originalData.value = data && JSON.parse(JSON.stringify(data));
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { onBeforeMount, computed } from 'vue';
|
||||
import { onBeforeMount, computed, watchEffect } from 'vue';
|
||||
import { useRoute, onBeforeRouteUpdate } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
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>
|
||||
<template>
|
||||
<Teleport
|
||||
|
|
|
@ -147,7 +147,7 @@ const customTags = computed(() =>
|
|||
|
||||
async function remove(key) {
|
||||
userParams.value[key] = null;
|
||||
await search();
|
||||
await arrayData.applyFilter({ params: userParams.value });
|
||||
emit('remove', key);
|
||||
}
|
||||
|
||||
|
|
|
@ -827,6 +827,7 @@ worker:
|
|||
log: Log
|
||||
calendar: Calendar
|
||||
timeControl: Time control
|
||||
locker: Locker
|
||||
list:
|
||||
name: Name
|
||||
email: Email
|
||||
|
|
|
@ -825,6 +825,7 @@ worker:
|
|||
log: Historial
|
||||
calendar: Calendario
|
||||
timeControl: Control de horario
|
||||
locker: Taquilla
|
||||
list:
|
||||
name: Nombre
|
||||
email: Email
|
||||
|
|
|
@ -280,7 +280,7 @@ function navigateToRouteSummary(event, row) {
|
|||
<div class="table-actions">
|
||||
<QIcon
|
||||
name="preview"
|
||||
size="xs"
|
||||
size="sm"
|
||||
color="primary"
|
||||
@click.stop="
|
||||
viewSummary(
|
||||
|
|
|
@ -422,7 +422,7 @@ const openTicketsDialog = (id) => {
|
|||
<div class="flex items-center no-wrap table-actions">
|
||||
<QIcon
|
||||
name="vn:ticketAdd"
|
||||
size="xs"
|
||||
size="sm"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
@click="openTicketsDialog(props?.row?.id)"
|
||||
|
@ -431,7 +431,7 @@ const openTicketsDialog = (id) => {
|
|||
</QIcon>
|
||||
<QIcon
|
||||
name="preview"
|
||||
size="xs"
|
||||
size="sm"
|
||||
color="primary"
|
||||
@click="
|
||||
viewSummary(props?.row?.id, RouteSummary)
|
||||
|
|
|
@ -242,7 +242,7 @@ function navigateToRoadmapSummary(event, row) {
|
|||
<div class="flex items-center table-actions">
|
||||
<QIcon
|
||||
name="preview"
|
||||
size="xs"
|
||||
size="sm"
|
||||
color="primary"
|
||||
@click.stop="
|
||||
viewSummary(
|
||||
|
|
|
@ -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>
|
|
@ -1,2 +1,3 @@
|
|||
Search worker: Buscar trabajador
|
||||
You can search by worker id or name: Puedes buscar por id o nombre del trabajador
|
||||
Locker: Taquilla
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
<script setup>
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import ZoneDescriptor from './ZoneDescriptor.vue';
|
||||
</script>
|
||||
<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>
|
||||
|
|
|
@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import { toTimeFormat } from 'src/filters/date';
|
||||
import { toCurrency } from 'filters/index';
|
||||
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
|
||||
|
@ -73,24 +74,11 @@ const setData = (entity) => {
|
|||
</template> -->
|
||||
<template #body="{ entity }">
|
||||
{{ console.log('entity', entity) }}
|
||||
<VnLv :label="t('Agency')" :value="entity.agencyMode.name" />
|
||||
<VnLv :label="t('Closing hour')" :value="toTimeFormat(entity.hour)" />
|
||||
<VnLv :label="t('zoneing days')" :value="entity.zoneingDays" />
|
||||
<VnLv :label="t('Price')" :value="entity.price" />
|
||||
<VnLv :label="t('Bonus')" :value="entity.bonus" />
|
||||
<VnLv :label="t('summary.agency')" :value="entity.agencyMode.name" />
|
||||
<VnLv :label="t('summary.closeHour')" :value="toTimeFormat(entity.hour)" />
|
||||
<VnLv :label="t('summary.travelingDays')" :value="entity.travelingDays" />
|
||||
<VnLv :label="t('summary.price')" :value="toCurrency(entity.price)" />
|
||||
<VnLv :label="t('summary.bonus')" :value="toCurrency(entity.bonus)" />
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
</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 { useRoute } from 'vue-router';
|
||||
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 VnLinkPhone from 'src/components/ui/VnLinkPhone.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 { getUrl } from 'src/composables/getUrl';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import { toTimeFormat } from 'src/filters/date';
|
||||
import axios from 'axios';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -23,71 +25,84 @@ const $props = defineProps({
|
|||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const zoneUrl = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
zoneUrl.value = (await getUrl('')) + `zone/${entityId.value}/`;
|
||||
const filter = computed(() => {
|
||||
const filter = {
|
||||
include: {
|
||||
relation: 'agencyMode',
|
||||
fields: ['name'],
|
||||
},
|
||||
where: {
|
||||
id: route.params.id,
|
||||
},
|
||||
};
|
||||
return filter;
|
||||
});
|
||||
|
||||
const filter = computed(() => {
|
||||
return { where: { id: entityId.value } };
|
||||
const columns = computed(() => [
|
||||
{
|
||||
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>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
data-key="zoneData"
|
||||
data-key="ZoneSummary"
|
||||
ref="summary"
|
||||
:url="`Zones/summary`"
|
||||
url="Zones/findOne"
|
||||
:filter="filter"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
|
||||
<div>#{{ entity.id }} - {{ entity.name }}</div>
|
||||
</template>
|
||||
<template #body="{ entity: zone }">
|
||||
<QCard class="vn-one">
|
||||
<VnTitle
|
||||
:url="zoneUrl + `basic-data`"
|
||||
:text="t('zone.summary.basicData')"
|
||||
/>
|
||||
<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" />
|
||||
<VnTitle :url="zoneUrl + `basic-data`" :text="t('summary.basicData')" />
|
||||
<VnLv :label="t('summary.agency')" :value="zone.agencyMode?.name" />
|
||||
<VnLv :label="t('summary.price')" :value="toCurrency(zone.price)" />
|
||||
<VnLv :label="t('summary.bonus')" :value="toCurrency(zone.bonus)" />
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<VnTitle :text="t('zone.summary.userData')" />
|
||||
<VnLv :label="t('zone.summary.userId')" :value="zone.user.id" />
|
||||
<VnLv :label="t('zone.card.name')" :value="zone.user.nickname" />
|
||||
<VnLv :label="t('zone.summary.role')" :value="zone.user.role.name" />
|
||||
<VnLv :value="zone?.sip?.extension">
|
||||
<template #label>
|
||||
{{ t('zone.summary.sipExtension') }}
|
||||
<VnLinkPhone :phone-number="zone?.sip?.extension" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnTitle :url="zoneUrl + `basic-data`" :text="t('summary.basicData')" />
|
||||
<VnLv :label="t('summary.closeHour')" :value="toTimeFormat(zone.hour)" />
|
||||
<VnLv :label="t('summary.travelingDays')" :value="zone.travelingDays" />
|
||||
<QCheckbox
|
||||
:label="t('summary.volumetric')"
|
||||
v-model="zone.isVolumetric"
|
||||
:disable="true"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="full-width">
|
||||
<VnTitle :url="zoneUrl + `warehouses`" :text="t('summary.warehouse')" />
|
||||
<QTable
|
||||
:columns="columns"
|
||||
:rows="warehouses"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
/>
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
|
|
|
@ -63,7 +63,7 @@ async function remove(row) {
|
|||
outline
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('zone.list.remove')"
|
||||
:label="t('list.remove')"
|
||||
@click.stop="remove(row)"
|
||||
color="primary"
|
||||
style="margin-top: 15px"
|
||||
|
|
|
@ -63,7 +63,7 @@ async function remove(row) {
|
|||
outline
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('zone.list.remove')"
|
||||
:label="t('list.remove')"
|
||||
@click.stop="remove(row)"
|
||||
color="primary"
|
||||
style="margin-top: 15px"
|
||||
|
|
|
@ -96,7 +96,7 @@ function filterType(val, update) {
|
|||
<QInput
|
||||
filled
|
||||
v-model="zone.label"
|
||||
:label="t('zone.create.name')"
|
||||
:label="t('create.name')"
|
||||
type="number"
|
||||
min="0"
|
||||
:rules="[(val) => !!val || t('zone.warnings.labelNotEmpty')]"
|
||||
|
@ -106,7 +106,7 @@ function filterType(val, update) {
|
|||
<VnInput
|
||||
filled
|
||||
v-model="zone.plate"
|
||||
:label="t('zone.create.agency')"
|
||||
:label="t('create.agency')"
|
||||
:rules="[(val) => !!val || t('zone.warnings.plateNotEmpty')]"
|
||||
/>
|
||||
</div>
|
||||
|
@ -116,7 +116,7 @@ function filterType(val, update) {
|
|||
<QInput
|
||||
filled
|
||||
v-model="zone.volume"
|
||||
:label="t('zone.create.close')"
|
||||
:label="t('create.close')"
|
||||
type="number"
|
||||
min="0"
|
||||
:rules="[(val) => !!val || t('zone.warnings.volumeNotEmpty')]"
|
||||
|
@ -134,7 +134,7 @@ function filterType(val, update) {
|
|||
option-value="id"
|
||||
emit-value
|
||||
map-options
|
||||
:label="t('zone.create.price')"
|
||||
:label="t('create.price')"
|
||||
:options="filteredZoneTypes"
|
||||
:rules="[(val) => !!val || t('zone.warnings.typeNotEmpty')]"
|
||||
@filter="filterType"
|
||||
|
@ -158,9 +158,9 @@ function filterType(val, update) {
|
|||
</div>
|
||||
</QCard>
|
||||
<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
|
||||
:label="t('zone.type.reset')"
|
||||
:label="t('type.reset')"
|
||||
type="reset"
|
||||
color="primary"
|
||||
flat
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import VnInput from 'components/common/VnInput.vue';
|
||||
import FetchData from 'components/FetchData.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 props = defineProps({
|
||||
|
@ -17,37 +17,47 @@ const props = defineProps({
|
|||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const agencies = ref([]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="agencies"
|
||||
limit="30"
|
||||
@on-fetch="(data) => (agencies = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #body="{ params }">
|
||||
<FetchData url="agencies" @on-fetch="(data) => (agencies = data)" auto-load />
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
:hidden-tags="['search']"
|
||||
>
|
||||
<template #tags="{ tag }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`filterPanel.${tag.label}`) }}: </strong>
|
||||
<span>{{ tag.value }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput :label="t('Name')" v-model="params.name" is-outlined />
|
||||
<VnInput
|
||||
:label="t('filterPanel.name')"
|
||||
v-model="params.name"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('Agency')"
|
||||
v-model="params.agencyModefK"
|
||||
<VnSelect
|
||||
:label="t('filterPanel.agencyModeFk')"
|
||||
v-model="params.agencyModeFk"
|
||||
:options="agencies"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@input-value="agencies.fetch()"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
</VnSelectFilter>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
|
|
@ -1,111 +1,219 @@
|
|||
<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 { 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 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 { 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 arrayData = useArrayData('ZoneList');
|
||||
const store = arrayData.store;
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const { notify } = useNotify();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/zone/${id}/edit` });
|
||||
}
|
||||
const redirectToZoneSummary = (event, { id }) => {
|
||||
router.push({ name: 'ZoneSummary', params: { id } });
|
||||
};
|
||||
|
||||
function create() {
|
||||
function redirectToCreateView() {
|
||||
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) {
|
||||
try {
|
||||
await axios.delete(`Zones/${row.id}`).then(async () => {
|
||||
quasar.notify({
|
||||
message: t('zone.list.removeItem'),
|
||||
type: 'positive',
|
||||
});
|
||||
store.data.splice(store.data.indexOf(row), 1);
|
||||
});
|
||||
} catch (error) {
|
||||
//
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'name':
|
||||
return {
|
||||
name: { like: `%${value}%` },
|
||||
};
|
||||
case 'code':
|
||||
return {
|
||||
code: { like: `%${value}%` },
|
||||
};
|
||||
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>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="/Agencies"
|
||||
@on-fetch="(data) => (agencyOptions = data)"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
auto-load
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="ZoneList"
|
||||
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">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate data-key="ZoneList" url="/Zones" order="id DESC" auto-load>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:title="(row.label || '').toString()"
|
||||
:id="row.id"
|
||||
@click="navigate(row.id)"
|
||||
<VnPaginate
|
||||
data-key="ZoneList"
|
||||
url="Zones"
|
||||
:filter="{
|
||||
include: { relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||
}"
|
||||
:limit="20"
|
||||
auto-load
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv
|
||||
:label="t('zone.list.id')"
|
||||
:title-label="t('zone.list.id')"
|
||||
:value="row.id"
|
||||
/>
|
||||
<VnLv :label="t('zone.list.name')" :value="row?.name" />
|
||||
<VnLv
|
||||
:label="t('zone.list.agency')"
|
||||
:options="agencyOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:value="row?.agencyFk"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('zone.list.close')"
|
||||
:value="toTimeFormat(row?.hour)"
|
||||
/>
|
||||
<VnLv :label="t('zone.list.price')" :value="row?.price" />
|
||||
<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 #actions>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openCard')"
|
||||
@click.stop="navigate(row.id)"
|
||||
outline
|
||||
/>
|
||||
<QBtn
|
||||
: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 #body-cell="props">
|
||||
<QTd :props="props">
|
||||
<QTr :props="props" class="cursor-pointer">
|
||||
{{ props.value }}
|
||||
</QTr>
|
||||
</QTd>
|
||||
</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>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
||||
<QBtn @click="create" fab icon="add" color="primary">
|
||||
<QTooltip>{{ t('zone.list.create') }}</QTooltip>
|
||||
<QBtn @click="redirectToCreateView()" fab icon="add" color="primary">
|
||||
<QTooltip>{{ t('list.create') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
zone:
|
||||
list:
|
||||
volume: Volume
|
||||
pageTitles:
|
||||
zones: Zone
|
||||
zonesList: Zones
|
||||
deliveryList: Delivery days
|
||||
upcomingList: Upcoming deliveries
|
||||
list:
|
||||
clone: Clone
|
||||
id: Id
|
||||
name: Name
|
||||
|
@ -9,11 +13,28 @@ zone:
|
|||
price: Price
|
||||
create: Create zone
|
||||
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
|
||||
agency: Agency
|
||||
close: Close
|
||||
price: Price
|
||||
type:
|
||||
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,6 +1,10 @@
|
|||
zone:
|
||||
list:
|
||||
volume: Volumen
|
||||
pageTitles:
|
||||
zones: Zonas
|
||||
zonesList: Zonas
|
||||
deliveryList: Días de entrega
|
||||
upcomingList: Próximos repartos
|
||||
list:
|
||||
clone: Clonar
|
||||
id: Id
|
||||
name: Nombre
|
||||
|
@ -9,11 +13,30 @@ zone:
|
|||
price: Precio
|
||||
create: Crear zona
|
||||
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
|
||||
agency: Agencia
|
||||
close: Cierre
|
||||
price: Precio
|
||||
type:
|
||||
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
|
||||
|
|
|
@ -22,6 +22,7 @@ export default {
|
|||
'WorkerCalendar',
|
||||
'WorkerDms',
|
||||
'WorkerTimeControl',
|
||||
'WorkerLocker',
|
||||
],
|
||||
departmentCard: ['BasicData'],
|
||||
},
|
||||
|
@ -167,6 +168,15 @@ export default {
|
|||
component: () =>
|
||||
import('src/pages/Worker/Card/WorkerTimeControl.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerLocker',
|
||||
path: 'locker',
|
||||
meta: {
|
||||
title: 'locker',
|
||||
icon: 'lock',
|
||||
},
|
||||
component: () => import('src/pages/Worker/Card/WorkerLocker.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -11,58 +11,54 @@ export default {
|
|||
component: RouterView,
|
||||
redirect: { name: 'ZoneMain' },
|
||||
menus: {
|
||||
main: [
|
||||
/*'ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'*/
|
||||
],
|
||||
card: [
|
||||
//
|
||||
],
|
||||
main: ['ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'],
|
||||
card: ['ZoneBasicData'],
|
||||
},
|
||||
children: [
|
||||
// {
|
||||
// path: '/zone',
|
||||
// name: 'ZoneMain',
|
||||
// component: () => import('src/pages/Zone/ZoneMain.vue'),
|
||||
// redirect: { name: 'ZoneList' },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'list',
|
||||
// name: 'ZoneList',
|
||||
// meta: {
|
||||
// title: 'zonesList',
|
||||
// icon: 'vn:zone',
|
||||
// },
|
||||
// component: () => import('src/pages/Zone/ZoneList.vue'),
|
||||
// },
|
||||
// {
|
||||
// path: 'create',
|
||||
// name: 'ZoneCreate',
|
||||
// meta: {
|
||||
// title: 'zoneCreate',
|
||||
// icon: 'create',
|
||||
// },
|
||||
// component: () => import('src/pages/Zone/ZoneCreate.vue'),
|
||||
// },
|
||||
// {
|
||||
// path: ':id/edit',
|
||||
// name: 'ZoneEdit',
|
||||
// meta: {
|
||||
// title: 'zoneEdit',
|
||||
// icon: 'edit',
|
||||
// },
|
||||
// component: () => import('src/pages/Zone/ZoneCreate.vue'),
|
||||
// },
|
||||
// {
|
||||
// path: 'counter',
|
||||
// name: 'ZoneCounter',
|
||||
// meta: {
|
||||
// title: 'zoneCounter',
|
||||
// icon: 'add_circle',
|
||||
// },
|
||||
// component: () => import('src/pages/Zone/ZoneCounter.vue'),
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
path: '/zone',
|
||||
name: 'ZoneMain',
|
||||
component: () => import('src/pages/Zone/ZoneMain.vue'),
|
||||
redirect: { name: 'ZoneList' },
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
name: 'ZoneList',
|
||||
meta: {
|
||||
title: 'zonesList',
|
||||
icon: 'vn:zone',
|
||||
},
|
||||
component: () => import('src/pages/Zone/ZoneList.vue'),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'ZoneCreate',
|
||||
meta: {
|
||||
title: 'zoneCreate',
|
||||
icon: 'create',
|
||||
},
|
||||
component: () => import('src/pages/Zone/ZoneCreate.vue'),
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
name: 'ZoneEdit',
|
||||
meta: {
|
||||
title: 'zoneEdit',
|
||||
icon: 'edit',
|
||||
},
|
||||
component: () => import('src/pages/Zone/ZoneCreate.vue'),
|
||||
},
|
||||
{
|
||||
path: 'counter',
|
||||
name: 'ZoneCounter',
|
||||
meta: {
|
||||
title: 'zoneCounter',
|
||||
icon: 'add_circle',
|
||||
},
|
||||
component: () => import('src/pages/Zone/ZoneCounter.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'ZoneCard',
|
||||
path: ':id',
|
||||
|
@ -78,6 +74,15 @@ export default {
|
|||
},
|
||||
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',
|
||||
// name: 'ZoneDeliveryMain',
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue