0
0
Fork 0

feat: refs #7346 radioButton

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.create) splittedColumns.value.create.push(col);
if (col.cardVisible) splittedColumns.value.cardVisible.push(col); if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
if ($props.isEditable && col.disable == null) col.disable = false; 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 }; col.columnFilter = { inWhere: true, ...col.columnFilter };
splittedColumns.value.columns.push(col); 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 { toCurrency, toDate } from 'src/filters/index';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { QBtn } from 'quasar'; import { QBtn } from 'quasar';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
import axios from 'axios'; import axios from 'axios';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import InvoiceOutFilter from './InvoiceOutFilter.vue'; import InvoiceOutFilter from './InvoiceOutFilter.vue';
@ -28,6 +27,7 @@ const hasSelectedCards = computed(() => selectedRows.value.length > 0);
const MODEL = 'InvoiceOuts'; const MODEL = 'InvoiceOuts';
const { openReport } = usePrintService(); const { openReport } = usePrintService();
const addressOptions = ref([]); const addressOptions = ref([]);
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`);
@ -214,7 +214,7 @@ watchEffect(selectedRows);
:url="`${MODEL}/filter`" :url="`${MODEL}/filter`"
:create="{ :create="{
urlCreate: 'InvoiceOuts/createManualInvoice', urlCreate: 'InvoiceOuts/createManualInvoice',
title: t('Create manual invoice'), title: t('createManualInvoice'),
onDataSaved: ({ id }) => tableRef.redirect(id), onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: { formInitialData: {
active: true, active: true,
@ -231,103 +231,142 @@ watchEffect(selectedRows);
selection: 'multiple', selection: 'multiple',
}" }"
> >
<template #column-clientFk="{ row }">
<span class="link" @click.stop>
{{ row.clientSocialName }}
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</template>
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<div class="row q-col-gutter-md"> <div class="row q-col-gutter-md">
<div class="col-12"> <div class="col-12">
<VnSelect <div class="q-gutter-sm q-col-gutter-xs">
url="Tickets" <div class="row q-m-none">
v-model="data.ticketFk" <div class="col-auto">
:label="t('invoiceOutList.tableVisibleColumns.ticket')" <QRadio
option-label="id" v-model="selectedOption"
option-value="id" val="ticket"
> label="Ticket"
<template #option="scope"> class="q-my-none q-mr-md"
<QItem v-bind="scope.itemProps"> />
<QItemSection> </div>
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel> <div class="col">
<QItemLabel caption>{{ <QInput
scope.opt?.nickname v-if="selectedOption === 'ticket'"
}}</QItemLabel> v-model="data.ticketFk"
</QItemSection> label="Ticket ID"
</QItem> />
</template> </div>
</VnSelect> </div>
</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>
<VnSelect <div class="row m-xs">
url="InvoiceOutSerials" <div class="col-auto">
v-model="data.serial" <QRadio
:label="t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')" v-model="selectedOption"
:options="invoiceOutSerialsOptions" val="cliente"
option-label="description" label="Cliente"
option-value="code" class="q-my-none q-mr-md"
/> />
<VnInputDate </div>
:label="t('invoiceOutList.tableVisibleColumns.dueDate')" <div class="col">
v-model="data.maxShipped" <VnSelect
/> v-if="selectedOption === 'cliente'"
<VnSelect v-model="data.clientFk"
url="TaxAreas" label="Cliente"
v-model="data.taxArea" url="Clients"
:label="t('invoiceOutList.tableVisibleColumns.taxArea')" :options="customerOptions"
:options="taxAreasOptions" option-label="name"
option-label="code" option-value="id"
option-value="code" @update:model-value="fetchClientAddress"
/> />
<QInput </div>
v-model="data.reference" </div>
:label="t('invoiceOutList.tableVisibleColumns.ref')"
/> <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> </template>
</VnTable> </VnTable>
</template> </template>
<i18n> <i18n>
en: en:
searchInvoice: Search issued invoice searchInvoice: Search issued invoice
fileDenied: Browser denied file download... fileDenied: Browser denied file download...
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 Create manual invoice: Create manual invoice createInvoice: Make invoice
createManualInvoice: Create manual invoice
es: es:
searchInvoice: Buscar factura emitida fileDenied: El navegador denegó la searchInvoice: Buscar factura emitida
descarga de archivos... fileAllowed: Descarga exitosa de archivo CSV fileDenied: El navegador denegó la descarga de archivos...
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura fileAllowed: Descarga exitosa de archivo CSV
createInvoice: Crear factura Create manual invoice: Crear factura manual youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
</i18n> 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 VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import { useDialogPluginComponent } from 'quasar'; import { useDialogPluginComponent } from 'quasar';
import FetchData from 'components/FetchData.vue';
const { t } = useI18n(); const { t } = useI18n();
const state = useState(); 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({ const $props = defineProps({
clientFk: { clientFk: {
type: Number, type: Number,
@ -73,39 +68,6 @@ const initialFormState = reactive({
addressId: null, addressId: null,
clientFk: $props.clientFk, 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) => { const onClientChange = async (clientId = $props.clientFk) => {
try { try {