fix(03): employee drawer info checkup
This commit is contained in:
parent
de83675db4
commit
c39b6a69a3
4 changed files with 44 additions and 22 deletions
|
|
@ -10,10 +10,13 @@ import { EmployeeCheckupCreate } from 'src/stores/employee/types';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { checkTabBeforeAdd, selectFilterOptionRefMod } from 'src/stores/utils';
|
import { checkTabBeforeAdd, selectFilterOptionRefMod } from 'src/stores/utils';
|
||||||
import { QSelect } from 'quasar';
|
import { QSelect } from 'quasar';
|
||||||
|
import {
|
||||||
import SaveButton from 'src/components/button/SaveButton.vue';
|
AddButton,
|
||||||
import EditButton from 'src/components/button/EditButton.vue';
|
EditButton,
|
||||||
import DeleteButton from 'src/components/button/DeleteButton.vue';
|
DeleteButton,
|
||||||
|
SaveButton,
|
||||||
|
UndoButton,
|
||||||
|
} from 'src/components/button';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const adrressStore = useAddressStore();
|
const adrressStore = useAddressStore();
|
||||||
|
|
@ -63,6 +66,7 @@ defineEmits<{
|
||||||
(e: 'save', index: number): void;
|
(e: 'save', index: number): void;
|
||||||
(e: 'edit', index: number): void;
|
(e: 'edit', index: number): void;
|
||||||
(e: 'delete', index: number): void;
|
(e: 'delete', index: number): void;
|
||||||
|
(e: 'undo'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
async function fetchProvince() {
|
async function fetchProvince() {
|
||||||
|
|
@ -143,25 +147,22 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="row col-12">
|
<div class="row col-12">
|
||||||
<div class="col-12 q-pb-sm text-weight-bold text-body1">
|
<div class="col-12 q-pb-sm text-weight-bold text-body1 row items-center">
|
||||||
<q-icon
|
<q-icon
|
||||||
flat
|
flat
|
||||||
size="xs"
|
size="xs"
|
||||||
class="q-pa-sm rounded q-mr-xs"
|
class="q-pa-sm rounded q-mr-sm"
|
||||||
color="info"
|
color="info"
|
||||||
name="mdi-hospital-box"
|
name="mdi-hospital-box"
|
||||||
style="background-color: var(--surface-3)"
|
style="background-color: var(--surface-3)"
|
||||||
/>
|
/>
|
||||||
{{ $t(`formDialogTitleHealthCheck`) }}
|
{{ $t(`formDialogTitleHealthCheck`) }}
|
||||||
<q-btn
|
<AddButton
|
||||||
rounded
|
|
||||||
color="primary"
|
|
||||||
class="q-ml-md"
|
|
||||||
icon="mdi-plus"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
@click="addCheckup"
|
|
||||||
v-if="!readonly"
|
v-if="!readonly"
|
||||||
|
id="btn-add-bank"
|
||||||
|
icon-only
|
||||||
|
class="q-ml-sm"
|
||||||
|
@click="addCheckup"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -180,19 +181,30 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
|
||||||
<span class="col-12 flex justify-between items-center">
|
<span class="col-12 flex justify-between items-center">
|
||||||
{{ `ครั้งที่ ${index + 1}` }}
|
{{ `ครั้งที่ ${index + 1}` }}
|
||||||
<div class="row items-center">
|
<div class="row items-center">
|
||||||
|
<UndoButton
|
||||||
|
v-if="!readonly"
|
||||||
|
id="btn-info-health-undo"
|
||||||
|
icon-only
|
||||||
|
@click="$emit('undo')"
|
||||||
|
type="button"
|
||||||
|
/>
|
||||||
<SaveButton
|
<SaveButton
|
||||||
|
icon-only
|
||||||
|
id="btn-info-health-save"
|
||||||
v-if="!readonly && !checkup.statusSave"
|
v-if="!readonly && !checkup.statusSave"
|
||||||
@click="$emit('save', index)"
|
@click="$emit('save', index)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<EditButton
|
<EditButton
|
||||||
v-if="!readonly && checkup.statusSave"
|
icon-only
|
||||||
|
id="btn-info-health-edit"
|
||||||
|
v-if="readonly"
|
||||||
@click="$emit('edit', index)"
|
@click="$emit('edit', index)"
|
||||||
type="button"
|
type="button"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DeleteButton
|
<DeleteButton
|
||||||
v-if="!readonly && checkup.statusSave"
|
icon-only
|
||||||
|
id="btn-info-health-delete"
|
||||||
|
v-if="readonly"
|
||||||
@click="$emit('delete', index)"
|
@click="$emit('delete', index)"
|
||||||
type="button"
|
type="button"
|
||||||
/>
|
/>
|
||||||
|
|
@ -220,7 +232,7 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
|
||||||
class="col-5"
|
class="col-5"
|
||||||
:label="$t('formDialogInputCheckupRes')"
|
:label="$t('formDialogInputCheckupRes')"
|
||||||
v-model="checkup.checkupResult"
|
v-model="checkup.checkupResult"
|
||||||
:rules="[(val) => !!val || $t('formDialogInputCheckupResRequired')]"
|
:rules="[(val) => !!val || $t('formDialogInputCheckupResValidate')]"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
outlined
|
outlined
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,8 @@ export default {
|
||||||
workHistory: 'Work History',
|
workHistory: 'Work History',
|
||||||
other: 'Other',
|
other: 'Other',
|
||||||
|
|
||||||
|
formDialogInputCheckupResValidate: 'Please Enter Health Checkup Results',
|
||||||
|
|
||||||
formDialogInputOwnerName: 'Employer Name',
|
formDialogInputOwnerName: 'Employer Name',
|
||||||
formDialogInputJobPosition: 'Job Position',
|
formDialogInputJobPosition: 'Job Position',
|
||||||
formDialogInputJobType: 'Job Type',
|
formDialogInputJobType: 'Job Type',
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,8 @@ export default {
|
||||||
workHistory: 'ประวัติการทำงาน',
|
workHistory: 'ประวัติการทำงาน',
|
||||||
other: 'อื่นๆ',
|
other: 'อื่นๆ',
|
||||||
|
|
||||||
|
formDialogInputCheckupResValidate: 'กรุณากรอกผลการตรวจสุขภาพ',
|
||||||
|
|
||||||
formDialogInputOwnerName: 'ชื่อนายจ้าง',
|
formDialogInputOwnerName: 'ชื่อนายจ้าง',
|
||||||
formDialogInputJobPosition: 'ตำแหน่งงาน',
|
formDialogInputJobPosition: 'ตำแหน่งงาน',
|
||||||
formDialogInputJobType: 'ลักษณะงาน',
|
formDialogInputJobType: 'ลักษณะงาน',
|
||||||
|
|
|
||||||
|
|
@ -460,9 +460,17 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
].statusSave = true;
|
].statusSave = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const data =
|
||||||
|
currentFromDataEmployee.value.employeeCheckup[state.value.currentIndex];
|
||||||
|
delete data['createdAt'];
|
||||||
|
delete data['createdByUserId'];
|
||||||
|
delete data['employeeId'];
|
||||||
|
delete data['updatedAt'];
|
||||||
|
delete data['updatedByUserId'];
|
||||||
|
|
||||||
const res = await employeeStore.editByIdEmployeeCheckup(
|
const res = await employeeStore.editByIdEmployeeCheckup(
|
||||||
state.value.currentEmployee?.id || '',
|
state.value.currentEmployee?.id || '',
|
||||||
currentFromDataEmployee.value.employeeCheckup[state.value.currentIndex],
|
data,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|
@ -577,8 +585,6 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
? (state.value.profileSubmit = true)
|
? (state.value.profileSubmit = true)
|
||||||
: (state.value.profileSubmit = false);
|
: (state.value.profileSubmit = false);
|
||||||
|
|
||||||
state.value.isEmployeeEdit = true;
|
|
||||||
|
|
||||||
state.value.formDataEmployeeOwner = { ...foundBranch };
|
state.value.formDataEmployeeOwner = { ...foundBranch };
|
||||||
|
|
||||||
if (foundBranch.address === playlond.address) {
|
if (foundBranch.address === playlond.address) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue