feat: refs #7346 address ordered
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javi Gallego 2024-11-12 07:28:51 +01:00
parent 4e957ed8a7
commit 76e35cc758
1 changed files with 139 additions and 33 deletions

View File

@ -31,17 +31,24 @@ const MODEL = 'InvoiceOuts';
const { openReport } = usePrintService(); const { openReport } = usePrintService();
const addressOptions = ref([]); const addressOptions = ref([]);
const selectedOption = ref('ticket'); const selectedOption = ref('ticket');
async function fetchClientAddress(id) { async function fetchClientAddress(id) {
const { data } = await axios.get(`Clients/${id}/addresses`); const { data } = await axios.get(
`Clients/${id}/addresses?filter[order]=isActive DESC`
);
addressOptions.value = data; addressOptions.value = data;
} }
const exprBuilder = (_, value) => {
return {
or: [{ code: value }, { description: { like: `%${value}%` } }],
};
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'center', align: 'center',
name: 'id', name: 'id',
label: t('invoiceOutList.tableVisibleColumns.id'), label: t('invoice id'),
chip: { condition: () => true }, chip: { condition: () => true },
isId: true, isId: true,
columnFilter: { name: 'search' }, columnFilter: { name: 'search' },
@ -49,7 +56,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'ref', name: 'ref',
label: t('invoiceOutList.tableVisibleColumns.ref'), label: t('invoiceOut.list.ref'),
isTitle: true, isTitle: true,
component: 'select', component: 'select',
attrs: { url: MODEL, optionLabel: 'ref', optionValue: 'id' }, attrs: { url: MODEL, optionLabel: 'ref', optionValue: 'id' },
@ -57,8 +64,8 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'Issued', name: 'issued',
label: t('invoiceOutList.tableVisibleColumns.issued'), label: t('invoiceOut.list.issued'),
component: 'date', component: 'date',
format: (row) => toDate(row.issued), format: (row) => toDate(row.issued),
columnField: { component: null }, columnField: { component: null },
@ -66,7 +73,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'clientFk', name: 'clientFk',
label: t('invoiceOutModule.customer'), label: t('invoiceOut.list.client'),
cardVisible: true, cardVisible: true,
component: 'select', component: 'select',
attrs: { url: 'Clients', fields: ['id', 'name'] }, attrs: { url: 'Clients', fields: ['id', 'name'] },
@ -75,7 +82,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'companyCode', name: 'companyCode',
label: t('invoiceOutModule.company'), label: t('invoiceOut.list.company'),
cardVisible: true, cardVisible: true,
component: 'select', component: 'select',
attrs: { url: 'Companies', optionLabel: 'code', optionValue: 'id' }, attrs: { url: 'Companies', optionLabel: 'code', optionValue: 'id' },
@ -84,14 +91,14 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'amount', name: 'amount',
label: t('invoiceOutModule.amount'), label: t('invoiceOut.list.amount'),
cardVisible: true, cardVisible: true,
format: (row) => toCurrency(row.amount), format: (row) => toCurrency(row.amount),
}, },
{ {
align: 'left', align: 'left',
name: 'created', name: 'created',
label: t('invoiceOutList.tableVisibleColumns.created'), label: t('invoiceOut.list.created'),
component: 'date', component: 'date',
columnField: { component: null }, columnField: { component: null },
format: (row) => toDate(row.created), format: (row) => toDate(row.created),
@ -99,7 +106,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'dued', name: 'dued',
label: t('invoiceOutList.tableVisibleColumns.dueDate'), label: t('invoiceOut.list.dued'),
component: 'date', component: 'date',
columnField: { component: null }, columnField: { component: null },
format: (row) => toDate(row.dued), format: (row) => toDate(row.dued),
@ -109,12 +116,12 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('components.smartCard.viewSummary'), title: t('view summary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, InvoiceOutSummary), action: (row) => viewSummary(row.id, InvoiceOutSummary),
}, },
{ {
title: t('DownloadPdf'), title: t('download pdf'),
icon: 'vn:ticket', icon: 'vn:ticket',
isPrimary: true, isPrimary: true,
action: (row) => openPdf(row.id), action: (row) => openPdf(row.id),
@ -163,8 +170,8 @@ watchEffect(selectedRows);
<template> <template>
<VnSearchbar <VnSearchbar
:info="t('youCanSearchByInvoiceReference')" :info="t('you can search by invoice reference')"
:label="t('searchInvoice')" :label="t('search invoice')"
data-key="invoiceOut" data-key="invoiceOut"
/> />
<RightMenu> <RightMenu>
@ -180,7 +187,7 @@ watchEffect(selectedRows);
@click="downloadPdf()" @click="downloadPdf()"
:disable="!hasSelectedCards" :disable="!hasSelectedCards"
> >
<QTooltip>{{ t('globals.downloadPdf') }}</QTooltip> <QTooltip>{{ t('download pdf') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
@ -190,7 +197,7 @@ watchEffect(selectedRows);
:url="`${MODEL}/filter`" :url="`${MODEL}/filter`"
:create="{ :create="{
urlCreate: 'InvoiceOuts/createManualInvoice', urlCreate: 'InvoiceOuts/createManualInvoice',
title: t('createManualInvoice'), title: t('create manual invoice'),
onDataSaved: ({ id }) => tableRef.redirect(id), onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: { active: true }, formInitialData: { active: true },
}" }"
@ -240,7 +247,21 @@ watchEffect(selectedRows);
option-value="id" option-value="id"
@update:model-value="fetchClientAddress" @update:model-value="fetchClientAddress"
style="flex: 1" style="flex: 1"
/> >
<template #option="scope">
<QItem
v-bind="scope.itemProps"
@click="selectedClient(scope.opt)"
>
<QItemSection>
<QItemLabel>
#{{ scope.opt?.id }} -
{{ scope.opt?.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnRow> </VnRow>
<VnRow fixed> <VnRow fixed>
<VnRadio <VnRadio
@ -263,7 +284,21 @@ watchEffect(selectedRows);
option-value="id" option-value="id"
@update:model-value="fetchClientAddress" @update:model-value="fetchClientAddress"
:disable="selectedOption !== 'consignatario'" :disable="selectedOption !== 'consignatario'"
/> >
<template #option="scope">
<QItem
v-bind="scope.itemProps"
@click="selectedClient(scope.opt)"
>
<QItemSection>
<QItemLabel>
#{{ scope.opt?.id }} -
{{ scope.opt?.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</div> </div>
<div class="col"> <div class="col">
<VnSelect <VnSelect
@ -276,7 +311,52 @@ watchEffect(selectedRows);
!data.clientFk || !data.clientFk ||
selectedOption !== 'consignatario' selectedOption !== 'consignatario'
" "
/> >
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel
:class="{
'color-vn-label':
!scope.opt?.isActive,
}"
>
{{
`${
!scope.opt?.isActive
? t(
'basicData.inactive'
)
: ''
} `
}}
<span>
{{
scope.opt?.nickname
}}</span
>
<span
v-if="
scope.opt?.province ||
scope.opt?.city ||
scope.opt?.street
"
>, {{ scope.opt?.street }},
{{ scope.opt?.city }},
{{
scope.opt?.province?.name
}}
-
{{
scope.opt?.agencyMode
?.name
}}</span
>
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</div> </div>
</div> </div>
</VnRow> </VnRow>
@ -287,31 +367,36 @@ watchEffect(selectedRows);
<VnSelect <VnSelect
url="InvoiceOutSerials" url="InvoiceOutSerials"
v-model="data.serial" v-model="data.serial"
:label=" :label="t('invoice serial')"
t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')
"
:options="invoiceOutSerialsOptions" :options="invoiceOutSerialsOptions"
option-label="description" option-label="description"
option-value="code" option-value="code"
/> option-filter
<VnInputDate :expr-builder="exprBuilder"
:label="t('invoiceOutList.tableVisibleColumns.dueDate')" >
v-model="data.maxShipped" <template #option="scope">
/> <QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.code }} -
{{ scope.opt?.description }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnInputDate :label="t('due date')" v-model="data.maxShipped" />
</VnRow> </VnRow>
<VnRow class="row q-col-gutter-xs"> <VnRow class="row q-col-gutter-xs">
<VnSelect <VnSelect
url="TaxAreas" url="TaxAreas"
v-model="data.taxArea" v-model="data.taxArea"
:label="t('invoiceOutList.tableVisibleColumns.taxArea')" :label="t('tax area')"
:options="taxAreasOptions" :options="taxAreasOptions"
option-label="code" option-label="code"
option-value="code" option-value="code"
/> />
<VnInput <VnInput v-model="data.reference" :label="t('reference')" />
v-model="data.reference"
:label="t('invoiceOutList.tableVisibleColumns.ref')"
/>
</VnRow> </VnRow>
</div> </div>
</div> </div>
@ -332,3 +417,24 @@ watchEffect(selectedRows);
flex: 0.75; flex: 0.75;
} }
</style> </style>
<i18n>
en:
invoice id: Invoice ID
view summary: View Summary
download pdf: Download PDF
you can search by invoice reference: You can search by invoice reference
search invoice: Search Invoice
create manual invoice: Create Manual Invoice
invoice serial: Invoice Serial
tax area: Tax Area
es:
invoice id: ID de factura
view summary: Ver resumen
download pdf: Descargar PDF
you can search by invoice reference: Puedes buscar por referencia de la factura
search invoice: Buscar factura
create manual invoice: Crear factura manual
invoice serial: Serie de factura
tax area: Área fiscal
</i18n>