forked from verdnatura/salix-front
feat: refs #7346 add seriaType option
This commit is contained in:
parent
895441a8e4
commit
06c0f49128
|
@ -20,20 +20,18 @@ const { initialDataLoading, formInitialData, invoicing, status } =
|
||||||
const { makeInvoice, setStatusValue } = invoiceOutGlobalStore;
|
const { makeInvoice, setStatusValue } = invoiceOutGlobalStore;
|
||||||
|
|
||||||
const clientsToInvoice = ref('all');
|
const clientsToInvoice = ref('all');
|
||||||
|
|
||||||
const companiesOptions = ref([]);
|
const companiesOptions = ref([]);
|
||||||
|
|
||||||
const printersOptions = ref([]);
|
const printersOptions = ref([]);
|
||||||
|
|
||||||
const clientsOptions = ref([]);
|
const clientsOptions = ref([]);
|
||||||
|
const serialTypesOptions = ref([]);
|
||||||
const formData = ref({});
|
const formData = ref({});
|
||||||
|
|
||||||
const optionsInitialData = computed(() => {
|
const optionsInitialData = computed(() => {
|
||||||
return (
|
return (
|
||||||
companiesOptions.value.length > 0 &&
|
companiesOptions.value.length > 0 &&
|
||||||
printersOptions.value.length > 0 &&
|
printersOptions.value.length > 0 &&
|
||||||
clientsOptions.value.length > 0
|
clientsOptions.value.length > 0 &&
|
||||||
|
serialTypesOptions.value.length > 0
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,7 +58,22 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
<FetchData url="Printers" @on-fetch="(data) => (printersOptions = data)" auto-load />
|
<FetchData url="Printers" @on-fetch="(data) => (printersOptions = data)" auto-load />
|
||||||
<FetchData url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load />
|
<FetchData url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load />
|
||||||
|
<FetchData
|
||||||
|
url="invoiceOutSerials"
|
||||||
|
@on-fetch="
|
||||||
|
(data) => {
|
||||||
|
const uniqueTypes = new Set();
|
||||||
|
serialTypesOptions = data.filter((item) => {
|
||||||
|
if (item.type === null || uniqueTypes.has(item.type)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
uniqueTypes.add(item.type);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
<QForm
|
<QForm
|
||||||
v-if="!initialDataLoading && optionsInitialData"
|
v-if="!initialDataLoading && optionsInitialData"
|
||||||
@submit="makeInvoice(formData, clientsToInvoice)"
|
@submit="makeInvoice(formData, clientsToInvoice)"
|
||||||
|
@ -95,6 +108,17 @@ onMounted(async () => {
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
/>
|
/>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('invoiceOutSerialType')"
|
||||||
|
v-model="formData.invoiceType"
|
||||||
|
:options="serialTypesOptions"
|
||||||
|
option-value="type"
|
||||||
|
option-label="type"
|
||||||
|
hide-selected
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
/>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
v-model="formData.invoiceDate"
|
v-model="formData.invoiceDate"
|
||||||
:label="t('invoiceDate')"
|
:label="t('invoiceDate')"
|
||||||
|
@ -168,6 +192,7 @@ en:
|
||||||
printer: Printer
|
printer: Printer
|
||||||
invoiceOut: Invoice out
|
invoiceOut: Invoice out
|
||||||
client: Client
|
client: Client
|
||||||
|
invoiceOutSerialType: Serial Type
|
||||||
stop: Stop
|
stop: Stop
|
||||||
|
|
||||||
es:
|
es:
|
||||||
|
@ -179,5 +204,6 @@ es:
|
||||||
printer: Impresora
|
printer: Impresora
|
||||||
invoiceOut: Facturar
|
invoiceOut: Facturar
|
||||||
client: Cliente
|
client: Cliente
|
||||||
|
invoiceOutSerialType: Tipo de Serie
|
||||||
stop: Parar
|
stop: Parar
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -198,7 +198,7 @@ watchEffect(selectedRows);
|
||||||
:url="`${MODEL}/filter`"
|
:url="`${MODEL}/filter`"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'InvoiceOuts/createManualInvoice',
|
urlCreate: 'InvoiceOuts/createManualInvoice',
|
||||||
title: t('Create Manual Invoice'),
|
title: t('Create manual invoice'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {
|
formInitialData: {
|
||||||
active: true,
|
active: true,
|
||||||
|
@ -275,10 +275,12 @@ en:
|
||||||
fileAllowed: Successful download of CSV file
|
fileAllowed: Successful download of CSV file
|
||||||
youCanSearchByInvoiceReference: You can search by invoice reference
|
youCanSearchByInvoiceReference: You can search by invoice reference
|
||||||
createInvoice: Make invoice
|
createInvoice: Make invoice
|
||||||
|
Create manual invoice: Create manual invoice
|
||||||
es:
|
es:
|
||||||
searchInvoice: Buscar factura emitida
|
searchInvoice: Buscar factura emitida
|
||||||
fileDenied: El navegador denegó la descarga de archivos...
|
fileDenied: El navegador denegó la descarga de archivos...
|
||||||
fileAllowed: Descarga exitosa de archivo CSV
|
fileAllowed: Descarga exitosa de archivo CSV
|
||||||
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
||||||
createInvoice: Crear factura
|
createInvoice: Crear factura
|
||||||
|
Create manual invoice: Crear factura manual
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -19,6 +19,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
||||||
maxShipped: null,
|
maxShipped: null,
|
||||||
clientId: null,
|
clientId: null,
|
||||||
printer: null,
|
printer: null,
|
||||||
|
invoiceType: null,
|
||||||
},
|
},
|
||||||
addresses: [],
|
addresses: [],
|
||||||
minInvoicingDate: null,
|
minInvoicingDate: null,
|
||||||
|
@ -100,6 +101,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
||||||
maxShipped: new Date(formData.maxShipped),
|
maxShipped: new Date(formData.maxShipped),
|
||||||
clientId: formData.clientId ? formData.clientId : null,
|
clientId: formData.clientId ? formData.clientId : null,
|
||||||
companyFk: formData.companyFk,
|
companyFk: formData.companyFk,
|
||||||
|
invoiceType: formData.invoiceType,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.validateMakeInvoceParams(params, clientsToInvoice);
|
this.validateMakeInvoceParams(params, clientsToInvoice);
|
||||||
|
@ -152,7 +154,13 @@ export const useInvoiceOutGlobalStore = defineStore({
|
||||||
);
|
);
|
||||||
throw new Error('Invoice date in the future');
|
throw new Error('Invoice date in the future');
|
||||||
}
|
}
|
||||||
|
if (!params.invoiceType) {
|
||||||
|
notify(
|
||||||
|
'invoiceOut.globalInvoices.errors.chooseValidinvoiceType',
|
||||||
|
'negative'
|
||||||
|
);
|
||||||
|
throw new Error('Invalid Serial Type');
|
||||||
|
}
|
||||||
if (!params.companyFk) {
|
if (!params.companyFk) {
|
||||||
notify('invoiceOut.globalInvoices.errors.chooseValidCompany', 'negative');
|
notify('invoiceOut.globalInvoices.errors.chooseValidCompany', 'negative');
|
||||||
throw new Error('Invalid company');
|
throw new Error('Invalid company');
|
||||||
|
@ -180,6 +188,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
||||||
invoiceDate: new Date(formData.invoiceDate),
|
invoiceDate: new Date(formData.invoiceDate),
|
||||||
maxShipped: new Date(formData.maxShipped),
|
maxShipped: new Date(formData.maxShipped),
|
||||||
companyFk: formData.companyFk,
|
companyFk: formData.companyFk,
|
||||||
|
invoiceType: formData.invoiceType,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.status = 'invoicing';
|
this.status = 'invoicing';
|
||||||
|
|
Loading…
Reference in New Issue