feat: update detail penugasan
This commit is contained in:
parent
1962f7b735
commit
bba9b6192f
|
|
@ -594,6 +594,7 @@ export default function FormTaskTaDetail() {
|
|||
}
|
||||
|
||||
initState();
|
||||
getDataAcceptance();
|
||||
}, []);
|
||||
|
||||
const handleToggleInput = (): void => {
|
||||
|
|
@ -678,10 +679,9 @@ export default function FormTaskTaDetail() {
|
|||
}
|
||||
|
||||
const handleAcceptAcceptance = async () => {
|
||||
const isAccept = true;
|
||||
loading();
|
||||
console.log("Id user :", userId);
|
||||
const response = await acceptAssignment(id, !isAccept);
|
||||
const response = await acceptAssignment(id);
|
||||
|
||||
if (response?.error) {
|
||||
error(response?.message);
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ export type taskDetail = {
|
|||
broadcastType: string;
|
||||
narration: string;
|
||||
is_active: string;
|
||||
isAssignmentAccepted: boolean;
|
||||
isDone: any;
|
||||
};
|
||||
|
||||
|
|
@ -398,7 +399,7 @@ export default function FormTaskDetail() {
|
|||
}
|
||||
}
|
||||
initState();
|
||||
// fetchFilteredData();
|
||||
getDataAcceptance();
|
||||
}, [id, refresh]);
|
||||
|
||||
const handleUrlChange = (index: number, newUrl: string) => {
|
||||
|
|
@ -580,16 +581,17 @@ export default function FormTaskDetail() {
|
|||
};
|
||||
|
||||
async function getDataAcceptance() {
|
||||
console.log("Get Acceptance Status >> ");
|
||||
const response = await getAcceptanceAssignmentStatus(id);
|
||||
setStatusAcceptance(response?.data?.data?.isAccept);
|
||||
console.log("Status :", response?.data?.data?.isAccept);
|
||||
console.log("Get Acceptance Status : ", response);
|
||||
}
|
||||
|
||||
const handleAcceptAcceptance = async () => {
|
||||
const isAccept = true;
|
||||
loading();
|
||||
console.log("Id user :", userId);
|
||||
const response = await acceptAssignment(id, !isAccept);
|
||||
const response = await acceptAssignment(id);
|
||||
|
||||
if (response?.error) {
|
||||
error(response?.message);
|
||||
|
|
@ -1413,7 +1415,8 @@ export default function FormTaskDetail() {
|
|||
className="btn btn-primary lg:mx-3"
|
||||
style={
|
||||
statusAcceptance ||
|
||||
detail?.createdBy?.id !== Number(userId)
|
||||
detail?.isAssignmentAccepted == true ||
|
||||
detail?.createdBy?.id == Number(userId)
|
||||
? {
|
||||
display: "none",
|
||||
}
|
||||
|
|
@ -1443,7 +1446,7 @@ export default function FormTaskDetail() {
|
|||
if (!isTableResult) fetchAllData(); // Panggil API saat tombol diklik
|
||||
}}
|
||||
>
|
||||
Hasil Upload {Number(userId)}
|
||||
Hasil Upload
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ export async function getAcceptance(id: any, isAccept: any) {
|
|||
return httpGetInterceptor(url);
|
||||
}
|
||||
|
||||
export async function acceptAssignment(id: any, isAccept: any) {
|
||||
export async function acceptAssignment(id: any) {
|
||||
const url = `assignment/acceptance?id=${id}`;
|
||||
return httpPostInterceptor(url, id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue