upd: project dan task

Deskripsi:
- tambah project
- perbaiki task

No Issues
This commit is contained in:
amel
2024-08-23 18:10:11 +08:00
parent df2f61e833
commit 5b05edaf38
14 changed files with 163 additions and 115 deletions

View File

@@ -26,12 +26,13 @@ export const funGetTaskDivisionById = async (path: string, kategori: string) =>
}
export const funDeleteDetailTask = async (path: string) => {
export const funDeleteDetailTask = async (path: string, data: { idProject: string }) => {
const response = await fetch(`/api/task/detail/${path}`, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
};

View File

@@ -49,7 +49,7 @@ export default function ListTugasDetailTask() {
async function onDelete() {
try {
const res = await funDeleteDetailTask(idData);
const res = await funDeleteDetailTask(idData, { idProject: param.detail });
if (res.success) {
toast.success(res.message);
refresh.set(true)

View File

@@ -6,7 +6,7 @@ import { useParams } from "next/navigation";
import toast from "react-hot-toast";
import { HiMiniPresentationChartBar } from "react-icons/hi2";
import { funGetTaskDivisionById } from "../lib/api_task";
import { useEffect, useState } from "react";
import { useState } from "react";
import { globalRefreshTask } from "../lib/val_task";
import { useHookstate } from "@hookstate/core";
@@ -44,8 +44,7 @@ export default function ProgressDetailTask() {
}
useEffect(() => {
useShallowEffect(() => {
onRefresh()
}, [refresh.get()])
@@ -56,44 +55,44 @@ export default function ProgressDetailTask() {
return (
<Box mt={10}>
{loading ?
<Skeleton width={"100%"} height={100} radius={"md"} />
:
<Box
p={20}
bg={"#DCEED8"}
style={{
borderRadius: 10,
}}
>
<Grid gutter={"lg"}>
<Grid.Col span={3}>
<ActionIcon
variant="gradient"
size={68}
aria-label="Gradient action icon"
radius={100}
gradient={{ from: "#DFDA7C", to: "#F2AF46", deg: 174 }}
>
<HiMiniPresentationChartBar size={35} color={WARNA.biruTua} />
</ActionIcon>
</Grid.Col>
<Grid.Col span={9}>
<Box>
<Text>Kemajuan Proyek {valProgress}%</Text>
<Progress
style={{
border: `1px solid ${"#BDBDBD"}`,
}}
w={"100%"}
color="#FCAA4B"
radius="md"
size="xl"
value={valProgress}
/>
</Box>
</Grid.Col>
</Grid>
</Box>
<Skeleton width={"100%"} height={100} radius={"md"} />
:
<Box
p={20}
bg={"#DCEED8"}
style={{
borderRadius: 10,
}}
>
<Grid gutter={"lg"}>
<Grid.Col span={3}>
<ActionIcon
variant="gradient"
size={68}
aria-label="Gradient action icon"
radius={100}
gradient={{ from: "#DFDA7C", to: "#F2AF46", deg: 174 }}
>
<HiMiniPresentationChartBar size={35} color={WARNA.biruTua} />
</ActionIcon>
</Grid.Col>
<Grid.Col span={9}>
<Box>
<Text>Kemajuan Proyek {valProgress}%</Text>
<Progress
style={{
border: `1px solid ${"#BDBDBD"}`,
}}
w={"100%"}
color="#FCAA4B"
radius="md"
size="xl"
value={valProgress}
/>
</Box>
</Grid.Col>
</Grid>
</Box>
}
</Box>
)