0
0
Fork 0

Merge branch 'dev' into 7129-finishRouteMigration

This commit is contained in:
Pablo Natek 2024-06-17 07:21:40 +00:00
commit ef6a7001e8
2 changed files with 20 additions and 17 deletions

View File

@ -40,6 +40,7 @@ onMounted(() => {
<template> <template>
<FormModel <FormModel
model="createDepartmentChild"
:form-initial-data="departmentChildData" :form-initial-data="departmentChildData"
:observe-form-changes="false" :observe-form-changes="false"
:default-actions="false" :default-actions="false"

View File

@ -6,12 +6,11 @@ import { useQuasar } from 'quasar';
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue'; import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
import CreateDepartmentChild from './CreateDepartmentChild.vue'; import CreateDepartmentChild from './CreateDepartmentChild.vue';
import axios from 'axios'; import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify();
const state = useState(); const state = useState();
const router = useRouter(); const router = useRouter();
@ -62,24 +61,27 @@ const removeNode = (node) => {
const { id, parentFk } = node; const { id, parentFk } = node;
quasar quasar
.dialog({ .dialog({
component: VnConfirm,
componentProps: {
title: t('Are you sure you want to delete it?'), title: t('Are you sure you want to delete it?'),
message: t('Delete department'), message: t('Delete department'),
ok: { promise: () => remove(id),
push: true,
color: 'primary',
}, },
cancel: true,
}) })
.onOk(async () => { .onOk(async () => await fetchNodeLeaves(parentFk));
};
async function remove(id) {
try { try {
await axios.post(`/Departments/${id}/removeChild`, id); await axios.post(`/Departments/${id}/removeChild`, { id });
notify(t('department.departmentRemoved'), 'positive'); quasar.notify({
await fetchNodeLeaves(parentFk); message: t('department.departmentRemoved'),
type: 'positive',
});
} catch (err) { } catch (err) {
console.error('Error removing department'); console.error('Error removing department');
} }
}); }
};
const showCreateNodeForm = (nodeId) => { const showCreateNodeForm = (nodeId) => {
showCreateNodeFormVal.value = true; showCreateNodeFormVal.value = true;