refactor: handle edit

This commit is contained in:
Net 2024-08-13 13:31:29 +07:00
parent f337760644
commit d21506f4d6
3 changed files with 20 additions and 4 deletions

View file

@ -31,6 +31,7 @@ const addrOptions = reactive<{
subDistrictOps: [],
});
const currentIndex = defineModel<number>('currentIndex');
const employeeCheckup = defineModel<EmployeeCheckupCreate[]>('employeeCheckup');
const checkupTypeOption = defineModel<{ label: string; value: string }[]>(
'checkupTypeOption',
@ -164,6 +165,7 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
class="q-ml-sm"
type="button"
@click="addCheckup"
:disabled="!(currentIndex === -1)"
/>
</div>
@ -188,12 +190,14 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
icon-only
@click="$emit('undo', index)"
type="button"
:disabled="!(currentIndex === -1) && !(currentIndex === index)"
/>
<SaveButton
icon-only
id="btn-info-health-save"
v-if="!readonly && !checkup.statusSave"
@click="$emit('save', index)"
:disabled="!(currentIndex === -1) && !(currentIndex === index)"
/>
<EditButton
icon-only
@ -201,6 +205,7 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
v-if="!readonly && checkup.statusSave"
@click="$emit('edit', index)"
type="button"
:disabled="!(currentIndex === -1) && !(currentIndex === index)"
/>
<DeleteButton
icon-only
@ -208,6 +213,7 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
v-if="!readonly && !!checkup.id && checkup.statusSave"
@click="$emit('delete', index)"
type="button"
:disabled="!(currentIndex === -1) && !(currentIndex === index)"
/>
</div>
</span>