refactor: citizen missig

This commit is contained in:
Thanaphon Frappet 2024-11-20 17:35:33 +07:00
parent aa823d68aa
commit bad389f6be
3 changed files with 23 additions and 14 deletions

View file

@ -443,15 +443,16 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
let resetFormData = structuredClone(defaultFormData);
const currentFormData = ref<CustomerBranchCreate & { id?: string }>(
structuredClone(defaultFormData),
);
const currentFormData = ref<
CustomerBranchCreate & { id?: string; codeCustomer?: string }
>(structuredClone(defaultFormData));
const state = ref<{
dialogType: 'info' | 'create' | 'edit';
dialogOpen: boolean;
dialogModal: boolean;
currentCustomerId: string;
customerType?: 'CORP' | 'PERS';
}>({
dialogType: 'info',
dialogOpen: false,
@ -474,7 +475,6 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
resetFormData = {
id: _data.id,
code: _data.code,
customerCode: '',
provinceId: _data.provinceId,
districtId: _data.districtId,
subDistrictId: _data.subDistrictId,
@ -558,7 +558,8 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
const res = await customerStore.createBranch({
...currentFormData.value,
citizenId:
customerFormStore.currentFormData.customerType === 'CORP'
(state.value.customerType ||
customerFormStore.currentFormData.customerType) === 'CORP'
? undefined
: currentFormData.value.citizenId,
customerId: state.value.currentCustomerId,