From 4199fc0dc58f019604d095011c49643a9e0de762 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 20 May 2024 09:00:54 +0200 Subject: [PATCH] refs #7396 fix basicData, summary, change deleteDepartment --- .../Department/Card/DepartmentDescriptor.vue | 47 +++++++++---------- src/pages/Worker/Card/WorkerBasicData.vue | 18 +++---- src/pages/Worker/Card/WorkerSummary.vue | 8 ++-- 3 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/pages/Department/Card/DepartmentDescriptor.vue b/src/pages/Department/Card/DepartmentDescriptor.vue index e60a8c91b..70c578fc2 100644 --- a/src/pages/Department/Card/DepartmentDescriptor.vue +++ b/src/pages/Department/Card/DepartmentDescriptor.vue @@ -3,7 +3,7 @@ import { computed, ref } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { useI18n } from 'vue-i18n'; import { useQuasar } from 'quasar'; - +import { useVnConfirm } from 'composables/useVnConfirm'; import VnLv from 'src/components/ui/VnLv.vue'; import CardDescriptor from 'src/components/ui/CardDescriptor.vue'; import useCardDescription from 'src/composables/useCardDescription'; @@ -43,30 +43,17 @@ const setData = (entity) => { data.value = useCardDescription(entity.name, entity.id); }; -const removeDepartment = () => { - quasar - .dialog({ - title: 'Are you sure you want to delete it?', - message: 'Delete department', - ok: { - push: true, - color: 'primary', - }, - cancel: true, - }) - .onOk(async () => { - try { - await axios.post( - `/Departments/${entityId.value}/removeChild`, - entityId.value - ); - router.push({ name: 'WorkerDepartment' }); - notify('department.departmentRemoved', 'positive'); - } catch (err) { - console.error('Error removing department'); - } - }); +const removeDepartment = async () => { + try { + await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value); + router.push({ name: 'WorkerDepartment' }); + notify('department.departmentRemoved', 'positive'); + } catch (err) { + console.error('Error removing department'); + } }; + +const { openConfirmationModal } = useVnConfirm();