refactor: function and type

This commit is contained in:
Methapon2001 2024-04-11 11:46:42 +07:00
parent 7e9ea304df
commit e09991a8bd

View file

@ -169,17 +169,12 @@ function changeSubject(
typeBranch: 'headOffice' | 'subBranch',
) {
if (typeBranch === 'headOffice') {
if (formType === 'create') {
return 'เพิ่มสำนักงานใหญ่';
}
return 'แก้ไขสำนักงานใหญ่';
return formType === 'create' ? 'เพิ่มสำนักงานใหญ่' : 'แก้ไขสำนักงานใหญ่';
}
if (typeBranch === 'subBranch') {
if (formType === 'create') {
return 'เพิ่มสาขา';
}
return 'แก้ไขสาขา';
return formType === 'create' ? 'เพิ่มสาขา' : 'แก้ไขสาขา';
}
return '';
}
function triggerCreateSubBranch(code: string, id: string) {
@ -324,7 +319,7 @@ async function submitForm(
await branchContactStore.create(
result.id,
inputBranchContactCreate,
profileFile.value as File,
profileFile.value,
);
getTree();
modal.value = false;
@ -353,7 +348,7 @@ async function submitForm(
await branchContactStore.create(
result.id,
inputBranchContactCreate,
profileFile.value as File,
profileFile.value,
);
getTree();
modal.value = false;
@ -737,15 +732,13 @@ onMounted(async () => {
<FormDialog
ref="formDialogRef"
v-model:modal="modal"
addressTitle="ที่อยู่"
addressENTitle="address"
v-model:address="formData.address"
v-modeladdressEN="formData.addressEN"
v-model:addressEN="formData.addressEN"
v-model:provinceId="formData.provinceId as string"
v-model:districtId="formData.districtId as string"
v-model:subDistrictId="formData.subDistrictId as string"
v-model:zipCode="formData.zipCode"
:title="changeSubject(formType, typeBranch) as string"
:title="changeSubject(formType, typeBranch)"
:submit="() => submitForm(formType, typeBranch, formData, formDataContact)"
>
<template #top>
@ -977,7 +970,7 @@ onMounted(async () => {
.branch-container {
--_color-branch-tree-text: var(--blue-6-hsl);
--_color-branch-title: var(--blue-10-hsl);
--_bg-branch-title: var(--_color-branch-title) / 0.08;
--_bg-branch-title: var(--blue-0-hsl) / 0.5;
--_color-branch-btn: var(--cyan-6-hsl);
--_color-branch-tree-active: var(--blue-6-hsl);
--_bg-branch-tree-box: var(--gray-0-hsl);