forked from verdnatura/salix-front
Merge branch 'dev' into 6943_customer_spec
This commit is contained in:
commit
cdce4d063c
|
@ -2,9 +2,11 @@ import axios from 'axios';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { Router } from 'src/router';
|
import { Router } from 'src/router';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||||
|
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
const stateQuery = useStateQueryStore();
|
||||||
const baseUrl = '/api/';
|
const baseUrl = '/api/';
|
||||||
|
|
||||||
axios.defaults.baseURL = baseUrl;
|
axios.defaults.baseURL = baseUrl;
|
||||||
|
@ -15,7 +17,7 @@ const onRequest = (config) => {
|
||||||
if (token.length && !config.headers.Authorization) {
|
if (token.length && !config.headers.Authorization) {
|
||||||
config.headers.Authorization = token;
|
config.headers.Authorization = token;
|
||||||
}
|
}
|
||||||
|
stateQuery.add(config);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,10 +26,10 @@ const onRequestError = (error) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onResponse = (response) => {
|
const onResponse = (response) => {
|
||||||
const { method } = response.config;
|
const config = response.config;
|
||||||
|
stateQuery.remove(config);
|
||||||
|
|
||||||
const isSaveRequest = method === 'patch';
|
if (config.method === 'patch') {
|
||||||
if (isSaveRequest) {
|
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +37,8 @@ const onResponse = (response) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onResponseError = (error) => {
|
const onResponseError = (error) => {
|
||||||
|
stateQuery.remove(error.config);
|
||||||
|
|
||||||
let message = '';
|
let message = '';
|
||||||
|
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import PinnedModules from './PinnedModules.vue';
|
import PinnedModules from './PinnedModules.vue';
|
||||||
import UserPanel from 'components/UserPanel.vue';
|
import UserPanel from 'components/UserPanel.vue';
|
||||||
|
@ -12,6 +13,7 @@ import VnAvatar from './ui/VnAvatar.vue';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
const stateQuery = useStateQueryStore();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const appName = 'Lilium';
|
const appName = 'Lilium';
|
||||||
|
@ -50,6 +52,14 @@ const pinnedModulesRef = ref();
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<VnBreadcrumbs v-if="$q.screen.gt.sm" />
|
<VnBreadcrumbs v-if="$q.screen.gt.sm" />
|
||||||
|
<QSpinner
|
||||||
|
color="primary"
|
||||||
|
class="q-ml-md"
|
||||||
|
:class="{
|
||||||
|
'no-visible': !stateQuery.isLoading().value,
|
||||||
|
}"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<div id="searchbar" class="searchbar"></div>
|
<div id="searchbar" class="searchbar"></div>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
|
|
|
@ -134,6 +134,7 @@ const splittedColumns = ref({ columns: [] });
|
||||||
const columnsVisibilitySkipped = ref();
|
const columnsVisibilitySkipped = ref();
|
||||||
const createForm = ref();
|
const createForm = ref();
|
||||||
const tableFilterRef = ref([]);
|
const tableFilterRef = ref([]);
|
||||||
|
const tableRef = ref();
|
||||||
|
|
||||||
const tableModes = [
|
const tableModes = [
|
||||||
{
|
{
|
||||||
|
@ -321,6 +322,13 @@ function handleOnDataSaved(_) {
|
||||||
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
|
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
|
||||||
else $props.create.onDataSaved(_);
|
else $props.create.onDataSaved(_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleScroll() {
|
||||||
|
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||||
|
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||||
|
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||||
|
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QDrawer
|
<QDrawer
|
||||||
|
@ -405,6 +413,7 @@ function handleOnDataSaved(_) {
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QTable
|
<QTable
|
||||||
|
ref="tableRef"
|
||||||
v-bind="table"
|
v-bind="table"
|
||||||
class="vnTable"
|
class="vnTable"
|
||||||
:columns="splittedColumns.columns"
|
:columns="splittedColumns.columns"
|
||||||
|
@ -416,12 +425,7 @@ function handleOnDataSaved(_) {
|
||||||
flat
|
flat
|
||||||
:style="isTableMode && `max-height: ${tableHeight}`"
|
:style="isTableMode && `max-height: ${tableHeight}`"
|
||||||
:virtual-scroll="isTableMode"
|
:virtual-scroll="isTableMode"
|
||||||
@virtual-scroll="
|
@virtual-scroll="handleScroll"
|
||||||
(event) =>
|
|
||||||
event.index > rows.length - 2 &&
|
|
||||||
($props.crudModel?.paginate ?? true) &&
|
|
||||||
CrudModelRef.vnPaginateRef.paginate()
|
|
||||||
"
|
|
||||||
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
||||||
@update:selected="emit('update:selected', $event)"
|
@update:selected="emit('update:selected', $event)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -141,6 +141,7 @@ function findKeyInOptions() {
|
||||||
function setOptions(data) {
|
function setOptions(data) {
|
||||||
myOptions.value = JSON.parse(JSON.stringify(data));
|
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||||
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||||
|
emit('update:options', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filter(val, options) {
|
function filter(val, options) {
|
||||||
|
|
|
@ -288,3 +288,7 @@ input::-webkit-inner-spin-button {
|
||||||
color: $info;
|
color: $info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-visible {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
|
@ -277,6 +277,7 @@ globals:
|
||||||
medical: Mutual
|
medical: Mutual
|
||||||
RouteExtendedList: Router
|
RouteExtendedList: Router
|
||||||
wasteRecalc: Waste recaclulate
|
wasteRecalc: Waste recaclulate
|
||||||
|
operator: Operator
|
||||||
supplier: Supplier
|
supplier: Supplier
|
||||||
created: Created
|
created: Created
|
||||||
worker: Worker
|
worker: Worker
|
||||||
|
@ -743,6 +744,7 @@ worker:
|
||||||
locker: Locker
|
locker: Locker
|
||||||
balance: Balance
|
balance: Balance
|
||||||
medical: Medical
|
medical: Medical
|
||||||
|
operator: Operator
|
||||||
list:
|
list:
|
||||||
name: Name
|
name: Name
|
||||||
email: Email
|
email: Email
|
||||||
|
@ -840,6 +842,18 @@ worker:
|
||||||
debit: Debt
|
debit: Debt
|
||||||
credit: Have
|
credit: Have
|
||||||
concept: Concept
|
concept: Concept
|
||||||
|
operator:
|
||||||
|
numberOfWagons: Number of wagons
|
||||||
|
train: Train
|
||||||
|
itemPackingType: Item packing type
|
||||||
|
warehouse: Warehouse
|
||||||
|
sector: Sector
|
||||||
|
labeler: Printer
|
||||||
|
linesLimit: Lines limit
|
||||||
|
volumeLimit: Volume limit
|
||||||
|
sizeLimit: Size limit
|
||||||
|
isOnReservationMode: Reservation mode
|
||||||
|
machine: Machine
|
||||||
wagon:
|
wagon:
|
||||||
pageTitles:
|
pageTitles:
|
||||||
wagons: Wagons
|
wagons: Wagons
|
||||||
|
|
|
@ -281,6 +281,7 @@ globals:
|
||||||
serial: Facturas por serie
|
serial: Facturas por serie
|
||||||
medical: Mutua
|
medical: Mutua
|
||||||
wasteRecalc: Recalcular mermas
|
wasteRecalc: Recalcular mermas
|
||||||
|
operator: Operario
|
||||||
supplier: Proveedor
|
supplier: Proveedor
|
||||||
created: Fecha creación
|
created: Fecha creación
|
||||||
worker: Trabajador
|
worker: Trabajador
|
||||||
|
@ -750,6 +751,7 @@ worker:
|
||||||
balance: Balance
|
balance: Balance
|
||||||
formation: Formación
|
formation: Formación
|
||||||
medical: Mutua
|
medical: Mutua
|
||||||
|
operator: Operario
|
||||||
list:
|
list:
|
||||||
name: Nombre
|
name: Nombre
|
||||||
email: Email
|
email: Email
|
||||||
|
@ -838,6 +840,19 @@ worker:
|
||||||
debit: Debe
|
debit: Debe
|
||||||
credit: Haber
|
credit: Haber
|
||||||
concept: Concepto
|
concept: Concepto
|
||||||
|
operator:
|
||||||
|
numberOfWagons: Número de vagones
|
||||||
|
train: tren
|
||||||
|
itemPackingType: Tipo de embalaje
|
||||||
|
warehouse: Almacén
|
||||||
|
sector: Sector
|
||||||
|
labeler: Impresora
|
||||||
|
linesLimit: Líneas límite
|
||||||
|
volumeLimit: Volumen límite
|
||||||
|
sizeLimit: Tamaño límite
|
||||||
|
isOnReservationMode: Modo de reserva
|
||||||
|
machine: Máquina
|
||||||
|
|
||||||
wagon:
|
wagon:
|
||||||
pageTitles:
|
pageTitles:
|
||||||
wagons: Vagones
|
wagons: Vagones
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { useRoute, useRouter } from 'vue-router';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { toDateFormat } from 'src/filters/date.js';
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
|
|
||||||
import { toCurrency } from 'src/filters';
|
import { dashIfEmpty, toCurrency } from 'src/filters';
|
||||||
|
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
|
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
|
||||||
|
@ -32,6 +32,16 @@ const filter = {
|
||||||
},
|
},
|
||||||
{ relation: 'invoiceOut', scope: { fields: ['id'] } },
|
{ relation: 'invoiceOut', scope: { fields: ['id'] } },
|
||||||
{ relation: 'agencyMode', scope: { fields: ['name'] } },
|
{ relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||||
|
{
|
||||||
|
relation: 'ticketSales',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'concept', 'itemFk'],
|
||||||
|
include: { relation: 'item' },
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name', 'itemPackingTypeFk'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
where: { clientFk: route.params.id },
|
where: { clientFk: route.params.id },
|
||||||
order: ['shipped DESC', 'id'],
|
order: ['shipped DESC', 'id'],
|
||||||
|
@ -87,7 +97,12 @@ const columns = computed(() => [
|
||||||
label: t('Total'),
|
label: t('Total'),
|
||||||
name: 'total',
|
name: 'total',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'itemPackingTypeFk',
|
||||||
|
label: t('ticketSale.packaging'),
|
||||||
|
format: (row) => getItemPackagingType(row),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
label: '',
|
label: '',
|
||||||
|
@ -135,6 +150,15 @@ const setShippedColor = (date) => {
|
||||||
if (difference == 0) return 'warning';
|
if (difference == 0) return 'warning';
|
||||||
if (difference < 0) return 'success';
|
if (difference < 0) return 'success';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getItemPackagingType = (row) => {
|
||||||
|
const packagingType = row?.ticketSales
|
||||||
|
.map((sale) => sale.item?.itemPackingTypeFk || '-')
|
||||||
|
.filter((value) => value !== '-')
|
||||||
|
.join(', ');
|
||||||
|
|
||||||
|
return dashIfEmpty(packagingType);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -229,7 +229,7 @@ onBeforeMount(() => {
|
||||||
>
|
>
|
||||||
<template #body-cell-id="{ row }">
|
<template #body-cell-id="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat color="primary"> {{ row.ticketFk }}</QBtn>
|
<QBtn flat class="link"> {{ row.ticketFk }}</QBtn>
|
||||||
<TicketDescriptorProxy :id="row.ticketFk" />
|
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -251,7 +251,7 @@ onBeforeMount(() => {
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-requester="{ row }">
|
<template #body-cell-requester="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat dense color="primary"> {{ row.requesterName }}</QBtn>
|
<QBtn flat dense class="link"> {{ row.requesterName }}</QBtn>
|
||||||
<WorkerDescriptorProxy :id="row.requesterFk" />
|
<WorkerDescriptorProxy :id="row.requesterFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -292,7 +292,7 @@ onBeforeMount(() => {
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-concept="{ row }">
|
<template #body-cell-concept="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat dense color="primary"> {{ row.itemDescription }}</QBtn>
|
<QBtn flat dense class="link"> {{ row.itemDescription }}</QBtn>
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -174,6 +174,16 @@ const decrement = (paramsObj, key) => {
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="params.myTeam"
|
||||||
|
:label="t('params.myTeam')"
|
||||||
|
@update:model-value="searchFn()"
|
||||||
|
toggle-indeterminate
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QCard bordered>
|
<QCard bordered>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
|
@ -274,11 +284,11 @@ en:
|
||||||
to: To
|
to: To
|
||||||
mine: For me
|
mine: For me
|
||||||
state: State
|
state: State
|
||||||
|
myTeam: My team
|
||||||
dateFiltersTooltip: Cannot choose a range of dates and days onward at the same time
|
dateFiltersTooltip: Cannot choose a range of dates and days onward at the same time
|
||||||
denied: Denied
|
denied: Denied
|
||||||
accepted: Accepted
|
accepted: Accepted
|
||||||
pending: Pending
|
pending: Pending
|
||||||
|
|
||||||
es:
|
es:
|
||||||
params:
|
params:
|
||||||
search: Búsqueda general
|
search: Búsqueda general
|
||||||
|
@ -291,6 +301,7 @@ es:
|
||||||
to: Hasta
|
to: Hasta
|
||||||
mine: Para mi
|
mine: Para mi
|
||||||
state: Estado
|
state: Estado
|
||||||
|
myTeam: Mi equipo
|
||||||
dateFiltersTooltip: No se puede seleccionar un rango de fechas y días en adelante a la vez
|
dateFiltersTooltip: No se puede seleccionar un rango de fechas y días en adelante a la vez
|
||||||
denied: Denegada
|
denied: Denegada
|
||||||
accepted: Aceptada
|
accepted: Aceptada
|
||||||
|
|
|
@ -12,6 +12,7 @@ import VnInputTime from 'components/common/VnInputTime.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import { toTimeFormat } from 'filters/date.js';
|
import { toTimeFormat } from 'filters/date.js';
|
||||||
|
|
||||||
|
@ -28,14 +29,17 @@ const { validate } = useValidator();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const agencyFetchRef = ref(null);
|
const canEditZone = useAcl().hasAny([
|
||||||
const zonesFetchRef = ref(null);
|
{ model: 'Ticket', props: 'editZone', accessType: 'WRITE' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const agencyFetchRef = ref();
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const companiesOptions = ref([]);
|
const companiesOptions = ref([]);
|
||||||
const agenciesOptions = ref([]);
|
const agenciesOptions = ref([]);
|
||||||
const zonesOptions = ref([]);
|
const zonesOptions = ref([]);
|
||||||
const addresses = ref([]);
|
const addresses = ref([]);
|
||||||
|
const zoneSelectRef = ref();
|
||||||
const formData = ref($props.formData);
|
const formData = ref($props.formData);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -44,6 +48,8 @@ watch(
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
onMounted(() => onFormModelInit());
|
||||||
|
|
||||||
const agencyByWarehouseFilter = computed(() => ({
|
const agencyByWarehouseFilter = computed(() => ({
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
order: 'name ASC',
|
order: 'name ASC',
|
||||||
|
@ -52,18 +58,16 @@ const agencyByWarehouseFilter = computed(() => ({
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function zoneWhere() {
|
const zoneWhere = computed(() => {
|
||||||
if (formData?.value?.agencyModeFk) {
|
return formData.value?.agencyModeFk
|
||||||
return formData.value?.agencyModeFk
|
? {
|
||||||
? {
|
shipped: formData.value?.shipped,
|
||||||
shipped: formData.value?.shipped,
|
addressFk: formData.value?.addressFk,
|
||||||
addressFk: formData.value?.addressFk,
|
agencyModeFk: formData.value?.agencyModeFk,
|
||||||
agencyModeFk: formData.value?.agencyModeFk,
|
warehouseFk: formData.value?.warehouseFk,
|
||||||
warehouseFk: formData.value?.warehouseFk,
|
}
|
||||||
}
|
: {};
|
||||||
: {};
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getLanded = async (params) => {
|
const getLanded = async (params) => {
|
||||||
try {
|
try {
|
||||||
|
@ -270,7 +274,17 @@ const redirectToCustomerAddress = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => onFormModelInit());
|
async function getZone(options) {
|
||||||
|
if (!zoneId.value) return;
|
||||||
|
|
||||||
|
const zone = options.find((z) => z.id == zoneId.value);
|
||||||
|
if (zone) return;
|
||||||
|
|
||||||
|
const { data } = await axios.get('Zones/' + zoneId.value, {
|
||||||
|
params: { filter: JSON.stringify({ fields: ['id', 'name'] }) },
|
||||||
|
});
|
||||||
|
zoneSelectRef.value.opts.push(data);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -416,6 +430,7 @@ onMounted(() => onFormModelInit());
|
||||||
:rules="validate('basicData.agency')"
|
:rules="validate('basicData.agency')"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
ref="zoneSelectRef"
|
||||||
:label="t('basicData.zone')"
|
:label="t('basicData.zone')"
|
||||||
v-model="zoneId"
|
v-model="zoneId"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -424,11 +439,10 @@ onMounted(() => onFormModelInit());
|
||||||
:fields="['id', 'name']"
|
:fields="['id', 'name']"
|
||||||
sort-by="id"
|
sort-by="id"
|
||||||
:where="zoneWhere"
|
:where="zoneWhere"
|
||||||
hide-selected
|
|
||||||
map-options
|
|
||||||
:required="true"
|
|
||||||
@focus="zonesFetchRef.fetch()"
|
|
||||||
:rules="validate('basicData.zone')"
|
:rules="validate('basicData.zone')"
|
||||||
|
:required="true"
|
||||||
|
:disable="!canEditZone"
|
||||||
|
@update:options="getZone"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
|
|
@ -95,6 +95,7 @@ const columns = computed(() => [
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
|
columnClass: 'expand',
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(row.salesPerson),
|
format: (row, dashIfEmpty) => dashIfEmpty(row.salesPerson),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -153,11 +154,6 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'refFk',
|
|
||||||
label: t('ticketList.ref'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'zoneFk',
|
name: 'zoneFk',
|
||||||
|
@ -191,6 +187,12 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
format: (row) => toCurrency(row.totalWithVat),
|
format: (row) => toCurrency(row.totalWithVat),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'packing',
|
||||||
|
label: t('ticketSale.packaging'),
|
||||||
|
format: (row, dashIfEmpty) => dashIfEmpty(row.packing),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
name: 'tableActions',
|
name: 'tableActions',
|
||||||
|
@ -548,7 +550,7 @@ function setReference(data) {
|
||||||
</template>
|
</template>
|
||||||
<template #column-salesPersonFk="{ row }">
|
<template #column-salesPersonFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row.salesPerson }}
|
{{ dashIfEmpty(row.salesPerson) }}
|
||||||
<CustomerDescriptorProxy :id="row.salesPersonFk" />
|
<CustomerDescriptorProxy :id="row.salesPersonFk" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -577,16 +579,16 @@ function setReference(data) {
|
||||||
{{ row.state }}
|
{{ row.state }}
|
||||||
</QChip>
|
</QChip>
|
||||||
</span>
|
</span>
|
||||||
|
<span v-else-if="row.state === 'Entregado'">
|
||||||
|
<span class="link" @click.stop>
|
||||||
|
{{ row.refFk }}
|
||||||
|
<InvoiceOutDescriptorProxy :id="row.invoiceOutId" />
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ row.state }}
|
{{ row.state }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-refFk="{ row }">
|
|
||||||
<span class="link" @click.stop>
|
|
||||||
{{ dashIfEmpty(row.refFk) }}
|
|
||||||
<InvoiceOutDescriptorProxy :id="row.invoiceOutId" />
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
<template #column-zoneFk="{ row }">
|
<template #column-zoneFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ dashIfEmpty(row.zoneName) }}
|
{{ dashIfEmpty(row.zoneName) }}
|
||||||
|
|
|
@ -0,0 +1,204 @@
|
||||||
|
<script setup>
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const crudModelRef = ref();
|
||||||
|
const warehousesData = ref([]);
|
||||||
|
const itemPackingTypesData = ref([]);
|
||||||
|
const sectorsData = ref([]);
|
||||||
|
const trainsData = ref([]);
|
||||||
|
const machinesData = ref([]);
|
||||||
|
const route = useRoute();
|
||||||
|
const routeId = computed(() => route.params.id);
|
||||||
|
|
||||||
|
const initialData = computed(() => {
|
||||||
|
return {
|
||||||
|
workerFk: routeId.value,
|
||||||
|
numberOfWagons: 2,
|
||||||
|
trainFk: 1,
|
||||||
|
itemPackingTypeFk: 'H',
|
||||||
|
warehouseFk: 60,
|
||||||
|
sectorFk: null,
|
||||||
|
labelerFk: null,
|
||||||
|
linesLimit: 20,
|
||||||
|
volumenLimit: 0.5,
|
||||||
|
sizeLimit: null,
|
||||||
|
isOnReservationMode: 0,
|
||||||
|
machineFk: null,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
async function insert() {
|
||||||
|
await axios.post('Operators', initialData.value);
|
||||||
|
crudModelRef.value.reload();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<QPage class="column items-center q-pa-md centerCard">
|
||||||
|
<FetchData url="Trains" @on-fetch="(data) => (trainsData = data)" auto-load />
|
||||||
|
<FetchData
|
||||||
|
url="ItemPackingTypes"
|
||||||
|
@on-fetch="(data) => (itemPackingTypesData = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="Warehouses"
|
||||||
|
@on-fetch="(data) => (warehousesData = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FetchData url="Printers" @on-fetch="(data) => (PrintersData = data)" auto-load />
|
||||||
|
<FetchData url="Sectors" @on-fetch="(data) => (sectorsData = data)" auto-load />
|
||||||
|
<FetchData url="Machines" @on-fetch="(data) => (machinesData = data)" auto-load />
|
||||||
|
<CrudModel
|
||||||
|
data-key="workerOperator"
|
||||||
|
url="Operators"
|
||||||
|
primary-key="workerFk"
|
||||||
|
:filter="{ where: { workerFk: route.params.id } }"
|
||||||
|
:data-required="{ workerFk: route.params.id }"
|
||||||
|
ref="crudModelRef"
|
||||||
|
search-url="operator"
|
||||||
|
auto-load
|
||||||
|
>
|
||||||
|
<template #body="{ rows }">
|
||||||
|
<div v-if="rows.length">
|
||||||
|
<QCard
|
||||||
|
flat
|
||||||
|
bordered
|
||||||
|
:key="row.$index"
|
||||||
|
v-for="row of rows"
|
||||||
|
class="card q-px-md q-mb-sm container"
|
||||||
|
>
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
:label="t('worker.operator.numberOfWagons')"
|
||||||
|
v-model="row.numberOfWagons"
|
||||||
|
/>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('worker.operator.train')"
|
||||||
|
:options="trainsData"
|
||||||
|
hide-selected
|
||||||
|
v-model="row.trainFk"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('worker.operator.itemPackingType')"
|
||||||
|
:options="itemPackingTypesData"
|
||||||
|
hide-selected
|
||||||
|
option-label="code"
|
||||||
|
option-value="code"
|
||||||
|
v-model="row.itemPackingTypeFk"
|
||||||
|
/>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('worker.operator.warehouse')"
|
||||||
|
:options="warehousesData"
|
||||||
|
hide-selected
|
||||||
|
v-model="row.warehouseFk"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('worker.operator.sector')"
|
||||||
|
:options="sectorsData"
|
||||||
|
hide-selected
|
||||||
|
option-label="description"
|
||||||
|
v-model="row.sectorFk"
|
||||||
|
/>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('worker.operator.labeler')"
|
||||||
|
:options="PrintersData"
|
||||||
|
hide-selected
|
||||||
|
option-label="name"
|
||||||
|
v-model="row.labelerFk"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel
|
||||||
|
>ID: {{ scope.opt?.id }}</QItemLabel
|
||||||
|
>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ scope.opt?.id }},
|
||||||
|
{{ scope.opt?.name }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
:label="t('worker.operator.linesLimit')"
|
||||||
|
v-model="row.linesLimit"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
<VnInput
|
||||||
|
:label="t('worker.operator.volumeLimit')"
|
||||||
|
v-model="row.volumeLimit"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
:label="t('worker.operator.sizeLimit')"
|
||||||
|
v-model="row.sizeLimit"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
<VnInput
|
||||||
|
:label="t('worker.operator.isOnReservationMode')"
|
||||||
|
v-model="row.isOnReservationMode"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('worker.operator.machine')"
|
||||||
|
:options="machinesData"
|
||||||
|
hide-selected
|
||||||
|
option-label="plate"
|
||||||
|
v-model="row.machineFk"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</QCard>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</CrudModel>
|
||||||
|
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||||
|
<QBtn
|
||||||
|
fab
|
||||||
|
color="primary"
|
||||||
|
icon="add"
|
||||||
|
@click="insert()"
|
||||||
|
v-if="!crudModelRef?.formData?.length"
|
||||||
|
/>
|
||||||
|
</QPageSticky>
|
||||||
|
</QPage>
|
||||||
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.btn-delete {
|
||||||
|
max-width: 4%;
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Model: Modelo
|
||||||
|
Serial number: Número de serie
|
||||||
|
Current SIM: SIM actual
|
||||||
|
Add new device: Añadir nuevo dispositivo
|
||||||
|
PDA deallocated: PDA desasignada
|
||||||
|
Remove PDA: Eliminar PDA
|
||||||
|
Do you want to remove this PDA?: ¿Desea eliminar este PDA?
|
||||||
|
You can only have one PDA: Solo puedes tener un PDA si no eres autonomo
|
||||||
|
This PDA is already assigned to another user: Este PDA ya está asignado a otro usuario
|
||||||
|
</i18n>
|
|
@ -27,6 +27,7 @@ export default {
|
||||||
'WorkerBalance',
|
'WorkerBalance',
|
||||||
'WorkerFormation',
|
'WorkerFormation',
|
||||||
'WorkerMedical',
|
'WorkerMedical',
|
||||||
|
'WorkerOperator',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
@ -208,6 +209,15 @@ export default {
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Worker/Card/WorkerMedical.vue'),
|
component: () => import('src/pages/Worker/Card/WorkerMedical.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'WorkerOperator',
|
||||||
|
path: 'operator',
|
||||||
|
meta: {
|
||||||
|
title: 'operator',
|
||||||
|
icon: 'person',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Worker/Card/WorkerOperator.vue'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
|
export const useStateQueryStore = defineStore('stateQueryStore', () => {
|
||||||
|
const queries = ref(new Set());
|
||||||
|
|
||||||
|
function add(query) {
|
||||||
|
queries.value.add(query);
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLoading() {
|
||||||
|
return computed(() => queries.value.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove(query) {
|
||||||
|
queries.value.delete(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
queries.value = new Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
add,
|
||||||
|
isLoading,
|
||||||
|
remove,
|
||||||
|
queries,
|
||||||
|
reset,
|
||||||
|
};
|
||||||
|
});
|
|
@ -7,41 +7,46 @@ vi.mock('src/composables/useSession', () => ({
|
||||||
getToken: () => 'DEFAULT_TOKEN',
|
getToken: () => 'DEFAULT_TOKEN',
|
||||||
isLoggedIn: () => vi.fn(),
|
isLoggedIn: () => vi.fn(),
|
||||||
destroy: () => vi.fn(),
|
destroy: () => vi.fn(),
|
||||||
})
|
}),
|
||||||
|
}));
|
||||||
|
|
||||||
|
vi.mock('src/stores/useStateQueryStore', () => ({
|
||||||
|
useStateQueryStore: () => ({
|
||||||
|
add: () => vi.fn(),
|
||||||
|
remove: () => vi.fn(),
|
||||||
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('Axios boot', () => {
|
describe('Axios boot', () => {
|
||||||
|
|
||||||
describe('onRequest()', async () => {
|
describe('onRequest()', async () => {
|
||||||
it('should set the "Authorization" property on the headers', async () => {
|
it('should set the "Authorization" property on the headers', async () => {
|
||||||
const config = { headers: {} };
|
const config = { headers: {} };
|
||||||
|
|
||||||
const resultConfig = onRequest(config);
|
const resultConfig = onRequest(config);
|
||||||
|
|
||||||
expect(resultConfig).toEqual(expect.objectContaining({
|
expect(resultConfig).toEqual(
|
||||||
headers: {
|
expect.objectContaining({
|
||||||
Authorization: 'DEFAULT_TOKEN'
|
headers: {
|
||||||
}
|
Authorization: 'DEFAULT_TOKEN',
|
||||||
}));
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
describe('onResponseError()', async () => {
|
describe('onResponseError()', async () => {
|
||||||
it('should call to the Notify plugin with a message error for an status code "500"', async () => {
|
it('should call to the Notify plugin with a message error for an status code "500"', async () => {
|
||||||
Notify.create = vi.fn()
|
Notify.create = vi.fn();
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
response: {
|
response: {
|
||||||
status: 500
|
status: 500,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = onResponseError(error);
|
const result = onResponseError(error);
|
||||||
|
|
||||||
|
expect(result).rejects.toEqual(expect.objectContaining(error));
|
||||||
expect(result).rejects.toEqual(
|
|
||||||
expect.objectContaining(error)
|
|
||||||
);
|
|
||||||
expect(Notify.create).toHaveBeenCalledWith(
|
expect(Notify.create).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
message: 'An internal server error has ocurred',
|
message: 'An internal server error has ocurred',
|
||||||
|
@ -51,25 +56,22 @@ describe('Axios boot', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call to the Notify plugin with a message from the response property', async () => {
|
it('should call to the Notify plugin with a message from the response property', async () => {
|
||||||
Notify.create = vi.fn()
|
Notify.create = vi.fn();
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
response: {
|
response: {
|
||||||
status: 401,
|
status: 401,
|
||||||
data: {
|
data: {
|
||||||
error: {
|
error: {
|
||||||
message: 'Invalid user or password'
|
message: 'Invalid user or password',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = onResponseError(error);
|
const result = onResponseError(error);
|
||||||
|
|
||||||
|
expect(result).rejects.toEqual(expect.objectContaining(error));
|
||||||
expect(result).rejects.toEqual(
|
|
||||||
expect.objectContaining(error)
|
|
||||||
);
|
|
||||||
expect(Notify.create).toHaveBeenCalledWith(
|
expect(Notify.create).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
message: 'Invalid user or password',
|
message: 'Invalid user or password',
|
||||||
|
@ -77,5 +79,5 @@ describe('Axios boot', () => {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
import { describe, expect, it, beforeEach, beforeAll } from 'vitest';
|
||||||
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
|
||||||
|
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||||
|
|
||||||
|
describe('useStateQueryStore', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
createWrapper({}, {});
|
||||||
|
});
|
||||||
|
|
||||||
|
const stateQueryStore = useStateQueryStore();
|
||||||
|
const { add, isLoading, remove, reset } = useStateQueryStore();
|
||||||
|
const firstQuery = { url: 'myQuery' };
|
||||||
|
|
||||||
|
function getQueries() {
|
||||||
|
return stateQueryStore.queries;
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
reset();
|
||||||
|
expect(getQueries().size).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add two queries', async () => {
|
||||||
|
expect(getQueries().size).toBeFalsy();
|
||||||
|
add(firstQuery);
|
||||||
|
|
||||||
|
expect(getQueries().size).toBeTruthy();
|
||||||
|
expect(getQueries().has(firstQuery)).toBeTruthy();
|
||||||
|
|
||||||
|
add();
|
||||||
|
expect(getQueries().size).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add and remove loading state', async () => {
|
||||||
|
expect(isLoading().value).toBeFalsy();
|
||||||
|
add(firstQuery);
|
||||||
|
expect(isLoading().value).toBeTruthy();
|
||||||
|
remove(firstQuery);
|
||||||
|
expect(isLoading().value).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add and remove query', async () => {
|
||||||
|
const secondQuery = { ...firstQuery };
|
||||||
|
const thirdQuery = { ...firstQuery };
|
||||||
|
|
||||||
|
add(firstQuery);
|
||||||
|
add(secondQuery);
|
||||||
|
|
||||||
|
const beforeCount = getQueries().size;
|
||||||
|
add(thirdQuery);
|
||||||
|
expect(getQueries().has(thirdQuery)).toBeTruthy();
|
||||||
|
|
||||||
|
remove(thirdQuery);
|
||||||
|
expect(getQueries().has(thirdQuery)).toBeFalsy();
|
||||||
|
expect(getQueries().size).toBe(beforeCount);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue