diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue
index 6144f975d..c84a55122 100644
--- a/src/components/common/VnInput.vue
+++ b/src/components/common/VnInput.vue
@@ -13,6 +13,10 @@ const $props = defineProps({
type: Boolean,
default: false,
},
+ info: {
+ type: String,
+ default: '',
+ },
});
const { t } = useI18n();
@@ -83,6 +87,11 @@ const inputRules = [
v-if="hover && value && !$attrs.disabled"
@click="value = null"
>
+
+
+ {{ info }}
+
+
diff --git a/src/pages/Worker/Card/WorkerChangePasswordForm.vue b/src/pages/Worker/Card/WorkerChangePasswordForm.vue
new file mode 100644
index 000000000..ef75ba55a
--- /dev/null
+++ b/src/pages/Worker/Card/WorkerChangePasswordForm.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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 daa290ea1..86c846aca 100644
--- a/src/pages/Worker/Card/WorkerDescriptor.vue
+++ b/src/pages/Worker/Card/WorkerDescriptor.vue
@@ -6,8 +6,10 @@ import { useSession } from 'src/composables/useSession';
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 useCardDescription from 'src/composables/useCardDescription';
import { useState } from 'src/composables/useState';
+import axios from 'axios';
const $props = defineProps({
id: {
@@ -25,12 +27,16 @@ const route = useRoute();
const { t } = useI18n();
const { getTokenMultimedia } = useSession();
const state = useState();
+const user = state.getUser();
+const changePasswordFormDialog = ref(null);
+const cardDescriptorRef = ref(null);
const entityId = computed(() => {
return $props.id || route.params.id;
});
const worker = ref();
+const workerExcluded = ref(false);
const filter = {
include: [
{
@@ -71,14 +77,44 @@ function getWorkerAvatar() {
const token = getTokenMultimedia();
return `/api/Images/user/160x160/${entityId.value}/download?access_token=${token}`;
}
+
const data = ref(useCardDescription());
const setData = (entity) => {
if (!entity) return;
data.value = useCardDescription(entity.user.nickname, entity.id);
};
+
+const openChangePasswordForm = () => changePasswordFormDialog.value.show();
+
+const getIsExcluded = async () => {
+ try {
+ const { data } = await axios.get(
+ `WorkerDisableExcludeds/${entityId.value}/exists`
+ );
+ if (!data) return;
+ workerExcluded.value = data.exists;
+ } catch (err) {
+ console.error('Error getting worker excluded: ', err);
+ }
+};
+
+const handleExcluded = async () => {
+ if (workerExcluded.value)
+ await axios.delete(`WorkerDisableExcludeds/${entityId.value}`);
+ else
+ await axios.post(`WorkerDisableExcludeds`, {
+ workerFk: entityId.value,
+ dated: new Date(),
+ });
+
+ workerExcluded.value = !workerExcluded.value;
+};
+
+const refetch = async () => await cardDescriptorRef.value.getData();
{
(data) => {
worker = data;
setData(data);
+ getIsExcluded();
}
"
>
+
+
+
+ {{
+ workerExcluded
+ ? t('Click to allow the user to be disabled')
+ : t('Click to exclude the user from getting disabled')
+ }}
+
+
+
+
+ {{ t('Change password') }}
+
+
+
+
+
+
@@ -139,3 +200,10 @@ const setData = (entity) => {
height: 256px;
}
+
+
+es:
+ Click to allow the user to be disabled: Marcar para deshabilitar
+ Click to exclude the user from getting disabled: Marcar para no deshabilitar
+ Change password: Cambiar contraseña
+
diff --git a/src/pages/Worker/locale/en.yml b/src/pages/Worker/locale/en.yml
new file mode 100644
index 000000000..f947b30e7
--- /dev/null
+++ b/src/pages/Worker/locale/en.yml
@@ -0,0 +1 @@
+passwordRequirements: 'The password must have at least { length } length characters, {nAlpha} alphabetic characters, {nUpper} capital letters, {nDigits} digits and {nPunct} symbols (Ex: $%&.)\n'
diff --git a/src/pages/Worker/locale/es.yml b/src/pages/Worker/locale/es.yml
index f74cb4fdb..d2478535a 100644
--- a/src/pages/Worker/locale/es.yml
+++ b/src/pages/Worker/locale/es.yml
@@ -3,3 +3,4 @@ You can search by worker id or name: Puedes buscar por id o nombre del trabajado
Locker: Taquilla
Internal: Interno
External: Externo
+passwordRequirements: 'La contraseña debe tener al menos { length } caracteres de longitud, {nAlpha} caracteres alfabéticos, {nUpper} letras mayúsculas, {nDigits} dígitos y {nPunct} símbolos (Ej: $%&.)'