diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 4a78811e6..a0a678e6e 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -346,6 +346,7 @@ globals: countryFk: Country companyFk: Company changePass: Change password + setPass: Set password deleteConfirmTitle: Delete selected elements changeState: Change state raid: 'Raid {daysInForward} days' diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 2bfe7ec4b..e448ead83 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -348,6 +348,7 @@ globals: countryFk: País companyFk: Empresa changePass: Cambiar contraseña + setPass: Establecer contraseña deleteConfirmTitle: Eliminar los elementos seleccionados changeState: Cambiar estado raid: 'Redada {daysInForward} días' diff --git a/src/pages/Account/Card/AccountDescriptorMenu.vue b/src/pages/Account/Card/AccountDescriptorMenu.vue index 1780b4247..9bb6a7c52 100644 --- a/src/pages/Account/Card/AccountDescriptorMenu.vue +++ b/src/pages/Account/Card/AccountDescriptorMenu.vue @@ -6,9 +6,11 @@ import { useVnConfirm } from 'composables/useVnConfirm'; import { useRoute } from 'vue-router'; import { useAcl } from 'src/composables/useAcl'; import { useArrayData } from 'src/composables/useArrayData'; +import { useState } from 'src/composables/useState'; import VnConfirm from 'src/components/ui/VnConfirm.vue'; import VnChangePassword from 'src/components/common/VnChangePassword.vue'; import { useQuasar } from 'quasar'; +import { useRouter } from 'vue-router'; const $props = defineProps({ hasAccount: { @@ -21,11 +23,13 @@ const { t } = useI18n(); const { hasAccount } = toRefs($props); const { openConfirmationModal } = useVnConfirm(); const route = useRoute(); +const router = useRouter(); +const state = useState(); +const user = state.getUser(); const { notify } = useQuasar(); const account = computed(() => useArrayData('AccountId').store.data[0]); account.value.hasAccount = hasAccount.value; const entityId = computed(() => +route.params.id); - async function updateStatusAccount(active) { if (active) { await axios.post(`Accounts`, { id: entityId.value }); @@ -36,7 +40,7 @@ async function updateStatusAccount(active) { account.value.hasAccount = active; const status = active ? 'enable' : 'disable'; notify({ - message: t(`account.card.${status}Account.success`), + message: t(`account.card.actions.${status}Account.success`), type: 'positive', }); } @@ -49,6 +53,17 @@ async function updateStatusUser(active) { type: 'positive', }); } + +async function deleteAccount() { + const { data } = await axios.delete(`VnUsers/${entityId.value}`); + if (data) { + notify({ + message: t('account.card.actions.delete.success'), + type: 'positive', + }); + router.push({ name: 'AccountList' }); + } +} const showSyncDialog = ref(false); const syncPassword = ref(null); const shouldSyncPassword = ref(false); @@ -63,11 +78,18 @@ async function sync() { type: 'positive', }); } +const askOldPass = ref(false); +const changePassRef = ref(); + +const onChangePass = (oldPass) => { + askOldPass.value = oldPass; + changePassRef.value.show(); +};