From 91f317dfe67b87bdf860dbf485e8c53f72e559f9 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 11 Feb 2025 23:31:43 +0100 Subject: [PATCH 01/42] style: refs #7347 updates --- src/css/app.scss | 8 +- .../Supplier/Card/SupplierConsumption.vue | 332 +++++++++++++++--- src/pages/Zone/ZoneUpcoming.vue | 26 +- 3 files changed, 310 insertions(+), 56 deletions(-) diff --git a/src/css/app.scss b/src/css/app.scss index 2a60830bf..4c4a556a7 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -320,8 +320,12 @@ input::-webkit-inner-spin-button { .q-item > .q-item__section:has(.q-checkbox) { max-width: fit-content; } - -.row > .column:has(.q-checkbox) { +.vn-row > * .q-checkbox r { + min-width: 80%; + display: flex; + justify-content: space-between; +} +.vn-row > .q-checkbox.row.items-center { max-width: fit-content; } .q-field__inner { diff --git a/src/pages/Supplier/Card/SupplierConsumption.vue b/src/pages/Supplier/Card/SupplierConsumption.vue index 718de95dd..25ac773f0 100644 --- a/src/pages/Supplier/Card/SupplierConsumption.vue +++ b/src/pages/Supplier/Card/SupplierConsumption.vue @@ -8,8 +8,9 @@ import SendEmailDialog from 'components/common/SendEmailDialog.vue'; import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; -import { dateRange, toDate } from 'src/filters'; -import { dashIfEmpty } from 'src/filters'; +import { dateRange, toCurrency, toDate } from 'src/filters'; + +import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue'; import { usePrintService } from 'composables/usePrintService'; import useNotify from 'src/composables/useNotify.js'; import axios from 'axios'; @@ -31,7 +32,81 @@ const arrayData = useArrayData('SupplierConsumption', { order: ['itemTypeFk', 'itemName', 'itemSize'], userFilter: { where: { supplierFk: route.params.id } }, }); +const headerColumns = computed(() => [ + { + name: 'id', + label: t('globals.entry'), + align: 'left', + field: 'id', + sortable: true, + }, + { + name: 'invoiceNumber', + label: t('globals.subItem'), + align: 'left', + field: 'invoiceNumber', + sortable: true, + }, + { + name: 'quantity', + label: t('globals.quantity'), + align: 'left', + field: 'quantity', + sortable: true, + }, + { + name: 'total', + label: t('globals.quantity'), + align: 'left', + field: 'total', + sortable: true, + }, + { + name: 'shipped', + label: t('globals.quantity'), + align: 'left', + field: 'shipped', + sortable: true, + }, +]); +const columns = computed(() => [ + { + name: 'itemName', + label: t('globals.item'), + align: 'left', + field: 'itemName', + sortable: true, + }, + { + name: 'subName', + label: t('globals.subItem'), + align: 'left', + field: 'subName', + sortable: true, + }, + { + name: 'quantity', + label: t('globals.quantity'), + align: 'left', + field: 'quantity', + sortable: true, + }, + { + name: 'price', + label: t('globals.price'), + align: 'left', + field: 'price', + sortable: true, + }, + { + name: 'total', + label: t('globals.total'), + align: 'left', + field: 'total', + sortable: true, + }, +]); const store = arrayData.store; onUnmounted(() => state.unset('SupplierConsumption')); @@ -122,13 +197,17 @@ const totalEntryPrice = (rows) => { totalQuantity = totalQuantity + quantity; } totalRows.value = { totalPrice, totalQuantity }; + // expanded.value = rows.map((r) => r.id); return rows; }; - +const tableRef = ref(null); onMounted(async () => { stateStore.rightDrawer = true; await getSupplierConsumptionData(); }); + +const expanded = ref([]); +// const initialExpanded = rows.filter((r, i) => i % 3 === 0).map((r) => r.index); - - + diff --git a/src/pages/Zone/ZoneUpcoming.vue b/src/pages/Zone/ZoneUpcoming.vue index c74ae6078..1b5ed87cf 100644 --- a/src/pages/Zone/ZoneUpcoming.vue +++ b/src/pages/Zone/ZoneUpcoming.vue @@ -61,11 +61,27 @@ onMounted(() => weekdayStore.initStore()); v-for="(detail, index) in details" :key="index" class="full-width flex q-mb-lg" + style="flex-direction: column" > - - {{ getHeaderTitle(detail.shipped) }} - - +
+
+ + {{ getHeaderTitle(detail.shipped) }} + + + {{ getHeaderTitle(detail.shipped) }} + + + {{ getHeaderTitle(detail.shipped) }} + +
+ +
@@ -73,7 +89,7 @@ onMounted(() => weekdayStore.initStore()); From d7ba8868a654ecb36ea3d1c6c287fa5c3c633127 Mon Sep 17 00:00:00 2001 From: provira Date: Wed, 5 Mar 2025 07:49:42 +0100 Subject: [PATCH 03/42] feat: refs #7449 added new button on claimLines, prevented claimAction to import lines with 0 quantity --- src/components/CrudModel.vue | 6 +-- src/components/FormModel.vue | 4 +- src/i18n/locale/en.yml | 5 ++- src/i18n/locale/es.yml | 5 ++- src/pages/Claim/Card/ClaimAction.vue | 19 ++++++--- src/pages/Claim/Card/ClaimBasicData.vue | 1 + src/pages/Claim/Card/ClaimLines.vue | 52 +++++++++++++++++++------ src/router/modules/claim.js | 20 +++++----- 8 files changed, 78 insertions(+), 34 deletions(-) diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index 8c4f70f3b..b40f0c2fc 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -347,8 +347,8 @@ watch(formUrl, async () => { { :label="t && t('globals.pleaseWait')" color="primary" /> - + \ No newline at end of file diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index c4d9a4149..ff1b9ec4f 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -368,8 +368,8 @@ defineExpose({ data-cy="saveAndContinueDefaultBtn" v-if="$props.goTo" @click="saveAndGo" - :label="tMobile('globals.saveAndContinue')" - :title="t('globals.saveAndContinue')" + :label="tMobile('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())" + :title="t('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())" :disable="!hasChanges" color="primary" icon="save" diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 5b667555e..6c0e470cc 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -28,7 +28,7 @@ globals: create: Create edit: Edit save: Save - saveAndContinue: Save and continue + saveAndContinue: Save and go to remove: Remove reset: Reset close: Close @@ -106,6 +106,8 @@ globals: from: From to: To notes: Notes + photos: Photos + due-day: Due day refresh: Refresh item: Item ticket: Ticket @@ -383,6 +385,7 @@ errors: updateUserConfig: Error updating user config tokenConfig: Error fetching token config writeRequest: The requested operation could not be completed + claimBeginningQuantity: Cannot import a line with a claimed quantity of 0 login: title: Login username: Username diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 3f004485d..9af2bd7c9 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -28,7 +28,7 @@ globals: create: Crear edit: Modificar save: Guardar - saveAndContinue: Guardar y continuar + saveAndContinue: Guardar e ir a remove: Eliminar reset: Restaurar close: Cerrar @@ -110,6 +110,8 @@ globals: from: Desde to: Hasta notes: Notas + photos: Fotos + due-day: Vencimiento refresh: Actualizar item: Artículo ticket: Ticket @@ -379,6 +381,7 @@ errors: updateUserConfig: Error al actualizar la configuración de usuario tokenConfig: Error al obtener configuración de token writeRequest: No se pudo completar la operación solicitada + claimBeginningQuantity: No se puede importar una linea sin una cantidad reclamada login: title: Inicio de sesión username: Nombre de usuario diff --git a/src/pages/Claim/Card/ClaimAction.vue b/src/pages/Claim/Card/ClaimAction.vue index baa36710c..4b2414d46 100644 --- a/src/pages/Claim/Card/ClaimAction.vue +++ b/src/pages/Claim/Card/ClaimAction.vue @@ -13,8 +13,10 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import { useArrayData } from 'composables/useArrayData'; import RightMenu from 'src/components/common/RightMenu.vue'; +import useNotify from 'src/composables/useNotify.js'; const { t } = useI18n(); +const { notify } = useNotify(); const quasar = useQuasar(); const route = useRoute(); const claim = ref(null); @@ -176,12 +178,17 @@ async function save(data) { } async function importToNewRefundTicket() { - await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`); - await claimActionsForm.value.reload(); - quasar.notify({ - message: t('globals.dataSaved'), - type: 'positive', - }); + try{ + await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`); + await claimActionsForm.value.reload(); + quasar.notify({ + message: t('globals.dataSaved'), + type: 'positive', + }); + } catch (error) { + const errorMessage = error.response?.data?.error?.message; + notify( t(errorMessage), 'negative' ); + } } async function post(query, params) { diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index 43941d1dc..62721703a 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -26,6 +26,7 @@ const workersOptions = ref([]); diff --git a/src/pages/Claim/Card/ClaimLines.vue b/src/pages/Claim/Card/ClaimLines.vue index dee03b95d..1df7fbeef 100644 --- a/src/pages/Claim/Card/ClaimLines.vue +++ b/src/pages/Claim/Card/ClaimLines.vue @@ -152,12 +152,33 @@ function showImportDialog() { .onOk(() => claimLinesForm.value.reload()); } -async function saveWhenHasChanges() { - if (claimLinesForm.value.getChanges().updates) { - await claimLinesForm.value.onSubmit(); - onFetch(claimLinesForm.value.formData); +function fillClaimedQuantities() { + const formData = claimLinesForm.value.formData; + let hasChanges = false; + + const selectedRows = formData.filter(row => selected.value.includes(row)); + + for (const row of selectedRows) { + if (row.quantity === 0 || row.quantity === null) { + row.quantity = row.sale.quantity; + hasChanges = true; + } + } + + if (hasChanges) { + quasar.notify({ + message: t('Cantidades rellenadas automáticamente'), + type: 'positive', + }); + } else { + quasar.notify({ + message: t('No hay cantidades para rellenar'), + type: 'info', + }); } } + + @@ -272,10 +293,7 @@ async function saveWhenHasChanges() { type="number" dense autofocus - @keyup.enter=" - saveWhenHasChanges() - " - @blur="saveWhenHasChanges()" + /> @@ -313,6 +331,18 @@ async function saveWhenHasChanges() {
+ diff --git a/src/router/modules/claim.js b/src/router/modules/claim.js index 4dfde08da..aa0fc2819 100644 --- a/src/router/modules/claim.js +++ b/src/router/modules/claim.js @@ -8,9 +8,9 @@ const claimCard = { meta: { menu: [ 'ClaimBasicData', + 'ClaimNotes', 'ClaimLines', 'ClaimPhotos', - 'ClaimNotes', 'ClaimDevelopment', 'ClaimAction', 'ClaimLog', @@ -36,6 +36,15 @@ const claimCard = { }, component: () => import('src/pages/Claim/Card/ClaimBasicData.vue'), }, + { + path: 'notes', + name: 'ClaimNotes', + meta: { + title: 'notes', + icon: 'draft', + }, + component: () => import('src/pages/Claim/Card/ClaimNotes.vue'), + }, { path: 'lines', name: 'ClaimLines', @@ -54,15 +63,6 @@ const claimCard = { }, component: () => import('src/pages/Claim/Card/ClaimPhoto.vue'), }, - { - path: 'notes', - name: 'ClaimNotes', - meta: { - title: 'notes', - icon: 'draft', - }, - component: () => import('src/pages/Claim/Card/ClaimNotes.vue'), - }, { path: 'development', name: 'ClaimDevelopment', From d4fe1e6a6db1826142eb690b74146432a6640842 Mon Sep 17 00:00:00 2001 From: provira Date: Tue, 11 Mar 2025 12:33:23 +0100 Subject: [PATCH 04/42] feat: refs #7449 added save button to claimNotes & added e2e tests --- src/components/ui/VnNotes.vue | 37 +++++++++++++++++-- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + src/pages/Claim/Card/ClaimNotes.vue | 2 + .../integration/claim/claimLines.spec.js | 23 ++++++++++++ 5 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 test/cypress/integration/claim/claimLines.spec.js diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue index 6740934d4..5eb12f76b 100644 --- a/src/components/ui/VnNotes.vue +++ b/src/components/ui/VnNotes.vue @@ -1,10 +1,11 @@