From 5e867a368ebf0b97d5430b3d9d0c778dc97c11f2 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 27 Oct 2022 14:59:19 +0200 Subject: [PATCH 1/7] Changes --- src/components/FetchData.vue | 46 +++ src/components/FormModel.vue | 97 +++++ src/components/SkeletonForm.vue | 48 +-- src/composables/useState.js | 18 + src/composables/useValidator.js | 4 - src/i18n/en/index.js | 3 +- src/i18n/es/index.js | 3 +- src/pages/Customer/Card/CustomerBasicData.vue | 354 ++++++++---------- 8 files changed, 343 insertions(+), 230 deletions(-) create mode 100644 src/components/FetchData.vue create mode 100644 src/components/FormModel.vue diff --git a/src/components/FetchData.vue b/src/components/FetchData.vue new file mode 100644 index 000000000..3da3a8e5f --- /dev/null +++ b/src/components/FetchData.vue @@ -0,0 +1,46 @@ + + diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue new file mode 100644 index 000000000..ebb8f57cf --- /dev/null +++ b/src/components/FormModel.vue @@ -0,0 +1,97 @@ + + diff --git a/src/components/SkeletonForm.vue b/src/components/SkeletonForm.vue index 179744c26..f7c54ef77 100644 --- a/src/components/SkeletonForm.vue +++ b/src/components/SkeletonForm.vue @@ -1,30 +1,32 @@ diff --git a/src/composables/useState.js b/src/composables/useState.js index e41e69e91..c17b8af5b 100644 --- a/src/composables/useState.js +++ b/src/composables/useState.js @@ -1,5 +1,7 @@ import { ref, computed } from 'vue'; +const state = ref({}); + const user = ref({ id: 0, name: '', @@ -44,11 +46,27 @@ export function useState() { roles.value = data; } + function set(name, data) { + state.value[name] = ref(data); + } + + function get(name) { + return state.value[name]; + } + + function unset(name) { + delete state.value[name]; + } + + return { getUser, setUser, getRoles, setRoles, + set, + get, + unset, drawer }; } diff --git a/src/composables/useValidator.js b/src/composables/useValidator.js index 16f6239f9..ef2dcbd90 100644 --- a/src/composables/useValidator.js +++ b/src/composables/useValidator.js @@ -33,10 +33,6 @@ export function useValidator() { return validations(validation)[validation.validation]; }); - if (property === 'socialName') { - console.log(modelValidations[property]) - } - return rules; } diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index aedd17e88..edb257336 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -23,7 +23,8 @@ export default { noChanges: 'No changes to save', confirmRemove: 'You are about to delete this row. Are you sure?', rowAdded: 'Row added', - rowRemoved: 'Row removed' + rowRemoved: 'Row removed', + pleaseWait: 'Please wait...' }, moduleIndex: { allModules: 'All modules' diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index c478e5b23..999af76af 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -23,7 +23,8 @@ export default { noChanges: 'Sin cambios que guardar', confirmRemove: 'Vas a eliminar este registro. ¿Continuar?', rowAdded: 'Fila añadida', - rowRemoved: 'Fila eliminada' + rowRemoved: 'Fila eliminada', + pleaseWait: 'Por favor, espera...' }, moduleIndex: { allModules: 'Todos los módulos' diff --git a/src/pages/Customer/Card/CustomerBasicData.vue b/src/pages/Customer/Card/CustomerBasicData.vue index 68d185272..d47d8f08e 100644 --- a/src/pages/Customer/Card/CustomerBasicData.vue +++ b/src/pages/Customer/Card/CustomerBasicData.vue @@ -1,236 +1,188 @@