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/CrudModel.vue b/src/components/CrudModel.vue index a4cb55a2c..0de5d3aa2 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -77,7 +77,7 @@ const isLoading = ref(false); const hasChanges = ref(false); const originalData = ref(); const vnPaginateRef = ref(); -const formData = ref(); +const formData = ref([]); const saveButtonRef = ref(null); const watchChanges = ref(); const formUrl = computed(() => $props.url); diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue index 9da0b26a4..86802ee92 100644 --- a/src/components/VnTable/VnFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -25,7 +25,7 @@ const $props = defineProps({ }, searchUrl: { type: String, - default: 'params', + default: 'table', }, }); diff --git a/src/components/VnTable/VnOrder.vue b/src/components/VnTable/VnOrder.vue index 7fdd23b78..8ffdfe2bc 100644 --- a/src/components/VnTable/VnOrder.vue +++ b/src/components/VnTable/VnOrder.vue @@ -17,7 +17,7 @@ const $props = defineProps({ }, searchUrl: { type: String, - default: 'params', + default: 'table', }, vertical: { type: Boolean, 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/CardSummary.vue b/src/components/ui/CardSummary.vue index f469aa799..cf8859a35 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -83,7 +83,7 @@ async function fetch() { - + diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index a8aca49dd..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, @@ -49,7 +49,7 @@ const $props = defineProps({ }, searchUrl: { type: String, - default: 'params', + default: 'table', }, redirect: { type: Boolean, @@ -61,7 +61,6 @@ const emit = defineEmits([ 'update:modelValue', 'refresh', 'clear', - 'search', 'init', 'remove', 'setUserParams', diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 80c607214..b058dc642 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -44,7 +44,7 @@ const props = defineProps({ }, limit: { type: Number, - default: 10, + default: 20, }, userParams: { type: Object, @@ -100,7 +100,7 @@ const arrayData = useArrayData(props.dataKey, { const store = arrayData.store; onMounted(async () => { - if (props.autoLoad) await fetch(); + if (props.autoLoad && !store.data?.length) await fetch(); mounted.value = true; }); @@ -115,7 +115,11 @@ watch( watch( () => store.data, - (data) => emit('onChange', data) + (data) => { + if (!mounted.value) return; + emit('onChange', data); + }, + { immediate: true } ); watch( 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/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index dc6d4751c..da2d370fe 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -45,7 +45,7 @@ const props = defineProps({ }, limit: { type: Number, - default: 10, + default: 20, }, userParams: { type: Object, diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 9348793d2..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, @@ -271,7 +280,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { const pushUrl = { path: to }; if (to.endsWith('/list') || to.endsWith('/')) pushUrl.query = newUrl.query; - destroy(); + else destroy(); return router.push(pushUrl); } } diff --git a/src/filters/getParamWhere.js b/src/filters/getParamWhere.js index 22dd69af1..ef00a93ae 100644 --- a/src/filters/getParamWhere.js +++ b/src/filters/getParamWhere.js @@ -9,7 +9,7 @@ function parseJSON(str, fallback) { } export default function (route, param) { // catch route query params - const params = parseJSON(route?.query?.params, {}); + const params = parseJSON(route?.query?.table, {}); // extract and parse filter from params const { filter: filterStr = '{}' } = params; 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/Account/AccountList.vue b/src/pages/Account/AccountList.vue index 9e7f1b10a..cbaaf8e26 100644 --- a/src/pages/Account/AccountList.vue +++ b/src/pages/Account/AccountList.vue @@ -104,7 +104,7 @@ const exprBuilder = (param, value) => {