diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts
index bcb7e54d9..b30ec3ec1 100644
--- a/src/api/02_organizational/api.organization.ts
+++ b/src/api/02_organizational/api.organization.ts
@@ -192,6 +192,8 @@ export default {
`${orgProfile}/keycloak/permissionProfile/${rootId}`,
profileidPosition: (type: string) =>
`${orgProfile}${type}/profileid/position`,
+ uploadProfile: (type: string, id: string) =>
+ `${organization}/upload/${type}-profileSalaryTemp/${id}`,
workflowCommanderOperate: `${workflow}/commander/operate`,
workflowCommanderSign: `${workflow}/commander/sign`,
diff --git a/src/modules/04_registryPerson/views/edit/components/Table.vue b/src/modules/04_registryPerson/views/edit/components/Table.vue
index 7d99fd725..74849426c 100644
--- a/src/modules/04_registryPerson/views/edit/components/Table.vue
+++ b/src/modules/04_registryPerson/views/edit/components/Table.vue
@@ -847,6 +847,58 @@ async function validateAndSave(
}
}
+/**
+ * ฟังก์ชันอัปโหลดไฟล์ Excel
+ * ส่งไฟล์ Excel ไปยัง API โดยตรง
+ */
+function handUploadFile() {
+ const input = document.createElement("input");
+ input.type = "file";
+ input.accept = ".xlsx,.xls";
+
+ input.onchange = async (e: Event) => {
+ try {
+ const file = (e.target as HTMLInputElement).files?.[0];
+ if (!file) return;
+
+ // ตรวจสอบชนิดไฟล์โดยตรวจสอบนามสกุล
+ const validExtensions = [".xlsx", ".xls"];
+ const fileExtension = file.name
+ .substring(file.name.lastIndexOf("."))
+ .toLowerCase();
+
+ if (!validExtensions.includes(fileExtension)) {
+ messageError("กรุณาเลือกไฟล์ Excel เท่านั้น (.xlsx, .xls)");
+ return;
+ }
+
+ showLoader();
+ const type = empType.value === "officer" ? "office" : "employee";
+ const formData = new FormData();
+ formData.append("file", file);
+
+ await http.post(
+ config.API.uploadProfile(type, profileId.value),
+ formData,
+ {
+ headers: {
+ "Content-Type": "multipart/form-data",
+ },
+ }
+ );
+
+ success($q, "อัปโหลดไฟล์สำเร็จ");
+ await fetchData();
+ } catch (error) {
+ messageError($q, error);
+ } finally {
+ hideLoader();
+ }
+ };
+
+ input.click();
+}
+
onMounted(async () => {
await Promise.all([fetchData(), fetchType()]);
});
@@ -886,6 +938,15 @@ onMounted(async () => {
>