(warehouses = data)"
+ auto-load
+ />
- (warehouses = data)"
- auto-load
- />
-import { ref, reactive, onMounted } from 'vue';
-import { useI18n } from 'vue-i18n';
-
-import VnRow from 'components/ui/VnRow.vue';
-import FormPopup from 'src/components/FormPopup.vue';
-import VnInput from 'src/components/common/VnInput.vue';
-
-import axios from 'axios';
-import useNotify from 'src/composables/useNotify.js';
-
-const $props = defineProps({
- id: {
- type: Object,
- default: () => {},
- },
-});
-
-const emit = defineEmits(['onSubmit']);
-
-const { t } = useI18n();
-const { notify } = useNotify();
-
-const formData = reactive({
- newPassword: null,
- repeatPassword: null,
-});
-
-const passRequirements = ref([]);
-
-const setPassword = async () => {
- try {
- if (!formData.newPassword) {
- notify(t('You must enter a new password'), 'negative');
- return;
- }
-
- if (formData.newPassword != formData.repeatPassword) {
- notify(t(`Passwords don't match`), 'negative');
- return;
- }
-
- await axios.patch(`Workers/${$props.id}/setPassword`, {
- newPass: formData.newPassword,
- });
- notify(t('Password changed!'), 'positive');
- emit('onSubmit');
- } catch (err) {
- console.error('Error setting password', err);
- }
-};
-
-const getPassRequirements = async () => {
- const { data } = await axios.get('UserPasswords/findOne');
- passRequirements.value = data;
-};
-
-onMounted(async () => await getPassRequirements());
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-es:
- Reset password: Restablecer 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/Worker/Card/WorkerDescriptor.vue b/src/pages/Worker/Card/WorkerDescriptor.vue
index 3675d40f8..1cb42bbfb 100644
--- a/src/pages/Worker/Card/WorkerDescriptor.vue
+++ b/src/pages/Worker/Card/WorkerDescriptor.vue
@@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
-import WorkerChangePasswordForm from 'src/pages/Worker/Card/WorkerChangePasswordForm.vue';
+import VnChangePassword from 'src/components/common/VnChangePassword.vue';
import { useState } from 'src/composables/useState';
import axios from 'axios';
import VnImg from 'src/components/ui/VnImg.vue';
@@ -24,18 +24,13 @@ const route = useRoute();
const { t } = useI18n();
const state = useState();
const user = state.getUser();
-const changePasswordFormDialog = ref(null);
-const cardDescriptorRef = ref(null);
const showEditPhotoForm = ref(false);
const toggleEditPictureForm = () => {
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();
await cardDescriptorRef.value.getData();
url="Workers/descriptor"
:filter="{ where: { id: entityId } }"
title="user.nickname"
- @on-fetch="
- (data) => {
- worker = data;
- getIsExcluded();
- }
- "
+ @on-fetch="getIsExcluded"
>
-
-
+
+
{{
workerExcluded
@@ -92,16 +82,13 @@ const refetch = async () => await cardDescriptorRef.value.getData();
- {{ t('Change password') }}
-
-
-
+ {{ t('globals.changePass') }}
@@ -167,10 +154,10 @@ const refetch = async () => await cardDescriptorRef.value.getData();
-
+
{{ t('worker.summary.sipExtension') }}
-
+
@@ -201,6 +188,15 @@ const refetch = async () => await cardDescriptorRef.value.getData();
+