diff --git a/package.json b/package.json index e2e75f253..04b75a0b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.44.0", + "version": "24.50.0", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", @@ -64,4 +64,4 @@ "vite": "^5.1.4", "vitest": "^0.31.1" } -} +} \ No newline at end of file diff --git a/src/components/CreateManualInvoiceForm.vue b/src/components/CreateManualInvoiceForm.vue deleted file mode 100644 index da006e024..000000000 --- a/src/components/CreateManualInvoiceForm.vue +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - -es: - Create manual invoice: Crear factura manual - Ticket: Ticket - Client: Cliente - Max date: Fecha límite - Serial: Serie - Area: Area - Reference: Referencia - Or: O - Invoicing in progress...: Facturación en progreso... - diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index fd7b0c51a..65f716142 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -162,9 +162,7 @@ onMounted(() => { : $props.defaultMode; stateStore.rightDrawer = quasar.screen.gt.xs; columnsVisibilitySkipped.value = [ - ...splittedColumns.value.columns - .filter((c) => c.visible == false) - .map((c) => c.name), + ...splittedColumns.value.columns.filter((c) => !c.visible).map((c) => c.name), ...['tableActions'], ]; createForm.value = $props.create; @@ -237,7 +235,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 !== false) col.columnFilter = { inWhere: true, ...col.columnFilter }; splittedColumns.value.columns.push(col); } diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index fcc04ddf7..eb9dc0f38 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -1,8 +1,7 @@ diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index c3611c464..84f2b43d7 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -37,7 +37,7 @@ const $props = defineProps({ }, hiddenTags: { type: Array, - default: () => ['filter', 'search', 'or', 'and'], + default: () => ['filter', 'or', 'and'], }, customTags: { type: Array, @@ -61,7 +61,6 @@ const emit = defineEmits([ 'update:modelValue', 'refresh', 'clear', - 'search', 'init', 'remove', 'setUserParams', diff --git a/src/components/ui/VnRow.vue b/src/components/ui/VnRow.vue index 40dabf610..b57489a98 100644 --- a/src/components/ui/VnRow.vue +++ b/src/components/ui/VnRow.vue @@ -1,5 +1,5 @@ @@ -18,6 +18,9 @@ &:not(.wrap) { flex-direction: column; } + &[fixed] { + flex-direction: row; + } } } diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 269231797..ac0c1da08 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -75,18 +75,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { limit: store.limit, }; - let exprFilter; let userParams = { ...store.userParams }; - if (store?.exprBuilder) { - const where = buildFilter(userParams, (param, value) => { - const res = store.exprBuilder(param, value); - if (res) delete userParams[param]; - return res; - }); - exprFilter = where ? { where } : null; - } - Object.assign(filter, store.userFilter, exprFilter); + Object.assign(filter, store.userFilter); + let where; if (filter?.where || store.filter?.where) where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {}); @@ -96,11 +88,28 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { Object.assign(params, userParams); params.filter.skip = store.skip; - if (store.order && store.order.length) params.filter.order = store.order; + if (store?.order && typeof store?.order == 'string') store.order = [store.order]; + if (store.order?.length) params.filter.order = [...store.order]; else delete params.filter.order; + store.currentFilter = JSON.parse(JSON.stringify(params)); + delete store.currentFilter.filter.include; + store.currentFilter.filter = JSON.stringify(store.currentFilter.filter); + + let exprFilter; + if (store?.exprBuilder) { + exprFilter = buildFilter(params, (param, value) => { + if (param == 'filter') return; + const res = store.exprBuilder(param, value); + if (res) delete params[param]; + return res; + }); + } + + if (params.filter.where || exprFilter) + params.filter.where = { ...params.filter.where, ...exprFilter }; params.filter = JSON.stringify(params.filter); - store.currentFilter = params; + store.isLoading = true; const response = await axios.get(store.url, { signal: canceller.signal, diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index ae7007c32..1729af9aa 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -506,6 +506,7 @@ invoiceOut: invoiceWithFutureDate: Exists an invoice with a future date noTicketsToInvoice: There are not tickets to invoice criticalInvoiceError: 'Critical invoicing error, process stopped' + invalidSerialTypeForAll: The serial type must be global when invoicing all clients table: addressId: Address id streetAddress: Street @@ -857,6 +858,7 @@ components: downloadFile: Download file openCard: View openSummary: Summary + viewSummary: Summary cardDescriptor: mainList: Main list summary: Summary diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index eb0978ddd..7d594b303 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -509,6 +509,7 @@ invoiceOut: invoiceWithFutureDate: Existe una factura con una fecha futura noTicketsToInvoice: No existen tickets para facturar criticalInvoiceError: Error crítico en la facturación proceso detenido + invalidSerialTypeForAll: El tipo de serie debe ser global cuando se facturan todos los clientes table: addressId: Id dirección streetAddress: Dirección fiscal diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue index e85f1f44c..3fd3104bf 100644 --- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue +++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue @@ -183,7 +183,7 @@ onMounted(async () => { en: invoiceDate: Invoice date - maxShipped: Max date + maxShipped: Max date ticket allClients: All clients oneClient: One client company: Company @@ -195,7 +195,7 @@ en: es: invoiceDate: Fecha de factura - maxShipped: Fecha límite + maxShipped: Fecha límite ticket allClients: Todos los clientes oneClient: Un solo cliente company: Empresa diff --git a/src/pages/InvoiceOut/InvoiceOutList.vue b/src/pages/InvoiceOut/InvoiceOutList.vue index f1b4902f2..9facb35dc 100644 --- a/src/pages/InvoiceOut/InvoiceOutList.vue +++ b/src/pages/InvoiceOut/InvoiceOutList.vue @@ -6,15 +6,19 @@ import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; -import { usePrintService } from 'composables/usePrintService'; -import VnTable from 'components/VnTable/VnTable.vue'; +import { usePrintService } from 'src/composables/usePrintService'; +import VnTable from 'src/components/VnTable/VnTable.vue'; 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'; +import VnRow from 'src/components/ui/VnRow.vue'; +import VnRadio from 'src/components/common/VnRadio.vue'; +import VnInput from 'src/components/common/VnInput.vue'; +import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue'; const { t } = useI18n(); const stateStore = useStateStore(); @@ -26,99 +30,86 @@ const selectedRows = ref([]); 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?filter[order]=isActive DESC` + ); + addressOptions.value = data; +} + +const exprBuilder = (_, value) => { + return { + or: [{ code: value }, { description: { like: `%${value}%` } }], + }; +}; const columns = computed(() => [ { align: 'center', name: 'id', label: t('invoiceOutList.tableVisibleColumns.id'), - chip: { - condition: () => true, - }, + chip: { condition: () => true }, isId: true, - columnFilter: { - name: 'search', - }, + columnFilter: { name: 'search' }, }, { align: 'left', name: 'ref', - label: t('invoiceOutList.tableVisibleColumns.ref'), + label: t('globals.reference'), isTitle: true, component: 'select', - attrs: { - url: MODEL, - optionLabel: 'ref', - optionValue: 'id', - }, - columnField: { - component: null, - }, + attrs: { url: MODEL, optionLabel: 'ref', optionValue: 'id' }, + columnField: { component: null }, }, { align: 'left', - name: 'Issued', - label: t('invoiceOutList.tableVisibleColumns.issued'), + name: 'issued', + label: t('invoiceOut.summary.issued'), component: 'date', format: (row) => toDate(row.issued), - columnField: { - component: null, - }, + columnField: { component: null }, }, { align: 'left', name: 'clientFk', - label: t('invoiceOutModule.customer'), + label: t('globals.client'), cardVisible: true, component: 'select', - attrs: { - url: 'Clients', - fields: ['id', 'name'], - }, - columnField: { - component: null, - }, + attrs: { url: 'Clients', fields: ['id', 'name'] }, + columnField: { component: null }, }, { align: 'left', name: 'companyCode', - label: t('invoiceOutModule.company'), + label: t('globals.company'), cardVisible: true, component: 'select', - attrs: { - url: 'Companies', - optionLabel: 'code', - optionValue: 'id', - }, - columnField: { - component: null, - }, + attrs: { url: 'Companies', optionLabel: 'code', optionValue: 'id' }, + columnField: { component: null }, }, { align: 'left', name: 'amount', - label: t('invoiceOutModule.amount'), + label: t('globals.amount'), cardVisible: true, format: (row) => toCurrency(row.amount), }, { align: 'left', name: 'created', - label: t('invoiceOutList.tableVisibleColumns.created'), + label: t('globals.created'), component: 'date', - columnField: { - component: null, - }, + columnField: { component: null }, format: (row) => toDate(row.created), }, { align: 'left', name: 'dued', - label: t('invoiceOutList.tableVisibleColumns.dueDate'), + label: t('invoiceOut.summary.dued'), component: 'date', - columnField: { - component: null, - }, + columnField: { component: null }, format: (row) => toDate(row.dued), }, { @@ -128,11 +119,12 @@ const columns = computed(() => [ { title: t('components.smartCard.viewSummary'), icon: 'preview', + isPrimary: true, action: (row) => viewSummary(row.id, InvoiceOutSummary), }, { - title: t('DownloadPdf'), - icon: 'vn:ticket', + title: t('globals.downloadPdf'), + icon: 'cloud_download', isPrimary: true, action: (row) => openPdf(row.id), }, @@ -181,7 +173,7 @@ watchEffect(selectedRows); @@ -207,11 +199,9 @@ 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, - }, + formInitialData: { active: true }, }" :right-search="false" v-model:selected="selectedRows" @@ -231,74 +221,203 @@ watchEffect(selectedRows); + + -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 -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 + en: + invoiceId: Invoice ID + youCanSearchByInvoiceReference: You can search by invoice reference + createManualInvoice: Create Manual Invoice + inactive: (Inactive) + + es: + invoiceId: ID de factura + youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura + createManualInvoice: Crear factura manual + inactive: (Inactivo) diff --git a/src/pages/InvoiceOut/locale/en.yml b/src/pages/InvoiceOut/locale/en.yml index 5ad92ed09..8cefe8bdc 100644 --- a/src/pages/InvoiceOut/locale/en.yml +++ b/src/pages/InvoiceOut/locale/en.yml @@ -2,6 +2,7 @@ invoiceOutModule: customer: Client amount: Amount company: Company + address: Address invoiceOutList: tableVisibleColumns: id: ID @@ -15,11 +16,11 @@ invoiceOutList: DownloadPdf: Download PDF InvoiceOutSummary: Summary negativeBases: - country: Country - clientId: Client ID - base: Base - ticketId: Ticket - active: Active - hasToInvoice: Has to invoice - verifiedData: Verified data - commercial: Commercial \ No newline at end of file + country: Country + clientId: Client ID + base: Base + ticketId: Ticket + active: Active + hasToInvoice: Has to invoice + verifiedData: Verified data + commercial: Commercial diff --git a/src/pages/InvoiceOut/locale/es.yml b/src/pages/InvoiceOut/locale/es.yml index 192f5b26f..bf5126641 100644 --- a/src/pages/InvoiceOut/locale/es.yml +++ b/src/pages/InvoiceOut/locale/es.yml @@ -4,6 +4,7 @@ invoiceOutModule: customer: Cliente amount: Importe company: Empresa + address: Consignatario invoiceOutList: tableVisibleColumns: id: ID diff --git a/src/pages/Order/Card/OrderCreateDialog.vue b/src/pages/Order/Card/OrderCreateDialog.vue index b9b232115..e4806e96c 100644 --- a/src/pages/Order/Card/OrderCreateDialog.vue +++ b/src/pages/Order/Card/OrderCreateDialog.vue @@ -1,6 +1,6 @@