diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index 99e447c0..4c4c5344 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -9,7 +9,7 @@ import { calculateAge, dateFormat } from 'src/utils/datetime'; import useCustomerStore from 'stores/customer'; import useEmployeeStore from 'stores/employee'; import useMyBranchStore from 'stores/my-branch'; -import useUtilsStore, { dialog, notify } from 'stores/utils'; +import useUtilsStore, { dialog } from 'stores/utils'; import useFlowStore from 'stores/flow'; import { Status } from 'stores/types'; import { CustomerStats, Customer, CustomerBranch } from 'stores/customer/types'; @@ -408,6 +408,12 @@ async function editCustomerForm(id: string) { customerFormState.value.editCustomerId = id; } +async function editEmployeeFormPersonal(id: string) { + await employeeFormStore.assignFormDataEmployee(id); + employeeFormState.value.dialogType = 'edit'; + employeeFormState.value.drawerModal = true; +} + function employeeConfirmUnsave(close = true) { dialog({ color: 'warning', @@ -615,8 +621,8 @@ watch( ? customerStats.map((v) => ({ count: v.name === 'CORP' - ? (statsCustomerType?.CORP ?? 0) - : (statsCustomerType?.PERS ?? 0), + ? statsCustomerType?.CORP ?? 0 + : statsCustomerType?.PERS ?? 0, label: v.name === 'CORP' ? 'customerLegalEntity' @@ -1507,12 +1513,10 @@ watch( class="row q-py-sm" style="white-space: nowrap" @click=" - () => { - // openDialogInputForm( - // 'INFO', - // props.row.id, - // true, - // ); + async () => { + await editEmployeeFormPersonal( + props.row.id, + ); } " > @@ -1614,7 +1618,7 @@ watch( { icon: 'mdi-clock-outline', value: props.row.dateOfBirth - ? (calculateAge(props.row.dateOfBirth) ?? '') + ? calculateAge(props.row.dateOfBirth) ?? '' : '', }, ], @@ -1920,10 +1924,19 @@ watch( :title="$t('form.title.create', { name: 'Employee' })" v-model:modal="employeeFormState.dialogModal" :undo="() => employeeFormUndo(false)" + :submit=" + async () => { + await employeeFormStore.submitPersonal(); + await fetchListEmployee(); + } + " + :close=" + () => { + employeeFormStore.resetFormDataEmployee(true); + } + " :before-close=" () => { - console.log('asd'); - if (employeeFormStore.isFormDataDifferent()) { employeeConfirmUnsave(); return true; @@ -1933,6 +1946,7 @@ watch( " >