refactor: edit layout

This commit is contained in:
Thanaphon Frappet 2024-11-15 14:38:51 +07:00 committed by Methapon Metanipat
parent a7ada91861
commit 4515f93933
2 changed files with 1 additions and 97 deletions

View file

@ -89,28 +89,6 @@ async function fetchProvince() {
);
}
function addCheckup() {
// const canAdd = checkTabBeforeAdd(employeeCheckup.value || []);
const canAdd = true;
if (canAdd) {
employeeCheckup.value?.push({
coverageExpireDate: null,
coverageStartDate: null,
insuranceCompany: '',
medicalBenefitScheme: '',
remark: '',
hospitalName: '',
provinceId: '',
checkupResult: '',
checkupType: '',
});
if (employeeCheckup.value) {
tab.value = `tab${employeeCheckup.value.length - 1}`;
currentIndex.value = employeeCheckup.value.length - 1;
}
}
}
function removeData(index: number) {
if (!employeeCheckup.value) return;
if (employeeCheckup.value.length === 1) return;
@ -163,28 +141,7 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
</script>
<template>
<div class="row col-12">
<div class="col-12 q-pb-sm text-weight-bold text-body1 row items-center">
<q-icon
flat
size="xs"
class="q-pa-sm rounded q-mr-sm"
color="info"
name="mdi-hospital-box-outline"
style="background-color: var(--surface-3)"
/>
{{ $t(`customerEmployee.formHealthCheck.title`) }}
<AddButton
v-if="currentIndex === -1 && !hideAction"
id="btn-add-bank"
icon-only
class="q-ml-sm"
type="button"
@click="addCheckup"
:disabled="!(currentIndex === -1)"
/>
</div>
<div class="row">
<div
v-for="(checkup, index) in employeeCheckup"
v-bind:key="index"

View file

@ -45,38 +45,6 @@ defineEmits<{
(e: 'undo', index: number): void;
}>();
function addData() {
// const canAdd = checkTabBeforeAdd(employeeWork.value || []);
const canAdd = true;
if (canAdd) {
employeeWork.value?.push({
workPermitExpireDate: null,
workPermitIssueDate: null,
workPermitNo: '',
workplace: '',
jobType: '',
positionName: '',
ownerName: '',
remark: '',
});
if (employeeWork.value) {
tab.value = `tab${employeeWork.value.length - 1}`;
currentIndex.value = employeeWork.value.length - 1;
}
}
}
function removeData(index: number) {
if (!employeeWork.value) return;
if (employeeWork.value.length === 1) return;
employeeWork.value.splice(index, 1);
if (index) if (tab.value === `tab${index}`) tab.value = `tab${index - 1}`;
if (tab.value === `tab${employeeWork.value.length}`)
tab.value = `tab${employeeWork.value.length - 1}`;
}
onMounted(async () => {
tab.value = 'tab0';
});
@ -105,27 +73,6 @@ const workplaceFilter = selectFilterOptionRefMod(
<template>
<div class="row col-12">
<div class="col-12 q-pb-sm text-weight-bold text-body1 row items-center">
<q-icon
flat
size="xs"
class="q-pa-sm rounded q-mr-xs"
color="info"
name="mdi-briefcase-outline"
style="background-color: var(--surface-3)"
/>
{{ $t(`customerEmployee.form.group.workHistory`) }}
<AddButton
v-if="currentIndex === -1 && !hideAction"
id="btn-add-bank"
icon-only
class="q-ml-sm"
type="button"
@click="addData"
:disabled="!(currentIndex === -1)"
/>
</div>
<div
v-for="(work, index) in employeeWork"
v-bind:key="index"