feat: tambah fitur approval task pada project dan divisi

- tambah komponen ModalRiwayatApproval dan ModalTolakApproval
- update itemSectionTanggalTugas untuk mendukung status menunggu persetujuan
- update sectionTanggalTugas (project) dan sectionTanggalTugasTask (divisi) dengan alur approval lengkap
- tambah API approval project task dan division task di lib/api.ts
- tambah toggle approver di headerMemberDetail dan tampilkan badge approver di detail member
- update carouselHome untuk dispatch isApprover ke Redux
- update drawerBottom untuk mendukung scroll pada modal
- ganti label 'Belum dimulai' menjadi 'Belum ada tugas yang diselesaikan'
This commit is contained in:
2026-05-07 16:04:02 +08:00
parent d2e1663f9f
commit e48456ea7f
13 changed files with 811 additions and 289 deletions

View File

@@ -166,6 +166,11 @@ export const apiDeleteUser = async (data: { user: string, isActive: boolean }, i
return response.data
};
export const apiToggleApprover = async (data: { user: string, isApprover: boolean }, id: string) => {
const response = await api.patch(`mobile/user/${id}`, data)
return response.data
};
export const apiEditUser = async (data: FormData, id: string) => {
const response = await api.put(`/mobile/user/${id}`, data, {
headers: {
@@ -379,6 +384,21 @@ export const apiDeleteProjectTaskFile = async (data: { user: string }, id: strin
return response.data;
};
export const apiGetProjectTaskApprovals = async ({ user, id }: { user: string, id: string }) => {
const response = await api.get(`/mobile/project/task/${id}/approval`, { params: { user } })
return response.data;
};
export const apiSubmitProjectTask = async ({ user, id }: { user: string, id: string }) => {
const response = await api.post(`/mobile/project/task/${id}/approval`, { user })
return response.data;
};
export const apiApproveRejectProjectTask = async ({ user, id, action, note }: { user: string, id: string, action: 'approve' | 'reject', note?: string }) => {
const response = await api.put(`/mobile/project/task/${id}/approval`, { user, action, note })
return response.data;
};
export const apiAddMemberProject = async ({ data, id }: { data: { user: string, member: any[] }, id: string }) => {
const response = await api.post(`/mobile/project/${id}/member`, data)
@@ -686,6 +706,21 @@ export const apiAddFileTask = async ({ data, id }: { data: FormData, id: string
return response.data;
};
export const apiGetTaskTugasApprovals = async ({ user, id }: { user: string, id: string }) => {
const response = await api.get(`/mobile/task/tugas/${id}/approval`, { params: { user } })
return response.data;
};
export const apiSubmitTaskTugas = async ({ user, id }: { user: string, id: string }) => {
const response = await api.post(`/mobile/task/tugas/${id}/approval`, { user })
return response.data;
};
export const apiApproveRejectTaskTugas = async ({ user, id, action, note }: { user: string, id: string, action: 'approve' | 'reject', note?: string }) => {
const response = await api.put(`/mobile/task/tugas/${id}/approval`, { user, action, note })
return response.data;
};
export const apiGetTugasTaskFile = async ({ user, id }: { user: string, id: string }) => {
const response = await api.get(`/mobile/task/tugas/file/${id}`, { params: { user } })
return response.data;