feat: refs #7346 radioButton
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javi Gallego 2024-10-22 15:04:23 +02:00
parent 69215851bb
commit 2a94916bc2
3 changed files with 132 additions and 131 deletions

View File

@ -234,7 +234,7 @@ function splitColumns(columns) {
if (col.create) splittedColumns.value.create.push(col);
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
if ($props.isEditable && col.disable == null) col.disable = false;
if ($props.useModel && col.columnFilter != false)
if ($props.useModel && col.columnFilter)
col.columnFilter = { inWhere: true, ...col.columnFilter };
splittedColumns.value.columns.push(col);
}

View File

@ -12,7 +12,6 @@ import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
import { toCurrency, toDate } from 'src/filters/index';
import { useStateStore } from 'stores/useStateStore';
import { QBtn } from 'quasar';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
import axios from 'axios';
import RightMenu from 'src/components/common/RightMenu.vue';
import InvoiceOutFilter from './InvoiceOutFilter.vue';
@ -28,6 +27,7 @@ const hasSelectedCards = computed(() => selectedRows.value.length > 0);
const MODEL = 'InvoiceOuts';
const { openReport } = usePrintService();
const addressOptions = ref([]);
const selectedOption = ref('ticket');
async function fetchClientAddress(id) {
const { data } = await axios.get(`Clients/${id}/addresses`);
@ -214,7 +214,7 @@ watchEffect(selectedRows);
:url="`${MODEL}/filter`"
:create="{
urlCreate: 'InvoiceOuts/createManualInvoice',
title: t('Create manual invoice'),
title: t('createManualInvoice'),
onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {
active: true,
@ -231,103 +231,142 @@ watchEffect(selectedRows);
selection: 'multiple',
}"
>
<template #column-clientFk="{ row }">
<span class="link" @click.stop>
{{ row.clientSocialName }}
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</template>
<template #more-create-dialog="{ data }">
<div class="row q-col-gutter-md">
<div class="col-12">
<VnSelect
url="Tickets"
v-model="data.ticketFk"
:label="t('invoiceOutList.tableVisibleColumns.ticket')"
option-label="id"
option-value="id"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
<QItemLabel caption>{{
scope.opt?.nickname
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</div>
</div>
<div class="row q-col-gutter-md">
<div class="col-12">
<span class="q-ml-md q-mt-md">O</span>
</div>
</div>
<div class="row q-col-gutter-md">
<div class="col-12">
<VnSelect
url="Clients"
v-model="data.clientFk"
:label="t('invoiceOutModule.customer')"
:options="customerOptions"
option-label="name"
option-value="id"
@update:model-value="fetchClientAddress"
/>
</div>
</div>
<div class="row q-col-gutter-md">
<div class="col-12">
<VnSelect
v-model="data.addressFk"
:label="t('invoiceOutModule.address')"
:options="addressOptions"
option-value="id"
option-label="nickname"
:disable="!data.clientFk"
/>
</div>
</div>
<div class="q-gutter-sm q-col-gutter-xs">
<div class="row q-m-none">
<div class="col-auto">
<QRadio
v-model="selectedOption"
val="ticket"
label="Ticket"
class="q-my-none q-mr-md"
/>
</div>
<div class="col">
<QInput
v-if="selectedOption === 'ticket'"
v-model="data.ticketFk"
label="Ticket ID"
/>
</div>
</div>
<VnSelect
url="InvoiceOutSerials"
v-model="data.serial"
:label="t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')"
:options="invoiceOutSerialsOptions"
option-label="description"
option-value="code"
/>
<VnInputDate
:label="t('invoiceOutList.tableVisibleColumns.dueDate')"
v-model="data.maxShipped"
/>
<VnSelect
url="TaxAreas"
v-model="data.taxArea"
:label="t('invoiceOutList.tableVisibleColumns.taxArea')"
:options="taxAreasOptions"
option-label="code"
option-value="code"
/>
<QInput
v-model="data.reference"
:label="t('invoiceOutList.tableVisibleColumns.ref')"
/>
<div class="row m-xs">
<div class="col-auto">
<QRadio
v-model="selectedOption"
val="cliente"
label="Cliente"
class="q-my-none q-mr-md"
/>
</div>
<div class="col">
<VnSelect
v-if="selectedOption === 'cliente'"
v-model="data.clientFk"
label="Cliente"
url="Clients"
:options="customerOptions"
option-label="name"
option-value="id"
@update:model-value="fetchClientAddress"
/>
</div>
</div>
<div class="row m-xs">
<div class="col-auto">
<QRadio
v-model="selectedOption"
val="consignatario"
label="Consignatario"
class="q-my-none q-mr-md"
/>
</div>
<div class="col">
<div
v-if="selectedOption === 'consignatario'"
class="row q-col-gutter-md"
>
<div class="col">
<VnSelect
v-model="data.clientFk"
label="Cliente"
url="Clients"
:options="customerOptions"
option-label="name"
option-value="id"
@update:model-value="fetchClientAddress"
/>
</div>
<div class="col">
<VnSelect
v-model="data.addressFk"
label="Consignatario"
:options="addressOptions"
option-label="nickname"
option-value="id"
:disable="!data.clientFk"
/>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="q-gutter-md">
<div class="row q-gutter-md">
<VnSelect
url="InvoiceOutSerials"
v-model="data.serial"
:label="
t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')
"
:options="invoiceOutSerialsOptions"
option-label="description"
option-value="code"
/>
<VnInputDate
:label="t('invoiceOutList.tableVisibleColumns.dueDate')"
v-model="data.maxShipped"
/>
</div>
<div class="row q-gutter-md">
<VnSelect
url="TaxAreas"
v-model="data.taxArea"
:label="t('invoiceOutList.tableVisibleColumns.taxArea')"
:options="taxAreasOptions"
option-label="code"
option-value="code"
/>
<QInput
v-model="data.reference"
:label="t('invoiceOutList.tableVisibleColumns.ref')"
/>
</div>
</div>
</div>
</template>
</VnTable>
</template>
<i18n>
en:
searchInvoice: Search issued invoice
fileDenied: Browser denied file download...
fileAllowed: Successful download of CSV file
youCanSearchByInvoiceReference: You can search by invoice reference
createInvoice: Make invoice Create manual invoice: Create manual invoice
searchInvoice: Search issued invoice
fileDenied: Browser denied file download...
fileAllowed: Successful download of CSV file
youCanSearchByInvoiceReference: You can search by invoice reference
createInvoice: Make invoice
createManualInvoice: Create manual invoice
es:
searchInvoice: Buscar factura emitida fileDenied: El navegador denegó la
descarga de archivos... fileAllowed: Descarga exitosa de archivo CSV
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
createInvoice: Crear factura Create manual invoice: Crear factura manual
</i18n>
searchInvoice: Buscar factura emitida
fileDenied: El navegador denegó la descarga de archivos...
fileAllowed: Descarga exitosa de archivo CSV
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
createInvoice: Crear factura
createManualInvoice: Crear factura manual
</i18n>

View File

@ -9,7 +9,6 @@ import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import { useDialogPluginComponent } from 'quasar';
import FetchData from 'components/FetchData.vue';
const { t } = useI18n();
const state = useState();
@ -58,10 +57,6 @@ const fetchAgencyList = async (landed, addressFk) => {
}
};
// const fetchOrderDetails = (order) => {
// fetchAddressList(order?.addressFk);
// fetchAgencyList(order?.landed, order?.addressFk);
// };
const $props = defineProps({
clientFk: {
type: Number,
@ -73,39 +68,6 @@ const initialFormState = reactive({
addressId: null,
clientFk: $props.clientFk,
});
// const orderMapper = (order) => {
// return {
// addressId: order.addressFk,
// agencyModeId: order.agencyModeFk,
// landed: new Date(order.landed).toISOString(),
// };
// };
// const orderFilter = {
// include: [
// { relation: 'agencyMode', scope: { fields: ['name'] } },
// {
// relation: 'address',
// scope: { fields: ['nickname'] },
// },
// { relation: 'rows', scope: { fields: ['id'] } },
// {
// relation: 'client',
// scope: {
// fields: [
// 'salesPersonFk',
// 'name',
// 'isActive',
// 'isFreezed',
// 'isTaxDataChecked',
// ],
// include: {
// relation: 'salesPersonUser',
// scope: { fields: ['id', 'name'] },
// },
// },
// },
// ],
// };
const onClientChange = async (clientId = $props.clientFk) => {
try {