fix: 02 view detail branch

This commit is contained in:
puriphatt 2024-07-23 09:18:34 +00:00
parent dc4fa20d52
commit 9e1c4f6736

View file

@ -268,7 +268,7 @@ async function openDialog(
}
}
}
if (userStore.userOption.hqOpts.length !== 0) {
if (userStore.userOption.hqOpts.length !== 0 && !id) {
hqId.value = userStore.userOption.hqOpts[0].value;
}
if (userStore.userOption.hqOpts.length === 0) {
@ -468,7 +468,6 @@ async function assignFormData(idEdit: string) {
if (foundUser) {
currentUser.value = foundUser;
infoPersonId.value = currentUser.value.id;
formData.value = {
branchId: foundUser.branch[0]?.id,
provinceId: foundUser.provinceId,
@ -515,7 +514,7 @@ async function assignFormData(idEdit: string) {
: (statusToggle.value = false);
userId.value = foundUser.id;
if (foundUser.branch[0]) {
if (foundUser.branch) {
if (foundUser.branch[0].isHeadOffice) {
hqId.value = foundUser.branch[0].id as string;
} else {