refactor: add remark

This commit is contained in:
Net 2024-09-25 10:57:57 +07:00
parent cd6c2b743d
commit 8695c90110

View file

@ -40,6 +40,7 @@ import FormBank from 'components/01_branch-management/FormBank.vue';
import ToggleButton from 'src/components/button/ToggleButton.vue';
import FormBranchAdmin from 'src/components/01_branch-management/FormBranchAdmin.vue';
import KebabAction from 'src/components/shared/KebabAction.vue';
import RemarkComponent from 'src/components/RemarkComponent.vue';
import { User } from 'src/stores/user/types';
import {
EditButton,
@ -158,7 +159,6 @@ const currentAttachmentList = ref<
file?: File;
}[]
>([]);
const currentAttachmentSelected = ref<string>('');
const statusQrCodeFile = ref<File | undefined>(undefined);
const statusQrCodeUrl = ref<string>('');
@ -203,19 +203,6 @@ const treeData = computed(() => {
map[v.id] = { ...v, name, branch: v.branch || [] };
});
// branchData.value?.result.forEach((v) => {
// const name = locale.value === 'eng' ? v.nameEN : v.name;
// if (v.isHeadOffice) map[v.id] = { ...v, name, branch: [] };
// else children.push({ ...v, name });
// });
// children.forEach((v) => {
// const name = locale.value === 'eng' ? v.nameEN : v.name;
// if (v.headOfficeId && map[v.headOfficeId]) {
// map[v.headOfficeId].branch.push({ ...v, name });
// }
// });
return Object.values(map);
});
@ -332,6 +319,7 @@ const splitterModel = ref(25);
const defaultFormData = {
headOfficeId: null,
remark: '',
code: '',
taxNo: '',
nameEN: '',
@ -459,6 +447,7 @@ async function fetchBranchById(id: string) {
}
formData.value = {
remark: res.remark,
code: res.code,
headOfficeId: res.headOfficeId,
taxNo: res.taxNo,
@ -1512,7 +1501,7 @@ watch(currentHq, () => {
'subBranch',
);
}
await drawerEdit();
drawerEdit();
formType = 'edit';
}
"
@ -1642,7 +1631,7 @@ watch(currentHq, () => {
'subBranch',
);
}
await drawerEdit();
drawerEdit();
formType = 'edit';
}
"
@ -1704,7 +1693,7 @@ watch(currentHq, () => {
:toggleTitle="$t('status.title')"
:caption="
formTypeBranch === 'headOffice'
? `${formData.code}00000`
? `${formData.code}`
: `${formData.code?.slice(0, -5)}${(formLastSubBranch + 1).toString().padStart(5, '0')}`
"
v-model:toggle-status="formData.status"
@ -1954,6 +1943,7 @@ watch(currentHq, () => {
}
"
/>
<FormBranchAdmin
id="form-branch-admin-view"
:admin="currentBranchAdmin"
@ -1971,7 +1961,9 @@ watch(currentHq, () => {
if (file) {
attachmentList.push(file);
await branchStore.putAttachment(currentId, attachmentList);
attachmentList.forEach(async (v) => {
await branchStore.putAttachment(currentId, v);
});
}
}
"
@ -1993,6 +1985,12 @@ watch(currentHq, () => {
}
"
/>
<RemarkComponent
id="form-remark"
:readonly="formType === 'view'"
v-model:remark="formData.remark"
/>
</div>
</div>
</div>
@ -2311,7 +2309,10 @@ watch(currentHq, () => {
async (_group, file) => {
if (file) {
attachmentList.push(file);
await branchStore.putAttachment(currentId, attachmentList);
attachmentList.forEach(async (v) => {
await branchStore.putAttachment(currentId, v);
});
}
}
"
@ -2335,6 +2336,13 @@ watch(currentHq, () => {
}
"
/>
<RemarkComponent
id="info-remark"
class="q-mb-xl"
:readonly="formType === 'view'"
v-model:remark="formData.remark"
/>
</div>
</div>
</div>
@ -2480,7 +2488,7 @@ watch(currentHq, () => {
v-model:file="statusQrCodeFile as File"
v-model:image-url="statusQrCodeUrl"
@save="
(_file, imageUrl) => {
(_file) => {
qrCodeDialog = false;
if (currentIndexQrCodeBank === -1) {
triggerEditQrCodeLine({ save: true });