From 6b7e943f681dbef31e249826bbfd6b51f4a19565 Mon Sep 17 00:00:00 2001 From: Net Date: Tue, 13 Aug 2024 14:02:00 +0700 Subject: [PATCH] refactor: handle edit --- .../FormEmployeeWorkHistory.vue | 6 ++++++ src/pages/03_customer-management/MainPage.vue | 20 +++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/components/03_customer-management/FormEmployeeWorkHistory.vue b/src/components/03_customer-management/FormEmployeeWorkHistory.vue index 11359684..4490edc3 100644 --- a/src/components/03_customer-management/FormEmployeeWorkHistory.vue +++ b/src/components/03_customer-management/FormEmployeeWorkHistory.vue @@ -13,6 +13,7 @@ import { } from 'components/button'; const { locale } = useI18n(); +const currentIndex = defineModel('currentIndex'); const employeeWork = defineModel('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)" /> @@ -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)" /> diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index 641778fb..810ea0d1 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -2469,7 +2469,11 @@ watch( !currentFromDataEmployee.image || !employeeFormState.profileUrl " clear-button - @save="() => {}" + @save=" + async () => { + await employeeFormStore.submitPersonal(); + } + " >