forked from verdnatura/salix-front
Merge branch 'dev' into 7566-FixCustomerSummary
This commit is contained in:
commit
64648c77f6
|
@ -40,6 +40,7 @@ onMounted(() => {
|
|||
|
||||
<template>
|
||||
<FormModel
|
||||
model="createDepartmentChild"
|
||||
:form-initial-data="departmentChildData"
|
||||
:observe-form-changes="false"
|
||||
:default-actions="false"
|
||||
|
|
|
@ -6,12 +6,11 @@ import { useQuasar } from 'quasar';
|
|||
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import CreateDepartmentChild from './CreateDepartmentChild.vue';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useRouter } from 'vue-router';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const state = useState();
|
||||
const router = useRouter();
|
||||
|
||||
|
@ -62,24 +61,27 @@ const removeNode = (node) => {
|
|||
const { id, parentFk } = node;
|
||||
quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('Are you sure you want to delete it?'),
|
||||
message: t('Delete department'),
|
||||
ok: {
|
||||
push: true,
|
||||
color: 'primary',
|
||||
promise: () => remove(id),
|
||||
},
|
||||
cancel: true,
|
||||
})
|
||||
.onOk(async () => {
|
||||
.onOk(async () => await fetchNodeLeaves(parentFk));
|
||||
};
|
||||
|
||||
async function remove(id) {
|
||||
try {
|
||||
await axios.post(`/Departments/${id}/removeChild`, id);
|
||||
notify(t('department.departmentRemoved'), 'positive');
|
||||
await fetchNodeLeaves(parentFk);
|
||||
await axios.post(`/Departments/${id}/removeChild`, { id });
|
||||
quasar.notify({
|
||||
message: t('department.departmentRemoved'),
|
||||
type: 'positive',
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error removing department');
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
const showCreateNodeForm = (nodeId) => {
|
||||
showCreateNodeFormVal.value = true;
|
||||
|
|
Loading…
Reference in New Issue