Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8036-arrayData_exprBuilder_after
This commit is contained in:
commit
e739f42ddf
|
@ -39,37 +39,7 @@ const onResponse = (response) => {
|
||||||
const onResponseError = (error) => {
|
const onResponseError = (error) => {
|
||||||
stateQuery.remove(error.config);
|
stateQuery.remove(error.config);
|
||||||
|
|
||||||
let message = '';
|
if (session.isLoggedIn() && error.response?.status === 401) {
|
||||||
|
|
||||||
const response = error.response;
|
|
||||||
const responseData = response && response.data;
|
|
||||||
const responseError = responseData && response.data.error;
|
|
||||||
if (responseError) {
|
|
||||||
message = responseError.message;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (response?.status) {
|
|
||||||
case 422:
|
|
||||||
if (error.name == 'ValidationError')
|
|
||||||
message +=
|
|
||||||
' "' +
|
|
||||||
responseError.details.context +
|
|
||||||
'.' +
|
|
||||||
Object.keys(responseError.details.codes).join(',') +
|
|
||||||
'"';
|
|
||||||
break;
|
|
||||||
case 500:
|
|
||||||
message = 'errors.statusInternalServerError';
|
|
||||||
break;
|
|
||||||
case 502:
|
|
||||||
message = 'errors.statusBadGateway';
|
|
||||||
break;
|
|
||||||
case 504:
|
|
||||||
message = 'errors.statusGatewayTimeout';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (session.isLoggedIn() && response?.status === 401) {
|
|
||||||
session.destroy(false);
|
session.destroy(false);
|
||||||
const hash = window.location.hash;
|
const hash = window.location.hash;
|
||||||
const url = hash.slice(1);
|
const url = hash.slice(1);
|
||||||
|
@ -78,8 +48,6 @@ const onResponseError = (error) => {
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
notify(message, 'negative');
|
|
||||||
|
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,51 @@ import qFormMixin from './qformMixin';
|
||||||
import mainShortcutMixin from './mainShortcutMixin';
|
import mainShortcutMixin from './mainShortcutMixin';
|
||||||
import keyShortcut from './keyShortcut';
|
import keyShortcut from './keyShortcut';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import { CanceledError } from 'axios';
|
||||||
|
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
app.mixin(qFormMixin);
|
app.mixin(qFormMixin);
|
||||||
app.mixin(mainShortcutMixin);
|
app.mixin(mainShortcutMixin);
|
||||||
app.directive('shortcut', keyShortcut);
|
app.directive('shortcut', keyShortcut);
|
||||||
app.config.errorHandler = function (err) {
|
app.config.errorHandler = (error) => {
|
||||||
console.error(err);
|
let message;
|
||||||
notify('globals.error', 'negative', 'error');
|
const response = error.response;
|
||||||
|
const responseData = response?.data;
|
||||||
|
const responseError = responseData && response.data.error;
|
||||||
|
if (responseError) {
|
||||||
|
message = responseError.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (response?.status) {
|
||||||
|
case 422:
|
||||||
|
if (error.name == 'ValidationError')
|
||||||
|
message +=
|
||||||
|
' "' +
|
||||||
|
responseError.details.context +
|
||||||
|
'.' +
|
||||||
|
Object.keys(responseError.details.codes).join(',') +
|
||||||
|
'"';
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
message = 'errors.statusInternalServerError';
|
||||||
|
break;
|
||||||
|
case 502:
|
||||||
|
message = 'errors.statusBadGateway';
|
||||||
|
break;
|
||||||
|
case 504:
|
||||||
|
message = 'errors.statusGatewayTimeout';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error(error);
|
||||||
|
if (error instanceof CanceledError) {
|
||||||
|
const env = process.env.NODE_ENV;
|
||||||
|
if (env && env !== 'development') return;
|
||||||
|
message = 'Duplicate request';
|
||||||
|
}
|
||||||
|
|
||||||
|
notify(message ?? 'globals.error', 'negative', 'error');
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -217,9 +217,6 @@ async function save() {
|
||||||
updateAndEmit('onDataSaved', formData.value, response?.data);
|
updateAndEmit('onDataSaved', formData.value, response?.data);
|
||||||
if ($props.reload) await arrayData.fetch({});
|
if ($props.reload) await arrayData.fetch({});
|
||||||
hasChanges.value = false;
|
hasChanges.value = false;
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
notify('errors.writeRequest', 'negative');
|
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ defineExpose({
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@click="emit('onDataCanceled')"
|
@click="emit('onDataCanceled')"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
|
data-cy="FormModelPopup_cancel"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('globals.save')"
|
:label="t('globals.save')"
|
||||||
|
@ -70,6 +71,7 @@ defineExpose({
|
||||||
class="q-ml-sm"
|
class="q-ml-sm"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
|
data-cy="FormModelPopup_save"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -457,7 +457,11 @@ function handleScroll() {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #header-cell="{ col }">
|
<template #header-cell="{ col }">
|
||||||
<QTh v-if="col.visible ?? true">
|
<QTh
|
||||||
|
v-if="col.visible ?? true"
|
||||||
|
:style="col.headerStyle"
|
||||||
|
:class="col.headerClass"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="column self-start q-ml-xs ellipsis"
|
class="column self-start q-ml-xs ellipsis"
|
||||||
:class="`text-${col?.align ?? 'left'}`"
|
:class="`text-${col?.align ?? 'left'}`"
|
||||||
|
|
|
@ -9,10 +9,6 @@ const $props = defineProps({
|
||||||
type: Number, //Progress value (1.0 > x > 0.0)
|
type: Number, //Progress value (1.0 > x > 0.0)
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
showDialog: {
|
|
||||||
type: Boolean,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
cancelled: {
|
cancelled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
|
@ -24,30 +20,22 @@ const emit = defineEmits(['cancel', 'close']);
|
||||||
|
|
||||||
const dialogRef = ref(null);
|
const dialogRef = ref(null);
|
||||||
|
|
||||||
const _showDialog = computed({
|
const showDialog = defineModel('showDialog', {
|
||||||
get: () => $props.showDialog,
|
type: Boolean,
|
||||||
set: (value) => {
|
default: false,
|
||||||
if (value) dialogRef.value.show();
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const _progress = computed(() => $props.progress);
|
const _progress = computed(() => $props.progress);
|
||||||
|
|
||||||
const progressLabel = computed(() => `${Math.round($props.progress * 100)}%`);
|
const progressLabel = computed(() => `${Math.round($props.progress * 100)}%`);
|
||||||
|
|
||||||
const cancel = () => {
|
|
||||||
dialogRef.value.hide();
|
|
||||||
emit('cancel');
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QDialog ref="dialogRef" v-model="_showDialog" @hide="onDialogHide">
|
<QDialog ref="dialogRef" v-model="showDialog" @hide="emit('close')">
|
||||||
<QCard class="full-width dialog">
|
<QCard class="full-width dialog">
|
||||||
<QCardSection class="row">
|
<QCardSection class="row">
|
||||||
<span class="text-h6">{{ t('Progress') }}</span>
|
<span class="text-h6">{{ t('Progress') }}</span>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<QBtn icon="close" flat round dense @click="emit('close')" />
|
<QBtn icon="close" flat round dense v-close-popup />
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
|
@ -80,7 +68,7 @@ const cancel = () => {
|
||||||
type="button"
|
type="button"
|
||||||
flat
|
flat
|
||||||
class="text-primary"
|
class="text-primary"
|
||||||
@click="cancel()"
|
v-close-popup
|
||||||
>
|
>
|
||||||
{{ t('globals.cancel') }}
|
{{ t('globals.cancel') }}
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -46,13 +46,9 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const deleteAlias = async (row) => {
|
const deleteAlias = async (row) => {
|
||||||
try {
|
|
||||||
await axios.delete(`${urlPath.value}/${row.id}`);
|
await axios.delete(`${urlPath.value}/${row.id}`);
|
||||||
notify(t('User removed'), 'positive');
|
notify(t('User removed'), 'positive');
|
||||||
fetchAliases();
|
fetchAliases();
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
|
@ -61,23 +61,15 @@ const fetchAccountExistence = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailAlias = async (row) => {
|
const deleteMailAlias = async (row) => {
|
||||||
try {
|
|
||||||
await axios.delete(`${urlPath}/${row.id}`);
|
await axios.delete(`${urlPath}/${row.id}`);
|
||||||
fetchMailAliases();
|
fetchMailAliases();
|
||||||
notify(t('Unsubscribed from alias!'), 'positive');
|
notify(t('Unsubscribed from alias!'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createMailAlias = async (mailAliasFormData) => {
|
const createMailAlias = async (mailAliasFormData) => {
|
||||||
try {
|
|
||||||
await axios.post(urlPath, mailAliasFormData);
|
await axios.post(urlPath, mailAliasFormData);
|
||||||
notify(t('Subscribed to alias!'), 'positive');
|
notify(t('Subscribed to alias!'), 'positive');
|
||||||
fetchMailAliases();
|
fetchMailAliases();
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchMailAliases = async () => {
|
const fetchMailAliases = async () => {
|
||||||
|
|
|
@ -46,29 +46,15 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const deleteSubRole = async (row) => {
|
const deleteSubRole = async (row) => {
|
||||||
try {
|
|
||||||
await axios.delete(`${urlPath.value}/${row.id}`);
|
await axios.delete(`${urlPath.value}/${row.id}`);
|
||||||
fetchSubRoles();
|
fetchSubRoles();
|
||||||
notify(
|
notify(t('Role removed. Changes will take a while to fully propagate.'), 'positive');
|
||||||
t('Role removed. Changes will take a while to fully propagate.'),
|
|
||||||
'positive'
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createSubRole = async (subRoleFormData) => {
|
const createSubRole = async (subRoleFormData) => {
|
||||||
try {
|
|
||||||
await axios.post(urlPath.value, subRoleFormData);
|
await axios.post(urlPath.value, subRoleFormData);
|
||||||
notify(
|
notify(t('Role added! Changes will take a while to fully propagate.'), 'positive');
|
||||||
t('Role added! Changes will take a while to fully propagate.'),
|
|
||||||
'positive'
|
|
||||||
);
|
|
||||||
fetchSubRoles();
|
fetchSubRoles();
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
|
@ -112,32 +112,20 @@ const getShipped = async (params) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChangeZone = async (zoneId) => {
|
const onChangeZone = async (zoneId) => {
|
||||||
try {
|
|
||||||
formData.value.agencyModeFk = null;
|
formData.value.agencyModeFk = null;
|
||||||
const { data } = await axios.get(`Zones/${zoneId}`);
|
const { data } = await axios.get(`Zones/${zoneId}`);
|
||||||
formData.value.agencyModeFk = data.agencyModeFk;
|
formData.value.agencyModeFk = data.agencyModeFk;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChangeAddress = async (addressId) => {
|
const onChangeAddress = async (addressId) => {
|
||||||
try {
|
|
||||||
formData.value.nickname = null;
|
formData.value.nickname = null;
|
||||||
const { data } = await axios.get(`Addresses/${addressId}`);
|
const { data } = await axios.get(`Addresses/${addressId}`);
|
||||||
formData.value.nickname = data.nickname;
|
formData.value.nickname = data.nickname;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getClientDefaultAddress = async (clientId) => {
|
const getClientDefaultAddress = async (clientId) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Clients/${clientId}`);
|
const { data } = await axios.get(`Clients/${clientId}`);
|
||||||
if (data) addressId.value = data.defaultAddressFk;
|
if (data) addressId.value = data.defaultAddressFk;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clientAddressesList = async (value) => {
|
const clientAddressesList = async (value) => {
|
||||||
|
|
|
@ -70,7 +70,6 @@ const isFormInvalid = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPriceDifference = async () => {
|
const getPriceDifference = async () => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
landed: formData.value.landed,
|
landed: formData.value.landed,
|
||||||
addressId: formData.value.addressFk,
|
addressId: formData.value.addressFk,
|
||||||
|
@ -84,15 +83,10 @@ const getPriceDifference = async () => {
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
formData.value.sale = data;
|
formData.value.sale = data;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
try {
|
if (!formData.value.option) return notify(t('basicData.chooseAnOption'), 'negative');
|
||||||
if (!formData.value.option)
|
|
||||||
return notify(t('basicData.chooseAnOption'), 'negative');
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
clientFk: formData.value.clientFk,
|
clientFk: formData.value.clientFk,
|
||||||
|
@ -121,9 +115,6 @@ const submit = async () => {
|
||||||
const ticketToMove = data.id;
|
const ticketToMove = data.id;
|
||||||
notify(t('basicData.unroutedTicket'), 'positive');
|
notify(t('basicData.unroutedTicket'), 'positive');
|
||||||
router.push({ name: 'TicketSummary', params: { id: ticketToMove } });
|
router.push({ name: 'TicketSummary', params: { id: ticketToMove } });
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const submitWithNegatives = async () => {
|
const submitWithNegatives = async () => {
|
||||||
|
|
|
@ -34,10 +34,7 @@ const newTicketFormData = reactive({});
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
|
||||||
const createTicket = async () => {
|
const createTicket = async () => {
|
||||||
try {
|
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
|
||||||
const expeditionIds = $props.selectedExpeditions.map(
|
|
||||||
(expedition) => expedition.id
|
|
||||||
);
|
|
||||||
const params = {
|
const params = {
|
||||||
clientId: $props.ticket.clientFk,
|
clientId: $props.ticket.clientFk,
|
||||||
landed: newTicketFormData.landed,
|
landed: newTicketFormData.landed,
|
||||||
|
@ -51,9 +48,6 @@ const createTicket = async () => {
|
||||||
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -150,31 +150,19 @@ const getTotal = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const getComponentsSum = async () => {
|
const getComponentsSum = async () => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Tickets/${route.params.id}/getComponentsSum`);
|
const { data } = await axios.get(`Tickets/${route.params.id}/getComponentsSum`);
|
||||||
componentsList.value = data;
|
componentsList.value = data;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTheoricalCost = async () => {
|
const getTheoricalCost = async () => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Tickets/${route.params.id}/freightCost`);
|
const { data } = await axios.get(`Tickets/${route.params.id}/freightCost`);
|
||||||
theoricalCost.value = data;
|
theoricalCost.value = data;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTicketVolume = async () => {
|
const getTicketVolume = async () => {
|
||||||
try {
|
|
||||||
if (!ticketData.value) return;
|
if (!ticketData.value) return;
|
||||||
const { data } = await axios.get(`Tickets/${ticketData.value.id}/getVolume`);
|
const { data } = await axios.get(`Tickets/${ticketData.value.id}/getVolume`);
|
||||||
ticketVolume.value = data[0].volume;
|
ticketVolume.value = data[0].volume;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
@ -163,16 +163,12 @@ const showNewTicketDialog = (withRoute = false) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteExpedition = async () => {
|
const deleteExpedition = async () => {
|
||||||
try {
|
|
||||||
const expeditionIds = selectedRows.value.map((expedition) => expedition.id);
|
const expeditionIds = selectedRows.value.map((expedition) => expedition.id);
|
||||||
const params = { expeditionIds };
|
const params = { expeditionIds };
|
||||||
await axios.post('Expeditions/deleteExpeditions', params);
|
await axios.post('Expeditions/deleteExpeditions', params);
|
||||||
vnTableRef.value.reload();
|
vnTableRef.value.reload();
|
||||||
selectedExpeditions.value = [];
|
selectedExpeditions.value = [];
|
||||||
notify(t('expedition.expeditionRemoved'), 'positive');
|
notify(t('expedition.expeditionRemoved'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showLog = async (expedition) => {
|
const showLog = async (expedition) => {
|
||||||
|
@ -181,7 +177,6 @@ const showLog = async (expedition) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getExpeditionState = async (expedition) => {
|
const getExpeditionState = async (expedition) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: { expeditionFk: expedition.id },
|
where: { expeditionFk: expedition.id },
|
||||||
order: ['created DESC'],
|
order: ['created DESC'],
|
||||||
|
@ -195,9 +190,6 @@ const getExpeditionState = async (expedition) => {
|
||||||
...state,
|
...state,
|
||||||
isScanned: !!state.isScanned,
|
isScanned: !!state.isScanned,
|
||||||
}));
|
}));
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
|
@ -165,14 +165,10 @@ const createRefund = async (withWarehouse) => {
|
||||||
negative: true,
|
negative: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
const { data } = await axios.post('Tickets/cloneAll', params);
|
const { data } = await axios.post('Tickets/cloneAll', params);
|
||||||
const [refundTicket] = data;
|
const [refundTicket] = data;
|
||||||
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
|
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
|
||||||
push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,6 @@ const shelvingsTableColumns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const getSaleTrackings = async (sale) => {
|
const getSaleTrackings = async (sale) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: { saleFk: sale.saleFk },
|
where: { saleFk: sale.saleFk },
|
||||||
order: ['itemFk DESC'],
|
order: ['itemFk DESC'],
|
||||||
|
@ -159,9 +158,6 @@ const getSaleTrackings = async (sale) => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
saleTrackings.value = data;
|
saleTrackings.value = data;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showLog = async (sale) => {
|
const showLog = async (sale) => {
|
||||||
|
@ -170,7 +166,6 @@ const showLog = async (sale) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getItemShelvingSales = async (sale) => {
|
const getItemShelvingSales = async (sale) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: { saleFk: sale.saleFk },
|
where: { saleFk: sale.saleFk },
|
||||||
};
|
};
|
||||||
|
@ -178,9 +173,6 @@ const getItemShelvingSales = async (sale) => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
itemShelvingsSales.value = data;
|
itemShelvingsSales.value = data;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showShelving = async (sale) => {
|
const showShelving = async (sale) => {
|
||||||
|
@ -189,20 +181,15 @@ const showShelving = async (sale) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateQuantity = async (sale) => {
|
const updateQuantity = async (sale) => {
|
||||||
try {
|
|
||||||
if (oldQuantity.value === sale.quantity) return;
|
if (oldQuantity.value === sale.quantity) return;
|
||||||
const params = {
|
const params = {
|
||||||
quantity: sale.quantity,
|
quantity: sale.quantity,
|
||||||
};
|
};
|
||||||
await axios.patch(`ItemShelvingSales/${sale.id}`, params);
|
await axios.patch(`ItemShelvingSales/${sale.id}`, params);
|
||||||
oldQuantity.value = null;
|
oldQuantity.value = null;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateParking = async (sale) => {
|
const updateParking = async (sale) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['id'],
|
fields: ['id'],
|
||||||
where: {
|
where: {
|
||||||
|
@ -216,9 +203,6 @@ const updateParking = async (sale) => {
|
||||||
parkingFk: sale.parkingFk,
|
parkingFk: sale.parkingFk,
|
||||||
};
|
};
|
||||||
await axios.patch(`Shelvings/${data.id}`, params);
|
await axios.patch(`Shelvings/${data.id}`, params);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateShelving = async (sale) => {
|
const updateShelving = async (sale) => {
|
||||||
|
@ -241,7 +225,6 @@ const updateShelving = async (sale) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const saleTrackingNew = async (sale, stateCode, isChecked) => {
|
const saleTrackingNew = async (sale, stateCode, isChecked) => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
saleFk: sale.saleFk,
|
saleFk: sale.saleFk,
|
||||||
isChecked,
|
isChecked,
|
||||||
|
@ -250,52 +233,33 @@ const saleTrackingNew = async (sale, stateCode, isChecked) => {
|
||||||
};
|
};
|
||||||
await axios.post(`SaleTrackings/new`, params);
|
await axios.post(`SaleTrackings/new`, params);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const saleTrackingDel = async ({ saleFk }, stateCode) => {
|
const saleTrackingDel = async ({ saleFk }, stateCode) => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
saleFk,
|
saleFk,
|
||||||
stateCodes: [stateCode],
|
stateCodes: [stateCode],
|
||||||
};
|
};
|
||||||
await axios.post(`SaleTrackings/delete`, params);
|
await axios.post(`SaleTrackings/delete`, params);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clickSaleGroupDetail = async (sale) => {
|
const clickSaleGroupDetail = async (sale) => {
|
||||||
try {
|
|
||||||
if (!sale.saleGroupDetailFk) return;
|
if (!sale.saleGroupDetailFk) return;
|
||||||
|
|
||||||
await axios.delete(`SaleGroupDetails/${sale.saleGroupDetailFk}`);
|
await axios.delete(`SaleGroupDetails/${sale.saleGroupDetailFk}`);
|
||||||
sale.hasSaleGroupDetail = false;
|
sale.hasSaleGroupDetail = false;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clickPreviousSelected = (sale) => {
|
const clickPreviousSelected = (sale) => {
|
||||||
try {
|
|
||||||
qCheckBoxController(sale, 'isPreviousSelected');
|
qCheckBoxController(sale, 'isPreviousSelected');
|
||||||
if (!sale.isPreviousSelected) sale.isPrevious = false;
|
if (!sale.isPreviousSelected) sale.isPrevious = false;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clickPrevious = (sale) => {
|
const clickPrevious = (sale) => {
|
||||||
try {
|
|
||||||
qCheckBoxController(sale, 'isPrevious');
|
qCheckBoxController(sale, 'isPrevious');
|
||||||
if (sale.isPrevious) sale.isPreviousSelected = true;
|
if (sale.isPrevious) sale.isPreviousSelected = true;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const qCheckBoxController = (sale, action) => {
|
const qCheckBoxController = (sale, action) => {
|
||||||
|
@ -306,7 +270,6 @@ const qCheckBoxController = (sale, action) => {
|
||||||
isPreviousSelected: 'PREVIOUS_PREPARATION',
|
isPreviousSelected: 'PREVIOUS_PREPARATION',
|
||||||
};
|
};
|
||||||
const stateCode = STATE_CODES[action];
|
const stateCode = STATE_CODES[action];
|
||||||
try {
|
|
||||||
if (!sale[action]) {
|
if (!sale[action]) {
|
||||||
saleTrackingNew(sale, stateCode, true);
|
saleTrackingNew(sale, stateCode, true);
|
||||||
sale[action] = true;
|
sale[action] = true;
|
||||||
|
@ -314,9 +277,6 @@ const qCheckBoxController = (sale, action) => {
|
||||||
saleTrackingDel(sale, stateCode);
|
saleTrackingDel(sale, stateCode);
|
||||||
sale[action] = false;
|
sale[action] = false;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ watch(
|
||||||
onMounted(async () => await getDefaultTaxClass());
|
onMounted(async () => await getDefaultTaxClass());
|
||||||
|
|
||||||
const createRefund = async () => {
|
const createRefund = async () => {
|
||||||
try {
|
|
||||||
if (!selected.value.length) return;
|
if (!selected.value.length) return;
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -63,13 +62,9 @@ const createRefund = async () => {
|
||||||
'positive'
|
'positive'
|
||||||
);
|
);
|
||||||
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDefaultTaxClass = async () => {
|
const getDefaultTaxClass = async () => {
|
||||||
try {
|
|
||||||
let filter = {
|
let filter = {
|
||||||
where: { code: 'G' },
|
where: { code: 'G' },
|
||||||
};
|
};
|
||||||
|
@ -77,9 +72,6 @@ const getDefaultTaxClass = async () => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
defaultTaxClass.value = data;
|
defaultTaxClass.value = data;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
|
|
@ -75,7 +75,6 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const applyVolumes = async (salesData) => {
|
const applyVolumes = async (salesData) => {
|
||||||
try {
|
|
||||||
if (!salesData.length) return;
|
if (!salesData.length) return;
|
||||||
|
|
||||||
sales.value = salesData;
|
sales.value = salesData;
|
||||||
|
@ -88,9 +87,6 @@ const applyVolumes = async (salesData) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
packingTypeVolume.value = data.packingTypeVolume;
|
packingTypeVolume.value = data.packingTypeVolume;
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => (stateStore.rightDrawer = true));
|
onMounted(() => (stateStore.rightDrawer = true));
|
||||||
|
|
|
@ -1,24 +1,20 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, computed, reactive } from 'vue';
|
import { ref, computed, reactive, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import VnProgress from 'src/components/common/VnProgressModal.vue';
|
import VnProgress from 'src/components/common/VnProgressModal.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import TicketAdvanceFilter from './TicketAdvanceFilter.vue';
|
import TicketAdvanceFilter from './TicketAdvanceFilter.vue';
|
||||||
|
|
||||||
import { dashIfEmpty, toCurrency } from 'src/filters';
|
import { dashIfEmpty, toCurrency } from 'src/filters';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { toDateFormat } from 'src/filters/date.js';
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -29,109 +25,58 @@ const user = state.getUser();
|
||||||
const itemPackingTypesOptions = ref([]);
|
const itemPackingTypesOptions = ref([]);
|
||||||
const zonesOptions = ref([]);
|
const zonesOptions = ref([]);
|
||||||
const selectedTickets = ref([]);
|
const selectedTickets = ref([]);
|
||||||
|
const vnTableRef = ref({});
|
||||||
const exprBuilder = (param, value) => {
|
const originElRef = ref(null);
|
||||||
switch (param) {
|
const destinationElRef = ref(null);
|
||||||
case 'id':
|
let today = Date.vnNew().toISOString();
|
||||||
case 'futureId':
|
const tomorrow = new Date(today);
|
||||||
case 'liters':
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||||
case 'futureLiters':
|
const userParams = reactive({
|
||||||
case 'lines':
|
dateFuture: tomorrow,
|
||||||
case 'futureLines':
|
dateToAdvance: today,
|
||||||
case 'totalWithVat':
|
warehouseFk: user.value.warehouseFk,
|
||||||
case 'futureTotalWithVat':
|
ipt: 'H',
|
||||||
case 'futureZone':
|
futureIpt: 'H',
|
||||||
case 'notMovableLines':
|
isFullMovable: true,
|
||||||
case 'futureZoneFk':
|
|
||||||
return { [param]: value };
|
|
||||||
case 'iptColFilter':
|
|
||||||
return { ipt: { like: `%${value}%` } };
|
|
||||||
case 'futureIptColFilter':
|
|
||||||
return { futureIpt: { like: `%${value}%` } };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const userParams = reactive({});
|
|
||||||
|
|
||||||
const arrayData = useArrayData('AdvanceTickets', {
|
|
||||||
url: 'Tickets/getTicketsAdvance',
|
|
||||||
userParams: userParams,
|
|
||||||
exprBuilder: exprBuilder,
|
|
||||||
limit: 0,
|
|
||||||
});
|
});
|
||||||
const { store } = arrayData;
|
|
||||||
const tickets = computed(() =>
|
|
||||||
(store.data || []).map((ticket, index) => ({ ...ticket, index: index }))
|
|
||||||
);
|
|
||||||
|
|
||||||
const applyColumnFilter = async (col) => {
|
|
||||||
try {
|
|
||||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
|
||||||
userParams[paramKey] = col.columnFilter.filterValue;
|
|
||||||
await arrayData.addFilter({ params: userParams });
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error applying column filter', err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getInputEvents = (col) => {
|
|
||||||
return col.columnFilter.type === 'select'
|
|
||||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
|
||||||
: {
|
|
||||||
'keyup.enter': () => applyColumnFilter(col),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const ticketColumns = computed(() => [
|
const ticketColumns = computed(() => [
|
||||||
{
|
{
|
||||||
label: '',
|
label: '',
|
||||||
name: 'icons',
|
name: 'icons',
|
||||||
align: 'left',
|
hidden: true,
|
||||||
columnFilter: null,
|
headerClass: 'horizontal-separator',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('advanceTickets.ticketId'),
|
|
||||||
name: 'ticketId',
|
|
||||||
align: 'center',
|
align: 'center',
|
||||||
sortable: true,
|
label: t('advanceTickets.ticketId'),
|
||||||
columnFilter: {
|
name: 'id',
|
||||||
component: VnInput,
|
headerClass: 'horizontal-separator',
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
filterParamKey: 'id',
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.ipt'),
|
label: t('advanceTickets.ipt'),
|
||||||
name: 'ipt',
|
name: 'ipt',
|
||||||
field: 'ipt',
|
|
||||||
align: 'left',
|
|
||||||
sortable: true,
|
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: VnSelect,
|
component: 'select',
|
||||||
filterParamKey: 'iptColFilter',
|
|
||||||
type: 'select',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
attrs: {
|
||||||
options: itemPackingTypesOptions.value,
|
url: 'itemPackingTypes',
|
||||||
'option-value': 'code',
|
fields: ['code', 'description'],
|
||||||
'option-label': 'description',
|
where: { isActive: true },
|
||||||
dense: true,
|
optionValue: 'code',
|
||||||
|
optionLabel: 'description',
|
||||||
|
inWhere: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
format: (val) => dashIfEmpty(val),
|
format: (row, dashIfEmpty) => dashIfEmpty(row.ipt),
|
||||||
|
headerClass: 'horizontal-separator',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.state'),
|
label: t('advanceTickets.state'),
|
||||||
name: 'state',
|
name: 'state',
|
||||||
align: 'left',
|
headerClass: 'horizontal-separator',
|
||||||
sortable: true,
|
hidden: true,
|
||||||
columnFilter: null,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('advanceTickets.preparation'),
|
label: t('advanceTickets.preparation'),
|
||||||
|
@ -139,171 +84,105 @@ const ticketColumns = computed(() => [
|
||||||
field: 'preparation',
|
field: 'preparation',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
columnFilter: null,
|
headerClass: 'horizontal-separator',
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('advanceTickets.liters'),
|
|
||||||
name: 'liters',
|
|
||||||
field: 'liters',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
label: t('advanceTickets.liters'),
|
||||||
columnFilter: {
|
headerClass: 'horizontal-separator',
|
||||||
component: VnInput,
|
name: 'liters',
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.lines'),
|
label: t('advanceTickets.lines'),
|
||||||
name: 'lines',
|
name: 'lines',
|
||||||
field: 'lines',
|
headerClass: 'horizontal-separator',
|
||||||
align: 'left',
|
format: (row, dashIfEmpty) => dashIfEmpty(row.lines),
|
||||||
sortable: true,
|
|
||||||
columnFilter: {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.import'),
|
label: t('advanceTickets.import'),
|
||||||
field: 'import',
|
name: 'totalWithVat',
|
||||||
name: 'import',
|
hidden: true,
|
||||||
align: 'left',
|
headerClass: 'horizontal-separator',
|
||||||
sortable: true,
|
format: (row) => toCurrency(row.totalWithVat),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.futureId'),
|
label: t('advanceTickets.futureId'),
|
||||||
name: 'futureId',
|
name: 'futureId',
|
||||||
align: 'left',
|
headerClass: 'vertical-separator horizontal-separator',
|
||||||
sortable: true,
|
columnClass: 'vertical-separator',
|
||||||
columnFilter: {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
filterParamKey: 'futureId',
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.futureIpt'),
|
label: t('advanceTickets.futureIpt'),
|
||||||
name: 'futureIpt',
|
name: 'futureIpt',
|
||||||
field: 'futureIpt',
|
|
||||||
align: 'left',
|
|
||||||
sortable: true,
|
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: VnSelect,
|
component: 'select',
|
||||||
filterParamKey: 'futureIptColFilter',
|
|
||||||
type: 'select',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
attrs: {
|
||||||
options: itemPackingTypesOptions.value,
|
url: 'itemPackingTypes',
|
||||||
'option-value': 'code',
|
fields: ['code', 'description'],
|
||||||
'option-label': 'description',
|
where: { isActive: true },
|
||||||
dense: true,
|
optionValue: 'code',
|
||||||
|
optionLabel: 'description',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
format: (val) => dashIfEmpty(val),
|
headerClass: 'horizontal-separator',
|
||||||
|
format: (row, dashIfEmpty) => dashIfEmpty(row.futureIpt),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.futureState'),
|
label: t('advanceTickets.futureState'),
|
||||||
name: 'futureState',
|
name: 'futureState',
|
||||||
align: 'left',
|
headerClass: 'horizontal-separator',
|
||||||
sortable: true,
|
hidden: true,
|
||||||
columnFilter: null,
|
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.futureLiters'),
|
label: t('advanceTickets.futureLiters'),
|
||||||
|
headerClass: 'horizontal-separator',
|
||||||
name: 'futureLiters',
|
name: 'futureLiters',
|
||||||
field: 'futureLiters',
|
|
||||||
align: 'left',
|
|
||||||
sortable: true,
|
|
||||||
columnFilter: {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.futureZone'),
|
label: t('advanceTickets.futureZone'),
|
||||||
name: 'futureZoneName',
|
name: 'futureZoneFk',
|
||||||
field: 'futureZoneName',
|
columnClass: 'expand',
|
||||||
align: 'left',
|
|
||||||
sortable: true,
|
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: VnSelect,
|
component: 'select',
|
||||||
type: 'select',
|
inWhere: true,
|
||||||
filterValue: null,
|
|
||||||
filterParamKey: 'futureZoneFk',
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
attrs: {
|
||||||
options: zonesOptions.value,
|
url: 'Zones',
|
||||||
'option-value': 'id',
|
fields: ['id', 'name'],
|
||||||
'option-label': 'name',
|
|
||||||
dense: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
format: (val) => dashIfEmpty(val),
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
|
headerClass: 'horizontal-separator',
|
||||||
|
format: (row, dashIfEmpty) => dashIfEmpty(row.futureZoneName),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.notMovableLines'),
|
label: t('advanceTickets.notMovableLines'),
|
||||||
|
headerClass: 'horizontal-separator',
|
||||||
name: 'notMovableLines',
|
name: 'notMovableLines',
|
||||||
field: 'notMovableLines',
|
|
||||||
align: 'left',
|
|
||||||
sortable: true,
|
|
||||||
columnFilter: {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
align: 'left',
|
||||||
label: t('advanceTickets.futureLines'),
|
label: t('advanceTickets.futureLines'),
|
||||||
|
headerClass: 'horizontal-separator',
|
||||||
name: 'futureLines',
|
name: 'futureLines',
|
||||||
field: 'futureLines',
|
|
||||||
align: 'left',
|
|
||||||
sortable: true,
|
|
||||||
columnFilter: {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
event: getInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('advanceTickets.futureImport'),
|
|
||||||
name: 'futureImport',
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
label: t('advanceTickets.futureImport'),
|
||||||
columnFilter: null,
|
name: 'futureTotalWithVat',
|
||||||
|
hidden: true,
|
||||||
|
headerClass: 'horizontal-separator',
|
||||||
|
format: (row) => toCurrency(row.futureTotalWithVat),
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -329,7 +208,7 @@ const requestComponentUpdate = async (ticket, isWithoutNegatives) => {
|
||||||
const query = `tickets/${ticket.futureId}/componentUpdate`;
|
const query = `tickets/${ticket.futureId}/componentUpdate`;
|
||||||
if (!ticket.landed) {
|
if (!ticket.landed) {
|
||||||
const newLanded = await getLanded({
|
const newLanded = await getLanded({
|
||||||
shipped: userParams.dateToAdvance,
|
shipped: vnTableRef.value.params.dateToAdvance,
|
||||||
addressFk: ticket.futureAddressFk,
|
addressFk: ticket.futureAddressFk,
|
||||||
agencyModeFk: ticket.agencyModeFk ?? ticket.futureAgencyModeFk,
|
agencyModeFk: ticket.agencyModeFk ?? ticket.futureAgencyModeFk,
|
||||||
warehouseFk: ticket.futureWarehouseFk,
|
warehouseFk: ticket.futureWarehouseFk,
|
||||||
|
@ -352,7 +231,7 @@ const requestComponentUpdate = async (ticket, isWithoutNegatives) => {
|
||||||
zoneFk: ticket.zoneFk ?? ticket.futureZoneFk,
|
zoneFk: ticket.zoneFk ?? ticket.futureZoneFk,
|
||||||
warehouseFk: ticket.futureWarehouseFk,
|
warehouseFk: ticket.futureWarehouseFk,
|
||||||
companyFk: ticket.futureCompanyFk,
|
companyFk: ticket.futureCompanyFk,
|
||||||
shipped: userParams.dateToAdvance,
|
shipped: vnTableRef.value.params.dateToAdvance,
|
||||||
landed: ticket.landed,
|
landed: ticket.landed,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
isWithoutNegatives,
|
isWithoutNegatives,
|
||||||
|
@ -364,7 +243,6 @@ const requestComponentUpdate = async (ticket, isWithoutNegatives) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const moveTicketsAdvance = async () => {
|
const moveTicketsAdvance = async () => {
|
||||||
try {
|
|
||||||
let ticketsToMove = [];
|
let ticketsToMove = [];
|
||||||
for (const ticket of selectedTickets.value) {
|
for (const ticket of selectedTickets.value) {
|
||||||
if (!ticket.id) {
|
if (!ticket.id) {
|
||||||
|
@ -387,13 +265,9 @@ const moveTicketsAdvance = async () => {
|
||||||
|
|
||||||
const params = { tickets: ticketsToMove };
|
const params = { tickets: ticketsToMove };
|
||||||
await axios.post('Tickets/merge', params);
|
await axios.post('Tickets/merge', params);
|
||||||
arrayData.fetch({ append: false });
|
vnTableRef.value.reload();
|
||||||
selectedTickets.value = [];
|
selectedTickets.value = [];
|
||||||
if (ticketsToMove.length)
|
if (ticketsToMove.length) notify(t('advanceTickets.moveTicketSuccess'), 'positive');
|
||||||
notify(t('advanceTickets.moveTicketSuccess'), 'positive');
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error moving tickets', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const progressLength = ref(0);
|
const progressLength = ref(0);
|
||||||
|
@ -434,10 +308,8 @@ const splitTickets = async () => {
|
||||||
progressAdd(ticket.futureId);
|
progressAdd(ticket.futureId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('Error splitting tickets', error);
|
|
||||||
} finally {
|
} finally {
|
||||||
arrayData.fetch({ append: false });
|
vnTableRef.value.reload();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -455,22 +327,52 @@ const handleCloseProgressDialog = () => {
|
||||||
|
|
||||||
const handleCancelProgress = () => (cancelProgress.value = true);
|
const handleCancelProgress = () => (cancelProgress.value = true);
|
||||||
|
|
||||||
onMounted(async () => {
|
watch(
|
||||||
let today = Date.vnNew();
|
() => vnTableRef.value.tableRef?.$el,
|
||||||
const tomorrow = new Date(today);
|
($el) => {
|
||||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
if (!$el) return;
|
||||||
userParams.dateFuture = tomorrow;
|
const head = $el.querySelector('thead');
|
||||||
userParams.dateToAdvance = today;
|
const firstRow = $el.querySelector('thead > tr');
|
||||||
userParams.scopeDays = 1;
|
|
||||||
userParams.warehouseFk = user.value.warehouseFk;
|
|
||||||
userParams.ipt = 'H';
|
|
||||||
userParams.futureIpt = 'H';
|
|
||||||
userParams.isFullMovable = true;
|
|
||||||
const filter = { limit: 0 };
|
|
||||||
await arrayData.addFilter({ filter, userParams });
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
const newRow = document.createElement('tr');
|
||||||
|
destinationElRef.value = document.createElement('th');
|
||||||
|
originElRef.value = document.createElement('th');
|
||||||
|
|
||||||
|
newRow.classList.add('bg-header');
|
||||||
|
destinationElRef.value.classList.add('text-uppercase', 'color-vn-label');
|
||||||
|
originElRef.value.classList.add('text-uppercase', 'color-vn-label');
|
||||||
|
|
||||||
|
destinationElRef.value.setAttribute('colspan', '7');
|
||||||
|
originElRef.value.setAttribute('colspan', '9');
|
||||||
|
|
||||||
|
destinationElRef.value.textContent = `${t(
|
||||||
|
'advanceTickets.destination'
|
||||||
|
)} ${toDateFormat(vnTableRef.value.params.dateToAdvance)}`;
|
||||||
|
originElRef.value.textContent = `${t('advanceTickets.origin')} ${toDateFormat(
|
||||||
|
vnTableRef.value.params.dateFuture
|
||||||
|
)}`;
|
||||||
|
|
||||||
|
newRow.append(destinationElRef.value, originElRef.value);
|
||||||
|
head.insertBefore(newRow, firstRow);
|
||||||
|
},
|
||||||
|
{ once: true, inmmediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => vnTableRef.value.params,
|
||||||
|
() => {
|
||||||
|
if (originElRef.value && destinationElRef.value) {
|
||||||
|
destinationElRef.value.textContent = `${t(
|
||||||
|
'advanceTickets.destination'
|
||||||
|
)} ${toDateFormat(vnTableRef.value.params.dateToAdvance)}`;
|
||||||
|
originElRef.value.textContent = `${t('advanceTickets.origin')} ${toDateFormat(
|
||||||
|
vnTableRef.value.params.dateFuture
|
||||||
|
)}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="itemPackingTypes"
|
url="itemPackingTypes"
|
||||||
|
@ -491,11 +393,6 @@ onMounted(async () => {
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => (zonesOptions = data)"
|
@on-fetch="(data) => (zonesOptions = data)"
|
||||||
/>
|
/>
|
||||||
<VnSearchbar
|
|
||||||
data-key="WeeklyTickets"
|
|
||||||
:label="t('weeklyTickets.search')"
|
|
||||||
:info="t('weeklyTickets.searchInfo')"
|
|
||||||
/>
|
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
<template #st-data>
|
<template #st-data>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -539,79 +436,30 @@ onMounted(async () => {
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<TicketAdvanceFilter data-key="AdvanceTickets" />
|
<TicketAdvanceFilter data-key="advanceTickets" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QTable
|
<VnTable
|
||||||
:rows="tickets"
|
data-key="advanceTickets"
|
||||||
|
ref="vnTableRef"
|
||||||
|
url="Tickets/getTicketsAdvance"
|
||||||
|
search-url="advanceTickets"
|
||||||
|
:user-params="userParams"
|
||||||
|
:limit="0"
|
||||||
:columns="ticketColumns"
|
:columns="ticketColumns"
|
||||||
row-key="index"
|
:table="{
|
||||||
selection="multiple"
|
'row-key': '$index',
|
||||||
|
selection: 'multiple',
|
||||||
|
}"
|
||||||
v-model:selected="selectedTickets"
|
v-model:selected="selectedTickets"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
:no-data-label="t('globals.noResults')"
|
:no-data-label="t('globals.noResults')"
|
||||||
style="max-width: 99%"
|
:right-search="false"
|
||||||
|
auto-load
|
||||||
|
:disable-option="{ card: true }"
|
||||||
>
|
>
|
||||||
<template #header="props">
|
<template #column-icons="{ row }">
|
||||||
{{ userParams.scopeDays }}
|
|
||||||
<QTr :props="props">
|
|
||||||
<QTh
|
|
||||||
class="horizontal-separator text-uppercase color-vn-label"
|
|
||||||
colspan="7"
|
|
||||||
translate
|
|
||||||
>
|
|
||||||
{{ t('advanceTickets.destination') }}
|
|
||||||
{{ toDateFormat(userParams.dateToAdvance) }}
|
|
||||||
</QTh>
|
|
||||||
<QTh
|
|
||||||
class="horizontal-separator text-uppercase color-vn-label"
|
|
||||||
colspan="9"
|
|
||||||
translate
|
|
||||||
>
|
|
||||||
{{ t('advanceTickets.origin') }}
|
|
||||||
{{ toDateFormat(userParams.dateFuture) }}
|
|
||||||
</QTh>
|
|
||||||
</QTr>
|
|
||||||
<QTr>
|
|
||||||
<QTh>
|
|
||||||
<QCheckbox v-model="props.selected" />
|
|
||||||
</QTh>
|
|
||||||
<QTh
|
|
||||||
v-for="(col, index) in ticketColumns"
|
|
||||||
:key="index"
|
|
||||||
:class="{ 'vertical-separator': col.name === 'futureId' }"
|
|
||||||
>
|
|
||||||
{{ col.label }}
|
|
||||||
</QTh>
|
|
||||||
</QTr>
|
|
||||||
</template>
|
|
||||||
<template #top-row="{ cols }">
|
|
||||||
<QTr>
|
|
||||||
<QTd />
|
|
||||||
<QTd
|
|
||||||
v-for="(col, index) in cols"
|
|
||||||
:key="index"
|
|
||||||
style="max-width: 100px"
|
|
||||||
>
|
|
||||||
<component
|
|
||||||
:is="col.columnFilter.component"
|
|
||||||
v-if="col.columnFilter"
|
|
||||||
v-model="col.columnFilter.filterValue"
|
|
||||||
v-bind="col.columnFilter.attrs"
|
|
||||||
v-on="col.columnFilter.event(col)"
|
|
||||||
dense
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</QTr>
|
|
||||||
</template>
|
|
||||||
<template #header-cell-availableLines="{ col }">
|
|
||||||
<QTh class="vertical-separator">
|
|
||||||
{{ col.label }}
|
|
||||||
</QTh>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-icons="{ row }">
|
|
||||||
<QTd class="q-gutter-x-xs">
|
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="row.futureAgency !== row.agency && row.agency"
|
v-if="row.futureAgency !== row.agency && row.agency"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -635,19 +483,14 @@ onMounted(async () => {
|
||||||
</span>
|
</span>
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-id="{ row }">
|
||||||
<template #body-cell-ticketId="{ row }">
|
|
||||||
<QTd>
|
|
||||||
<QBtn flat class="link">
|
<QBtn flat class="link">
|
||||||
{{ row.id }}
|
{{ row.id }}
|
||||||
<TicketDescriptorProxy :id="row.id" />
|
<TicketDescriptorProxy :id="row.id" />
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-state="{ row }">
|
<template #column-state="{ row }">
|
||||||
<QTd>
|
|
||||||
<QBadge
|
<QBadge
|
||||||
v-if="row.state"
|
v-if="row.state"
|
||||||
text-color="black"
|
text-color="black"
|
||||||
|
@ -658,10 +501,8 @@ onMounted(async () => {
|
||||||
{{ row.state }}
|
{{ row.state }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
<span v-else> {{ dashIfEmpty(row.state) }}</span>
|
<span v-else> {{ dashIfEmpty(row.state) }}</span>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-import="{ row }">
|
<template #column-import="{ row }">
|
||||||
<QTd>
|
|
||||||
<QBadge
|
<QBadge
|
||||||
:text-color="isLessThan50(row.totalWithVat) ? 'black' : 'white'"
|
:text-color="isLessThan50(row.totalWithVat) ? 'black' : 'white'"
|
||||||
:color="totalPriceColor(row.totalWithVat)"
|
:color="totalPriceColor(row.totalWithVat)"
|
||||||
|
@ -670,18 +511,14 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
{{ toCurrency(row.totalWithVat || 0) }}
|
{{ toCurrency(row.totalWithVat || 0) }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-futureId="{ row }">
|
<template #column-futureId="{ row }">
|
||||||
<QTd class="vertical-separator">
|
|
||||||
<QBtn flat class="link" dense>
|
<QBtn flat class="link" dense>
|
||||||
{{ row.futureId }}
|
{{ row.futureId }}
|
||||||
<TicketDescriptorProxy :id="row.futureId" />
|
<TicketDescriptorProxy :id="row.futureId" />
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-futureState="{ row }">
|
<template #column-futureState="{ row }">
|
||||||
<QTd>
|
|
||||||
<QBadge
|
<QBadge
|
||||||
text-color="black"
|
text-color="black"
|
||||||
:color="row.futureClassColor"
|
:color="row.futureClassColor"
|
||||||
|
@ -690,23 +527,18 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
{{ row.futureState }}
|
{{ row.futureState }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-futureImport="{ row }">
|
<template #column-futureImport="{ row }">
|
||||||
<QTd>
|
|
||||||
<QBadge
|
<QBadge
|
||||||
:text-color="
|
:text-color="isLessThan50(row.futureTotalWithVat) ? 'black' : 'white'"
|
||||||
isLessThan50(row.futureTotalWithVat) ? 'black' : 'white'
|
|
||||||
"
|
|
||||||
:color="totalPriceColor(row.futureTotalWithVat)"
|
:color="totalPriceColor(row.futureTotalWithVat)"
|
||||||
class="q-ma-none"
|
class="q-ma-none"
|
||||||
dense
|
dense
|
||||||
>
|
>
|
||||||
{{ toCurrency(row.futureTotalWithVat || 0) }}
|
{{ toCurrency(row.futureTotalWithVat || 0) }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</VnTable>
|
||||||
<VnProgress
|
<VnProgress
|
||||||
:progress="progressPercentage"
|
:progress="progressPercentage"
|
||||||
:cancelled="cancelProgress"
|
:cancelled="cancelProgress"
|
||||||
|
@ -725,11 +557,11 @@ onMounted(async () => {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.vertical-separator {
|
:deep(.vertical-separator) {
|
||||||
border-left: 4px solid white !important;
|
border-left: 4px solid white !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.horizontal-separator {
|
:deep(.horizontal-separator) {
|
||||||
border-bottom: 4px solid white !important;
|
border-top: 4px solid white !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -27,7 +27,6 @@ const warehousesOptions = ref([]);
|
||||||
const itemPackingTypes = ref([]);
|
const itemPackingTypes = ref([]);
|
||||||
|
|
||||||
const getItemPackingTypes = async () => {
|
const getItemPackingTypes = async () => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: { isActive: true },
|
where: { isActive: true },
|
||||||
};
|
};
|
||||||
|
@ -38,9 +37,6 @@ const getItemPackingTypes = async () => {
|
||||||
description: t(ipt.description),
|
description: t(ipt.description),
|
||||||
code: ipt.code,
|
code: ipt.code,
|
||||||
}));
|
}));
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getLocale = (val) => {
|
const getLocale = (val) => {
|
||||||
|
@ -58,6 +54,7 @@ onMounted(async () => await getItemPackingTypes());
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
|
search-url="advanceTickets"
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
:hidden-tags="['search']"
|
:hidden-tags="['search']"
|
||||||
|
@ -101,6 +98,7 @@ onMounted(async () => await getItemPackingTypes());
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
|
:use-like="false"
|
||||||
>
|
>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -118,6 +116,7 @@ onMounted(async () => await getItemPackingTypes());
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
|
:use-like="false"
|
||||||
>
|
>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -24,7 +24,6 @@ const itemPackingTypes = ref([]);
|
||||||
const stateOptions = ref([]);
|
const stateOptions = ref([]);
|
||||||
|
|
||||||
const getItemPackingTypes = async () => {
|
const getItemPackingTypes = async () => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: { isActive: true },
|
where: { isActive: true },
|
||||||
};
|
};
|
||||||
|
@ -35,22 +34,15 @@ const getItemPackingTypes = async () => {
|
||||||
description: t(ipt.description),
|
description: t(ipt.description),
|
||||||
code: ipt.code,
|
code: ipt.code,
|
||||||
}));
|
}));
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getGroupedStates = async () => {
|
const getGroupedStates = async () => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get('AlertLevels');
|
const { data } = await axios.get('AlertLevels');
|
||||||
stateOptions.value = data.map((state) => ({
|
stateOptions.value = data.map((state) => ({
|
||||||
id: state.id,
|
id: state.id,
|
||||||
name: t(`futureTickets.${state.code}`),
|
name: t(`futureTickets.${state.code}`),
|
||||||
code: state.code,
|
code: state.code,
|
||||||
}));
|
}));
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
|
@ -17,6 +17,11 @@ const $props = defineProps({
|
||||||
required: false,
|
required: false,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
dataKey: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'workerData',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const image = ref(null);
|
const image = ref(null);
|
||||||
|
|
||||||
|
@ -65,7 +70,7 @@ const handlePhotoUpdated = (evt = false) => {
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
ref="cardDescriptorRef"
|
ref="cardDescriptorRef"
|
||||||
module="Worker"
|
module="Worker"
|
||||||
data-key="workerData"
|
:data-key="dataKey"
|
||||||
url="Workers/descriptor"
|
url="Workers/descriptor"
|
||||||
:filter="{ where: { id: entityId } }"
|
:filter="{ where: { id: entityId } }"
|
||||||
title="user.nickname"
|
title="user.nickname"
|
||||||
|
|
|
@ -12,6 +12,11 @@ const $props = defineProps({
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy>
|
<QPopupProxy>
|
||||||
<WorkerDescriptor v-if="$props.id" :id="$props.id" :summary="WorkerSummary" />
|
<WorkerDescriptor
|
||||||
|
v-if="$props.id"
|
||||||
|
:id="$props.id"
|
||||||
|
:summary="WorkerSummary"
|
||||||
|
data-key="workerDescriptorProxy"
|
||||||
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -44,8 +44,9 @@ async function toggleNotification(notification) {
|
||||||
`worker.notificationsManager.${notification.active ? '' : 'un'}subscribed`
|
`worker.notificationsManager.${notification.active ? '' : 'un'}subscribed`
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
} catch {
|
} catch (e) {
|
||||||
notification.active = !notification.active;
|
notification.active = !notification.active;
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,21 +34,13 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const deleteWarehouse = async (row) => {
|
const deleteWarehouse = async (row) => {
|
||||||
try {
|
|
||||||
await axios.delete(`${urlPath.value}/${row.id}`);
|
await axios.delete(`${urlPath.value}/${row.id}`);
|
||||||
fetchWarehouses();
|
fetchWarehouses();
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createZoneWarehouse = async (ZoneWarehouseFormData) => {
|
const createZoneWarehouse = async (ZoneWarehouseFormData) => {
|
||||||
try {
|
|
||||||
await axios.post(urlPath.value, ZoneWarehouseFormData);
|
await axios.post(urlPath.value, ZoneWarehouseFormData);
|
||||||
fetchWarehouses();
|
fetchWarehouses();
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe('Logout', () => {
|
||||||
});
|
});
|
||||||
describe('not user', () => {
|
describe('not user', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.intercept('GET', '**/VnUsers/acl', {
|
cy.intercept('GET', '**DefaultViewConfigs**', {
|
||||||
statusCode: 401,
|
statusCode: 401,
|
||||||
body: {
|
body: {
|
||||||
error: {
|
error: {
|
||||||
|
@ -24,10 +24,11 @@ describe('Logout', () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
statusMessage: 'AUTHORIZATION_REQUIRED',
|
statusMessage: 'AUTHORIZATION_REQUIRED',
|
||||||
}).as('someRoute');
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('when token not exists', () => {
|
it('when token not exists', () => {
|
||||||
cy.reload();
|
cy.get('.q-list > [href="#/item"]').click();
|
||||||
cy.get('.q-notification__message').should(
|
cy.get('.q-notification__message').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
'Authorization Required'
|
'Authorization Required'
|
||||||
|
|
|
@ -7,31 +7,20 @@ describe('AgencyWorkCenter', () => {
|
||||||
const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
|
const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
|
||||||
const workCenterCombobox = 'input[role="combobox"]';
|
const workCenterCombobox = 'input[role="combobox"]';
|
||||||
|
|
||||||
it('assign workCenter', () => {
|
it('check workCenter crud', () => {
|
||||||
|
// create
|
||||||
cy.get(createButton).click();
|
cy.get(createButton).click();
|
||||||
cy.get(workCenterCombobox).type('workCenterOne{enter}');
|
cy.get(workCenterCombobox).type('workCenterOne{enter}');
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
cy.hasNotify('Data created');
|
||||||
});
|
|
||||||
|
|
||||||
it('delete workCenter', () => {
|
// expect error when duplicate
|
||||||
|
cy.get(createButton).click();
|
||||||
|
cy.get('[data-cy="FormModelPopup_save"]').click();
|
||||||
|
cy.hasNotify('This workCenter is already assigned to this agency');
|
||||||
|
cy.get('[data-cy="FormModelPopup_cancel"]').click();
|
||||||
|
|
||||||
|
// delete
|
||||||
cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
|
cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
cy.get('.q-notification__message').should(
|
cy.hasNotify('WorkCenter removed successfully');
|
||||||
'have.text',
|
|
||||||
'WorkCenter removed successfully'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('error on duplicate workCenter', () => {
|
|
||||||
cy.get(createButton).click();
|
|
||||||
cy.get(workCenterCombobox).type('workCenterOne{enter}');
|
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
|
||||||
cy.get(createButton).click();
|
|
||||||
cy.get(
|
|
||||||
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
|
|
||||||
).type('workCenterOne{enter}');
|
|
||||||
|
|
||||||
cy.get(
|
|
||||||
':nth-child(2) > .q-notification__wrapper > .q-notification__content > .q-notification__message'
|
|
||||||
).should('have.text', 'This workCenter is already assigned to this agency');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,10 +17,7 @@ describe('WorkerNotificationsManager', () => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/worker/${salesPersonId}/notifications`);
|
cy.visit(`/#/worker/${salesPersonId}/notifications`);
|
||||||
cy.get(firstAvailableNotification).click();
|
cy.get(firstAvailableNotification).click();
|
||||||
cy.notificationHas(
|
cy.hasNotify('The notification subscription of this worker cant be modified');
|
||||||
'.q-notification__message',
|
|
||||||
'The notification subscription of this worker cant be modified'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should active a notification that is yours', () => {
|
it('should active a notification that is yours', () => {
|
||||||
|
|
|
@ -262,3 +262,14 @@ Cypress.Commands.add('openUserPanel', () => {
|
||||||
'.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image'
|
'.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image'
|
||||||
).click();
|
).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('hasNotify', (text) => {
|
||||||
|
//last
|
||||||
|
cy.get('.q-notification')
|
||||||
|
.should('be.visible')
|
||||||
|
.last()
|
||||||
|
.then(($lastNotification) => {
|
||||||
|
if (!Cypress.$($lastNotification).text().includes(text))
|
||||||
|
throw new Error(`Notification not found: "${text}"`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -36,8 +36,6 @@ describe('Axios boot', () => {
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
response: {
|
response: {
|
||||||
status: 500,
|
status: 500,
|
||||||
|
@ -45,19 +43,10 @@ describe('Axios boot', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
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.objectContaining({
|
|
||||||
message: 'An internal server error has ocurred',
|
|
||||||
type: 'negative',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
response: {
|
response: {
|
||||||
status: 401,
|
status: 401,
|
||||||
|
@ -70,14 +59,7 @@ describe('Axios boot', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
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.objectContaining({
|
|
||||||
message: 'Invalid user or password',
|
|
||||||
type: 'negative',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue