forked from verdnatura/salix-front
refs #7396 fix basicData, summary, change deleteDepartment
This commit is contained in:
parent
488c6b3f94
commit
4199fc0dc5
|
@ -3,7 +3,7 @@ import { computed, ref } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
|
@ -43,30 +43,17 @@ const setData = (entity) => {
|
||||||
data.value = useCardDescription(entity.name, entity.id);
|
data.value = useCardDescription(entity.name, entity.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeDepartment = () => {
|
const removeDepartment = async () => {
|
||||||
quasar
|
try {
|
||||||
.dialog({
|
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
|
||||||
title: 'Are you sure you want to delete it?',
|
router.push({ name: 'WorkerDepartment' });
|
||||||
message: 'Delete department',
|
notify('department.departmentRemoved', 'positive');
|
||||||
ok: {
|
} catch (err) {
|
||||||
push: true,
|
console.error('Error removing department');
|
||||||
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 { openConfirmationModal } = useVnConfirm();
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
|
@ -84,7 +71,17 @@ const removeDepartment = () => {
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<template #menu="{}">
|
<template #menu="{}">
|
||||||
<QItem v-ripple clickable @click="removeDepartment()">
|
<QItem
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="
|
||||||
|
openConfirmationModal(
|
||||||
|
t('Are you sure you want to delete it?'),
|
||||||
|
t('Delete department'),
|
||||||
|
removeDepartment
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
<QItemSection>{{ t('Delete') }}</QItemSection>
|
<QItemSection>{{ t('Delete') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -74,11 +74,11 @@ const maritalStatus = [
|
||||||
model="Worker"
|
model="Worker"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput :label="t('Name')" clearable v-model="data.firstName" />
|
<VnInput :label="t('Name')" clearable v-model="data.firstName" />
|
||||||
<VnInput :label="t('Last name')" clearable v-model="data.lastName" />
|
<VnInput :label="t('Last name')" clearable v-model="data.lastName" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput v-model="data.phone" :label="t('Business phone')" clearable />
|
<VnInput v-model="data.phone" :label="t('Business phone')" clearable />
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.mobileExtension"
|
v-model="data.mobileExtension"
|
||||||
|
@ -87,7 +87,7 @@ const maritalStatus = [
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Boss')"
|
:label="t('Boss')"
|
||||||
:options="workersOptions"
|
:options="workersOptions"
|
||||||
|
@ -118,7 +118,7 @@ const maritalStatus = [
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Origin country')"
|
:label="t('Origin country')"
|
||||||
:options="countriesOptions"
|
:options="countriesOptions"
|
||||||
|
@ -137,7 +137,7 @@ const maritalStatus = [
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput v-model="data.SSN" :label="t('SSN')" clearable />
|
<VnInput v-model="data.SSN" :label="t('SSN')" clearable />
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.locker"
|
v-model="data.locker"
|
||||||
|
@ -146,19 +146,19 @@ const maritalStatus = [
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInputDate :label="t('fiDueDate')" v-model="data.fiDueDate" />
|
<VnInputDate :label="t('fiDueDate')" v-model="data.fiDueDate" />
|
||||||
|
|
||||||
<VnInput v-model="data.sex" :label="t('sex')" clearable />
|
<VnInput v-model="data.sex" :label="t('sex')" clearable />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInputDate :label="t('seniority')" v-model="data.seniority" />
|
<VnInputDate :label="t('seniority')" v-model="data.seniority" />
|
||||||
<VnInput v-model="data.fi" :label="t('fi')" />
|
<VnInput v-model="data.fi" :label="t('fi')" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInputDate :label="t('birth')" v-model="data.birth" />
|
<VnInputDate :label="t('birth')" v-model="data.birth" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
size="sm"
|
size="sm"
|
||||||
:label="t('isFreelance')"
|
:label="t('isFreelance')"
|
||||||
|
|
|
@ -128,25 +128,25 @@ const filter = {
|
||||||
<VnLv :label="t('worker.summary.fi')" :value="worker.fi" />
|
<VnLv :label="t('worker.summary.fi')" :value="worker.fi" />
|
||||||
<VnLv :label="t('worker.summary.birth')" :value="toDate(worker.birth)" />
|
<VnLv :label="t('worker.summary.birth')" :value="toDate(worker.birth)" />
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
style="padding: 0"
|
class="padding-none"
|
||||||
:label="t('worker.summary.isFreelance')"
|
:label="t('worker.summary.isFreelance')"
|
||||||
v-model="worker.isFreelance"
|
v-model="worker.isFreelance"
|
||||||
:disable="true"
|
:disable="true"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
style="padding: 0"
|
class="padding-none"
|
||||||
:label="t('worker.summary.isSsDiscounted')"
|
:label="t('worker.summary.isSsDiscounted')"
|
||||||
v-model="worker.isSsDiscounted"
|
v-model="worker.isSsDiscounted"
|
||||||
:disable="true"
|
:disable="true"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
style="padding: 0"
|
class="padding-none"
|
||||||
:label="t('worker.summary.hasMachineryAuthorized')"
|
:label="t('worker.summary.hasMachineryAuthorized')"
|
||||||
v-model="worker.hasMachineryAuthorized"
|
v-model="worker.hasMachineryAuthorized"
|
||||||
:disable="true"
|
:disable="true"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
style="padding: 0"
|
class="padding-none"
|
||||||
:label="t('worker.summary.isDisable')"
|
:label="t('worker.summary.isDisable')"
|
||||||
v-model="worker.isDisable"
|
v-model="worker.isDisable"
|
||||||
:disable="true"
|
:disable="true"
|
||||||
|
|
Loading…
Reference in New Issue