From f05334ea346e09166246403b0b50ac982927b9fd Mon Sep 17 00:00:00 2001 From: nguentrungthat Date: Fri, 7 Feb 2025 15:23:03 +0700 Subject: [PATCH] Update --- .../StaffEvaluation/StaffEvaluation.module.css | 2 -- .../src/pages/StaffEvaluation/StaffEvaluation.tsx | 13 ++++++++++--- FRONTEND/src/rtk/helpers/apiService.ts | 15 +++++++++------ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/FRONTEND/src/pages/StaffEvaluation/StaffEvaluation.module.css b/FRONTEND/src/pages/StaffEvaluation/StaffEvaluation.module.css index cc571e9..86122c0 100644 --- a/FRONTEND/src/pages/StaffEvaluation/StaffEvaluation.module.css +++ b/FRONTEND/src/pages/StaffEvaluation/StaffEvaluation.module.css @@ -55,8 +55,6 @@ display: flex; margin-top: 20px; gap: 10px; - max-height: 72vh; - overflow-y: scroll; } .titleSidebar { diff --git a/FRONTEND/src/pages/StaffEvaluation/StaffEvaluation.tsx b/FRONTEND/src/pages/StaffEvaluation/StaffEvaluation.tsx index 7ee5df7..ee978b9 100644 --- a/FRONTEND/src/pages/StaffEvaluation/StaffEvaluation.tsx +++ b/FRONTEND/src/pages/StaffEvaluation/StaffEvaluation.tsx @@ -103,6 +103,9 @@ const StaffEvaluation = () => { name: '', role: '', note: '', + user_id: 0, + created_at: '', + updated_at: '', }, validate: { name: (value) => @@ -511,9 +514,10 @@ const StaffEvaluation = () => { const handleCreate = async (values: DataProjectReview) => { try { - const { id, ...data } = values const res = await post(projectReviewAdd, { - ...data, + name: values.name, + role: values.role, + note: values.note, user_id: filter.userID, }) if (res.id) { @@ -530,7 +534,10 @@ const StaffEvaluation = () => { const handleUpdate = async (values: DataProjectReview) => { try { const res = await update(projectReviewUpdate, { - ...values, + id: values.id, + name: values.name, + role: values.role, + note: values.note, user_id: filter.userID, }) if (res) { diff --git a/FRONTEND/src/rtk/helpers/apiService.ts b/FRONTEND/src/rtk/helpers/apiService.ts index bd98bc5..c43c938 100755 --- a/FRONTEND/src/rtk/helpers/apiService.ts +++ b/FRONTEND/src/rtk/helpers/apiService.ts @@ -3,7 +3,6 @@ import { getFormDataHeader, getHeaderInfo } from '@/rtk/helpers/tokenCreator' import { removeTokens } from '@/rtk/localStorage' import { notifications } from '@mantine/notifications' import axios from 'axios' -import moment from 'moment' const handleResponse = (response: any) => { if (response.status === 401) { removeTokens() @@ -158,14 +157,18 @@ export const postImage = async (url: string, body: any, method: any) => { } } -export const exportFile = async (url: string, params: any = {}, fileName: string) => { +export const exportFile = async ( + url: string, + params: any = {}, + fileName: string, +) => { const header = await getHeaderInfo() - + try { const response = await axios.get(url, { ...header, params, - responseType: 'blob' + responseType: 'blob', }) if (response.status === 200) { @@ -174,7 +177,7 @@ export const exportFile = async (url: string, params: any = {}, fileName: string const link = document.createElement('a') link.href = downloadUrl link.download = fileName - + document.body.appendChild(link) link.click() window.URL.revokeObjectURL(downloadUrl) @@ -188,7 +191,7 @@ export const exportFile = async (url: string, params: any = {}, fileName: string return true } - + throw new Error('Export failed') } catch (error: any) { notifications.show({