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

View file

@ -2469,7 +2469,11 @@ watch(
!currentFromDataEmployee.image || !employeeFormState.profileUrl !currentFromDataEmployee.image || !employeeFormState.profileUrl
" "
clear-button clear-button
@save="() => {}" @save="
async () => {
await employeeFormStore.submitPersonal();
}
"
> >
<template #error> <template #error>
<div class="full-height full-width" style="background: white"> <div class="full-height full-width" style="background: white">
@ -2548,6 +2552,18 @@ watch(
<div class="full-height full-width column"> <div class="full-height full-width column">
<div class="q-mx-lg q-mt-lg"> <div class="q-mx-lg q-mt-lg">
<ProfileBanner <ProfileBanner
@view="employeeFormState.imageDialog = true"
@edit="
dialogEmployeeImageUpload && dialogEmployeeImageUpload.browse()
"
@update:toggle-status="
() => {
currentFromDataEmployee.status =
currentFromDataEmployee.status === 'CREATED'
? 'INACTIVE'
: 'CREATED';
}
"
active active
useToggle useToggle
color="white" color="white"
@ -2556,7 +2572,7 @@ watch(
v-model:current-tab="employeeFormState.currentTab" v-model:current-tab="employeeFormState.currentTab"
v-model:cover-url="employeeFormState.profileUrl" v-model:cover-url="employeeFormState.profileUrl"
fallbackCover="images/employee-banner.png" fallbackCover="images/employee-banner.png"
:img="`/images/employee-avatar.png`" :img="employeeFormState.profileUrl"
:tabs-list="[ :tabs-list="[
{ name: 'personalInfo', label: 'personalInfo' }, { name: 'personalInfo', label: 'personalInfo' },
{ name: 'healthCheck', label: 'healthCheck' }, { name: 'healthCheck', label: 'healthCheck' },