From 3f1c0b95faf7d8ff00b10fa93acdbed4047d6b9a Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 10 Jul 2024 15:03:25 +0200 Subject: [PATCH 01/13] fix: proposal to avoid notify error --- src/pages/Customer/Card/CustomerUnpaid.vue | 2 +- src/pages/Customer/Card/CustomerWebAccess.vue | 2 +- src/pages/Customer/components/CustomerChangePassword.vue | 2 +- src/pages/Customer/components/CustomerSamplesCreate.vue | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/Customer/Card/CustomerUnpaid.vue b/src/pages/Customer/Card/CustomerUnpaid.vue index a9d4a3d66..6c61b92a1 100644 --- a/src/pages/Customer/Card/CustomerUnpaid.vue +++ b/src/pages/Customer/Card/CustomerUnpaid.vue @@ -92,7 +92,7 @@ const onSubmit = async () => { notify('globals.dataSaved', 'positive'); unpaidClient.value = true; } catch (error) { - notify('errors.create', 'negative'); + notify('errors.writeRequest', 'negative'); } finally { isLoading.value = false; } diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue index 33659dd77..4468c52f0 100644 --- a/src/pages/Customer/Card/CustomerWebAccess.vue +++ b/src/pages/Customer/Card/CustomerWebAccess.vue @@ -70,7 +70,7 @@ const onSubmit = async () => { notify('globals.dataSaved', 'positive'); if (usersPreviewRef.value) usersPreviewRef.value.fetch(); } catch (error) { - notify('errors.create', 'negative'); + notify('errors.writeRequest', 'negative'); } finally { isLoading.value = false; } diff --git a/src/pages/Customer/components/CustomerChangePassword.vue b/src/pages/Customer/components/CustomerChangePassword.vue index 1bfc5e103..632b11dc9 100644 --- a/src/pages/Customer/components/CustomerChangePassword.vue +++ b/src/pages/Customer/components/CustomerChangePassword.vue @@ -48,7 +48,7 @@ const onSubmit = async () => { await axios.patch(`Clients/${$props.id}/setPassword`, payload); await $props.promise(); } catch (error) { - notify('errors.create', 'negative'); + notify('errors.writeRequest', 'negative'); } finally { isLoading.value = false; if (closeButton.value) closeButton.value.click(); diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue index be614aa0b..283b8fa97 100644 --- a/src/pages/Customer/components/CustomerSamplesCreate.vue +++ b/src/pages/Customer/components/CustomerSamplesCreate.vue @@ -150,7 +150,7 @@ const onSubmit = async () => { notify('globals.dataSaved', 'positive'); onDataSaved(data); } catch (error) { - notify('errors.create', 'negative'); + notify('errors.writeRequest', 'negative'); } finally { isLoading.value = false; } From e90b78c4c5867f2afd48b9029c9b443d5291c385 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 13 Sep 2024 12:27:37 +0200 Subject: [PATCH 02/13] fix: refs #7702 rollback --- src/pages/Customer/Card/CustomerWebAccess.vue | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue index 3dc025d9c..f990e720c 100644 --- a/src/pages/Customer/Card/CustomerWebAccess.vue +++ b/src/pages/Customer/Card/CustomerWebAccess.vue @@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; import axios from 'axios'; import { useQuasar } from 'quasar'; -import useNotify from 'src/composables/useNotify'; import VnInput from 'src/components/common/VnInput.vue'; import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue'; import FormModel from 'components/FormModel.vue'; @@ -13,7 +12,6 @@ const { t } = useI18n(); const quasar = useQuasar(); const route = useRoute(); const canChangePassword = ref(0); -const { notify } = useNotify(); const filter = computed(() => { return { @@ -32,13 +30,8 @@ const showChangePasswordDialog = () => { }; async function hasCustomerRole() { - try { - canChangePassword.value = ( - await axios(`Clients/${route.params.id}/hasCustomerRole`) - ).data; - } catch (e) { - notify('errors.writeRequest', 'negative'); - } + const { data } = await axios(`Clients/${route.params.id}/hasCustomerRole`); + canChangePassword.value = data; } From 4bf8e1224d1d8cd0082174fe7830baeeddc45b0c Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 13 Sep 2024 12:28:07 +0200 Subject: [PATCH 03/13] chore: refs #7702 rollback --- src/pages/Customer/Card/CustomerWebAccess.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue index f990e720c..8d025a365 100644 --- a/src/pages/Customer/Card/CustomerWebAccess.vue +++ b/src/pages/Customer/Card/CustomerWebAccess.vue @@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; import axios from 'axios'; import { useQuasar } from 'quasar'; + import VnInput from 'src/components/common/VnInput.vue'; import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue'; import FormModel from 'components/FormModel.vue'; From 98cdeabe9f91791faa4a623ed9e67237180b0666 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 13 Sep 2024 18:15:28 +0200 Subject: [PATCH 04/13] feat: refs #7702 vnChangePassword --- src/components/common/VnChangePassword.vue | 112 ++++++++++++++++++ src/pages/Customer/Card/CustomerWebAccess.vue | 28 ++--- 2 files changed, 124 insertions(+), 16 deletions(-) create mode 100644 src/components/common/VnChangePassword.vue diff --git a/src/components/common/VnChangePassword.vue b/src/components/common/VnChangePassword.vue new file mode 100644 index 000000000..d7c9ad02f --- /dev/null +++ b/src/components/common/VnChangePassword.vue @@ -0,0 +1,112 @@ + + + + +es: + Change password: Cambiar contraseña + New password: Nueva contraseña + Repeat password: Repetir contraseña + You must enter a new password: Debes introducir la nueva contraseña + Passwords don't match: Las contraseñas no coinciden + diff --git a/src/pages/Customer/Card/CustomerWebAccess.vue b/src/pages/Customer/Card/CustomerWebAccess.vue index 8d025a365..ba906a144 100644 --- a/src/pages/Customer/Card/CustomerWebAccess.vue +++ b/src/pages/Customer/Card/CustomerWebAccess.vue @@ -3,14 +3,11 @@ import { computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; import axios from 'axios'; -import { useQuasar } from 'quasar'; - import VnInput from 'src/components/common/VnInput.vue'; -import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue'; import FormModel from 'components/FormModel.vue'; +import VnChangePassword from 'src/components/common/VnChangePassword.vue'; const { t } = useI18n(); -const quasar = useQuasar(); const route = useRoute(); const canChangePassword = ref(0); @@ -21,21 +18,11 @@ const filter = computed(() => { }; }); -const showChangePasswordDialog = () => { - quasar.dialog({ - component: CustomerChangePassword, - componentProps: { - id: route.params.id, - }, - }); -}; - async function hasCustomerRole() { const { data } = await axios(`Clients/${route.params.id}/hasCustomerRole`); canChangePassword.value = data; } - + - es: Enable web access: Habilitar acceso web From 9ec2fb4c77edede9e5b80a34a80263a33ac80a1c Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 16 Sep 2024 10:36:56 +0200 Subject: [PATCH 05/13] feat: refs #7702 fine tunning --- src/components/common/VnChangePassword.vue | 14 +++++++- src/pages/Worker/Card/WorkerDescriptor.vue | 40 ++++++++++------------ 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/components/common/VnChangePassword.vue b/src/components/common/VnChangePassword.vue index d7c9ad02f..a36c6bcff 100644 --- a/src/components/common/VnChangePassword.vue +++ b/src/components/common/VnChangePassword.vue @@ -7,7 +7,7 @@ import FetchData from '../FetchData.vue'; import useNotify from 'src/composables/useNotify'; const props = defineProps({ submitFn: { type: Function, default: () => {} } }); - +const emit = defineEmits(['onSubmit']); const { t } = useI18n(); const { notify } = useNotify(); @@ -15,19 +15,27 @@ const form = ref(); const changePassDialog = ref(); const passwords = ref({ newPassword: null, repeatPassword: null }); const requirements = ref([]); +const isLoading = ref(false); const validate = async () => { const { newPassword, repeatPassword } = passwords.value; + if (!newPassword) { + notify(t('You must enter a new password'), 'negative'); + return; + } if (newPassword !== repeatPassword) { notify(t("Passwords don't match"), 'negative'); return; } try { + isLoading.value = true; await props.submitFn(newPassword); + emit('onSubmit'); } catch (e) { notify('errors.writeRequest', 'negative'); } finally { changePassDialog.value.hide(); + isLoading.value = false; } }; @@ -84,6 +92,8 @@ defineExpose({ show: () => changePassDialog.value.show() }); changePassDialog.value.show() }); v-close-popup /> { showEditPhotoForm.value = !showEditPhotoForm.value; }; - const entityId = computed(() => { return $props.id || route.params.id; }); - -const worker = ref(); const workerExcluded = ref(false); const getIsExcluded = async () => { @@ -61,10 +56,10 @@ const handleExcluded = async () => { workerExcluded.value = !workerExcluded.value; }; + const handlePhotoUpdated = (evt = false) => { image.value.reload(evt); }; -const refetch = async () => await cardDescriptorRef.value.getData(); @@ -197,6 +184,15 @@ const refetch = async () => await cardDescriptorRef.value.getData(); +