From 01ffe3adb7a040e0319473540c3b11d03d692b34 Mon Sep 17 00:00:00 2001 From: carlosfonseca Date: Mon, 5 Feb 2024 15:51:09 -0500 Subject: [PATCH 1/2] Se termina desarrollo de las tarjetas gestion documental e impagado --- src/components/FormModel.vue | 18 +- src/pages/Customer/Card/CustomerBalance.vue | 2 +- .../Customer/Card/CustomerCreditOpinion.vue | 2 +- src/pages/Customer/Card/CustomerCredits.vue | 15 +- .../Customer/Card/CustomerFileManagement.vue | 267 +++++++++++++++++- .../Customer/Card/CustomerRecoveries.vue | 2 +- src/pages/Customer/Card/CustomerSamples.vue | 2 +- src/pages/Customer/Card/CustomerUnpaid.vue | 56 +++- .../CustomerDefaulterAddObservation.vue | 3 +- .../CustomerFileManagementActions.vue | 96 +++++++ .../CustomerFileManagementCreate.vue | 247 ++++++++++++++++ .../CustomerFileManagementDelete.vue | 81 ++++++ .../components/CustomerFileManagementEdit.vue | 225 +++++++++++++++ src/router/modules/customer.js | 38 ++- 14 files changed, 1017 insertions(+), 37 deletions(-) create mode 100644 src/pages/Customer/components/CustomerFileManagementActions.vue create mode 100644 src/pages/Customer/components/CustomerFileManagementCreate.vue create mode 100644 src/pages/Customer/components/CustomerFileManagementDelete.vue create mode 100644 src/pages/Customer/components/CustomerFileManagementEdit.vue diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 2bc72f96d..b18312896 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -109,14 +109,18 @@ function tMobile(...args) { } async function fetch() { - const { data } = await axios.get($props.url, { - params: { filter: JSON.stringify($props.filter) }, - }); + try { + const { data } = await axios.get($props.url, { + params: { filter: JSON.stringify($props.filter) }, + }); + state.set($props.model, data); + originalData.value = data && JSON.parse(JSON.stringify(data)); - state.set($props.model, data); - originalData.value = data && JSON.parse(JSON.stringify(data)); - - emit('onFetch', state.get($props.model)); + emit('onFetch', state.get($props.model)); + } catch (error) { + state.set($props.model, {}); + originalData.value = {}; + } } async function save() { diff --git a/src/pages/Customer/Card/CustomerBalance.vue b/src/pages/Customer/Card/CustomerBalance.vue index e74933477..c8109eb7d 100644 --- a/src/pages/Customer/Card/CustomerBalance.vue +++ b/src/pages/Customer/Card/CustomerBalance.vue @@ -37,7 +37,7 @@ const params = { }; const filter = { include: { relation: 'company', scope: { fields: ['code'] } }, - where: { clientFk: `${route.params.id}`, companyFk: user.value.companyFk }, + where: { clientFk: route.params.id, companyFk: user.value.companyFk }, }; const tableColumnComponents = { diff --git a/src/pages/Customer/Card/CustomerCreditOpinion.vue b/src/pages/Customer/Card/CustomerCreditOpinion.vue index 74d61b7c1..8a532a4e3 100644 --- a/src/pages/Customer/Card/CustomerCreditOpinion.vue +++ b/src/pages/Customer/Card/CustomerCreditOpinion.vue @@ -23,7 +23,7 @@ const filter = { }, }, ], - where: { clientFk: `${route.params.id}` }, + where: { clientFk: route.params.id }, order: ['created DESC'], limit: 20, }; diff --git a/src/pages/Customer/Card/CustomerCredits.vue b/src/pages/Customer/Card/CustomerCredits.vue index 6852b42eb..f5e820aac 100644 --- a/src/pages/Customer/Card/CustomerCredits.vue +++ b/src/pages/Customer/Card/CustomerCredits.vue @@ -1,5 +1,5 @@ + + + + + +es: + Id: Id + Type: Tipo + Order: Orden + Reference: Referencia + Description: Descripción + Original: Original + File: Fichero + Employee: Empleado + Created: Fecha creación + Upload file: Subir fichero + diff --git a/src/pages/Customer/Card/CustomerRecoveries.vue b/src/pages/Customer/Card/CustomerRecoveries.vue index e747b3d79..c4ae47a64 100644 --- a/src/pages/Customer/Card/CustomerRecoveries.vue +++ b/src/pages/Customer/Card/CustomerRecoveries.vue @@ -15,7 +15,7 @@ const router = useRouter(); const rows = ref([]); const filter = { - where: { clientFk: `${route.params.id}` }, + where: { clientFk: route.params.id }, order: ['started DESC'], limit: 20, }; diff --git a/src/pages/Customer/Card/CustomerSamples.vue b/src/pages/Customer/Card/CustomerSamples.vue index c0d84eff6..499db87fb 100644 --- a/src/pages/Customer/Card/CustomerSamples.vue +++ b/src/pages/Customer/Card/CustomerSamples.vue @@ -71,7 +71,7 @@ const columns = computed(() => [ }, { align: 'left', - field: (value) => value.company.code, + field: (value) => value.company?.code, label: t('Company'), name: 'company', }, diff --git a/src/pages/Customer/Card/CustomerUnpaid.vue b/src/pages/Customer/Card/CustomerUnpaid.vue index 66f771aba..54b4851db 100644 --- a/src/pages/Customer/Card/CustomerUnpaid.vue +++ b/src/pages/Customer/Card/CustomerUnpaid.vue @@ -1,3 +1,57 @@ + + + + +es: + Unpaid client: Cliente impagado + Date: Fecha + Amount: Importe + diff --git a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue index b150f4d8b..cb24548a3 100644 --- a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue +++ b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue @@ -3,7 +3,7 @@ import { ref } from 'vue'; import { useI18n } from 'vue-i18n'; import axios from 'axios'; -import { useQuasar } from 'quasar'; +import { useDialogPluginComponent, useQuasar } from 'quasar'; import VnRow from 'components/ui/VnRow.vue'; @@ -18,6 +18,7 @@ const $props = defineProps({ }, }); +const { dialogRef } = useDialogPluginComponent(); const { t } = useI18n(); const quasar = useQuasar(); diff --git a/src/pages/Customer/components/CustomerFileManagementActions.vue b/src/pages/Customer/components/CustomerFileManagementActions.vue new file mode 100644 index 000000000..105c12cf7 --- /dev/null +++ b/src/pages/Customer/components/CustomerFileManagementActions.vue @@ -0,0 +1,96 @@ + + + + + +es: + Download file: Descargar fichero + Edit file: Editar fichero + Remove file: Eliminar fichero + diff --git a/src/pages/Customer/components/CustomerFileManagementCreate.vue b/src/pages/Customer/components/CustomerFileManagementCreate.vue new file mode 100644 index 000000000..9e15758f8 --- /dev/null +++ b/src/pages/Customer/components/CustomerFileManagementCreate.vue @@ -0,0 +1,247 @@ + + + + + +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/Customer/components/CustomerFileManagementDelete.vue b/src/pages/Customer/components/CustomerFileManagementDelete.vue new file mode 100644 index 000000000..c4e80d492 --- /dev/null +++ b/src/pages/Customer/components/CustomerFileManagementDelete.vue @@ -0,0 +1,81 @@ + + + + + +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/Customer/components/CustomerFileManagementEdit.vue b/src/pages/Customer/components/CustomerFileManagementEdit.vue new file mode 100644 index 000000000..5b6cb0981 --- /dev/null +++ b/src/pages/Customer/components/CustomerFileManagementEdit.vue @@ -0,0 +1,225 @@ + + + + + +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/customer.js b/src/router/modules/customer.js index 46202128c..88faec2a5 100644 --- a/src/router/modules/customer.js +++ b/src/router/modules/customer.js @@ -356,12 +356,12 @@ export default { { name: 'CustomerCreditContracts', title: 'creditContracts', - icon: 'paid', + icon: 'vn:solunion', }, { name: 'CustomerCreditOpinion', title: 'creditOpinion', - icon: 'paid', + icon: 'vn:linesprepaired', }, ], }, @@ -371,7 +371,6 @@ export default { name: 'CustomerCreditContracts', meta: { title: 'creditContracts', - icon: 'paid', }, component: () => import( @@ -388,7 +387,6 @@ export default { name: 'CustomerCreditContracts', meta: { title: 'creditContracts', - icon: 'paid', }, component: () => import( @@ -418,7 +416,6 @@ export default { name: 'CustomerCreditOpinion', meta: { title: 'creditOpinion', - icon: 'paid', }, component: () => import( @@ -437,37 +434,37 @@ export default { { name: 'CustomerSamples', title: 'samples', - icon: 'pending', + icon: 'vn:notes', }, { name: 'CustomerConsumption', title: 'consumption', - icon: 'pending', + icon: 'vn:lines', }, { name: 'CustomerMandates', title: 'mandates', - icon: 'pending', + icon: 'vn:mandatory', }, { name: 'CustomerContacts', title: 'contacts', - icon: 'pending', + icon: 'contact_phone', }, { name: 'CustomerWebPayment', title: 'webPayment', - icon: 'pending', + icon: 'vn:onlinepayment', }, { name: 'CustomerFileManagement', title: 'fileManagement', - icon: 'pending', + icon: 'Upload', }, { name: 'CustomerUnpaid', title: 'unpaid', - icon: 'pending', + icon: 'vn:supplierfalse', }, ], }, @@ -477,7 +474,6 @@ export default { name: 'CustomerSamples', meta: { title: 'samples', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerSamples.vue'), @@ -492,7 +488,6 @@ export default { name: 'CustomerSamples', meta: { title: 'samples', - icon: 'paid', }, component: () => import( @@ -514,7 +509,6 @@ export default { name: 'CustomerConsumption', meta: { title: 'consumption', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerConsumption.vue'), @@ -524,7 +518,6 @@ export default { name: 'CustomerMandates', meta: { title: 'mandates', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerMandates.vue'), @@ -534,7 +527,6 @@ export default { name: 'CustomerContacts', meta: { title: 'contacts', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerContacts.vue'), @@ -544,7 +536,6 @@ export default { name: 'CustomerWebPayment', meta: { title: 'webPayment', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerWebPayment.vue'), @@ -554,7 +545,6 @@ export default { name: 'CustomerFileManagement', meta: { title: 'fileManagement', - icon: 'paid', }, component: () => import( @@ -571,7 +561,6 @@ export default { name: 'CustomerFileManagement', meta: { title: 'fileManagement', - icon: 'paid', }, component: () => import( @@ -586,6 +575,14 @@ export default { 'src/pages/Customer/components/CustomerFileManagementCreate.vue' ), }, + { + path: ':dmsId/edit', + name: 'CustomerFileManagementEdit', + component: () => + import( + 'src/pages/Customer/components/CustomerFileManagementEdit.vue' + ), + }, ], }, { @@ -593,7 +590,6 @@ export default { name: 'CustomerUnpaid', meta: { title: 'unpaid', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerUnpaid.vue'), From fd3eea70dea42bf5d2b35b872fe281bda872bf0e Mon Sep 17 00:00:00 2001 From: carlosfonseca Date: Tue, 6 Feb 2024 11:04:37 -0500 Subject: [PATCH 2/2] Se corrigen comentarios de PR --- src/css/app.scss | 4 +++ src/pages/Customer/Card/CustomerBalance.vue | 30 ++++++++-------- .../Customer/Card/CustomerConsumption.vue | 8 +---- .../Customer/Card/CustomerCreditContracts.vue | 17 +++++---- src/pages/Customer/Card/CustomerCredits.vue | 12 ++++--- .../Customer/Card/CustomerFileManagement.vue | 33 ++++++++--------- src/pages/Customer/Card/CustomerGreuges.vue | 30 ++++++---------- src/pages/Customer/Card/CustomerLog.vue | 2 +- src/pages/Customer/Card/CustomerMandates.vue | 8 +---- src/pages/Customer/Card/CustomerNotes.vue | 10 ++---- .../Customer/Card/CustomerRecoveries.vue | 12 +------ src/pages/Customer/Card/CustomerSamples.vue | 26 +++++--------- .../Customer/Card/CustomerWebPayment.vue | 8 +---- .../Customer/Defaulter/CustomerDefaulter.vue | 35 +++++++++---------- .../CustomerDefaulterAddObservation.vue | 16 ++++----- .../CustomerFileManagementCreate.vue | 14 +++----- .../CustomerFileManagementDelete.vue | 12 +++---- .../components/CustomerFileManagementEdit.vue | 15 +++----- 18 files changed, 113 insertions(+), 179 deletions(-) diff --git a/src/css/app.scss b/src/css/app.scss index f11ab865c..fdb402053 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -48,6 +48,10 @@ body.body--dark { background-color: var(--vn-dark); } +.color-vn-label { + color: var(--vn-label); +} + .color-vn-text { color: var(--vn-text); } diff --git a/src/pages/Customer/Card/CustomerBalance.vue b/src/pages/Customer/Card/CustomerBalance.vue index c8109eb7d..9e2cfb6ff 100644 --- a/src/pages/Customer/Card/CustomerBalance.vue +++ b/src/pages/Customer/Card/CustomerBalance.vue @@ -27,7 +27,6 @@ const companiesOptions = ref([]); const companyId = ref(null); const receiptsRef = ref(null); const rows = ref([]); -const workerId = ref(null); const filterCompanies = { order: ['code'] }; const params = { @@ -44,42 +43,42 @@ const tableColumnComponents = { payed: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, created: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, userName: { component: QBtn, props: () => ({ flat: true, color: 'blue' }), - event: ({ row }) => (workerId.value = row.clientFk), + event: () => {}, }, description: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, bankFk: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, debit: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, credit: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, balance: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, isConciliate: { component: QCheckbox, @@ -87,7 +86,7 @@ const tableColumnComponents = { disable: true, 'model-value': Boolean(prop.value), }), - event: () => (workerId.value = null), + event: () => {}, }, }; @@ -207,11 +206,11 @@ const updateCompanyId = (id) => { -
- {{ t('globals.noResults') }} -
-
- - es: Enter a new search: Introduce una nueva búsqueda diff --git a/src/pages/Customer/Card/CustomerCreditContracts.vue b/src/pages/Customer/Card/CustomerCreditContracts.vue index 71bf42fd4..c23e3e6c0 100644 --- a/src/pages/Customer/Card/CustomerCreditContracts.vue +++ b/src/pages/Customer/Card/CustomerCreditContracts.vue @@ -108,7 +108,7 @@ const updateData = () => {
-
+
{{ t('Since') }}:
@@ -116,7 +116,9 @@ const updateData = () => {
-
{{ t('To') }}:
+
+ {{ t('To') }}: +
{{ toDate(item.finished) }}
@@ -129,7 +131,7 @@ const updateData = () => {
-
+
{{ t('Credit') }}:
@@ -137,7 +139,7 @@ const updateData = () => {
-
+
{{ t('Grade') }}:
@@ -145,7 +147,7 @@ const updateData = () => {
-
+
{{ t('Date') }}:
@@ -167,7 +169,7 @@ const updateData = () => {
-
+
{{ t('globals.noResults') }}
@@ -188,9 +190,6 @@ const updateData = () => { diff --git a/src/pages/Customer/Card/CustomerLog.vue b/src/pages/Customer/Card/CustomerLog.vue index 36d79959d..5616bdf87 100644 --- a/src/pages/Customer/Card/CustomerLog.vue +++ b/src/pages/Customer/Card/CustomerLog.vue @@ -124,7 +124,7 @@ const setInq = (value, status) => { :url="urlClientLogsModels" /> -
+
{{ t('globals.noResults') }}
diff --git a/src/pages/Customer/Card/CustomerMandates.vue b/src/pages/Customer/Card/CustomerMandates.vue index 676c9f551..9d9634a16 100644 --- a/src/pages/Customer/Card/CustomerMandates.vue +++ b/src/pages/Customer/Card/CustomerMandates.vue @@ -5,13 +5,7 @@ const { t } = useI18n(); - - diff --git a/src/pages/Customer/Card/CustomerNotes.vue b/src/pages/Customer/Card/CustomerNotes.vue index 781c57e50..eca1e165f 100644 --- a/src/pages/Customer/Card/CustomerNotes.vue +++ b/src/pages/Customer/Card/CustomerNotes.vue @@ -43,8 +43,8 @@ const toCustomerNoteCreate = () => { }" >
-

{{ item.worker.user.nickname }}

-

+

{{ item.worker.user.nickname }}

+

{{ date.formatDate(item?.created, 'DD-MM-YYYY HH:mm:ss') }} @@ -55,7 +55,7 @@ const toCustomerNoteCreate = () => {

-
+
{{ t('globals.noResults') }}
@@ -89,8 +89,4 @@ const toCustomerNoteCreate = () => { border-radius: 10px; padding: 10px; } - -.label-color { - color: var(--vn-label); -} diff --git a/src/pages/Customer/Card/CustomerRecoveries.vue b/src/pages/Customer/Card/CustomerRecoveries.vue index c4ae47a64..749eec4cc 100644 --- a/src/pages/Customer/Card/CustomerRecoveries.vue +++ b/src/pages/Customer/Card/CustomerRecoveries.vue @@ -89,11 +89,11 @@ const toCustomerRecoverieCreate = () => { - - -
- {{ t('globals.noResults') }} -
-
@@ -132,10 +126,6 @@ const toCustomerRecoverieCreate = () => { border-radius: 10px; padding: 10px; } - -.label-color { - color: var(--vn-label); -} diff --git a/src/pages/Customer/Card/CustomerSamples.vue b/src/pages/Customer/Card/CustomerSamples.vue index 499db87fb..ca5d63dcb 100644 --- a/src/pages/Customer/Card/CustomerSamples.vue +++ b/src/pages/Customer/Card/CustomerSamples.vue @@ -12,7 +12,6 @@ const { t } = useI18n(); const route = useRoute(); const router = useRouter(); -const workerId = ref(null); const rows = ref([]); const filter = { @@ -30,22 +29,22 @@ const tableColumnComponents = { sent: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, description: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, worker: { component: QBtn, props: () => ({ flat: true, color: 'blue' }), - event: ({ row }) => (workerId.value = row.clientFk), + event: () => {}, }, company: { component: 'span', props: () => {}, - event: () => (workerId.value = null), + event: () => {}, }, }; @@ -97,7 +96,7 @@ const toCustomerSamplesCreate = () => { :rows="rows" class="full-width q-mt-md" row-key="id" - v-if="rows?.length" + :no-data-label="t('globals.noResults')" > - - -
- {{ t('globals.noResults') }} -
-
@@ -137,10 +133,6 @@ const toCustomerSamplesCreate = () => { border-radius: 10px; padding: 10px; } - -.label-color { - color: var(--vn-label); -} diff --git a/src/pages/Customer/Card/CustomerWebPayment.vue b/src/pages/Customer/Card/CustomerWebPayment.vue index 676c9f551..9d9634a16 100644 --- a/src/pages/Customer/Card/CustomerWebPayment.vue +++ b/src/pages/Customer/Card/CustomerWebPayment.vue @@ -5,13 +5,7 @@ const { t } = useI18n(); - - diff --git a/src/pages/Customer/Defaulter/CustomerDefaulter.vue b/src/pages/Customer/Defaulter/CustomerDefaulter.vue index 89a106a18..69f9052c2 100644 --- a/src/pages/Customer/Defaulter/CustomerDefaulter.vue +++ b/src/pages/Customer/Defaulter/CustomerDefaulter.vue @@ -17,7 +17,6 @@ const { t } = useI18n(); const quasar = useQuasar(); const balanceDueTotal = ref(0); -const customerId = ref(0); const selected = ref([]); const workerId = ref(0); const rows = ref([]); @@ -26,7 +25,7 @@ const tableColumnComponents = { client: { component: QBtn, props: () => ({ flat: true, color: 'blue' }), - event: ({ row }) => selectCustomerId(row.clientFk), + event: () => {}, }, isWorker: { component: QCheckbox, @@ -35,10 +34,10 @@ const tableColumnComponents = { 'model-value': Boolean(row.selected), }), }, - salesperson: { + salesPerson: { component: QBtn, props: () => ({ flat: true, color: 'blue' }), - event: ({ row }) => selectWorkerId(row.salesPersonFk), + event: () => {}, }, country: { component: 'span', @@ -58,7 +57,7 @@ const tableColumnComponents = { author: { component: QBtn, props: () => ({ flat: true, color: 'blue' }), - event: ({ row }) => selectWorkerId(row.workerFk), + event: () => {}, }, lastObservation: { component: 'span', @@ -99,7 +98,7 @@ const columns = computed(() => [ align: 'left', field: 'salesPersonName', label: t('Salesperson'), - name: 'salesperson', + name: 'salesPerson', }, { align: 'left', @@ -158,16 +157,6 @@ const setRows = (data) => { }, 0); }; -const selectCustomerId = (id) => { - workerId.value = 0; - customerId.value = id; -}; - -const selectWorkerId = (id) => { - customerId.value = 0; - workerId.value = id; -}; - const viewAddObservation = (rowsSelected) => { quasar.dialog({ component: CustomerDefaulterAddObservation, @@ -233,8 +222,18 @@ const refreshData = () => { > {{ props.value }} - - + + + diff --git a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue index cb24548a3..2d5125f39 100644 --- a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue +++ b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue @@ -3,7 +3,9 @@ import { ref } from 'vue'; import { useI18n } from 'vue-i18n'; import axios from 'axios'; -import { useDialogPluginComponent, useQuasar } from 'quasar'; +import { useDialogPluginComponent } from 'quasar'; + +import useNotify from 'src/composables/useNotify'; import VnRow from 'components/ui/VnRow.vue'; @@ -19,8 +21,8 @@ const $props = defineProps({ }); const { dialogRef } = useDialogPluginComponent(); +const { notify } = useNotify(); const { t } = useI18n(); -const quasar = useQuasar(); const newObservation = ref(null); @@ -39,15 +41,9 @@ const onSubmit = async () => { await $props.promise(); - quasar.notify({ - message: t('globals.dataSaved'), - type: 'positive', - }); + notify('globals.dataSaved', 'positive'); } catch (error) { - quasar.notify({ - message: t(`${error.message}`), - type: 'negative', - }); + notify(error.message, 'negative'); } }; diff --git a/src/pages/Customer/components/CustomerFileManagementCreate.vue b/src/pages/Customer/components/CustomerFileManagementCreate.vue index 9e15758f8..c401d1924 100644 --- a/src/pages/Customer/components/CustomerFileManagementCreate.vue +++ b/src/pages/Customer/components/CustomerFileManagementCreate.vue @@ -4,17 +4,17 @@ import { useI18n } from 'vue-i18n'; import { useRoute, useRouter } from 'vue-router'; import axios from 'axios'; -import { useQuasar } from 'quasar'; import { useState } from 'src/composables/useState'; +import useNotify from 'src/composables/useNotify'; import FetchData from 'components/FetchData.vue'; import VnRow from 'components/ui/VnRow.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnInput from 'src/components/common/VnInput.vue'; +const { notify } = useNotify(); const { t } = useI18n(); -const quasar = useQuasar(); const route = useRoute(); const router = useRouter(); const state = useState(); @@ -64,16 +64,10 @@ const saveData = async () => { await axios.post(url, formData, { params: dms.value, }); - quasar.notify({ - message: t('globals.dataSaved'), - type: 'positive', - }); + notify('globals.dataSaved', 'positive'); router.push({ name: 'CustomerFileManagement' }); } catch (error) { - quasar.notify({ - message: t(`${error.message}`), - type: 'negative', - }); + notify(error.message, 'negative'); } }; diff --git a/src/pages/Customer/components/CustomerFileManagementDelete.vue b/src/pages/Customer/components/CustomerFileManagementDelete.vue index c4e80d492..aadcd5c12 100644 --- a/src/pages/Customer/components/CustomerFileManagementDelete.vue +++ b/src/pages/Customer/components/CustomerFileManagementDelete.vue @@ -2,9 +2,11 @@ import { ref } from 'vue'; import { useI18n } from 'vue-i18n'; -import { useDialogPluginComponent, useQuasar } from 'quasar'; +import { useDialogPluginComponent } from 'quasar'; import axios from 'axios'; +import useNotify from 'src/composables/useNotify'; + const $props = defineProps({ id: { type: Number, @@ -17,8 +19,8 @@ const $props = defineProps({ }); const { dialogRef } = useDialogPluginComponent(); +const { notify } = useNotify(); const { t } = useI18n(); -const quasar = useQuasar(); const closeButton = ref(null); const isLoading = ref(false); @@ -28,11 +30,9 @@ const deleteDms = async () => { try { await axios.post(`ClientDms/${$props.id}/removeFile`); if ($props.promise) await $props.promise(); + notify('globals.dataDeleted', 'positive'); } catch (error) { - quasar.notify({ - message: t(`${error.message}`), - type: 'negative', - }); + notify(error.message, 'negative'); } finally { closeButton.value.click(); isLoading.value = false; diff --git a/src/pages/Customer/components/CustomerFileManagementEdit.vue b/src/pages/Customer/components/CustomerFileManagementEdit.vue index 5b6cb0981..6773db42e 100644 --- a/src/pages/Customer/components/CustomerFileManagementEdit.vue +++ b/src/pages/Customer/components/CustomerFileManagementEdit.vue @@ -4,15 +4,16 @@ import { useI18n } from 'vue-i18n'; import { useRoute, useRouter } from 'vue-router'; import axios from 'axios'; -import { useQuasar } from 'quasar'; + +import useNotify from 'src/composables/useNotify'; import FetchData from 'components/FetchData.vue'; import VnRow from 'components/ui/VnRow.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnInput from 'src/components/common/VnInput.vue'; +const { notify } = useNotify(); const { t } = useI18n(); -const quasar = useQuasar(); const route = useRoute(); const router = useRouter(); @@ -51,16 +52,10 @@ const saveData = async () => { params: dms.value, }); - quasar.notify({ - message: t('globals.dataSaved'), - type: 'positive', - }); + notify('globals.dataSaved', 'positive'); router.push({ name: 'CustomerFileManagement' }); } catch (error) { - quasar.notify({ - message: t(`${error.message}`), - type: 'negative', - }); + notify(error.message, 'negative'); } };