From 810e579ea97e2229e9d9d5eb2f6f68a19b5e6d30 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 5 Aug 2024 12:10:15 +0200 Subject: [PATCH 1/5] refactor(customer_recovery): to vnTable --- src/i18n/locale/en.yml | 3 + src/i18n/locale/es.yml | 7 +- .../Customer/Card/CustomerRecoveries.vue | 179 +++++++----------- src/router/modules/customer.js | 32 +--- 4 files changed, 83 insertions(+), 138 deletions(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 78c1fa18d..d2cd83560 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -90,6 +90,9 @@ globals: salesPerson: SalesPerson send: Send code: Code + since: Since + from: From + to: To pageTitles: logIn: Login summary: Summary diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 0266bd208..b926bd50b 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -90,6 +90,9 @@ globals: salesPerson: Comercial send: Enviar code: Código + since: Desde + from: Desde + to: Hasta pageTitles: logIn: Inicio de sesión summary: Resumen @@ -697,8 +700,6 @@ invoiceOut: percentageText: '{getPercentage}% {getAddressNumber} de {getNAddresses}' pdfsNumberText: '{nPdfs} de {totalPdfs} PDFs' negativeBases: - from: Desde - to: Hasta company: Empresa country: País clientId: Id cliente @@ -1240,8 +1241,6 @@ components: # LatestBuysFilter salesPersonFk: Comprador supplierFk: Proveedor - from: Desde - to: Hasta active: Activo visible: Visible floramondo: Floramondo diff --git a/src/pages/Customer/Card/CustomerRecoveries.vue b/src/pages/Customer/Card/CustomerRecoveries.vue index 289b4bc0e..8d3d05702 100644 --- a/src/pages/Customer/Card/CustomerRecoveries.vue +++ b/src/pages/Customer/Card/CustomerRecoveries.vue @@ -1,146 +1,107 @@ - - es: - Since: Desde - To: Hasta - Amount: Importe Period: Periodo - New recoverie: Nuevo recobro + New recovery: Nuevo recobro + Finish that recovery period: Terminar recobro diff --git a/src/router/modules/customer.js b/src/router/modules/customer.js index 6d697967b..684b83b0f 100644 --- a/src/router/modules/customer.js +++ b/src/router/modules/customer.js @@ -226,31 +226,13 @@ export default { }, { path: 'recoveries', - name: 'RecoveriesCard', - redirect: { name: 'CustomerRecoveries' }, - children: [ - { - path: '', - name: 'CustomerRecoveries', - meta: { - title: 'recoveries', - icon: 'vn:recovery', - }, - component: () => - import('src/pages/Customer/Card/CustomerRecoveries.vue'), - }, - { - path: 'create', - name: 'CustomerRecoverieCreate', - meta: { - title: 'recoverie-create', - }, - component: () => - import( - 'src/pages/Customer/components/CustomerRecoverieCreate.vue' - ), - }, - ], + name: 'CustomerRecoveries', + meta: { + title: 'recoveries', + icon: 'vn:recovery', + }, + component: () => + import('src/pages/Customer/Card/CustomerRecoveries.vue'), }, { path: 'web-access', From 7612260359f146db5e36b1fbcb065bb3da30e4a9 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 5 Aug 2024 13:36:27 +0200 Subject: [PATCH 2/5] refactor(customer_webAccess): FormModel --- src/components/FormModel.vue | 14 +- src/pages/Customer/Card/CustomerWebAccess.vue | 163 +++++------------- 2 files changed, 48 insertions(+), 129 deletions(-) diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 115145f37..a0f6bf479 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -100,7 +100,6 @@ const isResetting = ref(false); const hasChanges = ref(!$props.observeFormChanges); const originalData = ref({}); const formData = computed(() => state.get(modelValue)); -const formUrl = computed(() => $props.url); const defaultButtons = computed(() => ({ save: { color: 'primary', @@ -148,11 +147,14 @@ if (!$props.url) (val) => updateAndEmit('onFetch', val) ); -watch(formUrl, async () => { - originalData.value = null; - reset(); - await fetch(); -}); +watch( + () => [$props.url, $props.filter], + async () => { + originalData.value = null; + reset(); + await fetch(); + } +); onBeforeRouteLeave((to, from, next) => { if (hasChanges.value && $props.observeFormChanges) diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue index 33659dd77..8d025a365 100644 --- a/src/pages/Customer/Card/CustomerWebAccess.vue +++ b/src/pages/Customer/Card/CustomerWebAccess.vue @@ -2,164 +2,81 @@ import { computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; - import axios from 'axios'; import { useQuasar } from 'quasar'; -import { useValidator } from 'src/composables/useValidator'; -import useNotify from 'src/composables/useNotify'; -import { useStateStore } from 'stores/useStateStore'; - -import FetchData from 'components/FetchData.vue'; import VnInput from 'src/components/common/VnInput.vue'; import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue'; +import FormModel from 'components/FormModel.vue'; -const { notify } = useNotify(); const { t } = useI18n(); -const { validate } = useValidator(); const quasar = useQuasar(); const route = useRoute(); -const stateStore = useStateStore(); - -const active = ref(false); const canChangePassword = ref(0); -const email = ref(null); -const isLoading = ref(false); -const name = ref(null); -const usersPreviewRef = ref(null); -const user = ref([]); -const dataChanges = computed(() => { - return ( - user.value.active !== active.value || - user.value.email !== email.value || - user.value.name !== name.value - ); +const filter = computed(() => { + return { + fields: ['active', 'email', 'name'], + where: { id: route.params.id }, + }; }); -const filter = { where: { id: `${route.params.id}` } }; - const showChangePasswordDialog = () => { quasar.dialog({ component: CustomerChangePassword, componentProps: { id: route.params.id, - promise: usersPreviewRef.value.fetch(), }, }); }; -const setInitialData = () => { - if (user.value.length) { - active.value = user.value[0].active; - email.value = user.value[0].email; - name.value = user.value[0].name; - } -}; - -const onSubmit = async () => { - isLoading.value = true; - - const payload = { - active: active.value, - email: email.value, - name: name.value, - }; - try { - await axios.patch(`Clients/${route.params.id}/updateUser`, payload); - notify('globals.dataSaved', 'positive'); - if (usersPreviewRef.value) usersPreviewRef.value.fetch(); - } catch (error) { - notify('errors.create', 'negative'); - } finally { - isLoading.value = false; - } -}; +async function hasCustomerRole() { + const { data } = await axios(`Clients/${route.params.id}/hasCustomerRole`); + canChangePassword.value = data; +} From 98a16b94539592be36d9779b47c8b7df494bbca5 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 5 Aug 2024 13:44:35 +0200 Subject: [PATCH 3/5] refactor(customer_log: use VnLog --- src/pages/Customer/Card/CustomerLog.vue | 260 +----------------------- 1 file changed, 2 insertions(+), 258 deletions(-) diff --git a/src/pages/Customer/Card/CustomerLog.vue b/src/pages/Customer/Card/CustomerLog.vue index 4f0ee2de7..cdf1394b1 100644 --- a/src/pages/Customer/Card/CustomerLog.vue +++ b/src/pages/Customer/Card/CustomerLog.vue @@ -1,262 +1,6 @@ - - - -es: - Search: Buscar - Search by id or concept: xxx - Entity: Entidad - All: Todo - User: Usuario - System: Sistema - Changes: Cambios - Search by changes: xxx - Creates: Crea - Edits: Modifica - Deletes: Elimina - Accesses: Accede - Date: Fecha - To: Hasta - Quit filter: Quitar filtro - From 5bac9143e614538484d83ecd1d00806331891c64 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 5 Aug 2024 14:02:39 +0200 Subject: [PATCH 4/5] fix(customer_sms: fix reload --- src/components/ui/VnSms.vue | 47 ++++++++++++----------- src/pages/Customer/Card/CustomerNotes.vue | 15 +++++--- src/pages/Customer/Card/CustomerSms.vue | 17 ++++---- 3 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/components/ui/VnSms.vue b/src/components/ui/VnSms.vue index ceb24b2bb..81058a6cb 100644 --- a/src/components/ui/VnSms.vue +++ b/src/components/ui/VnSms.vue @@ -1,5 +1,5 @@