refactor: handle edit

This commit is contained in:
Net 2024-08-13 14:02:00 +07:00
parent d21506f4d6
commit 6b7e943f68
2 changed files with 24 additions and 2 deletions

View file

@ -13,6 +13,7 @@ import {
} from 'components/button';
const { locale } = useI18n();
const currentIndex = defineModel<number>('currentIndex');
const employeeWork = defineModel<EmployeeWorkCreate[]>('employeeWork');
const positionNameOption = defineModel<{ label: string; value: string }[]>(
'positionNameOption',
@ -119,6 +120,7 @@ const workplaceFilter = selectFilterOptionRefMod(
class="q-ml-sm"
type="button"
@click="addData"
:disabled="!(currentIndex === -1)"
/>
</div>
@ -142,6 +144,7 @@ const workplaceFilter = selectFilterOptionRefMod(
id="btn-info-health-undo"
icon-only
@click="$emit('undo', index)"
:disabled="!(currentIndex === -1) && !(currentIndex === index)"
type="button"
/>
@ -149,6 +152,7 @@ const workplaceFilter = selectFilterOptionRefMod(
icon-only
v-if="!readonly && !work.statusSave"
@click="$emit('save', index)"
:disabled="!(currentIndex === -1) && !(currentIndex === index)"
/>
<EditButton
@ -156,12 +160,14 @@ const workplaceFilter = selectFilterOptionRefMod(
v-if="!readonly && work.statusSave"
@click="$emit('edit', index)"
type="button"
:disabled="!(currentIndex === -1) && !(currentIndex === index)"
/>
<DeleteButton
icon-only
v-if="!readonly && !!work.id && work.statusSave"
@click="$emit('delete', index)"
type="button"
:disabled="!(currentIndex === -1) && !(currentIndex === index)"
/>
</div>
</span>