Merge branch '8316-parkingCardWithVnCardBeta' of https://gitea.verdnatura.es/verdnatura/salix-front into 8316-parkingCardWithVnCardBeta

This commit is contained in:
Alex Moreno 2025-01-16 07:35:27 +01:00
commit f645e8982c
19 changed files with 331 additions and 94 deletions

View File

@ -1,3 +1,82 @@
# Version 25.00 - 2025-01-14
### Added 🆕
- chore: refs #7056 move test by:jorgep
- feat: refs #7050 7050 add object check by:Jtubau
- feat: refs #7050 7050 add test to isEmpty() by:Jtubau
- feat: refs #7056 add tests in FormModel by:jorgep
- feat: refs #7056 update route meta information and add FormModel tests by:jorgep
- feat: refs #7074 tests for fns setData(), parseDms() and showFormDialog() (7074-makeFrontTestToVnDmsList) by:Jtubau
- feat: refs #7079 created VnLocation front test by:provira
- feat: refs #7189 add Accept-Language header to axios requests by:jorgep
- feat: refs #7924 add custom inspection checkbox and localization support by:jgallego
- feat: refs #7924 update custom inspection label for clarity in English and Spanish locales by:jgallego
- feat: refs #8004 enhance FetchedTags component with column support and styling updates by:pablone
- feat: refs #8004 hide rightFilter by:pablone
- feat: refs #8246 added new field in list by:Jon
- feat: refs #8266 added descriptor to item name by:jtubau
- feat: refs #8293 add zone filter by:Jtubau
- feat: refs #8293 include zone data in each record by:Jtubau
- fix: refs #8004 more list style issues by:pablone
- fix: refs #8004 some style issues on all list by:pablone
- style: refs #8004 update layout and styling in FetchedTags and ItemList components by:pablone
- style: update CustomerBalance.vue to set label color by:jgallego
### Changed 📦
- perf: order by:alexm
- perf: redirect transition list to card by:alexm
- perf: refs #8201 onDataSaved fetch by:Jon
- perf: revert processData by:alexm
- perf: simplify if by:alexm
- perf: simplify if (perf_redirectTransition) by:alexm
- refactor: item fixedPrice by:Jon
- refactor: refs #7050 refactorize by:jtubau
- refactor: refs #7050 removed blank spaces by:jtubau
- refactor: refs #7052 move EditTableCellValueForm tests to a new location and enhance test coverage by:jgallego
- refactor: refs #7052 remove unnecessary console logs from EditTableCellValueForm tests by:jgallego
- refactor: refs #7074 move dms constant to global scope by:Jtubau
- refactor: refs #7079 removed useless code by:provira
- refactor: refs #7924 simplify custom inspection icon rendering in ExtraCommunity.vue by:jgallego
- refactor: refs #8004 remove console log from CardSummary component on mount by:pablone
- refactor: refs #8004 remove consoleLogs by:pablone
- refactor: refs #8004 remove unused stateStore import in InvoiceInList.vue by:pablone
- refactor: refs #8004 remove unused travelFilterRef and chip definition in TravelList.vue by:pablone
- refactor: refs #8004 replace VnSelect with VnSelectWorker in CustomerList component by:pablone
- refactor: refs #8201 added onMounted to stablish the value to show icons by:Jon
- refactor: refs #8201 deleted condition by:Jon
- refactor: refs #8201 deleted log by:Jon
- refactor: refs #8201 deleted logs by:Jon
- refactor: refs #8266 8266 change expedition item name by:Jtubau
- refactor: refs #8266 change expedition label by:Jtubau
- refactor: refs #8293 remove redundant attributes by:Jtubau
- refactor: refs #8320 changed folder names from "specs" to "**tests**" by:provira
- refactor: refs #8320 moved front tests to their respective sections by:provira
- refactor: refs #8813 removed unused class property by:provira
### Fixed 🛠️
- fix: discount class by:PAU ROVIRA ROSALENY
- fix: duplicate transalation after test to dev by:alexm
- fix: fix translations by:carlossa
- fix: redirect to sales when confirming lines by:Jon
- fix: refs #7050 delete import added by mistake by:Jtubau
- fix: refs #7133 handleSalesModelValue function to handle empty input by:jorgep
- fix: refs #7189 update user language on sessionStorage by:jorgep
- fix: refs #7935 remove unused 'companyFk' column from InvoiceInList component by:jorgep
- fix: refs #8004 more list style issues by:pablone
- fix: refs #8004 some style issues on all list by:pablone
- fix: refs #8004 update label for daysOnward in TravelFilter component and add translations by:pablone
- fix: refs #8004 vnTable card with and add permanent labels by:pablone
- fix: refs #8201 added onDataSaved emi to refetch when cahnges are made by:Jon
- fix: refs #8201 use arrayData to fix the error by:Jon
- fix: refs #8314 space between label and value by:jtubau
- fix: refs #8813 fixed ClaimLines format by:provira
- fix: update button sizes in ExtraCommunity.vue for better visibility by:jgallego
- perf: revert processData by:alexm
- refactor: item fixedPrice by:Jon
# Version 24.52 - 2024-01-07 # Version 24.52 - 2024-01-07
### Added 🆕 ### Added 🆕

