refs #7396 fix basicData, summary, change deleteDepartment

This commit is contained in:
Carlos Satorres 2024-05-20 09:00:54 +02:00
parent 488c6b3f94
commit 4199fc0dc5
3 changed files with 35 additions and 38 deletions

View File

@ -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();
</script>
<template>
<CardDescriptor
@ -84,7 +71,17 @@ const removeDepartment = () => {
"
>
<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>
</QItem>
</template>

View File

@ -74,11 +74,11 @@ const maritalStatus = [
model="Worker"
>
<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('Last name')" clearable v-model="data.lastName" />
</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.mobileExtension"
@ -87,7 +87,7 @@ const maritalStatus = [
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Boss')"
:options="workersOptions"
@ -118,7 +118,7 @@ const maritalStatus = [
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Origin country')"
:options="countriesOptions"
@ -137,7 +137,7 @@ const maritalStatus = [
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput v-model="data.SSN" :label="t('SSN')" clearable />
<VnInput
v-model="data.locker"
@ -146,19 +146,19 @@ const maritalStatus = [
clearable
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInputDate :label="t('fiDueDate')" v-model="data.fiDueDate" />
<VnInput v-model="data.sex" :label="t('sex')" clearable />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInputDate :label="t('seniority')" v-model="data.seniority" />
<VnInput v-model="data.fi" :label="t('fi')" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInputDate :label="t('birth')" v-model="data.birth" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QCheckbox
size="sm"
:label="t('isFreelance')"

View File

@ -128,25 +128,25 @@ const filter = {
<VnLv :label="t('worker.summary.fi')" :value="worker.fi" />
<VnLv :label="t('worker.summary.birth')" :value="toDate(worker.birth)" />
<QCheckbox
style="padding: 0"
class="padding-none"
:label="t('worker.summary.isFreelance')"
v-model="worker.isFreelance"
:disable="true"
/>
<QCheckbox
style="padding: 0"
class="padding-none"
:label="t('worker.summary.isSsDiscounted')"
v-model="worker.isSsDiscounted"
:disable="true"
/>
<QCheckbox
style="padding: 0"
class="padding-none"
:label="t('worker.summary.hasMachineryAuthorized')"
v-model="worker.hasMachineryAuthorized"
:disable="true"
/>
<QCheckbox
style="padding: 0"
class="padding-none"
:label="t('worker.summary.isDisable')"
v-model="worker.isDisable"
:disable="true"