From aa2db28edab94ee3f0da0771c3e71337697399d6 Mon Sep 17 00:00:00 2001 From: carlosfonseca Date: Fri, 22 Mar 2024 08:30:54 -0500 Subject: [PATCH 01/20] Se crea submodulo mis documentos en worker --- src/css/app.scss | 5 + src/i18n/en/index.js | 5 +- src/i18n/es/index.js | 5 +- src/pages/Worker/Card/WorkerDms.vue | 164 +++++++++++ .../Worker/components/WorkerDmsActions.vue | 96 +++++++ .../Worker/components/WorkerDmsCreate.vue | 262 ++++++++++++++++++ .../Worker/components/WorkerDmsDelete.vue | 82 ++++++ src/pages/Worker/components/WorkerDmsEdit.vue | 246 ++++++++++++++++ src/router/modules/worker.js | 31 ++- 9 files changed, 891 insertions(+), 5 deletions(-) create mode 100644 src/pages/Worker/Card/WorkerDms.vue create mode 100644 src/pages/Worker/components/WorkerDmsActions.vue create mode 100644 src/pages/Worker/components/WorkerDmsCreate.vue create mode 100644 src/pages/Worker/components/WorkerDmsDelete.vue create mode 100644 src/pages/Worker/components/WorkerDmsEdit.vue diff --git a/src/css/app.scss b/src/css/app.scss index 3baa60c9b..c52cdb5d2 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -85,6 +85,11 @@ select:-webkit-autofill { color: $white; } +.card-width { + max-width: 800px; + width: 100%; +} + .vn-card { background-color: var(--vn-section-color); color: var(--vn-text-color); diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 80744b83d..197e94582 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -837,6 +837,7 @@ export default { workerCreate: 'New worker', department: 'Department', pda: 'PDA', + dms: 'My documentation', }, list: { name: 'Name', @@ -955,7 +956,7 @@ export default { roadmap: 'Roadmap', summary: 'Summary', basicData: 'Basic Data', - stops: 'Stops' + stops: 'Stops', }, }, roadmap: { @@ -963,7 +964,7 @@ export default { roadmap: 'Roadmap', summary: 'Summary', basicData: 'Basic Data', - stops: 'Stops' + stops: 'Stops', }, }, route: { diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 37ba8da85..61896a283 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -837,6 +837,7 @@ export default { workerCreate: 'Nuevo trabajador', department: 'Departamentos', pda: 'PDA', + dms: 'Mi documentación', }, list: { name: 'Nombre', @@ -955,7 +956,7 @@ export default { roadmap: 'Troncales', summary: 'Resumen', basicData: 'Datos básicos', - stops: 'Paradas' + stops: 'Paradas', }, }, roadmap: { @@ -963,7 +964,7 @@ export default { roadmap: 'Troncales', summary: 'Resumen', basicData: 'Datos básicos', - stops: 'Paradas' + stops: 'Paradas', }, }, route: { diff --git a/src/pages/Worker/Card/WorkerDms.vue b/src/pages/Worker/Card/WorkerDms.vue new file mode 100644 index 000000000..144e3edee --- /dev/null +++ b/src/pages/Worker/Card/WorkerDms.vue @@ -0,0 +1,164 @@ + + + + + + + +es: + Id: Id + Order: Orden + Reference: Referencia + Description: Descripción + File: Archivo + Original: Original + Created: Fecha creación + Upload file: Subir fichero + diff --git a/src/pages/Worker/components/WorkerDmsActions.vue b/src/pages/Worker/components/WorkerDmsActions.vue new file mode 100644 index 000000000..9a8e4816e --- /dev/null +++ b/src/pages/Worker/components/WorkerDmsActions.vue @@ -0,0 +1,96 @@ + + + + + +en: + actionFile: '{action} file' +es: + actionFile: '{action} fichero' + diff --git a/src/pages/Worker/components/WorkerDmsCreate.vue b/src/pages/Worker/components/WorkerDmsCreate.vue new file mode 100644 index 000000000..d38e044ca --- /dev/null +++ b/src/pages/Worker/components/WorkerDmsCreate.vue @@ -0,0 +1,262 @@ + + + + + +en: + clientFileDescription: '{dmsTypeName} FROM CLIENT {clientName} ID {clientId}' +es: + Reference: Referencia + Company: Empresa + Warehouse: Almacén + Type: Tipo + Description: Descripción + clientFileDescription: '{dmsTypeName} DEL CLIENTE {clientName} ID {clientId}' + File: Fichero + Select a file: Selecciona un fichero + Allowed content types: Tipos de archivo permitidos + Generate identifier for original file: Generar identificador para archivo original + diff --git a/src/pages/Worker/components/WorkerDmsDelete.vue b/src/pages/Worker/components/WorkerDmsDelete.vue new file mode 100644 index 000000000..5e1b98b24 --- /dev/null +++ b/src/pages/Worker/components/WorkerDmsDelete.vue @@ -0,0 +1,82 @@ + + + + + +es: + This file will be deleted: Este fichero va a ser borrado + Are you sure you want to continue?: ¿Seguro que quieres continuar? + diff --git a/src/pages/Worker/components/WorkerDmsEdit.vue b/src/pages/Worker/components/WorkerDmsEdit.vue new file mode 100644 index 000000000..8e84c6326 --- /dev/null +++ b/src/pages/Worker/components/WorkerDmsEdit.vue @@ -0,0 +1,246 @@ + + + + + +en: + clientFileDescription: '{dmsTypeName} FROM CLIENT {clientName} ID {clientId}' +es: + Reference: Referencia + Company: Empresa + Warehouse: Almacén + Type: Tipo + Description: Descripción + clientFileDescription: '{dmsTypeName} DEL CLIENTE {clientName} ID {clientId}' + File: Fichero + Select a file: Selecciona un fichero + Allowed content types: Tipos de archivo permitidos + Generate identifier for original file: Generar identificador para archivo original + diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js index 1c722afe8..a3b2d52dc 100644 --- a/src/router/modules/worker.js +++ b/src/router/modules/worker.js @@ -12,7 +12,7 @@ export default { redirect: { name: 'WorkerMain' }, menus: { main: ['WorkerList', 'WorkerDepartment'], - card: ['WorkerNotificationsManager', 'WorkerPda'], + card: ['WorkerNotificationsManager', 'WorkerPda', 'WorkerDms'], departmentCard: ['BasicData'], }, children: [ @@ -85,6 +85,35 @@ export default { }, component: () => import('src/pages/Worker/Card/WorkerPda.vue'), }, + { + path: 'dms', + name: 'DmsCard', + redirect: { name: 'WorkerDms' }, + children: [ + { + path: '', + name: 'WorkerDms', + meta: { + title: 'dms', + icon: 'cloud_upload', + }, + component: () => + import('src/pages/Worker/Card/WorkerDms.vue'), + }, + { + path: 'create', + name: 'WorkerDmsCreate', + component: () => + import('src/pages/Worker/components/WorkerDmsCreate.vue'), + }, + { + path: ':dmsId/edit', + name: 'WorkerDmsEdit', + component: () => + import('src/pages/Worker/components/WorkerDmsEdit.vue'), + }, + ], + }, ], }, ], From 627d3bbe85a38232de80a5d92bb67aee98a38291 Mon Sep 17 00:00:00 2001 From: carlosfonseca Date: Mon, 25 Mar 2024 16:00:47 -0500 Subject: [PATCH 02/20] Se implementan las correcciones a los comentarios --- src/pages/Worker/Card/WorkerDms.vue | 36 ++- .../Worker/components/WorkerDmsActions.vue | 16 +- .../Worker/components/WorkerDmsCreate.vue | 277 ++---------------- src/pages/Worker/components/WorkerDmsEdit.vue | 262 +++-------------- src/router/modules/worker.js | 32 +- 5 files changed, 103 insertions(+), 520 deletions(-) diff --git a/src/pages/Worker/Card/WorkerDms.vue b/src/pages/Worker/Card/WorkerDms.vue index 144e3edee..f794f6b17 100644 --- a/src/pages/Worker/Card/WorkerDms.vue +++ b/src/pages/Worker/Card/WorkerDms.vue @@ -1,22 +1,27 @@ @@ -95,6 +107,12 @@ const toWorkerDmsCreate = () => { auto-load :url="`WorkerDms/${route.params.id}/filter`" /> + { > @@ -138,7 +158,7 @@ const toWorkerDmsCreate = () => { - + {{ t('Upload file') }} @@ -147,7 +167,7 @@ const toWorkerDmsCreate = () => { diff --git a/src/pages/Worker/components/WorkerDmsActions.vue b/src/pages/Worker/components/WorkerDmsActions.vue index 9a8e4816e..2a6ab1ce3 100644 --- a/src/pages/Worker/components/WorkerDmsActions.vue +++ b/src/pages/Worker/components/WorkerDmsActions.vue @@ -1,17 +1,15 @@ - - -en: - clientFileDescription: '{dmsTypeName} FROM CLIENT {clientName} ID {clientId}' -es: - Reference: Referencia - Company: Empresa - Warehouse: Almacén - Type: Tipo - Description: Descripción - clientFileDescription: '{dmsTypeName} DEL CLIENTE {clientName} ID {clientId}' - File: Fichero - Select a file: Selecciona un fichero - Allowed content types: Tipos de archivo permitidos - Generate identifier for original file: Generar identificador para archivo original - diff --git a/src/pages/Worker/components/WorkerDmsEdit.vue b/src/pages/Worker/components/WorkerDmsEdit.vue index 8e84c6326..7656fe09f 100644 --- a/src/pages/Worker/components/WorkerDmsEdit.vue +++ b/src/pages/Worker/components/WorkerDmsEdit.vue @@ -1,246 +1,56 @@ - - -en: - clientFileDescription: '{dmsTypeName} FROM CLIENT {clientName} ID {clientId}' -es: - Reference: Referencia - Company: Empresa - Warehouse: Almacén - Type: Tipo - Description: Descripción - clientFileDescription: '{dmsTypeName} DEL CLIENTE {clientName} ID {clientId}' - File: Fichero - Select a file: Selecciona un fichero - Allowed content types: Tipos de archivo permitidos - Generate identifier for original file: Generar identificador para archivo original - diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js index a3b2d52dc..c0fe6e1fa 100644 --- a/src/router/modules/worker.js +++ b/src/router/modules/worker.js @@ -86,33 +86,13 @@ export default { component: () => import('src/pages/Worker/Card/WorkerPda.vue'), }, { + name: 'WorkerDms', path: 'dms', - name: 'DmsCard', - redirect: { name: 'WorkerDms' }, - children: [ - { - path: '', - name: 'WorkerDms', - meta: { - title: 'dms', - icon: 'cloud_upload', - }, - component: () => - import('src/pages/Worker/Card/WorkerDms.vue'), - }, - { - path: 'create', - name: 'WorkerDmsCreate', - component: () => - import('src/pages/Worker/components/WorkerDmsCreate.vue'), - }, - { - path: ':dmsId/edit', - name: 'WorkerDmsEdit', - component: () => - import('src/pages/Worker/components/WorkerDmsEdit.vue'), - }, - ], + meta: { + title: 'dms', + icon: 'cloud_upload', + }, + component: () => import('src/pages/Worker/Card/WorkerDms.vue'), }, ], }, From 0d6d18b8c8ddd9046f84a5ad71d54ccba0b7a379 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Wed, 27 Mar 2024 20:33:35 -0300 Subject: [PATCH 03/20] Apply VnDmsList component and add docuware action --- src/components/common/VnDmsList.vue | 33 +++- src/composables/downloadFile.js | 9 +- src/composables/getUrl.js | 24 +++ src/pages/Worker/Card/WorkerDms.vue | 185 +----------------- .../Worker/components/WorkerDmsActions.vue | 94 --------- .../Worker/components/WorkerDmsCreate.vue | 37 ---- .../Worker/components/WorkerDmsDelete.vue | 82 -------- src/pages/Worker/components/WorkerDmsEdit.vue | 56 ------ 8 files changed, 67 insertions(+), 453 deletions(-) delete mode 100644 src/pages/Worker/components/WorkerDmsActions.vue delete mode 100644 src/pages/Worker/components/WorkerDmsCreate.vue delete mode 100644 src/pages/Worker/components/WorkerDmsDelete.vue delete mode 100644 src/pages/Worker/components/WorkerDmsEdit.vue diff --git a/src/components/common/VnDmsList.vue b/src/components/common/VnDmsList.vue index 23e00f5d9..9bf90230d 100644 --- a/src/components/common/VnDmsList.vue +++ b/src/components/common/VnDmsList.vue @@ -9,6 +9,7 @@ import FetchData from 'components/FetchData.vue'; import VnDms from 'src/components/common/VnDms.vue'; import VnConfirm from 'components/ui/VnConfirm.vue'; import { downloadFile } from 'src/composables/downloadFile'; +import { getUrlFindOne } from 'composables/getUrl'; const route = useRoute(); const quasar = useQuasar(); @@ -142,15 +143,17 @@ const columns = computed(() => [ components: [ { component: QBtn, + name: 'download', props: () => ({ icon: 'cloud_download', flat: true, color: 'primary', }), - click: (prop) => downloadFile(prop.row.id), + click: (prop) => downloadFile(prop.row.id, prop.row.isDocuware), }, { component: QBtn, + name: 'edit', props: () => ({ icon: 'edit', flat: true, @@ -160,6 +163,7 @@ const columns = computed(() => [ }, { component: QBtn, + name: 'delete', props: () => ({ icon: 'delete', flat: true, @@ -167,6 +171,16 @@ const columns = computed(() => [ }), click: (prop) => deleteDms(prop.row.id), }, + { + component: QBtn, + name: 'openDocuware', + props: () => ({ + icon: 'open_in_new', + flat: true, + color: 'primary', + }), + click: () => openDocuware(), + }, ], }, ]); @@ -206,6 +220,16 @@ function parseDms(data) { } return data; } + +async function openDocuware() { + const url = await getUrlFindOne('WebClient', 'docuware'); + if (url) window.open(url).focus(); +} + +function shouldRenderButton(buttonName, isDocuware = false) { + // Renderizar el botón si no se llama 'openDocuware' o (se llama 'openDocuware' y props.row.isDocuware = true) + return buttonName !== 'openDocuware' || (buttonName === 'openDocuware' && isDocuware); +} diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue index 612e0d755..19e3f00ef 100644 --- a/src/pages/Claim/Card/ClaimSummary.vue +++ b/src/pages/Claim/Card/ClaimSummary.vue @@ -220,10 +220,9 @@ function openDialog(dmsId) { /> - diff --git a/test/vitest/__tests__/components/common/VnLog.spec.js b/test/vitest/__tests__/components/common/VnLog.spec.js index b654bff9b..53d2732a0 100644 --- a/test/vitest/__tests__/components/common/VnLog.spec.js +++ b/test/vitest/__tests__/components/common/VnLog.spec.js @@ -38,10 +38,10 @@ describe('VnLog', () => { action: 'update', changedModel: 'Claim', oldInstance: { - hasToPickUp: false, + pickup: null, }, newInstance: { - hasToPickUp: true, + pickup: 'agency', }, creationDate: '2023-09-18T12:25:34.000Z', changedModelId: '1', From 58b9eb1c78735d22404bf5ad170fe50d67910e57 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 5 Apr 2024 07:29:25 +0200 Subject: [PATCH 05/20] feat: refs #6636 Requested changes --- src/pages/Claim/Card/ClaimBasicData.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index 57ecc6cad..38d5d1ed5 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -185,7 +185,6 @@ const statesFilter = { :label="t('claim.basicData.pickup')" map-options use-input - @filter="(value, update) => filter(value, update, statesFilter)" :input-debounce="0" > From 9310d863aa719790fd2e94028b6afff8e21003d4 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 5 Apr 2024 07:39:05 +0200 Subject: [PATCH 06/20] fix: refs #6636 Icon save and reset --- src/components/FormModel.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 060a18bcc..39e8a72f5 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -132,12 +132,12 @@ const formUrl = computed(() => $props.url); const defaultButtons = computed(() => ({ save: { color: 'primary', - icon: 'restart_alt', + icon: 'save', label: 'globals.save', }, reset: { color: 'primary', - icon: 'save', + icon: 'restart_alt', label: 'globals.reset', }, ...$props.defaultButtons, From 1a15ccec2c96e51ab289899d7e8d686479e11e86 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 5 Apr 2024 11:01:48 +0200 Subject: [PATCH 07/20] fix: refs #6636 Call getEnumValues method --- src/pages/Claim/Card/ClaimBasicData.vue | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index 38d5d1ed5..56717c628 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; +import axios from 'axios'; import { useSession } from 'src/composables/useSession'; const route = useRoute(); @@ -50,13 +51,20 @@ function setClaimStates(data) { claimStates.value = data; claimStatesCopy.value = data; } - -// Simulate ENUM -let optionsList = [ - { id: null, description: t('claim.basicData.null') }, - { id: 'agency', description: t('claim.basicData.agency') }, - { id: 'delivery', description: t('claim.basicData.delivery') }, -]; +let optionsList; +async function getEnumValues() { + optionsList = [{ id: null, description: t('claim.basicData.null') }]; + const { data } = await axios.get(`Applications/get-enum-values`, { + params: { + schema: 'vn', + table: 'claim', + column: 'pickup', + }, + }); + for (let value of data) + optionsList.push({ id: value, description: t(`claim.basicData.${value}`) }); +} +getEnumValues(); const workerFilter = { options: workers, From 8de3ea16a6c79020bc5442e1c054db6a3cb90c46 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 8 Apr 2024 15:15:18 +0200 Subject: [PATCH 08/20] fix: refs #6992 add queryParams --- CHANGELOG.md | 4 ++++ src/composables/useArrayData.js | 16 ++++++++++------ test/cypress/integration/vnSearchBar.spec.js | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 555b4f0ba..9f493764a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +### Fixed + +- (General) => Se vuelven a mostrar los parámetros en la url al aplicar un filtro + ## [2414.01] - 2024-04-04 ### Added diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index b6b81f2d5..403683415 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -105,7 +105,7 @@ export function useArrayData(key, userOptions) { for (const row of response.data) store.data.push(row); } else { store.data = response.data; - if (!document.querySelectorAll('[role="dialog"]')) + if (!document.querySelectorAll('[role="dialog"]').length) updateRouter && updateStateParams(); } @@ -188,11 +188,15 @@ export function useArrayData(key, userOptions) { if (store.userParams && Object.keys(store.userParams).length !== 0) query.params = JSON.stringify(store.userParams); - if (router) - router.replace({ - path: route.path, - query: query, - }); + const url = new URL(window.location.href); + const { hash: currentHash } = url; + const [currentRoute] = currentHash.split('?'); + + const params = new URLSearchParams(); + for (const param in query) params.append(param, query[param]); + + url.hash = currentRoute + '?' + params.toString(); + window.history.pushState({}, '', url); } const totalRows = computed(() => (store.data && store.data.length) || 0); diff --git a/test/cypress/integration/vnSearchBar.spec.js b/test/cypress/integration/vnSearchBar.spec.js index 3db789773..f1f3a9e82 100644 --- a/test/cypress/integration/vnSearchBar.spec.js +++ b/test/cypress/integration/vnSearchBar.spec.js @@ -36,7 +36,7 @@ describe('VnSearchBar', () => { const checkCardListAndUrl = (expectedLength) => { cy.get(cardList).then(($cardList) => { expect($cardList.find('.q-card').length).to.equal(expectedLength); - cy.url().then((currentUrl) => expect(currentUrl).to.equal(url)); + cy.url().then((currentUrl) => expect(currentUrl).to.contain(url)); }); }; }); From 16548dadefd7638bd8fa20efbd0292eaf3ce0fd0 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 8 Apr 2024 16:38:36 +0200 Subject: [PATCH 09/20] feat: refs #6992 add test --- src/composables/useArrayData.js | 2 +- .../composables/useArrayData.spec.js | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/vitest/__tests__/composables/useArrayData.spec.js diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 403683415..a212cb744 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -196,7 +196,7 @@ export function useArrayData(key, userOptions) { for (const param in query) params.append(param, query[param]); url.hash = currentRoute + '?' + params.toString(); - window.history.pushState({}, '', url); + window.history.pushState({}, '', url.hash); } const totalRows = computed(() => (store.data && store.data.length) || 0); diff --git a/test/vitest/__tests__/composables/useArrayData.spec.js b/test/vitest/__tests__/composables/useArrayData.spec.js new file mode 100644 index 000000000..09bfc256f --- /dev/null +++ b/test/vitest/__tests__/composables/useArrayData.spec.js @@ -0,0 +1,27 @@ +import { describe, expect, it, beforeAll } from 'vitest'; +import { axios } from 'app/test/vitest/helper'; +import { useArrayData } from 'composables/useArrayData'; + +describe('useArrayData', () => { + let arrayData; + beforeAll(() => { + axios.get.mockResolvedValue({ data: [] }); + arrayData = useArrayData('InvoiceIn', { url: 'invoice-in/list' }); + Object.defineProperty(window.location, 'href', { + writable: true, + value: 'localhost:9000/invoice-in/list', + }); + window.history.pushState = (data, title, url) => (window.location.href = url); + global.URL = class URL { + constructor(url) { + this.hash = url.split('localhost:9000/')[1]; + } + }; + }); + + it('should add the params to the url', async () => { + arrayData.store.userParams = { supplierFk: 2 }; + arrayData.updateStateParams(); + expect(window.location.href).contain('params=%7B%22supplierFk%22%3A2%7D'); + }); +}); From 65626446fd3b3ecf4969149609a1e2486bed7f94 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 9 Apr 2024 13:01:29 +0200 Subject: [PATCH 10/20] refactor: refs #7186 fixed style and tab --- src/pages/InvoiceIn/Card/InvoiceInVat.vue | 38 ++++++++++++++++++----- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue index 3eb9365d2..fa0ad12db 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue @@ -32,6 +32,13 @@ const invoiceInFormRef = ref(); const expensesRef = ref(); const newExpenseRef = ref(); +const $props = defineProps({ + actionIcon: { + type: String, + default: 'add', + }, +}); + const columns = computed(() => [ { name: 'expense', @@ -94,6 +101,11 @@ const columns = computed(() => [ field: (row) => row.foreignValue, align: 'left', }, + { + get() { + return $props.actionIcon; + }, + } ]); const filter = { @@ -207,17 +219,19 @@ async function addExpense() { @click.stop="value = null" class="cursor-pointer" /> - {{ t('Create expense') }} - + @@ -470,6 +484,16 @@ async function addExpense() { .q-item { min-height: 0; } +.default-icon { + cursor: pointer; + color: $primary; + border-radius: 50px; + + &.--add-icon { + color: var(--vn-text-color); + background-color: $primary; + } +} es: From f6e140e369f54bf41c77fb3fd05e584e740eeaa7 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Tue, 9 Apr 2024 08:28:00 -0300 Subject: [PATCH 11/20] Apply workerDms changes --- src/components/common/VnDms.vue | 2 + src/components/common/VnDmsList.vue | 225 +++++++++++------- src/components/ui/VnPaginate.vue | 15 +- src/components/ui/VnTree.vue | 2 +- src/composables/downloadFile.js | 5 +- src/composables/getUrl.js | 24 -- src/composables/useArrayData.js | 2 +- src/i18n/en/index.js | 2 + src/i18n/es/index.js | 2 + .../Department/Card/DepartmentDescriptor.vue | 2 +- src/pages/Worker/Card/WorkerDms.vue | 7 +- 11 files changed, 163 insertions(+), 125 deletions(-) diff --git a/src/components/common/VnDms.vue b/src/components/common/VnDms.vue index 08255f8a5..daef5940b 100644 --- a/src/components/common/VnDms.vue +++ b/src/components/common/VnDms.vue @@ -198,9 +198,11 @@ function addDefaultData(data) { en: contentTypesInfo: Allowed file types {allowedContentTypes} EntryDmsDescription: Reference {reference} + WorkersDescription: Working of employee id {reference} es: Generate identifier for original file: Generar identificador para archivo original contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes} EntryDmsDescription: Referencia {reference} + WorkersDescription: Laboral del empleado {reference} diff --git a/src/components/common/VnDmsList.vue b/src/components/common/VnDmsList.vue index 9bf90230d..8c3ffc807 100644 --- a/src/components/common/VnDmsList.vue +++ b/src/components/common/VnDmsList.vue @@ -5,11 +5,12 @@ import { useRoute } from 'vue-router'; import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar'; import axios from 'axios'; -import FetchData from 'components/FetchData.vue'; +import VnPaginate from 'components/ui/VnPaginate.vue'; import VnDms from 'src/components/common/VnDms.vue'; import VnConfirm from 'components/ui/VnConfirm.vue'; +import VnInputDate from 'components/common/VnInputDate.vue'; +import VnUserLink from '../ui/VnUserLink.vue'; import { downloadFile } from 'src/composables/downloadFile'; -import { getUrlFindOne } from 'composables/getUrl'; const route = useRoute(); const quasar = useQuasar(); @@ -27,6 +28,11 @@ const $props = defineProps({ type: String, default: null, }, + downloadModel: { + type: String, + required: false, + default: null, + }, defaultDmsCode: { type: String, required: true, @@ -75,7 +81,7 @@ const dmsFilter = { ], }, }, - order: ['dmsFk DESC'], + where: { [$props.filter]: route.params.id }, }; const columns = computed(() => [ @@ -95,12 +101,12 @@ const columns = computed(() => [ props: (prop) => ({ readonly: true, borderless: true, - 'model-value': prop.row.dmsType.name, + 'model-value': prop.row.dmsType?.name, }), }, { align: 'left', - field: 'order', + field: 'hardCopyNumber', label: t('globals.order'), name: 'order', component: 'span', @@ -118,6 +124,7 @@ const columns = computed(() => [ label: t('globals.description'), name: 'description', component: 'span', + props: (prop) => ({ value: prop.value?.toUpperCase() }), }, { align: 'left', @@ -137,6 +144,28 @@ const columns = computed(() => [ name: 'file', component: 'span', }, + { + align: 'left', + field: 'worker', + label: t('globals.worker'), + name: 'worker', + component: VnUserLink, + props: (prop) => ({ + name: prop.row.worker?.user?.name.toLowerCase(), + workerId: prop.row.worker?.id, + }), + }, + { + align: 'left', + field: 'created', + label: t('globals.created'), + name: 'created', + component: VnInputDate, + props: (prop) => ({ + disable: true, + 'model-value': prop.row.created, + }), + }, { field: 'options', name: 'options', @@ -144,16 +173,24 @@ const columns = computed(() => [ { component: QBtn, name: 'download', + isDocuware: true, props: () => ({ icon: 'cloud_download', flat: true, color: 'primary', }), - click: (prop) => downloadFile(prop.row.id, prop.row.isDocuware), + click: (prop) => + downloadFile( + prop.row.id, + $props.downloadModel, + null, + prop.row.download + ), }, { component: QBtn, name: 'edit', + external: false, props: () => ({ icon: 'edit', flat: true, @@ -164,6 +201,7 @@ const columns = computed(() => [ { component: QBtn, name: 'delete', + external: false, props: () => ({ icon: 'delete', flat: true, @@ -173,20 +211,22 @@ const columns = computed(() => [ }, { component: QBtn, - name: 'openDocuware', + name: 'open', + external: true, props: () => ({ icon: 'open_in_new', flat: true, color: 'primary', }), - click: () => openDocuware(), + click: (prop) => open(prop.row.url), }, ], }, ]); function setData(data) { - const newData = data.map((value) => value.dms); + const newData = data.map((value) => value.dms || value); + newData.sort((a, b) => new Date(b.created) - new Date(a.created)); rows.value = newData; } @@ -221,100 +261,105 @@ function parseDms(data) { return data; } -async function openDocuware() { - const url = await getUrlFindOne('WebClient', 'docuware'); - if (url) window.open(url).focus(); +async function open(url) { + window.open(url).focus(); } -function shouldRenderButton(buttonName, isDocuware = false) { - // Renderizar el botón si no se llama 'openDocuware' o (se llama 'openDocuware' y props.row.isDocuware = true) - return buttonName !== 'openDocuware' || (buttonName === 'openDocuware' && isDocuware); +function shouldRenderButton(button, isExternal = false) { + if (button.name == 'download') return true; + return button.external === isExternal; } From 39af4278a688309d5543f56a84da523a986f040f Mon Sep 17 00:00:00 2001 From: wbuezas Date: Wed, 10 Apr 2024 08:27:30 -0300 Subject: [PATCH 18/20] Add delete model to worker dms --- src/components/common/VnDmsList.vue | 6 +++++- src/pages/Worker/Card/WorkerDms.vue | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/common/VnDmsList.vue b/src/components/common/VnDmsList.vue index 8c3ffc807..cc184703d 100644 --- a/src/components/common/VnDmsList.vue +++ b/src/components/common/VnDmsList.vue @@ -28,6 +28,10 @@ const $props = defineProps({ type: String, default: null, }, + deleteModel: { + type: String, + default: null, + }, downloadModel: { type: String, required: false, @@ -240,7 +244,7 @@ function deleteDms(dmsFk) { }, }) .onOk(async () => { - await axios.post(`${$props.model}/${dmsFk}/removeFile`); + await axios.post($props.deleteModel ?? `${$props.model}/${dmsFk}/removeFile`); const index = rows.value.findIndex((row) => row.id == dmsFk); rows.value.splice(index, 1); }); diff --git a/src/pages/Worker/Card/WorkerDms.vue b/src/pages/Worker/Card/WorkerDms.vue index eee42857c..faf89b245 100644 --- a/src/pages/Worker/Card/WorkerDms.vue +++ b/src/pages/Worker/Card/WorkerDms.vue @@ -1,11 +1,13 @@ -