Merge branch 'dev' into Fix_OrderModuleProblems
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-10-29 08:26:16 +00:00
commit 1ff77abaf5
20 changed files with 361 additions and 73 deletions

View File

@ -30,10 +30,11 @@ const props = defineProps({
}, },
}); });
defineEmits(['confirm', ...useDialogPluginComponent.emits]); const emit = defineEmits(['confirm', 'cancel', ...useDialogPluginComponent.emits]);
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
const { dialogRef, onDialogOK } = useDialogPluginComponent(); const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
useDialogPluginComponent();
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
const title = props.title || t('Confirm'); const title = props.title || t('Confirm');
const message = const message =
@ -53,9 +54,14 @@ async function confirm() {
} }
onDialogOK(props.data); onDialogOK(props.data);
} }
function cancel() {
emit('cancel');
onDialogCancel();
}
</script> </script>
<template> <template>
<QDialog ref="dialogRef"> <QDialog ref="dialogRef" @hide="onDialogHide">
<QCard class="q-pa-sm"> <QCard class="q-pa-sm">
<QCardSection class="row items-center q-pb-none"> <QCardSection class="row items-center q-pb-none">
<QAvatar <QAvatar
@ -67,7 +73,14 @@ async function confirm() {
/> />
<span class="text-h6">{{ title }}</span> <span class="text-h6">{{ title }}</span>
<QSpace /> <QSpace />
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup /> <QBtn
icon="close"
:disable="isLoading"
flat
round
dense
@click="cancel()"
/>
</QCardSection> </QCardSection>
<QCardSection class="q-pb-none"> <QCardSection class="q-pb-none">
<span v-if="message !== false" v-html="message" /> <span v-if="message !== false" v-html="message" />
@ -81,7 +94,7 @@ async function confirm() {
color="primary" color="primary"
:disable="isLoading" :disable="isLoading"
flat flat
v-close-popup @click="cancel()"
/> />
<QBtn <QBtn
:label="t('globals.confirm')" :label="t('globals.confirm')"

View File

@ -313,6 +313,7 @@ globals:
changePass: Change password changePass: Change password
deleteConfirmTitle: Delete selected elements deleteConfirmTitle: Delete selected elements
changeState: Change state changeState: Change state
raid: 'Raid {daysInForward} days'
errors: errors:
statusUnauthorized: Access denied statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred statusInternalServerError: An internal server error has ocurred
@ -370,7 +371,6 @@ entry:
companyFk: Company companyFk: Company
travelFk: Travel travelFk: Travel
isExcludedFromAvailable: Inventory isExcludedFromAvailable: Inventory
isRaid: Raid
invoiceAmount: Import invoiceAmount: Import
summary: summary:
commission: Commission commission: Commission
@ -381,7 +381,6 @@ entry:
ordered: Ordered ordered: Ordered
confirmed: Confirmed confirmed: Confirmed
booked: Booked booked: Booked
raid: Raid
excludedFromAvailable: Inventory excludedFromAvailable: Inventory
travelReference: Reference travelReference: Reference
travelAgency: Agency travelAgency: Agency
@ -414,7 +413,6 @@ entry:
ordered: Ordered ordered: Ordered
confirmed: Confirmed confirmed: Confirmed
booked: Booked booked: Booked
raid: Raid
excludedFromAvailable: Inventory excludedFromAvailable: Inventory
agency: Agency agency: Agency
warehouseOut: Warehouse Out warehouseOut: Warehouse Out
@ -477,7 +475,6 @@ entry:
packingOut: Package out packingOut: Package out
landing: Landing landing: Landing
isExcludedFromAvailable: Es inventory isExcludedFromAvailable: Es inventory
isRaid: Raid
ticket: ticket:
pageTitles: pageTitles:
tickets: Tickets tickets: Tickets
@ -1043,6 +1040,7 @@ travel:
warehouseIn: Warehouse In warehouseIn: Warehouse In
delivered: Delivered delivered: Delivered
received: Received received: Received
daysInForward: Days in forward
thermographs: thermographs:
code: Code code: Code
temperature: Temperature temperature: Temperature

View File

@ -317,6 +317,7 @@ globals:
changePass: Cambiar contraseña changePass: Cambiar contraseña
deleteConfirmTitle: Eliminar los elementos seleccionados deleteConfirmTitle: Eliminar los elementos seleccionados
changeState: Cambiar estado changeState: Cambiar estado
raid: 'Redada {daysInForward} días'
errors: errors:
statusUnauthorized: Acceso denegado statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor statusInternalServerError: Ha ocurrido un error interno del servidor
@ -372,7 +373,6 @@ entry:
companyFk: Empresa companyFk: Empresa
travelFk: Envio travelFk: Envio
isExcludedFromAvailable: Inventario isExcludedFromAvailable: Inventario
isRaid: Redada
invoiceAmount: Importe invoiceAmount: Importe
summary: summary:
commission: Comisión commission: Comisión
@ -383,7 +383,6 @@ entry:
ordered: Pedida ordered: Pedida
confirmed: Confirmada confirmed: Confirmada
booked: Contabilizada booked: Contabilizada
raid: Redada
excludedFromAvailable: Inventario excludedFromAvailable: Inventario
travelReference: Referencia travelReference: Referencia
travelAgency: Agencia travelAgency: Agencia
@ -416,7 +415,6 @@ entry:
ordered: Pedida ordered: Pedida
confirmed: Confirmado confirmed: Confirmado
booked: Asentado booked: Asentado
raid: Redada
excludedFromAvailable: Inventario excludedFromAvailable: Inventario
agency: Agencia agency: Agencia
warehouseOut: Alm. salida warehouseOut: Alm. salida
@ -479,7 +477,6 @@ entry:
packingOut: Embalaje envíos packingOut: Embalaje envíos
landing: Llegada landing: Llegada
isExcludedFromAvailable: Es inventario isExcludedFromAvailable: Es inventario
isRaid: Redada
ticket: ticket:
pageTitles: pageTitles:
tickets: Tickets tickets: Tickets
@ -1041,6 +1038,7 @@ travel:
warehouseIn: Alm. entrada warehouseIn: Alm. entrada
delivered: Enviada delivered: Enviada
received: Recibida received: Recibida
daysInForward: Días redada
thermographs: thermographs:
code: Código code: Código
temperature: Temperatura temperature: Temperatura

View File

@ -168,7 +168,6 @@ const onFilterTravelSelected = (formData, id) => {
v-model="data.isExcludedFromAvailable" v-model="data.isExcludedFromAvailable"
:label="t('entry.basicData.excludedFromAvailable')" :label="t('entry.basicData.excludedFromAvailable')"
/> />
<QCheckbox v-model="data.isRaid" :label="t('entry.basicData.raid')" />
<QCheckbox <QCheckbox
v-if="isAdministrative()" v-if="isAdministrative()"
v-model="data.isBooked" v-model="data.isBooked"

View File

@ -7,7 +7,6 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import { useState } from 'src/composables/useState';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { usePrintService } from 'composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
@ -23,7 +22,6 @@ const $props = defineProps({
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const { openReport } = usePrintService(); const { openReport } = usePrintService();
const state = useState();
const entryDescriptorRef = ref(null); const entryDescriptorRef = ref(null);
const url = ref(); const url = ref();
@ -32,7 +30,14 @@ const entryFilter = {
{ {
relation: 'travel', relation: 'travel',
scope: { scope: {
fields: ['id', 'landed', 'shipped', 'agencyModeFk', 'warehouseOutFk'], fields: [
'id',
'landed',
'shipped',
'agencyModeFk',
'warehouseOutFk',
'daysInForward',
],
include: [ include: [
{ {
relation: 'agency', relation: 'agency',
@ -75,8 +80,6 @@ const data = ref(useCardDescription());
const setData = (entity) => const setData = (entity) =>
(data.value = useCardDescription(entity.supplier?.nickname, entity.id)); (data.value = useCardDescription(entity.supplier?.nickname, entity.id));
const currentEntry = computed(() => state.get('entry'));
const getEntryRedirectionFilter = (entry) => { const getEntryRedirectionFilter = (entry) => {
let entryTravel = entry && entry.travel; let entryTravel = entry && entry.travel;
@ -133,10 +136,10 @@ watch;
:value="entity.travel?.warehouseOut?.name" :value="entity.travel?.warehouseOut?.name"
/> />
</template> </template>
<template #icons> <template #icons="{ entity }">
<QCardActions class="q-gutter-x-md"> <QCardActions class="q-gutter-x-md">
<QIcon <QIcon
v-if="currentEntry?.isExcludedFromAvailable" v-if="entity?.isExcludedFromAvailable"
name="vn:inventory" name="vn:inventory"
color="primary" color="primary"
size="xs" size="xs"
@ -144,12 +147,18 @@ watch;
<QTooltip>{{ t('Inventory entry') }}</QTooltip> <QTooltip>{{ t('Inventory entry') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="currentEntry?.isRaid" v-if="entity?.travel?.daysInForward"
name="vn:net" name="vn:net"
color="primary" color="primary"
size="xs" size="xs"
> >
<QTooltip>{{ t('Virtual entry') }}</QTooltip> <QTooltip>
{{
t('globals.raid', {
daysInForward: entity?.travel?.daysInForward,
})
}}</QTooltip
>
</QIcon> </QIcon>
</QCardActions> </QCardActions>
</template> </template>

View File

@ -259,11 +259,6 @@ const fetchEntryBuys = async () => {
v-model="entry.isBooked" v-model="entry.isBooked"
:disable="true" :disable="true"
/> />
<QCheckbox
:label="t('entry.summary.raid')"
v-model="entry.isRaid"
:disable="true"
/>
<QCheckbox <QCheckbox
:label="t('entry.summary.excludedFromAvailable')" :label="t('entry.summary.excludedFromAvailable')"
v-model="entry.isExcludedFromAvailable" v-model="entry.isExcludedFromAvailable"

View File

@ -121,7 +121,7 @@ const entriesTableColumns = computed(() => [
:loading="isLoading" :loading="isLoading"
@click=" @click="
openReport( openReport(
`Entries/${props.row.id}/buy-label` `Entries/${props.row.id}/buy-label-supplier`
) )
" "
unelevated unelevated

View File

@ -41,6 +41,10 @@ const entryFilter = {
}; };
const columns = computed(() => [ const columns = computed(() => [
{
name: 'status',
columnFilter: false,
},
{ {
align: 'left', align: 'left',
label: t('entry.list.tableVisibleColumns.id'), label: t('entry.list.tableVisibleColumns.id'),
@ -154,27 +158,8 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left',
label: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'), label: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'),
name: 'isExcludedFromAvailable', name: 'isExcludedFromAvailable',
chip: {
color: null,
condition: (value) => value,
icon: 'vn:inventory',
},
columnFilter: {
inWhere: true,
},
},
{
align: 'left',
label: t('entry.list.tableVisibleColumns.isRaid'),
name: 'isRaid',
chip: {
color: null,
condition: (value) => value,
icon: 'vn:net',
},
columnFilter: { columnFilter: {
inWhere: true, inWhere: true,
}, },
@ -225,6 +210,26 @@ onMounted(async () => {
auto-load auto-load
:right-search="false" :right-search="false"
> >
<template #column-status="{ row }">
<div class="row q-gutter-xs">
<QIcon
v-if="!!row.isExcludedFromAvailable"
name="vn:inventory"
color="primary"
>
<QTooltip>{{
t('entry.list.tableVisibleColumns.isExcludedFromAvailable')
}}</QTooltip>
</QIcon>
<QIcon v-if="!!row.daysInForward" name="vn:net" color="primary">
<QTooltip>
{{
t('globals.raid', { daysInForward: row.daysInForward })
}}</QTooltip
>
</QIcon>
</div>
</template>
<template #column-supplierFk="{ row }"> <template #column-supplierFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.supplierName }} {{ row.supplierName }}

View File

@ -1,7 +1,6 @@
entryList: entryList:
list: list:
inventoryEntry: Inventory entry inventoryEntry: Inventory entry
virtualEntry: Virtual entry
entryFilter: entryFilter:
filter: filter:
search: General search search: General search

View File

@ -4,7 +4,6 @@ You can search by entry reference: Puedes buscar por referencia de la entrada
entryList: entryList:
list: list:
inventoryEntry: Es inventario inventoryEntry: Es inventario
virtualEntry: Es una redada
entryFilter: entryFilter:
filter: filter:
search: Búsqueda general search: Búsqueda general

View File

@ -40,6 +40,12 @@ const itemFilter = {
fields: ['id', 'name'], fields: ['id', 'name'],
}, },
}, },
{
relation: 'production',
scope: {
fields: ['id', 'name'],
},
},
], ],
}; };
const columns = computed(() => [ const columns = computed(() => [
@ -161,19 +167,13 @@ const columns = computed(() => [
name: 'intrastat', name: 'intrastat',
align: 'left', align: 'left',
component: 'select', component: 'select',
attrs: {
url: 'Intrastats',
optionValue: 'description',
optionLabel: 'description',
},
columnFilter: { columnFilter: {
name: 'description', name: 'intrastat',
attrs: { attrs: {
url: 'Intrastats', url: 'Intrastats',
optionValue: 'description', optionValue: 'description',
optionLabel: 'description', optionLabel: 'description',
}, },
alias: 'intr',
}, },
columnField: { columnField: {
component: null, component: null,
@ -211,14 +211,19 @@ const columns = computed(() => [
label: t('item.list.userName'), label: t('item.list.userName'),
name: 'userName', name: 'userName',
align: 'left', align: 'left',
component: 'select',
columnFilter: { columnFilter: {
name: 'workerFk', name: 'workerFk',
attrs: { attrs: {
url: 'Users', url: 'VnUsers/preview',
optionValue: 'id', optionValue: 'id',
optionLabel: 'userName', optionLabel: 'nickname',
}, },
}, },
columnField: {
component: null,
},
}, },
{ {
label: t('item.list.weightByPiece'), label: t('item.list.weightByPiece'),
@ -255,9 +260,13 @@ const columns = computed(() => [
name: 'producer', name: 'producer',
align: 'left', align: 'left',
component: 'select', component: 'select',
attrs: { columnFilter: {
url: 'Producers', name: 'producerFk',
fields: ['id', 'name'], attrs: {
url: 'Producers',
optionValue: 'id',
optionLabel: 'name',
},
}, },
columnField: { columnField: {
component: null, component: null,
@ -331,7 +340,7 @@ const columns = computed(() => [
<template #column-userName="{ row }"> <template #column-userName="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.userName }} {{ row.userName }}
<WorkerDescriptorProxy :id="row.buyerFk" /> <WorkerDescriptorProxy :id="row.workerFk" />
</span> </span>
</template> </template>
<template #column-description="{ row }"> <template #column-description="{ row }">

View File

@ -70,6 +70,18 @@ const columns = computed(() => [
{ {
label: t('item.buyRequest.requester'), label: t('item.buyRequest.requester'),
name: 'requesterName', name: 'requesterName',
component: 'select',
columnFilter: {
name: 'requesterFk',
attrs: {
url: 'VnUsers/preview',
optionValue: 'id',
optionLabel: 'nickname',
},
},
columnField: {
component: null,
},
columnClass: 'shrink', columnClass: 'shrink',
}, },
{ {
@ -88,6 +100,18 @@ const columns = computed(() => [
label: t('item.buyRequest.attender'), label: t('item.buyRequest.attender'),
name: 'attenderName', name: 'attenderName',
align: 'left', align: 'left',
component: 'select',
columnFilter: {
name: 'attenderFk',
attrs: {
url: 'VnUsers/preview',
optionValue: 'id',
optionLabel: 'nickname',
},
},
columnField: {
component: null,
},
columnClass: 'shrink', columnClass: 'shrink',
}, },
{ {

View File

@ -2,6 +2,7 @@
import { onMounted, ref, computed, onUnmounted, watch } from 'vue'; import { onMounted, ref, computed, onUnmounted, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
import { useQuasar } from 'quasar';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
@ -23,6 +24,7 @@ import useNotify from 'src/composables/useNotify.js';
import axios from 'axios'; import axios from 'axios';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
import VnUsesMana from 'src/components/ui/VnUsesMana.vue'; import VnUsesMana from 'src/components/ui/VnUsesMana.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -32,7 +34,7 @@ const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const editPriceProxyRef = ref(null); const editPriceProxyRef = ref(null);
const stateBtnDropdownRef = ref(null); const stateBtnDropdownRef = ref(null);
const quasar = useQuasar();
const arrayData = useArrayData('ticketData'); const arrayData = useArrayData('ticketData');
const { store } = arrayData; const { store } = arrayData;
const selectedRows = ref([]); const selectedRows = ref([]);
@ -51,6 +53,7 @@ const transfer = ref({
sales: [], sales: [],
}); });
const tableRef = ref([]); const tableRef = ref([]);
const canProceed = ref();
watch( watch(
() => route.params.id, () => route.params.id,
@ -214,7 +217,9 @@ const addSale = async (sale) => {
} }
}; };
const changeQuantity = (sale) => { const changeQuantity = async (sale) => {
canProceed.value = await isSalePrepared(sale);
if (!canProceed.value) return;
if ( if (
!sale.itemFk || !sale.itemFk ||
sale.quantity == null || sale.quantity == null ||
@ -226,6 +231,8 @@ const changeQuantity = (sale) => {
}; };
const updateConcept = async (sale) => { const updateConcept = async (sale) => {
canProceed.value = await isSalePrepared(sale);
if (!canProceed.value) return;
try { try {
const data = { newConcept: sale.concept }; const data = { newConcept: sale.concept };
await axios.post(`Sales/${sale.id}/updateConcept`, data); await axios.post(`Sales/${sale.id}/updateConcept`, data);
@ -286,6 +293,8 @@ const onOpenEditDiscountPopover = async (sale) => {
}; };
const updatePrice = async (sale) => { const updatePrice = async (sale) => {
canProceed.value = await isSalePrepared(sale);
if (!canProceed.value) return;
try { try {
const newPrice = edit.value.price; const newPrice = edit.value.price;
if (newPrice != null && newPrice != sale.price) { if (newPrice != null && newPrice != sale.price) {
@ -300,12 +309,18 @@ const updatePrice = async (sale) => {
} }
}; };
const changeDiscount = (sale) => { const changeDiscount = async (sale) => {
canProceed.value = await isSalePrepared(sale);
if (!canProceed.value) return;
const newDiscount = edit.value.discount; const newDiscount = edit.value.discount;
if (newDiscount != null && newDiscount != sale.discount) updateDiscount([sale]); if (newDiscount != null && newDiscount != sale.discount) updateDiscount([sale]);
}; };
const updateDiscount = async (sales, newDiscount = null) => { const updateDiscount = async (sales, newDiscount = null) => {
for (const sale of sales) {
const canProceed = await isSalePrepared(sale);
if (!canProceed) return;
}
const saleIds = sales.map((sale) => sale.id); const saleIds = sales.map((sale) => sale.id);
const _newDiscount = newDiscount || edit.value.discount; const _newDiscount = newDiscount || edit.value.discount;
const params = { const params = {
@ -433,7 +448,9 @@ onUnmounted(() => (stateStore.rightDrawer = false));
const items = ref([]); const items = ref([]);
const newRow = ref({}); const newRow = ref({});
const updateItem = (row) => { const updateItem = async (row) => {
canProceed.value = await isSalePrepared(row);
if (!canProceed.value) return;
const selectedItem = items.value.find((item) => item.id === row.itemFk); const selectedItem = items.value.find((item) => item.id === row.itemFk);
if (selectedItem) { if (selectedItem) {
row.item = selectedItem; row.item = selectedItem;
@ -476,6 +493,55 @@ const endNewRow = (row) => {
} }
}; };
async function isSalePrepared(item) {
const filter = {
params: {
where: { ticketFk: route.params.id },
order: ['concept ASC', 'quantity DESC'],
},
};
const { data } = await axios.get(`SaleTrackings/${route.params.id}/filter`, {
params: {
filter: JSON.stringify(filter),
},
});
const matchingSale = data.find((sale) => sale.itemFk === item.itemFk);
if (!matchingSale) {
return true;
}
if (
matchingSale.hasSaleGroupDetail ||
matchingSale.isControled ||
matchingSale.isPrepared ||
matchingSale.isPrevious ||
matchingSale.isPreviousSelected
) {
try {
await new Promise((resolve, reject) => {
quasar
.dialog({
component: VnConfirm,
componentProps: {
title: t('Item prepared'),
message: t(
'This item is already prepared. Do you want to continue?'
),
data: item,
},
})
.onOk(() => resolve(true))
.onCancel(() => reject(new Error('cancelled')));
});
} catch (error) {
tableRef.value.reload();
return false;
}
}
return true;
}
watch( watch(
() => newRow.value.itemFk, () => newRow.value.itemFk,
(newItemFk) => { (newItemFk) => {
@ -821,4 +887,6 @@ es:
You are going to delete lines of the ticket: Vas a eliminar lineas del ticket You are going to delete lines of the ticket: Vas a eliminar lineas del ticket
Add item: Añadir artículo Add item: Añadir artículo
Transfer lines: Transferir líneas Transfer lines: Transferir líneas
Item prepared: Artículo preparado
This item is already prepared. Do you want to continue?: Este artículo ya esta preparado. Desea continuar?
</i18n> </i18n>

View File

@ -72,6 +72,16 @@ const agenciesOptions = ref([]);
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput v-model="data.m3" label="m3" /> <VnInput v-model="data.m3" label="m3" />
<VnInput
:label="t('travel.basicData.daysInForward')"
v-model="data.daysInForward"
>
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip>{{ t('raidDays') }}</QTooltip>
</QIcon>
</template>
</VnInput>
</VnRow> </VnRow>
<VnRow> <VnRow>
<QCheckbox <QCheckbox
@ -86,3 +96,10 @@ const agenciesOptions = ref([]);
</template> </template>
</FormModel> </FormModel>
</template> </template>
<i18n>
es:
raidDays: Al rellenarlo, generamos una redada. Indica los días que un travel se moverá automáticamente en el tiempo
en:
raidDays: When filling, a raid is generated. Enter the number of days the travel will automatically forward in time
</i18n>

View File

@ -32,6 +32,7 @@ const filter = {
'warehouseOutFk', 'warehouseOutFk',
'cargoSupplierFk', 'cargoSupplierFk',
'agencyModeFk', 'agencyModeFk',
'daysInForward',
], ],
include: [ include: [
{ {
@ -77,6 +78,22 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
<VnLv :label="t('globals.landed')" :value="toDate(entity.landed)" /> <VnLv :label="t('globals.landed')" :value="toDate(entity.landed)" />
<VnLv :label="t('globals.totalEntries')" :value="entity.totalEntries" /> <VnLv :label="t('globals.totalEntries')" :value="entity.totalEntries" />
</template> </template>
<template #icons="{ entity }">
<QCardActions class="q-gutter-x-md">
<QIcon
v-if="entity.daysInForward"
name="vn:net"
color="primary"
size="xs"
>
<QTooltip>
{{
t('globals.raid', { daysInForward: entity.daysInForward })
}}</QTooltip
>
</QIcon>
</QCardActions>
</template>
<template #actions="{ entity }"> <template #actions="{ entity }">
<QCardActions> <QCardActions>
<QBtn <QBtn

View File

@ -303,6 +303,10 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
<VnLv :label="t('globals.reference')" :value="travel.ref" /> <VnLv :label="t('globals.reference')" :value="travel.ref" />
<VnLv label="m³" :value="travel.m3" /> <VnLv label="m³" :value="travel.m3" />
<VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" /> <VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" />
<VnLv
:label="t('travel.basicData.daysInForward')"
:value="travel?.daysInForward"
/>
</QCard> </QCard>
<QCard class="full-width"> <QCard class="full-width">
<VnTitle :text="t('travel.summary.entries')" /> <VnTitle :text="t('travel.summary.entries')" />

View File

@ -45,6 +45,10 @@ const redirectCreateEntryView = (travelData) => {
}; };
const columns = computed(() => [ const columns = computed(() => [
{
name: 'status',
columnFilter: false,
},
{ {
align: 'left', align: 'left',
name: 'id', name: 'id',
@ -221,6 +225,17 @@ const columns = computed(() => [
:is-editable="false" :is-editable="false"
:use-model="true" :use-model="true"
> >
<template #column-status="{ row }">
<div class="row">
<QIcon v-if="!!row.daysInForward" name="vn:net" color="primary">
<QTooltip>
{{
t('globals.raid', { daysInForward: row.daysInForward })
}}</QTooltip
>
</QIcon>
</div>
</template>
<template #column-shipped="{ row }"> <template #column-shipped="{ row }">
<QBadge <QBadge
text-color="black" text-color="black"

View File

@ -13,7 +13,7 @@ describe('Logout', () => {
}); });
describe('not user', () => { describe('not user', () => {
beforeEach(() => { beforeEach(() => {
cy.intercept('GET', '**DefaultViewConfigs**', { cy.intercept('GET', '**StarredModules**', {
statusCode: 401, statusCode: 401,
body: { body: {
error: { error: {
@ -29,10 +29,7 @@ describe('Logout', () => {
it('when token not exists', () => { it('when token not exists', () => {
cy.get('.q-list > [href="#/item"]').click(); cy.get('.q-list > [href="#/item"]').click();
cy.get('.q-notification__message').should( cy.checkNotification('Authorization Required');
'have.text',
'Authorization Required'
);
}); });
}); });
}); });

View File

@ -0,0 +1,120 @@
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import TicketAdvance from 'pages/Ticket/TicketAdvance.vue';
import { Notify } from 'quasar';
import { nextTick } from 'vue';
describe('TicketAdvance', () => {
let wrapper;
let vm;
beforeAll(() => {
vi.spyOn(axios, 'get').mockImplementation(() => ({ data: [] }));
wrapper = createWrapper(TicketAdvance);
vm = wrapper.vm;
vi.spyOn(vm.vnTableRef, 'reload').mockImplementation(() => vi.fn());
vm.vnTableRef.value = { params: {} };
});
beforeEach(() => {
Notify.create = vi.fn();
});
afterEach(() => {
vi.clearAllMocks();
});
describe('requestComponentUpdate()', () => {
const mockTicket = {
futureId: 1,
futureClientFk: 1,
nickname: 'test',
futureAddressFk: 1,
futureAgencyModeFk: 1,
futureWarehouseFk: 1,
futureCompanyFk: 1,
landed: '2023-01-02',
zoneFk: 1,
};
const mockParams = {
clientFk: 1,
nickname: 'test',
agencyModeFk: 1,
addressFk: 1,
zoneFk: 1,
warehouseFk: 1,
companyFk: 1,
landed: '2023-01-02',
shipped: '2023-01-01',
isDeleted: false,
isWithoutNegatives: false,
newTicket: undefined,
keepPrice: true,
};
const queryResult = 'tickets/1/componentUpdate';
it('should return query and params when ticket has no landed', async () => {
vm.vnTableRef.params.dateToAdvance = '2023-01-01';
await nextTick();
const mockLanded = { landed: '2023-01-02', zoneFk: 1 };
vi.spyOn(vm, 'getLanded').mockResolvedValue(mockLanded);
const { query, params } = await vm.requestComponentUpdate(mockTicket, false);
expect(query).toBe(queryResult);
expect(params).toEqual(mockParams);
});
it('should return query and params when ticket has landed', async () => {
const { query, params } = await vm.requestComponentUpdate(mockTicket, false);
expect(query).toBe(queryResult);
expect(params).toEqual(mockParams);
});
});
describe('moveTicketsAdvance()', () => {
it('should move tickets and notify success', async () => {
const tickets = [
{
id: 1,
futureId: 2,
futureShipped: '2023-01-01',
shipped: '2023-01-02',
workerFk: 1,
},
{
id: 2,
futureId: 3,
futureShipped: '2023-01-01',
shipped: '2023-01-02',
workerFk: 1,
},
];
vm.selectedTickets = tickets;
vi.spyOn(axios, 'post').mockResolvedValue({});
await vm.moveTicketsAdvance();
expect(axios.post).toHaveBeenCalledOnce('Tickets/merge', {
tickets: [
{
originId: 2,
destinationId: 1,
originShipped: '2023-01-01',
destinationShipped: '2023-01-02',
workerFk: 1,
},
{
originId: 3,
destinationId: 2,
originShipped: '2023-01-01',
destinationShipped: '2023-01-02',
workerFk: 1,
},
],
});
expect(vm.vnTableRef.reload).toHaveBeenCalled();
expect(Notify.create).toHaveBeenCalled();
expect(vm.selectedTickets).toEqual([]);
});
});
});

View File

@ -70,8 +70,10 @@ class FormDataMock {
vi.fn(); vi.fn();
} }
} }
global.FormData = FormDataMock; global.FormData = FormDataMock;
global.URL = class URL {}; global.URL = class URL {};
global.Date.vnNew = () => new Date(Date.UTC(2001, 0, 1, 11));
export function createWrapper(component, options) { export function createWrapper(component, options) {
const defaultOptions = { const defaultOptions = {