forked from verdnatura/salix-front
passwordAccount
This commit is contained in:
parent
8b2b618d35
commit
2f617f4b92
|
@ -8,7 +8,7 @@ import { useRoute } from 'vue-router';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
|
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
hasAccount: {
|
hasAccount: {
|
||||||
|
@ -21,7 +21,7 @@ const { t } = useI18n();
|
||||||
const { hasAccount } = toRefs($props);
|
const { hasAccount } = toRefs($props);
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const { notify } = useNotify();
|
||||||
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
||||||
account.value.hasAccount = hasAccount.value;
|
account.value.hasAccount = hasAccount.value;
|
||||||
const entityId = computed(() => +route.params.id);
|
const entityId = computed(() => +route.params.id);
|
||||||
|
@ -71,9 +71,44 @@ async function sync() {
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// const removeAccount = async () => {
|
||||||
|
// try {
|
||||||
|
// quasar
|
||||||
|
// .dialog({
|
||||||
|
// component: VnConfirm,
|
||||||
|
// componentProps: {
|
||||||
|
// title: t('account.card.actions.delete.title'),
|
||||||
|
// message: t('account.card.actions.delete.subTitle'),
|
||||||
|
// promise: async () => {
|
||||||
|
// try {
|
||||||
|
// await axios.delete(`VnUsers/${this.id}`);
|
||||||
|
// notify('Account removed', 'positive');
|
||||||
|
// } catch (error) {
|
||||||
|
// notify('Error removing account', 'negative');
|
||||||
|
// console.error('Error deleting the account', error);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
// .onOk(() => {
|
||||||
|
// notify('Account removed', 'positive');
|
||||||
|
// });
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('Error deleting the account', error);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
const removeAccount = async () => {
|
||||||
|
try {
|
||||||
|
console.log('id', account.value.id);
|
||||||
|
await axios.delete(`VnUsers/${account.value.id}`);
|
||||||
|
notify(t('Account removed'), 'positive');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error killing session', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnConfirm
|
<!-- <VnConfirm
|
||||||
v-model="showSyncDialog"
|
v-model="showSyncDialog"
|
||||||
:message="t('account.card.actions.sync.message')"
|
:message="t('account.card.actions.sync.message')"
|
||||||
:title="t('account.card.actions.sync.title')"
|
:title="t('account.card.actions.sync.title')"
|
||||||
|
@ -102,8 +137,8 @@ async function sync() {
|
||||||
type="password"
|
type="password"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnConfirm>
|
</VnConfirm> -->
|
||||||
<QItem v-ripple clickable @click="setPassword">
|
<!-- <QItem v-ripple clickable @click="setPassword">
|
||||||
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
|
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem
|
<QItem
|
||||||
|
@ -119,7 +154,7 @@ async function sync() {
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
|
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
|
||||||
</QItem>
|
</QItem> -->
|
||||||
<QItem
|
<QItem
|
||||||
v-if="account.hasAccount"
|
v-if="account.hasAccount"
|
||||||
v-ripple
|
v-ripple
|
||||||
|
@ -168,17 +203,7 @@ async function sync() {
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QItem
|
<QItem @click="removeAccount(id)" v-ripple clickable>
|
||||||
@click="
|
|
||||||
openConfirmationModal(
|
|
||||||
t('account.card.actions.delete.title'),
|
|
||||||
t('account.card.actions.delete.subTitle'),
|
|
||||||
removeAccount
|
|
||||||
)
|
|
||||||
"
|
|
||||||
v-ripple
|
|
||||||
clickable
|
|
||||||
>
|
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="delete" />
|
<QIcon name="delete" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -68,7 +68,7 @@ account:
|
||||||
delete:
|
delete:
|
||||||
name: Delete
|
name: Delete
|
||||||
title: The account will be deleted
|
title: The account will be deleted
|
||||||
subtitle: Are you sure you want to continue?
|
subTitle: Are you sure you want to continue?
|
||||||
success: ''
|
success: ''
|
||||||
search: Search user
|
search: Search user
|
||||||
searchInfo: You can search by id, name or nickname
|
searchInfo: You can search by id, name or nickname
|
||||||
|
|
|
@ -67,7 +67,7 @@ account:
|
||||||
delete:
|
delete:
|
||||||
name: Eliminar
|
name: Eliminar
|
||||||
title: El usuario será eliminado
|
title: El usuario será eliminado
|
||||||
subtitle: ¿Seguro que quieres continuar?
|
subTitle: ¿Seguro que quieres continuar?
|
||||||
success: ''
|
success: ''
|
||||||
search: Buscar usuario
|
search: Buscar usuario
|
||||||
searchInfo: Puedes buscar por id, nombre o usuario
|
searchInfo: Puedes buscar por id, nombre o usuario
|
||||||
|
|
Loading…
Reference in New Issue