From 2a560e9548dffc848dfce5594c5490f328be00aa Mon Sep 17 00:00:00 2001 From: provira Date: Mon, 24 Mar 2025 14:07:02 +0100 Subject: [PATCH] Merge branch '8237-defaultObservationType' of https: refs #8237//gitea.verdnatura.es/verdnatura/salix-front into 8237-defaultObservationType --- src/components/ItemsFilterPanel.vue | 10 +- src/components/VnTable/VnTable.vue | 1 + src/components/common/VnCard.vue | 26 +- src/components/common/VnLog.vue | 9 +- .../common/__tests__/VnDmsList.spec.js | 46 +- src/components/ui/CardDescriptor.vue | 383 +---------------- src/components/ui/EntityDescriptor.vue | 78 ++++ src/components/ui/VnDescriptor.vue | 318 ++++++++++++++ .../__tests__/downloadFile.spec.js | 11 +- src/composables/downloadFile.js | 20 +- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + src/pages/Account/AccountFilter.vue | 7 +- src/pages/Account/Acls/AclFilter.vue | 14 +- .../Account/Alias/Card/AliasDescriptor.vue | 6 +- src/pages/Account/Card/AccountDescriptor.vue | 6 +- src/pages/Account/Role/AccountRolesFilter.vue | 4 +- .../Account/Role/Card/RoleDescriptor.vue | 6 +- src/pages/Claim/Card/ClaimDescriptor.vue | 6 +- src/pages/Claim/ClaimFilter.vue | 25 +- .../Customer/Card/CustomerDescriptor.vue | 6 +- src/pages/Customer/CustomerFilter.vue | 27 +- .../Defaulter/CustomerDefaulterFilter.vue | 22 +- .../Payments/CustomerPaymentsFilter.vue | 18 +- src/pages/Entry/Card/EntryDescriptor.vue | 6 +- src/pages/Entry/EntryFilter.vue | 34 +- .../InvoiceIn/Card/InvoiceInDescriptor.vue | 6 +- src/pages/InvoiceIn/InvoiceInFilter.vue | 31 +- .../Serial/InvoiceInSerialFilter.vue | 6 +- .../InvoiceOut/Card/InvoiceOutDescriptor.vue | 6 +- src/pages/InvoiceOut/InvoiceOutFilter.vue | 23 +- src/pages/InvoiceOut/InvoiceOutGlobalForm.vue | 22 +- .../InvoiceOutNegativeBasesFilter.vue | 22 +- src/pages/Item/Card/ItemDescriptor.vue | 6 +- src/pages/Item/ItemFixedPriceFilter.vue | 11 +- src/pages/Item/ItemListFilter.vue | 31 +- src/pages/Item/ItemRequestFilter.vue | 36 +- .../Item/ItemType/Card/ItemTypeDescriptor.vue | 6 +- .../Monitor/Ticket/MonitorTicketFilter.vue | 45 +- .../Order/Card/CatalogFilterValueDialog.vue | 10 +- src/pages/Order/Card/OrderCard.vue | 4 +- src/pages/Order/Card/OrderCatalogFilter.vue | 12 +- src/pages/Order/Card/OrderDescriptor.vue | 18 +- src/pages/Order/Card/OrderDescriptorProxy.vue | 7 +- src/pages/Order/Card/OrderFilter.vue | 25 +- .../Route/Agency/Card/AgencyDescriptor.vue | 6 +- .../Route/Card/RouteAutonomousFilter.vue | 35 +- src/pages/Route/Card/RouteDescriptor.vue | 7 +- src/pages/Route/Card/RouteFilter.vue | 22 +- src/pages/Route/Roadmap/RoadmapDescriptor.vue | 6 +- src/pages/Route/Roadmap/RoadmapFilter.vue | 17 +- .../Route/Vehicle/Card/VehicleDescriptor.vue | 6 +- .../Shelving/Card/ShelvingDescriptor.vue | 6 +- src/pages/Shelving/Card/ShelvingFilter.vue | 5 +- .../Parking/Card/ParkingDescriptor.vue | 6 +- src/pages/Shelving/Parking/ParkingFilter.vue | 9 +- .../Supplier/Card/SupplierBalanceFilter.vue | 8 +- .../Card/SupplierConsumptionFilter.vue | 25 +- .../Supplier/Card/SupplierDescriptor.vue | 6 +- src/pages/Ticket/Card/TicketDescriptor.vue | 6 +- .../Ticket/Negative/TicketLackFilter.vue | 14 +- src/pages/Ticket/TicketAdvanceFilter.vue | 18 +- src/pages/Ticket/TicketFilter.vue | 50 +-- src/pages/Ticket/TicketFutureFilter.vue | 23 +- src/pages/Travel/Card/TravelDescriptor.vue | 6 +- src/pages/Travel/ExtraCommunityFilter.vue | 32 +- src/pages/Travel/TravelFilter.vue | 34 +- .../Worker/Card/WorkerCalendarFilter.vue | 8 +- src/pages/Worker/Card/WorkerDescriptor.vue | 6 +- src/pages/Worker/Card/WorkerPda.vue | 401 +++++++++++------- .../Department/Card/DepartmentDescriptor.vue | 6 +- src/pages/Worker/WorkerFilter.vue | 31 +- src/pages/Zone/Card/ZoneDescriptor.vue | 6 +- src/pages/Zone/ZoneDeliveryPanel.vue | 7 +- .../integration/vnComponent/VnLog.spec.js | 2 +- .../integration/worker/workerPda.spec.js | 83 +++- test/cypress/support/commands.js | 10 +- 77 files changed, 1178 insertions(+), 1147 deletions(-) create mode 100644 src/components/ui/EntityDescriptor.vue create mode 100644 src/components/ui/VnDescriptor.vue diff --git a/src/components/ItemsFilterPanel.vue b/src/components/ItemsFilterPanel.vue index f73753a6b..0f1e3f1eb 100644 --- a/src/components/ItemsFilterPanel.vue +++ b/src/components/ItemsFilterPanel.vue @@ -198,8 +198,7 @@ const setCategoryList = (data) => { v-model="params.typeFk" :options="itemTypesOptions" dense - outlined - rounded + filled use-input :disable="!selectedCategoryFk" @update:model-value=" @@ -235,8 +234,7 @@ const setCategoryList = (data) => { v-model="value.selectedTag" :options="tagOptions" dense - outlined - rounded + filled :emit-value="false" use-input :is-clearable="false" @@ -252,8 +250,7 @@ const setCategoryList = (data) => { option-value="value" option-label="value" dense - outlined - rounded + filled emit-value use-input :disable="!value" @@ -265,7 +262,6 @@ const setCategoryList = (data) => { v-model="value.value" :label="t('components.itemsFilterPanel.value')" :disable="!value" - is-outlined :is-clearable="false" @keyup.enter="applyTags(params, searchFn)" /> diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index c64217198..e8dd1b526 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -633,6 +633,7 @@ const rowCtrlClickFunction = computed(() => { :data-key="$attrs['data-key']" :columns="columns" :redirect="redirect" + v-bind="$attrs?.['table-filter']" > diff --git a/src/components/ui/EntityDescriptor.vue b/src/components/ui/EntityDescriptor.vue new file mode 100644 index 000000000..a5dced551 --- /dev/null +++ b/src/components/ui/EntityDescriptor.vue @@ -0,0 +1,78 @@ + + + diff --git a/src/components/ui/VnDescriptor.vue b/src/components/ui/VnDescriptor.vue new file mode 100644 index 000000000..47da98d74 --- /dev/null +++ b/src/components/ui/VnDescriptor.vue @@ -0,0 +1,318 @@ + + + + + + + + + en: + globals: + copyId: Copy ID + es: + globals: + copyId: Copiar ID + diff --git a/src/composables/__tests__/downloadFile.spec.js b/src/composables/__tests__/downloadFile.spec.js index f53b56b3e..f83a973b0 100644 --- a/src/composables/__tests__/downloadFile.spec.js +++ b/src/composables/__tests__/downloadFile.spec.js @@ -6,10 +6,12 @@ const session = useSession(); const token = session.getToken(); describe('downloadFile', () => { - const baseUrl = 'http://localhost:9000'; let defaulCreateObjectURL; beforeAll(() => { + vi.mock('src/composables/getUrl', () => ({ + getUrl: vi.fn().mockResolvedValue(''), + })); defaulCreateObjectURL = window.URL.createObjectURL; window.URL.createObjectURL = vi.fn(() => 'blob:http://localhost:9000/blob-id'); }); @@ -22,15 +24,14 @@ describe('downloadFile', () => { headers: { 'content-disposition': 'attachment; filename="test-file.txt"' }, }; vi.spyOn(axios, 'get').mockImplementation((url) => { - if (url == 'Urls/getUrl') return Promise.resolve({ data: baseUrl }); - else if (url.includes('downloadFile')) return Promise.resolve(res); + if (url.includes('downloadFile')) return Promise.resolve(res); }); await downloadFile(1); expect(axios.get).toHaveBeenCalledWith( - `${baseUrl}/api/dms/1/downloadFile?access_token=${token}`, - { responseType: 'blob' } + `/api/dms/1/downloadFile?access_token=${token}`, + { responseType: 'blob' }, ); }); }); diff --git a/src/composables/downloadFile.js b/src/composables/downloadFile.js index 4588265a2..302836e09 100644 --- a/src/composables/downloadFile.js +++ b/src/composables/downloadFile.js @@ -5,20 +5,30 @@ import { exportFile } from 'quasar'; const { getTokenMultimedia } = useSession(); const token = getTokenMultimedia(); +const appUrl = (await getUrl('', 'lilium')).replace('/#/', ''); export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) { - const appUrl = (await getUrl('', 'lilium')).replace('/#/', ''); const response = await axios.get( url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`, { responseType: 'blob' } ); + download(response); +} + +export async function downloadDocuware(url, params) { + const response = await axios.get(`${appUrl}/api/` + url, { + responseType: 'blob', + params, + }); + + download(response); +} + +function download(response) { const contentDisposition = response.headers['content-disposition']; const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition); - const filename = - matches != null && matches[1] - ? matches[1].replace(/['"]/g, '') - : 'downloaded-file'; + const filename = matches?.[1] ? matches[1].replace(/['"]/g, '') : 'downloaded-file'; exportFile(filename, response.data); } diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 6be11b5ed..7374cda68 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -646,6 +646,7 @@ worker: model: Model serialNumber: Serial number removePDA: Deallocate PDA + sendToTablet: Send to tablet create: lastName: Last name birth: Birth diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 55e5abd95..f0ce53e37 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -731,6 +731,7 @@ worker: model: Modelo serialNumber: Número de serie removePDA: Desasignar PDA + sendToTablet: Enviar a la tablet create: lastName: Apellido birth: Fecha de nacimiento diff --git a/src/pages/Account/AccountFilter.vue b/src/pages/Account/AccountFilter.vue index 50c3ee1ac..732e92f77 100644 --- a/src/pages/Account/AccountFilter.vue +++ b/src/pages/Account/AccountFilter.vue @@ -47,7 +47,7 @@ const rolesOptions = ref([]); :label="t('globals.name')" v-model="params.name" lazy-rules - is-outlined + filled /> @@ -57,7 +57,7 @@ const rolesOptions = ref([]); :label="t('account.card.alias')" v-model="params.nickname" lazy-rules - is-outlined + filled /> @@ -75,8 +75,7 @@ const rolesOptions = ref([]); use-input hide-selected dense - outlined - rounded + filled :input-debounce="0" /> diff --git a/src/pages/Account/Acls/AclFilter.vue b/src/pages/Account/Acls/AclFilter.vue index 8035f92b8..222fe5b77 100644 --- a/src/pages/Account/Acls/AclFilter.vue +++ b/src/pages/Account/Acls/AclFilter.vue @@ -56,8 +56,7 @@ onBeforeMount(() => { option-label="name" use-input dense - outlined - rounded + filled /> @@ -72,8 +71,7 @@ onBeforeMount(() => { option-label="name" use-input dense - outlined - rounded + filled /> @@ -83,7 +81,7 @@ onBeforeMount(() => { :label="t('acls.aclFilter.property')" v-model="params.property" lazy-rules - is-outlined + filled /> @@ -98,8 +96,7 @@ onBeforeMount(() => { option-label="name" use-input dense - outlined - rounded + filled /> @@ -114,8 +111,7 @@ onBeforeMount(() => { option-label="name" use-input dense - outlined - rounded + filled /> diff --git a/src/pages/Account/Alias/Card/AliasDescriptor.vue b/src/pages/Account/Alias/Card/AliasDescriptor.vue index 7f6992bf0..957047cc3 100644 --- a/src/pages/Account/Alias/Card/AliasDescriptor.vue +++ b/src/pages/Account/Alias/Card/AliasDescriptor.vue @@ -4,7 +4,7 @@ import { useRoute, useRouter } from 'vue-router'; import { useI18n } from 'vue-i18n'; import { useQuasar } from 'quasar'; -import CardDescriptor from 'components/ui/CardDescriptor.vue'; +import EntityDescriptor from 'components/ui/EntityDescriptor.vue'; import VnLv from 'src/components/ui/VnLv.vue'; import axios from 'axios'; @@ -48,7 +48,7 @@ const removeAlias = () => { diff --git a/src/pages/Account/Card/AccountDescriptor.vue b/src/pages/Account/Card/AccountDescriptor.vue index 49328fe87..eb0a9013c 100644 --- a/src/pages/Account/Card/AccountDescriptor.vue +++ b/src/pages/Account/Card/AccountDescriptor.vue @@ -1,7 +1,7 @@ - + es: Model: Modelo @@ -190,4 +305,6 @@ es: Do you want to remove this PDA?: ¿Desea eliminar este PDA? You can only have one PDA: Solo puedes tener un PDA si no eres autonomo This PDA is already assigned to another user: Este PDA ya está asignado a otro usuario + Are you sure you want to send it?: ¿Seguro que quieres enviarlo? + Sign PDA: Firmar PDA diff --git a/src/pages/Worker/Department/Card/DepartmentDescriptor.vue b/src/pages/Worker/Department/Card/DepartmentDescriptor.vue index 4b7dfd9b8..820658593 100644 --- a/src/pages/Worker/Department/Card/DepartmentDescriptor.vue +++ b/src/pages/Worker/Department/Card/DepartmentDescriptor.vue @@ -4,7 +4,7 @@ import { useRoute, useRouter } from 'vue-router'; import { useI18n } from 'vue-i18n'; import { useVnConfirm } from 'composables/useVnConfirm'; import VnLv from 'src/components/ui/VnLv.vue'; -import CardDescriptor from 'src/components/ui/CardDescriptor.vue'; +import EntityDescriptor from 'src/components/ui/EntityDescriptor.vue'; import axios from 'axios'; import useNotify from 'src/composables/useNotify.js'; @@ -40,7 +40,7 @@ const removeDepartment = async () => { const { openConfirmationModal } = useVnConfirm(); - + diff --git a/src/pages/Worker/WorkerFilter.vue b/src/pages/Worker/WorkerFilter.vue index 8210ba0e3..44dfd32b4 100644 --- a/src/pages/Worker/WorkerFilter.vue +++ b/src/pages/Worker/WorkerFilter.vue @@ -35,7 +35,7 @@ const getLocale = (label) => { diff --git a/src/pages/Zone/ZoneDeliveryPanel.vue b/src/pages/Zone/ZoneDeliveryPanel.vue index a8cb05afc..fc5c04b41 100644 --- a/src/pages/Zone/ZoneDeliveryPanel.vue +++ b/src/pages/Zone/ZoneDeliveryPanel.vue @@ -95,8 +95,7 @@ watch( :filter-options="['code']" hide-selected dense - outlined - rounded + filled map-key="geoFk" data-cy="ZoneDeliveryDaysPostcodeSelect" > @@ -128,8 +127,7 @@ watch( option-label="name" hide-selected dense - outlined - rounded + filled data-cy="ZoneDeliveryDaysAgencySelect" /> diff --git a/test/cypress/integration/vnComponent/VnLog.spec.js b/test/cypress/integration/vnComponent/VnLog.spec.js index e857457a7..ae0013150 100644 --- a/test/cypress/integration/vnComponent/VnLog.spec.js +++ b/test/cypress/integration/vnComponent/VnLog.spec.js @@ -25,7 +25,7 @@ describe('VnLog', () => { it('should show claimDescriptor', () => { cy.dataCy('iconLaunch-claimFk').first().click(); - cy.dataCy('cardDescriptor_subtitle').contains('1'); + cy.dataCy('vnDescriptor_subtitle').contains('1'); cy.dataCy('iconLaunch-claimFk').first().click(); }); }); diff --git a/test/cypress/integration/worker/workerPda.spec.js b/test/cypress/integration/worker/workerPda.spec.js index 31ec19eda..2623e81cf 100644 --- a/test/cypress/integration/worker/workerPda.spec.js +++ b/test/cypress/integration/worker/workerPda.spec.js @@ -1,23 +1,80 @@ describe('WorkerPda', () => { - const select = '[data-cy="pda-dialog-select"]'; + const deviceId = 4; beforeEach(() => { - cy.viewport(1920, 1080); cy.login('developer'); cy.visit(`/#/worker/1110/pda`); }); - it('assign pda', () => { - cy.addBtnClick(); - cy.get(select).click(); - cy.get(select).type('{downArrow}{enter}'); - cy.get('.q-notification__message').should('have.text', 'Data created'); + it('assign and delete pda', () => { + creatNewPDA(); + cy.checkNotification('Data created'); + cy.visit(`/#/worker/1110/pda`); + removeNewPDA(); + cy.checkNotification('PDA deallocated'); }); - it('delete pda', () => { - cy.get('.btn-delete').click(); - cy.get( - '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' - ).click(); - cy.get('.q-notification__message').should('have.text', 'PDA deallocated'); + it('send and download pdf to docuware', () => { + //Send + cy.intercept('POST', '/api/Docuwares/upload-pda-pdf', (req) => { + req.reply({ + statusCode: 200, + body: {}, + }); + }); + + creatNewPDA(); + + cy.dataCy('workerPda-send').click(); + cy.clickConfirm(); + cy.checkNotification('PDF sended to signed'); + + //Download + cy.intercept('POST', /\/api\/Docuwares\/Jones%20Jessica\/checkFile/, (req) => { + req.reply({ + statusCode: 200, + body: { + id: deviceId, + state: 'Firmado', + }, + }); + }); + cy.get('#st-actions').contains('refresh').click(); + cy.intercept('GET', '/api/Docuwares/download-pda-pdf**', (req) => { + req.reply({ + statusCode: 200, + body: {}, + }); + }); + + cy.dataCy('workerPda-download').click(); + removeNewPDA(); }); + + it('send 2 pdfs to docuware', () => { + cy.intercept('POST', '/api/Docuwares/upload-pda-pdf', (req) => { + req.reply({ + statusCode: 200, + body: {}, + }); + }); + + creatNewPDA(); + creatNewPDA(2); + cy.selectRows([1, 2]); + cy.get('#st-actions').contains('Send').click(); + cy.checkNotification('PDF sended to signed'); + + removeNewPDA(); + }); + + function creatNewPDA(id = deviceId) { + cy.addBtnClick(); + cy.selectOption('[data-cy="pda-dialog-select"]', id); + cy.saveCard(); + } + + function removeNewPDA() { + cy.dataCy('workerPda-remove').first().click(); + cy.clickConfirm(); + } }); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index de25959b2..fe8d38e79 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -371,7 +371,7 @@ Cypress.Commands.add('validateContent', (selector, expectedValue) => { }); Cypress.Commands.add('openActionsDescriptor', () => { - cy.get('[data-cy="cardDescriptor"] [data-cy="descriptor-more-opts"]').click(); + cy.get('[data-cy="vnDescriptor"] [data-cy="descriptor-more-opts"]').click(); }); Cypress.Commands.add('openUserPanel', () => { @@ -466,16 +466,16 @@ Cypress.Commands.add('validateDescriptor', (toCheck = {}) => { const popupSelector = popup ? '[role="menu"] ' : ''; - if (title) cy.get(`${popupSelector}[data-cy="cardDescriptor_title"]`).contains(title); + if (title) cy.get(`${popupSelector}[data-cy="vnDescriptor_title"]`).contains(title); if (description) - cy.get(`${popupSelector}[data-cy="cardDescriptor_description"]`).contains( + cy.get(`${popupSelector}[data-cy="vnDescriptor_description"]`).contains( description, ); if (subtitle) - cy.get(`${popupSelector}[data-cy="cardDescriptor_subtitle"]`).contains(subtitle); + cy.get(`${popupSelector}[data-cy="vnDescriptor_subtitle"]`).contains(subtitle); for (const index in listbox) - cy.get(`${popupSelector}[data-cy="cardDescriptor_listbox"] > *`) + cy.get(`${popupSelector}[data-cy="vnDescriptor_listbox"] > *`) .eq(index) .should('contain.text', listbox[index]); });