feat: set addr of current customer
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 9s

This commit is contained in:
Thanaphon Frappet 2025-04-11 09:45:09 +07:00
parent d3e5aec842
commit b1295d00ff
2 changed files with 41 additions and 0 deletions

View file

@ -65,6 +65,8 @@ onMounted(async () => {
}
await getSelectedOption();
valueOption.value = selectOptions.value.find((v) => v.id === value.value);
});
</script>
<template>

View file

@ -296,6 +296,42 @@ watch(
function setCurrentBranchId() {
employeeFormState.value.currentBranchId = props.customerBranchId;
}
watch(
() => employeeFormState.value.currentCustomerBranch,
(e) => {
if (!e) return;
if (employeeFormState.value.formDataEmployeeSameAddr) {
currentFromDataEmployee.value.address = e.address;
currentFromDataEmployee.value.addressEN = e.addressEN;
currentFromDataEmployee.value.provinceId = e.provinceId;
currentFromDataEmployee.value.districtId = e.districtId;
currentFromDataEmployee.value.subDistrictId = e.subDistrictId;
}
currentFromDataEmployee.value.customerBranchId = e.id;
},
);
watch(
() => employeeFormState.value.formDataEmployeeSameAddr,
(isSame) => {
if (!employeeFormState.value.currentCustomerBranch) return;
if (isSame) {
currentFromDataEmployee.value.address =
employeeFormState.value.currentCustomerBranch.address;
currentFromDataEmployee.value.addressEN =
employeeFormState.value.currentCustomerBranch.addressEN;
currentFromDataEmployee.value.provinceId =
employeeFormState.value.currentCustomerBranch.provinceId;
currentFromDataEmployee.value.districtId =
employeeFormState.value.currentCustomerBranch.districtId;
currentFromDataEmployee.value.subDistrictId =
employeeFormState.value.currentCustomerBranch.subDistrictId;
}
currentFromDataEmployee.value.customerBranchId =
employeeFormState.value.currentCustomerBranch.id;
},
);
</script>
<template>
@ -1010,6 +1046,9 @@ function setCurrentBranchId() {
title="form.field.basicInformation"
:readonly="!employeeFormState.isEmployeeEdit"
v-model:customer-branch-id="employeeFormState.currentBranchId"
v-model:current-customer-branch="
employeeFormState.currentCustomerBranch
"
v-model:employee-id="employeeFormState.currentEmployeeCode"
v-model:nrc-no="currentFromDataEmployee.nrcNo"
v-model:code="currentFromDataEmployee.code"