diff --git a/src/components/02_personnel-management/FormByType.vue b/src/components/02_personnel-management/FormByType.vue
index ab94adde..d05d7682 100644
--- a/src/components/02_personnel-management/FormByType.vue
+++ b/src/components/02_personnel-management/FormByType.vue
@@ -1,9 +1,13 @@
• ข้อมูลการทำงาน
@@ -225,7 +257,7 @@ defineProps<{
:borderless="readonly"
label="ด่าน"
class="col-6"
- v-model="checkPoint"
+ v-model="checkpoint"
/>
+
+
+
+ openNewTab(item.url)"
+ >
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
diff --git a/src/components/TooltipComponent.vue b/src/components/TooltipComponent.vue
index 06476c58..e8a4114d 100644
--- a/src/components/TooltipComponent.vue
+++ b/src/components/TooltipComponent.vue
@@ -99,6 +99,7 @@ defineProps<{
}
.tooltip .tooltip-text {
+ border: 1px solid var(--_bg-box-content);
width: 250px;
height: 200px;
background-color: var(--_bg-tooltip-branch);
@@ -120,8 +121,7 @@ defineProps<{
left: var(--_main-page-branch-tooltip);
border-width: 8px;
border-style: solid;
- border-color: var(--_bg-tooltip-branch-arrow) transparent transparent
- transparent;
+ border-color: var(--_bg-box-content) transparent transparent transparent;
transform: rotate(270deg);
}
diff --git a/src/pages/02_personnel-management/MainPage.vue b/src/pages/02_personnel-management/MainPage.vue
index 27324d20..71e9043b 100644
--- a/src/pages/02_personnel-management/MainPage.vue
+++ b/src/pages/02_personnel-management/MainPage.vue
@@ -5,7 +5,12 @@ import useUserStore from 'stores/user';
import useBranchStore from 'src/stores/branch';
import { dialog } from 'src/stores/utils';
-import { User, UserCreate, UserTypeStats } from 'src/stores/user/types';
+import {
+ User,
+ UserAttachmentCreate,
+ UserCreate,
+ UserTypeStats,
+} from 'src/stores/user/types';
import { BranchUserStats } from 'src/stores/branch/types';
import useAddressStore from 'src/stores/address';
@@ -20,7 +25,7 @@ import FormInformation from 'src/components/02_personnel-management/FormInformat
import FormPerson from 'src/components/02_personnel-management/FormPerson.vue';
import FormByType from 'src/components/02_personnel-management/FormByType.vue';
import DrawerInfo from 'src/components/DrawerInfo.vue';
-import infoForm from 'src/components/02_personnel-management/infoForm.vue';
+import InfoForm from 'src/components/02_personnel-management/InfoForm.vue';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
@@ -61,6 +66,8 @@ const defaultFormData = {
responsibleArea: null,
username: '',
status: 'CREATED',
+ checkpoint: null,
+ checkpointEN: null,
};
const currentUser = ref();
@@ -83,6 +90,8 @@ const code = ref();
const formDialogRef = ref();
const userStats = ref();
const typeStats = ref();
+const agencyFile = ref([]);
+const agencyFileList = ref<{ name: string; url: string }[]>([]);
const formData = ref({
provinceId: null,
districtId: null,
@@ -190,6 +199,14 @@ async function openDialog(action?: 'FORM' | 'INFO', idEdit?: string) {
if (idEdit && userData.value) {
assignFormData(idEdit);
+
+ if (formData.value.userType === 'AGENCY') {
+ const result = await userStore.fetchAttachment(idEdit);
+
+ if (result) {
+ agencyFileList.value = result;
+ }
+ }
}
}
@@ -205,6 +222,7 @@ function onClose() {
brId.value = '';
userId.value = '';
urlProfile.value = '';
+ agencyFile.value = [];
profileSubmit.value = false;
modal.value = false;
infoDrawer.value = false;
@@ -215,8 +233,6 @@ function onClose() {
}
async function onSubmit() {
- console.log('hello');
-
formData.value.profileImage = profileFile.value as File;
if (isEdit.value === true && userId.value) {
dialog({
@@ -234,7 +250,6 @@ async function onSubmit() {
status: !statusToggle.value ? 'INACTIVE' : 'ACTIVE',
} as const;
await userStore.editById(userId.value, formDataEdit);
- onClose();
if (
hqId.value &&
@@ -249,12 +264,25 @@ async function onSubmit() {
);
}
+ if (userId.value && formDataEdit.userType === 'AGENCY') {
+ if (!agencyFile.value) return;
+ const payload: UserAttachmentCreate = {
+ file: agencyFile.value,
+ };
+
+ if (payload?.file) {
+ await userStore.addAttachment(userId.value, payload);
+ }
+ }
+
userStore.fetchList({
includeBranch: true,
query: !!inputSearch.value ? inputSearch.value : undefined,
userType: selectorLabel.value ?? undefined,
});
typeStats.value = await userStore.typeStats();
+
+ onClose();
},
});
} else {
@@ -279,6 +307,19 @@ async function onSubmit() {
result.id,
);
}
+
+ if (result && formData.value.userType === 'AGENCY') {
+ if (!agencyFile.value) return;
+
+ const payload: UserAttachmentCreate = {
+ file: agencyFile.value,
+ };
+
+ if (payload?.file) {
+ await userStore.addAttachment(result.id, payload);
+ }
+ }
+
selectorLabel.value = formData.value.userType;
userStore.fetchList({
includeBranch: true,
@@ -286,6 +327,7 @@ async function onSubmit() {
userType: selectorLabel.value ?? undefined,
});
typeStats.value = await userStore.typeStats();
+
onClose();
},
});
@@ -364,6 +406,8 @@ async function assignFormData(idEdit: string) {
userRole: foundUser.userRole,
userType: foundUser.userType,
username: foundUser.username,
+ checkpoint: foundUser.checkpoint,
+ checkpointEN: foundUser.checkpointEN,
responsibleArea: foundUser.responsibleArea,
status: foundUser.status,
licenseExpireDate:
@@ -630,7 +674,7 @@ watch(inputSearch, async () => {
:editData="() => (infoPersonCardEdit = true)"
>
- {
v-model:sourceNationality="formData.sourceNationality"
v-model:importNationality="formData.importNationality"
v-model:trainingPlace="formData.trainingPlace"
+ v-model:checkpoint="formData.checkpoint"
+ v-model:checkpointEN="formData.checkpointEN"
+ v-model:agencyFile="agencyFile"
+ v-model:agencyFileList="agencyFileList"
+ v-model:userId="userId"
/>
-
+
@@ -845,6 +894,9 @@ watch(inputSearch, async () => {
v-model:sourceNationality="formData.sourceNationality"
v-model:importNationality="formData.importNationality"
v-model:trainingPlace="formData.trainingPlace"
+ v-model:checkpoint="formData.checkpoint"
+ v-model:checkpointEN="formData.checkpointEN"
+ v-model:agencyFile="agencyFile"
/>