View File

@ -31,7 +31,7 @@ export default {
console.error(error); console.error(error);
} }
form.addEventListener('keyup', function (evt) { form.addEventListener('keyup', function (evt) {
if (evt.key === 'Enter') { if (evt.key === 'Enter' && !that.$attrs['prevent-submit']) {
const input = evt.target; const input = evt.target;
if (input.type == 'textarea' && evt.shiftKey) { if (input.type == 'textarea' && evt.shiftKey) {
evt.preventDefault(); evt.preventDefault();

View File

@ -0,0 +1,82 @@
import { createWrapper, axios } from 'app/test/vitest/helper';
import FilterItemForm from 'src/components/FilterItemForm.vue';
import { vi, beforeAll, describe, expect, it } from 'vitest';
describe('FilterItemForm', () => {
let vm;
let wrapper;
beforeAll(() => {
wrapper = createWrapper(FilterItemForm, {
props: {
url: 'Items/withName',
},
});
vm = wrapper.vm;
wrapper = wrapper.wrapper;
vi.spyOn(axios, 'get').mockResolvedValue({
data: [
{
id: 999996,
name: 'bolas de madera',
size: 2,
inkFk: null,
producerFk: null,
},
],
});
});
it('should filter data and populate tableRows for table display', async () => {
vm.itemFilterParams.name = 'bolas de madera';
await vm.onSubmit();
const expectedFilter = {
include: [
{ relation: 'producer', scope: { fields: ['name'] } },
{ relation: 'ink', scope: { fields: ['name'] } },
],
where: {"name":{"like":"%bolas de madera%"}},
};
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
params: { filter: JSON.stringify(expectedFilter) },
});
expect(vm.tableRows).toEqual([
{
id: 999996,
name: 'bolas de madera',
size: 2,
inkFk: null,
producerFk: null,
},
]);
});
it('should handle an empty itemFilterParams correctly', async () => {
vm.itemFilterParams.name = null;
vm.itemFilterParams = {};
await vm.onSubmit();
const expectedFilter = {
include: [
{ relation: 'producer', scope: { fields: ['name'] } },
{ relation: 'ink', scope: { fields: ['name'] } },
],
where: {},
};
expect(axios.get).toHaveBeenCalledWith('Items/withName', {
params: { filter: JSON.stringify(expectedFilter) },
});
});
it('should emit "itemSelected" with the correct id and close the form', () => {
vm.selectItem({ id: 12345 });
expect(wrapper.emitted('itemSelected')[0]).toEqual([12345]);
});
});

View File

@ -0,0 +1,72 @@
import { createWrapper } from 'app/test/vitest/helper.js';
import { describe, it, expect } from 'vitest';
import VnInputDate from 'components/common/VnInputDate.vue';
let vm;
let wrapper;
function generateWrapper(date, outlined, required) {
wrapper = createWrapper(VnInputDate, {
props: {
modelValue: date,
},
attrs: {
isOutlined: outlined,
required: required
},
});
wrapper = wrapper.wrapper;
vm = wrapper.vm;
};
describe('VnInputDate', () => {
describe('formattedDate', () => {
it('formats a valid date correctly', async () => {
generateWrapper('2023-12-25', false, false);
await vm.$nextTick();
expect(vm.formattedDate).toBe('25/12/2023');
});
it('updates the model value when a new date is set', async () => {
const input = wrapper.find('input');
await input.setValue('31/12/2023');
expect(wrapper.emitted()['update:modelValue']).toBeTruthy();
expect(wrapper.emitted()['update:modelValue'][0][0]).toBe('2023-12-31T00:00:00.000Z');
});
it('should not update the model value when an invalid date is set', async () => {
const input = wrapper.find('input');
await input.setValue('invalid-date');
expect(wrapper.emitted()['update:modelValue'][0][0]).toBe('2023-12-31T00:00:00.000Z');
});
});
describe('styleAttrs', () => {
it('should return empty styleAttrs when isOutlined is false', async () => {
generateWrapper('2023-12-25', false, false);
await vm.$nextTick();
expect(vm.styleAttrs).toEqual({});
});
it('should set styleAttrs when isOutlined is true', async () => {
generateWrapper('2023-12-25', true, false);
await vm.$nextTick();
expect(vm.styleAttrs.outlined).toBe(true);
});
});
describe('required', () => {
it('should not applies required class when isRequired is false', async () => {
generateWrapper('2023-12-25', false, false);
await vm.$nextTick();
expect(wrapper.find('.vn-input-date').classes()).not.toContain('required');
});
it('should applies required class when isRequired is true', async () => {
generateWrapper('2023-12-25', false, true);
await vm.$nextTick();
expect(wrapper.find('.vn-input-date').classes()).toContain('required');
});
});
});

View File

@ -82,7 +82,7 @@ async function fetch() {
<span v-else></span> <span v-else></span>
</slot> </slot>
<slot name="header" :entity="entity" dense> <slot name="header" :entity="entity" dense>
<VnLv :label="`${entity.id} -`" :value="entity.name" /> {{ entity.id + ' - ' + entity.name }}
</slot> </slot>
<span class="row no-wrap"> <span class="row no-wrap">
<slot name="header-right" :entity="entity" /> <slot name="header-right" :entity="entity" />

View File

@ -30,7 +30,7 @@ onBeforeMount(async () => {
.data; .data;
if (!channel) channel = defaultChannel; if (!channel) channel = defaultChannel;
phone.value = await parsePhone(props.phoneNumber, props.country.toLowerCase()); phone.value = await parsePhone(props.phoneNumber, props.country?.toLowerCase());
config[ config[
type type
].url = `${url}?customerIdentity=%2B${phone.value}&channelId=${channel}`; ].url = `${url}?customerIdentity=%2B${phone.value}&channelId=${channel}`;

View File

@ -248,12 +248,14 @@ function handleLocation(data, location) {
clearable clearable
v-model="data.longitude" v-model="data.longitude"
:decimal-places="7" :decimal-places="7"
:positive="false"
/> />
<VnInputNumber <VnInputNumber
:label="t('Latitude')" :label="t('Latitude')"
clearable clearable
v-model="data.latitude" v-model="data.latitude"
:decimal-places="7" :decimal-places="7"
:positive="false"
/> />
</VnRow> </VnRow>
<h4 class="q-mb-xs">{{ t('Notes') }}</h4> <h4 class="q-mb-xs">{{ t('Notes') }}</h4>

View File

@ -268,7 +268,7 @@ function deleteFile(dmsFk) {
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
:label="t('InvoiceIn.summary.sage')" :label="t('invoicein.summary.sage')"
v-model="data.withholdingSageFk" v-model="data.withholdingSageFk"
:options="sageWithholdings" :options="sageWithholdings"
option-value="id" option-value="id"

View File

@ -166,10 +166,10 @@ const createInvoiceInCorrection = async () => {
<InvoiceInDescriptorMenu :invoice="entity" /> <InvoiceInDescriptorMenu :invoice="entity" />
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('invoiceIn.list.issued')" :value="toDate(entity.issued)" /> <VnLv :label="t('invoicein.list.issued')" :value="toDate(entity.issued)" />
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" /> <VnLv :label="t('invoicein.summary.bookedDate')" :value="toDate(entity.booked)" />
<VnLv :label="t('invoiceIn.list.amount')" :value="toCurrency(totalAmount)" /> <VnLv :label="t('invoicein.list.amount')" :value="toCurrency(totalAmount)" />
<VnLv :label="t('invoiceIn.list.supplier')"> <VnLv :label="t('invoicein.list.supplier')">
<template #value> <template #value>
<span class="link"> <span class="link">
{{ entity?.supplier?.nickname }} {{ entity?.supplier?.nickname }}
@ -186,7 +186,7 @@ const createInvoiceInCorrection = async () => {
color="primary" color="primary"
:to="routes.getSupplier(entity.supplierFk)" :to="routes.getSupplier(entity.supplierFk)"
> >
<QTooltip>{{ t('invoiceIn.list.supplier') }}</QTooltip> <QTooltip>{{ t('invoicein.list.supplier') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
size="md" size="md"
@ -202,7 +202,7 @@ const createInvoiceInCorrection = async () => {
color="primary" color="primary"
:to="routes.getTickets(entity.supplierFk)" :to="routes.getTickets(entity.supplierFk)"
> >
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip> <QTooltip>{{ t('InvoiceOut.card.ticketList') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
v-if=" v-if="

View File

@ -33,15 +33,15 @@ const entityId = computed(() => $props.invoice.id || +currentRoute.value.params.
const invoiceIn = computed(() => arrayData.store.data); const invoiceIn = computed(() => arrayData.store.data);
const actions = { const actions = {
unbook: { unbook: {
title: t('assertAction', { action: t('InvoiceIn.descriptorMenu.unbook') }), title: t('assertAction', { action: t('invoicein.descriptorMenu.unbook') }),
action: toUnbook, action: toUnbook,
}, },
delete: { delete: {
title: t('assertAction', { action: t('InvoiceIn.descriptorMenu.delete') }), title: t('assertAction', { action: t('invoicein.descriptorMenu.delete') }),
action: deleteInvoice, action: deleteInvoice,
}, },
clone: { clone: {
title: t('assertAction', { action: t('InvoiceIn.descriptorMenu.clone') }), title: t('assertAction', { action: t('invoicein.descriptorMenu.clone') }),
action: cloneInvoice, action: cloneInvoice,
}, },
showPdf: { cb: showPdfInvoice }, showPdf: { cb: showPdfInvoice },
@ -84,7 +84,7 @@ async function deleteInvoice() {
await axios.delete(`InvoiceIns/${entityId.value}`); await axios.delete(`InvoiceIns/${entityId.value}`);
quasar.notify({ quasar.notify({
type: 'positive', type: 'positive',
message: t('InvoiceIn.descriptorMenu.invoiceDeleted'), message: t('invoicein.descriptorMenu.invoiceDeleted'),
}); });
push({ path: '/invoice-in' }); push({ path: '/invoice-in' });
} }
@ -93,7 +93,7 @@ async function cloneInvoice() {
const { data } = await axios.post(`InvoiceIns/${entityId.value}/clone`); const { data } = await axios.post(`InvoiceIns/${entityId.value}/clone`);
quasar.notify({ quasar.notify({
type: 'positive', type: 'positive',
message: t('InvoiceIn.descriptorMenu.invoiceCloned'), message: t('invoicein.descriptorMenu.invoiceCloned'),
}); });
push({ path: `/invoice-in/${data.id}/summary` }); push({ path: `/invoice-in/${data.id}/summary` });
} }
@ -144,7 +144,7 @@ function sendPdfInvoice({ address }) {
clickable clickable
@click="book(entityId)" @click="book(entityId)"
> >
<QItemSection>{{ t('InvoiceIn.descriptorMenu.toBook') }}</QItemSection> <QItemSection>{{ t('invoicein.descriptorMenu.toBook') }}</QItemSection>
</QItem> </QItem>
</template> </template>
</InvoiceInToBook> </InvoiceInToBook>
@ -155,28 +155,28 @@ function sendPdfInvoice({ address }) {
@click="triggerMenu('unbook')" @click="triggerMenu('unbook')"
> >
<QItemSection> <QItemSection>
{{ t('InvoiceIn.descriptorMenu.toUnbook') }} {{ t('invoicein.descriptorMenu.toUnbook') }}
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem <QItem
v-if="canEditProp('deleteById')" v-if="canEditProp('deleteById')"
v-ripple v-ripple
clickable clickable
@click="triggerMenu('InvoiceIn.descriptorMenu.delete')" @click="triggerMenu('invoicein.descriptorMenu.delete')"
> >
<QItemSection>{{ t('InvoiceIn.descriptorMenu.deleteInvoice') }}</QItemSection> <QItemSection>{{ t('invoicein.descriptorMenu.deleteInvoice') }}</QItemSection>
</QItem> </QItem>
<QItem v-if="canEditProp('clone')" v-ripple clickable @click="triggerMenu('clone')"> <QItem v-if="canEditProp('clone')" v-ripple clickable @click="triggerMenu('clone')">
<QItemSection>{{ t('InvoiceIn.descriptorMenu.cloneInvoice') }}</QItemSection> <QItemSection>{{ t('invoicein.descriptorMenu.cloneInvoice') }}</QItemSection>
</QItem> </QItem>
<QItem v-if="isAgricultural()" v-ripple clickable @click="triggerMenu('showPdf')"> <QItem v-if="isAgricultural()" v-ripple clickable @click="triggerMenu('showPdf')">
<QItemSection>{{ <QItemSection>{{
t('InvoiceIn.descriptorMenu.showAgriculturalPdf') t('invoicein.descriptorMenu.showAgriculturalPdf')
}}</QItemSection> }}</QItemSection>
</QItem> </QItem>
<QItem v-if="isAgricultural()" v-ripple clickable @click="triggerMenu('sendPdf')"> <QItem v-if="isAgricultural()" v-ripple clickable @click="triggerMenu('sendPdf')">
<QItemSection <QItemSection
>{{ t('InvoiceIn.descriptorMenu.sendAgriculturalPdf') }}...</QItemSection >{{ t('invoicein.descriptorMenu.sendAgriculturalPdf') }}...</QItemSection
> >
</QItem> </QItem>
<QItem <QItem
@ -186,7 +186,7 @@ function sendPdfInvoice({ address }) {
@click="triggerMenu('correct')" @click="triggerMenu('correct')"
> >
<QItemSection <QItemSection
>{{ t('InvoiceIn.descriptorMenu.createCorrective') }}...</QItemSection >{{ t('invoicein.descriptorMenu.createCorrective') }}...</QItemSection
> >
</QItem> </QItem>
<QItem v-if="invoice.dmsFk" v-ripple clickable @click="downloadFile(invoice.dmsFk)"> <QItem v-if="invoice.dmsFk" v-ripple clickable @click="downloadFile(invoice.dmsFk)">

View File

@ -27,14 +27,14 @@ const intrastatTotals = ref({ amount: 0, net: 0, stems: 0 });
const vatColumns = ref([ const vatColumns = ref([
{ {
name: 'expense', name: 'expense',
label: 'InvoiceIn.summary.expense', label: 'invoicein.summary.expense',
field: (row) => row.expenseFk, field: (row) => row.expenseFk,
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
{ {
name: 'landed', name: 'landed',
label: 'InvoiceIn.summary.taxableBase', label: 'invoicein.summary.taxableBase',
field: (row) => row.taxableBase, field: (row) => row.taxableBase,
format: (value) => toCurrency(value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
@ -42,7 +42,7 @@ const vatColumns = ref([
}, },
{ {
name: 'vat', name: 'vat',
label: 'InvoiceIn.summary.sageVat', label: 'invoicein.summary.sageVat',
field: (row) => { field: (row) => {
if (row.taxTypeSage) return `#${row.taxTypeSage.id} : ${row.taxTypeSage.vat}`; if (row.taxTypeSage) return `#${row.taxTypeSage.id} : ${row.taxTypeSage.vat}`;
}, },
@ -52,7 +52,7 @@ const vatColumns = ref([
}, },
{ {
name: 'transaction', name: 'transaction',
label: 'InvoiceIn.summary.sageTransaction', label: 'invoicein.summary.sageTransaction',
field: (row) => { field: (row) => {
if (row.transactionTypeSage) if (row.transactionTypeSage)
return `#${row.transactionTypeSage.id} : ${row.transactionTypeSage?.transaction}`; return `#${row.transactionTypeSage.id} : ${row.transactionTypeSage?.transaction}`;
@ -63,7 +63,7 @@ const vatColumns = ref([
}, },
{ {
name: 'rate', name: 'rate',
label: 'InvoiceIn.summary.rate', label: 'invoicein.summary.rate',
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate), field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
format: (value) => toCurrency(value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
@ -71,7 +71,7 @@ const vatColumns = ref([
}, },
{ {
name: 'currency', name: 'currency',
label: 'InvoiceIn.summary.currency', label: 'invoicein.summary.currency',
field: (row) => row.foreignValue, field: (row) => row.foreignValue,
format: (val) => val && toCurrency(val, currency.value), format: (val) => val && toCurrency(val, currency.value),
sortable: true, sortable: true,
@ -82,21 +82,21 @@ const vatColumns = ref([
const dueDayColumns = ref([ const dueDayColumns = ref([
{ {
name: 'date', name: 'date',
label: 'InvoiceIn.summary.dueDay', label: 'invoicein.summary.dueDay',
field: (row) => toDate(row.dueDated), field: (row) => toDate(row.dueDated),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
{ {
name: 'bank', name: 'bank',
label: 'InvoiceIn.summary.bank', label: 'invoicein.summary.bank',
field: (row) => row.bank.bank, field: (row) => row.bank.bank,
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
{ {
name: 'amount', name: 'amount',
label: 'InvoiceIn.list.amount', label: 'invoicein.list.amount',
field: (row) => row.amount, field: (row) => row.amount,
format: (value) => toCurrency(value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
@ -104,7 +104,7 @@ const dueDayColumns = ref([
}, },
{ {
name: 'landed', name: 'landed',
label: 'InvoiceIn.summary.foreignValue', label: 'invoicein.summary.foreignValue',
field: (row) => row.foreignValue, field: (row) => row.foreignValue,
format: (val) => val && toCurrency(val, currency.value), format: (val) => val && toCurrency(val, currency.value),
sortable: true, sortable: true,
@ -115,7 +115,7 @@ const dueDayColumns = ref([
const intrastatColumns = ref([ const intrastatColumns = ref([
{ {
name: 'code', name: 'code',
label: 'InvoiceIn.summary.code', label: 'invoicein.summary.code',
field: (row) => { field: (row) => {
return `${row.intrastat.id}: ${row.intrastat?.description}`; return `${row.intrastat.id}: ${row.intrastat?.description}`;
}, },
@ -124,21 +124,21 @@ const intrastatColumns = ref([
}, },
{ {
name: 'amount', name: 'amount',
label: 'InvoiceIn.list.amount', label: 'invoicein.list.amount',
field: (row) => toCurrency(row.amount), field: (row) => toCurrency(row.amount),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
{ {
name: 'net', name: 'net',
label: 'InvoiceIn.summary.net', label: 'invoicein.summary.net',
field: (row) => row.net, field: (row) => row.net,
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
{ {
name: 'stems', name: 'stems',
label: 'InvoiceIn.summary.stems', label: 'invoicein.summary.stems',
field: (row) => row.stems, field: (row) => row.stems,
format: (value) => value, format: (value) => value,
sortable: true, sortable: true,
@ -146,7 +146,7 @@ const intrastatColumns = ref([
}, },
{ {
name: 'landed', name: 'landed',
label: 'InvoiceIn.summary.country', label: 'invoicein.summary.country',
field: (row) => row.country?.code, field: (row) => row.country?.code,
format: (value) => value, format: (value) => value,
sortable: true, sortable: true,
@ -214,7 +214,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
/> />
</QCardSection> </QCardSection>
<VnLv <VnLv
:label="t('InvoiceIn.list.supplier')" :label="t('invoicein.list.supplier')"
:value="entity.supplier?.name" :value="entity.supplier?.name"
> >
<template #value> <template #value>
@ -225,14 +225,14 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv
:label="t('InvoiceIn.list.supplierRef')" :label="t('invoicein.list.supplierRef')"
:value="entity.supplierRef" :value="entity.supplierRef"
/> />
<VnLv <VnLv
:label="t('InvoiceIn.summary.currency')" :label="t('invoicein.summary.currency')"
:value="entity.currency?.code" :value="entity.currency?.code"
/> />
<VnLv :label="t('InvoiceIn.serial')" :value="`${entity.serial}`" /> <VnLv :label="t('invoicein.serial')" :value="`${entity.serial}`" />
<VnLv <VnLv
:label="t('globals.country')" :label="t('globals.country')"
:value="entity.supplier?.country?.code" :value="entity.supplier?.country?.code"
@ -247,19 +247,19 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QCardSection> </QCardSection>
<VnLv <VnLv
:ellipsis-value="false" :ellipsis-value="false"
:label="t('InvoiceIn.summary.issued')" :label="t('invoicein.summary.issued')"
:value="toDate(entity.issued)" :value="toDate(entity.issued)"
/> />
<VnLv <VnLv
:label="t('InvoiceIn.summary.operated')" :label="t('invoicein.summary.operated')"
:value="toDate(entity.operated)" :value="toDate(entity.operated)"
/> />
<VnLv <VnLv
:label="t('InvoiceIn.summary.bookEntried')" :label="t('invoicein.summary.bookEntried')"
:value="toDate(entity.bookEntried)" :value="toDate(entity.bookEntried)"
/> />
<VnLv <VnLv
:label="t('InvoiceIn.summary.bookedDate')" :label="t('invoicein.summary.bookedDate')"
:value="toDate(entity.booked)" :value="toDate(entity.booked)"
/> />
<VnLv :label="t('globals.isVies')" :value="entity.supplier?.isVies" /> <VnLv :label="t('globals.isVies')" :value="entity.supplier?.isVies" />
@ -272,18 +272,18 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
/> />
</QCardSection> </QCardSection>
<VnLv <VnLv
:label="t('InvoiceIn.summary.sage')" :label="t('invoicein.summary.sage')"
:value="entity.sageWithholding?.withholding" :value="entity.sageWithholding?.withholding"
/> />
<VnLv <VnLv
:label="t('InvoiceIn.summary.vat')" :label="t('invoicein.summary.vat')"
:value="entity.expenseDeductible?.name" :value="entity.expenseDeductible?.name"
/> />
<VnLv <VnLv
:label="t('InvoiceIn.card.company')" :label="t('invoicein.card.company')"
:value="entity.company?.code" :value="entity.company?.code"
/> />
<VnLv :label="t('InvoiceIn.isBooked')" :value="invoiceIn?.isBooked" /> <VnLv :label="t('invoicein.isBooked')" :value="invoiceIn?.isBooked" />
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<QCardSection class="q-pa-none"> <QCardSection class="q-pa-none">
@ -294,11 +294,11 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QCardSection> </QCardSection>
<QCardSection class="q-pa-none"> <QCardSection class="q-pa-none">
<VnLv <VnLv
:label="t('InvoiceIn.summary.taxableBase')" :label="t('invoicein.summary.taxableBase')"
:value="toCurrency(entity.totals.totalTaxableBase)" :value="toCurrency(entity.totals.totalTaxableBase)"
/> />
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" /> <VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
<VnLv :label="t('InvoiceIn.summary.dueTotal')"> <VnLv :label="t('invoicein.summary.dueTotal')">
<template #value> <template #value>
<QChip <QChip
dense dense
@ -306,8 +306,8 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
:color="amountsNotMatch ? 'negative' : 'transparent'" :color="amountsNotMatch ? 'negative' : 'transparent'"
:title=" :title="
amountsNotMatch amountsNotMatch
? t('InvoiceIn.summary.noMatch') ? t('invoicein.summary.noMatch')
: t('InvoiceIn.summary.dueTotal') : t('invoicein.summary.dueTotal')
" "
> >
{{ toCurrency(entity.totals.totalDueDay) }} {{ toCurrency(entity.totals.totalDueDay) }}
@ -318,7 +318,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QCard> </QCard>
<!--Vat--> <!--Vat-->
<QCard v-if="entity.invoiceInTax.length" class="vat"> <QCard v-if="entity.invoiceInTax.length" class="vat">
<VnTitle :url="getLink('vat')" :text="t('InvoiceIn.card.vat')" /> <VnTitle :url="getLink('vat')" :text="t('invoicein.card.vat')" />
<QTable <QTable
:columns="vatColumns" :columns="vatColumns"
:rows="entity.invoiceInTax" :rows="entity.invoiceInTax"
@ -366,7 +366,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QCard> </QCard>
<!--Due Day--> <!--Due Day-->
<QCard v-if="entity.invoiceInDueDay.length" class="due-day"> <QCard v-if="entity.invoiceInDueDay.length" class="due-day">
<VnTitle :url="getLink('due-day')" :text="t('InvoiceIn.card.dueDay')" /> <VnTitle :url="getLink('due-day')" :text="t('invoicein.card.dueDay')" />
<QTable :columns="dueDayColumns" :rows="entity.invoiceInDueDay" flat> <QTable :columns="dueDayColumns" :rows="entity.invoiceInDueDay" flat>
<template #header="dueDayProps"> <template #header="dueDayProps">
<QTr :props="dueDayProps" class="bg"> <QTr :props="dueDayProps" class="bg">
@ -404,7 +404,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QCard v-if="entity.invoiceInIntrastat.length"> <QCard v-if="entity.invoiceInIntrastat.length">
<VnTitle <VnTitle
:url="getLink('intrastat')" :url="getLink('intrastat')"
:text="t('InvoiceIn.card.intrastat')" :text="t('invoicein.card.intrastat')"
/> />
<QTable <QTable
:columns="intrastatColumns" :columns="intrastatColumns"

View File

@ -83,7 +83,7 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
</template> </template>
</VnSelect> </VnSelect>
<VnInput <VnInput
:label="t('InvoiceIn.list.supplierRef')" :label="t('invoicein.list.supplierRef')"
v-model="data.supplierRef" v-model="data.supplierRef"
/> />
</VnRow> </VnRow>
@ -97,10 +97,10 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
map-options map-options
hide-selected hide-selected
:required="true" :required="true"
:rules="validate('InvoiceIn.companyFk')" :rules="validate('invoicein.companyFk')"
/> />
<VnInputDate <VnInputDate
:label="t('InvoiceIn.summary.issued')" :label="t('invoicein.summary.issued')"
v-model="data.issued" v-model="data.issued"
/> />
</VnRow> </VnRow>

View File

@ -164,7 +164,7 @@ function handleDaysAgo(params, daysAgo) {
<QItem> <QItem>
<QItemSection> <QItemSection>
<QCheckbox <QCheckbox
:label="$t('InvoiceIn.isBooked')" :label="$t('invoicein.isBooked')"
v-model="params.isBooked" v-model="params.isBooked"
@update:model-value="searchFn()" @update:model-value="searchFn()"
toggle-indeterminate toggle-indeterminate

View File

@ -26,7 +26,7 @@ const cols = computed(() => [
{ {
align: 'left', align: 'left',
name: 'isBooked', name: 'isBooked',
label: t('InvoiceIn.isBooked'), label: t('invoicein.isBooked'),
columnFilter: false, columnFilter: false,
}, },
{ {
@ -41,7 +41,7 @@ const cols = computed(() => [
{ {
align: 'left', align: 'left',
name: 'supplierFk', name: 'supplierFk',
label: t('InvoiceIn.list.supplier'), label: t('invoicein.list.supplier'),
columnFilter: { columnFilter: {
component: 'select', component: 'select',
attrs: { attrs: {
@ -55,16 +55,16 @@ const cols = computed(() => [
{ {
align: 'left', align: 'left',
name: 'supplierRef', name: 'supplierRef',
label: t('InvoiceIn.list.supplierRef'), label: t('invoicein.list.supplierRef'),
}, },
{ {
align: 'left', align: 'left',
name: 'serial', name: 'serial',
label: t('InvoiceIn.serial'), label: t('invoicein.serial'),
}, },
{ {
align: 'left', align: 'left',
label: t('InvoiceIn.list.issued'), label: t('invoicein.list.issued'),
name: 'issued', name: 'issued',
component: null, component: null,
columnFilter: { columnFilter: {
@ -74,7 +74,7 @@ const cols = computed(() => [
}, },
{ {
align: 'left', align: 'left',
label: t('InvoiceIn.list.dueDated'), label: t('invoicein.list.dueDated'),
name: 'dueDated', name: 'dueDated',
component: null, component: null,
columnFilter: { columnFilter: {
@ -86,12 +86,12 @@ const cols = computed(() => [
{ {
align: 'left', align: 'left',
name: 'awbCode', name: 'awbCode',
label: t('InvoiceIn.list.awb'), label: t('invoicein.list.awb'),
}, },
{ {
align: 'left', align: 'left',
name: 'amount', name: 'amount',
label: t('InvoiceIn.list.amount'), label: t('invoicein.list.amount'),
format: ({ amount }) => toCurrency(amount), format: ({ amount }) => toCurrency(amount),
cardVisible: true, cardVisible: true,
}, },
@ -182,7 +182,7 @@ const cols = computed(() => [
</template> </template>
</VnSelect> </VnSelect>
<VnInput <VnInput
:label="t('InvoiceIn.list.supplierRef')" :label="t('invoicein.list.supplierRef')"
v-model="data.supplierRef" v-model="data.supplierRef"
/> />
<VnSelect <VnSelect
@ -194,7 +194,7 @@ const cols = computed(() => [
option-label="code" option-label="code"
:required="true" :required="true"
/> />
<VnInputDate :label="t('InvoiceIn.summary.issued')" v-model="data.issued" /> <VnInputDate :label="t('invoicein.summary.issued')" v-model="data.issued" />
</template> </template>
</VnTable> </VnTable>
</template> </template>

View File

@ -1,4 +1,4 @@
InvoiceIn: invoicein:
serial: Serial serial: Serial
isBooked: Is booked isBooked: Is booked
list: list:
@ -66,7 +66,6 @@ InvoiceIn:
search: Id or supplier name search: Id or supplier name
correctedFk: Corrected correctedFk: Corrected
isBooked: Is booked isBooked: Is booked
invoicein:
params:
account: Ledger account account: Ledger account
correctingFk: Rectificative correctingFk: Rectificative

View File

@ -1,4 +1,4 @@
InvoiceIn: invoicein:
serial: Serie serial: Serie
isBooked: Contabilizada isBooked: Contabilizada
list: list:
@ -63,7 +63,6 @@ InvoiceIn:
params: params:
search: Id o nombre proveedor search: Id o nombre proveedor
correctedFk: Rectificada correctedFk: Rectificada
invoicein:
params:
account: Cuenta contable account: Cuenta contable
correctingFk: Rectificativa correctingFk: Rectificativa

View File

@ -355,7 +355,7 @@ watchEffect(selectedRows);
<VnSelect <VnSelect
url="InvoiceOutSerials" url="InvoiceOutSerials"
v-model="data.serial" v-model="data.serial"
:label="t('InvoiceIn.serial')" :label="t('invoicein.serial')"
:options="invoiceOutSerialsOptions" :options="invoiceOutSerialsOptions"
option-label="description" option-label="description"
option-value="code" option-value="code"

View File

@ -213,9 +213,9 @@ async function handleConfirm() {
type: 'positive', type: 'positive',
}); });
router.push({ router.push({
name: 'TicketList', name: 'TicketSale',
query: { query: {
table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }), table: JSON.stringify({ id: route.params.id }),
}, },
}); });
} }

View File

@ -7,7 +7,14 @@ import useNotify from 'src/composables/useNotify.js';
import axios from 'axios'; import axios from 'axios';
const { notify } = useNotify(); const { notify } = useNotify();
const initInvoicing = {
invoicing: false,
nRequests: 0,
nPdfs: 0,
totalPdfs: 0,
addressIndex: 0,
errors: [],
};
export const useInvoiceOutGlobalStore = defineStore({ export const useInvoiceOutGlobalStore = defineStore({
id: 'invoiceOutGlobal', id: 'invoiceOutGlobal',
state: () => ({ state: () => ({
@ -23,16 +30,11 @@ export const useInvoiceOutGlobalStore = defineStore({
addresses: [], addresses: [],
minInvoicingDate: null, minInvoicingDate: null,
parallelism: null, parallelism: null,
invoicing: false,
isInvoicing: false,
status: null, status: null,
addressIndex: 0,
errors: [],
printer: null, printer: null,
nRequests: 0,
nPdfs: 0,
totalPdfs: 0,
formData: null, formData: null,
...initInvoicing,
}), }),
actions: { actions: {
async init() { async init() {
@ -117,12 +119,13 @@ export const useInvoiceOutGlobalStore = defineStore({
); );
throw new Error("There aren't addresses to invoice"); throw new Error("There aren't addresses to invoice");
} }
this.invoicing = false;
this.status = 'invoicing';
this.formData = formData; this.formData = formData;
this.addressIndex = 0; this.status = 'invoicing';
this.errors = []; //reset data
await this.invoiceClient(); for (const key in initInvoicing) {
this[key] = initInvoicing[key];
}
this.invoiceClient();
} catch (err) { } catch (err) {
this.handleError(err); this.handleError(err);
} }
@ -184,7 +187,6 @@ export const useInvoiceOutGlobalStore = defineStore({
async invoiceClient() { async invoiceClient() {
if (this.invoicing || this.nRequests >= this.parallelism) return; if (this.invoicing || this.nRequests >= this.parallelism) return;
const address = this.addresses[this.addressIndex]; const address = this.addresses[this.addressIndex];
if (!address || !this.status || this.status == 'stopping') { if (!address || !this.status || this.status == 'stopping') {
this.status = 'stopping'; this.status = 'stopping';
this.invoicing = false; this.invoicing = false;
@ -192,6 +194,7 @@ export const useInvoiceOutGlobalStore = defineStore({
} }
try { try {
this.invoicing = true; this.invoicing = true;
this.nRequests++;
const params = { const params = {
clientId: address.clientId, clientId: address.clientId,
addressId: address.id, addressId: address.id,
@ -215,6 +218,7 @@ export const useInvoiceOutGlobalStore = defineStore({
} }
} finally { } finally {
this.invoicing = false; this.invoicing = false;
this.nRequests--;
this.addressIndex++; this.addressIndex++;
this.invoiceClient(); this.invoiceClient();
} }