Merge pull request #203 from bipproduction/amalia/06-september-24
Amalia/06 september 24
This commit is contained in:
@@ -139,7 +139,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan pengumuman, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan pengumuman, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export async function POST(req: NextRequest) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return Response.json({ message: "Internal Server Error", success: false });
|
return Response.json({ message: "Internal Server Error", success: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export async function GET(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, data tidak ditemukan" }, { status: 404 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, data tidak ditemukan" }, { status: 404 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ export async function GET(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, data tidak ditemukan" }, { status: 404 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, data tidak ditemukan" }, { status: 404 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil menambah komentar", data: data, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil menambah komentar", data: data, }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menambah komentar, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambah komentar, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan diskusi", data: response }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan diskusi", data: response }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mengedit diskusi" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mengedit diskusi" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengedit diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengedit diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,7 +168,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
});
|
});
|
||||||
return NextResponse.json({ success: true, message: "Berhasil menghapus diskusi" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil menghapus diskusi" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menghapus diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menghapus diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mengedit diskusi" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mengedit diskusi" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengedit diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengedit diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export async function GET(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan diskusi", data, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil menambahkan diskusi", data, }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menambahkan diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambahkan diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -153,7 +153,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
|
|
||||||
|
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengubah status admin divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengubah status admin divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,7 +302,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota divisi" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota divisi" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menambahkan anggota divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambahkan anggota divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -61,7 +61,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data: dataFix, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data: dataFix, }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengedit divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengedit divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ export async function GET(request: Request) {
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ export async function GET(request: Request) {
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data: allData, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data: allData, }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan divisi", data, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil menambahkan divisi", data, }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menambahkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambahkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -68,7 +68,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil memindahkan item" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil memindahkan item" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal memindahkan item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal memindahkan item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -182,7 +182,7 @@ export async function PUT(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil salin item" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil salin item" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal salin item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal salin item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -221,7 +221,7 @@ export async function DELETE(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil membagikan item" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil membagikan item" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membagikan item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal membagikan item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -215,7 +215,7 @@ export async function GET(request: Request) {
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan item", data: formatData, jalur }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan item", data: formatData, jalur }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,7 +285,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil membuat folder baru" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil membuat folder baru" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membuat folder, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal membuat folder, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -342,7 +342,7 @@ export async function PUT(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil mengubah nama item" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mengubah nama item" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengubah nama item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengubah nama item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -373,7 +373,7 @@ export async function DELETE(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil menghapus item" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil menghapus item" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menghapus item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menghapus item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -94,7 +94,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil upload file" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil upload file" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal upload file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal upload file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -37,7 +37,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengedit grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengedit grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengedit grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengedit grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ export async function GET(request: Request) {
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan grup", data, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan grup", data, }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ export async function GET(request: Request) {
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan grup", data, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan grup", data, }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan grup", data, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil menambahkan grup", data, }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menambahkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambahkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -345,7 +345,7 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
|
import { createLogUser } from "@/module/user";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
if (data == 0) {
|
if (data == 0) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: false, message: "Gagal mendapatkan project, data tidak ditemukan",
|
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||||
},
|
},
|
||||||
{ status: 404 }
|
{ status: 404 }
|
||||||
);
|
);
|
||||||
@@ -42,11 +43,13 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota project" }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'CREATE', desc: 'User menambah anggota kegiatan', table: 'project', data: String(id) })
|
||||||
|
return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota kegiatan" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menambah anggota project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambah anggota kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,11 +88,14 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil mengeluarkan anggota project" }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'DELETE', desc: 'User mengeluarkan anggota kegiatan', table: 'project', data: String(id) })
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Berhasil mengeluarkan anggota kegiatan" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
|
import { createLogUser } from "@/module/user";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
@@ -159,7 +160,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
if (data == 0) {
|
if (data == 0) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: false, message: "Gagal mendapatkan project, data tidak ditemukan",
|
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||||
},
|
},
|
||||||
{ status: 404 }
|
{ status: 404 }
|
||||||
);
|
);
|
||||||
@@ -171,14 +172,20 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
idProject: id,
|
idProject: id,
|
||||||
dateStart: new Date(moment(dateStart).format('YYYY-MM-DD')),
|
dateStart: new Date(moment(dateStart).format('YYYY-MM-DD')),
|
||||||
dateEnd: new Date(moment(dateEnd).format('YYYY-MM-DD')),
|
dateEnd: new Date(moment(dateEnd).format('YYYY-MM-DD')),
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Detail project berhasil ditambahkan", data: dataCreate, }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'CREATE', desc: 'User membuat data tahapan kegiatan', table: 'projectTask', data: String(dataCreate.id) })
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Detail tahapan kegiatan berhasil ditambahkan", data: dataCreate, }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal tambah detail project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal tambah tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,11 +225,13 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Project berhasil dibatalkan" }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'UPDATE', desc: 'User membatalkan data kegiatan', table: 'project', data: String(id) })
|
||||||
|
return NextResponse.json({ success: true, message: "Kegiatan berhasil dibatalkan" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membatalkan project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal membatalkan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +255,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
if (data == 0) {
|
if (data == 0) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: false, message: "Gagal mendapatkan project, data tidak ditemukan",
|
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||||
},
|
},
|
||||||
{ status: 404 }
|
{ status: 404 }
|
||||||
);
|
);
|
||||||
@@ -261,10 +270,13 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Project berhasil diubah" }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengupdate data kegiatan', table: 'project', data: String(id) })
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Kegiatan berhasil diupdate" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengubah project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupdate kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
|
import { createLogUser } from "@/module/user";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: false,
|
success: false,
|
||||||
message: "Hapus project gagal, data tidak ditemukan",
|
message: "Hapus tahapan kegiatan gagal, data tidak ditemukan",
|
||||||
},
|
},
|
||||||
{ status: 404 }
|
{ status: 404 }
|
||||||
);
|
);
|
||||||
@@ -67,18 +68,21 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'DELETE', desc: 'User menghapus tahapan kegiatan', table: 'projectTask', data: String(id) })
|
||||||
|
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: true,
|
success: true,
|
||||||
message: "Project berhasil dihapus",
|
message: "Tahapan kegiatan berhasil dihapus",
|
||||||
data,
|
data,
|
||||||
},
|
},
|
||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menghapus project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menghapus tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +107,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
if (data == 0) {
|
if (data == 0) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: false, message: "Gagal mendapatkan project, data tidak ditemukan",
|
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||||
},
|
},
|
||||||
{ status: 404 }
|
{ status: 404 }
|
||||||
);
|
);
|
||||||
@@ -148,12 +152,14 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengupdate status tahapan kegiatan', table: 'projectTask', data: String(id) })
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Status detail Project berhasil diupdate", data }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Status tahapan kegiatan berhasil diupdate", data }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membatalkan project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupdate status tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +208,21 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
const { id } = context.params;
|
const { id } = context.params;
|
||||||
const { name, dateStart, dateEnd } = (await request.json());
|
const { name, dateStart, dateEnd } = (await request.json());
|
||||||
|
|
||||||
|
const dataTask = await prisma.projectTask.count({
|
||||||
|
where: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (dataTask == 0) {
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||||
|
},
|
||||||
|
{ status: 404 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const data = await prisma.projectTask.update({
|
const data = await prisma.projectTask.update({
|
||||||
where: {
|
where: {
|
||||||
id
|
id
|
||||||
@@ -213,10 +234,13 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Detail project berhasil diupdate", data }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengupdate tahapan kegiatan', table: 'projectTask', data: String(id) })
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Detail tahapan kegiatan berhasil diupdate", data }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membatalkan project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupdate detail tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import { NextResponse } from "next/server";
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import { createLogUser } from "@/module/user";
|
||||||
|
|
||||||
// HAPUS FILE PROJECT BUKAN PAKE ISACTIVE
|
// HAPUS FILE PROJECT BUKAN PAKE ISACTIVE
|
||||||
export async function DELETE(request: Request, context: { params: { id: string } }) {
|
export async function DELETE(request: Request, context: { params: { id: string } }) {
|
||||||
@@ -44,6 +45,9 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'DELETE', desc: 'User menghapus file kegiatan', table: 'project', data: String(dataRelasi?.idProject) })
|
||||||
|
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
@@ -55,7 +59,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
);
|
);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menghapus file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menghapus file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,7 +122,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Upload file gagal, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Upload file gagal, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,11 +195,12 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'CREATE', desc: 'User menambah file kegiatan', table: 'project', data: String(id) })
|
||||||
return NextResponse.json({ success: true, message: "Berhasil mengupload file kegiatan" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mengupload file kegiatan" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengupload file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupload file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menambah anggota tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambah anggota tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,9 +85,6 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(id, idUser)
|
|
||||||
|
|
||||||
|
|
||||||
const del = await prisma.divisionProjectMember.deleteMany({
|
const del = await prisma.divisionProjectMember.deleteMany({
|
||||||
where: {
|
where: {
|
||||||
idUser: idUser,
|
idUser: idUser,
|
||||||
@@ -104,7 +101,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengedit detail tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengedit detail tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membatalkan tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal membatalkan tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengedit tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengedit tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menghapus tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menghapus tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengupdate status detail tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupdate status detail tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan detail tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan detail tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengedit detail tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengedit detail tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
);
|
);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menghapus file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menghapus file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil membuat tugas divisi" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil membuat tugas divisi" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membuat tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal membuat tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Upload file gagal, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Upload file gagal, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ export async function GET(request: Request) {
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data: formatData, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data: formatData, }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,7 @@ export async function POST(request: Request) {
|
|||||||
return NextResponse.json({ success: true, message: "Berhasil membuat tugas divisi" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil membuat tugas divisi" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membuat tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal membuat tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
||||||
}
|
}
|
||||||
const { id } = context.params;
|
const { id } = context.params;
|
||||||
console.log(id)
|
|
||||||
|
|
||||||
const body = await request.formData()
|
const body = await request.formData()
|
||||||
const file = body.get("file") as File
|
const file = body.get("file") as File
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { WARNA } from '../fun/WARNA';
|
|||||||
import LayoutIconBack from './layout_icon_back';
|
import LayoutIconBack from './layout_icon_back';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
export const LayoutNavbarNew = ({ back, title, menu }: { back?: string, title: string, menu: React.ReactNode }) => {
|
export const LayoutNavbarNew = ({ back, state, title, menu }: { back?: string, title: string, menu: React.ReactNode, state?: React.ReactNode }) => {
|
||||||
return (
|
return (
|
||||||
<Box pt={25} pl={20} pr={20} m={0} pos={'sticky'} top={0} pb={25} bg={WARNA.biruTua}
|
<Box pt={25} pl={20} pr={20} m={0} pos={'sticky'} top={0} pb={25} bg={WARNA.biruTua}
|
||||||
style={{
|
style={{
|
||||||
@@ -16,11 +16,18 @@ export const LayoutNavbarNew = ({ back, title, menu }: { back?: string, title: s
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Grid justify='center' align='center'>
|
<Grid justify='center' align='center'>
|
||||||
<Grid.Col span="auto">
|
{
|
||||||
{
|
state != undefined &&
|
||||||
back!=undefined && (<LayoutIconBack back={back} />)
|
<Grid.Col span="auto">
|
||||||
}
|
{state}
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
back != undefined &&
|
||||||
|
<Grid.Col span="auto">
|
||||||
|
<LayoutIconBack back={back} />
|
||||||
|
</Grid.Col>
|
||||||
|
}
|
||||||
<Grid.Col span={8}>
|
<Grid.Col span={8}>
|
||||||
<Title c={WARNA.bgWhite} ta={'center'} order={5} lineClamp={1}>{_.startCase(title)}</Title>
|
<Title c={WARNA.bgWhite} ta={'center'} order={5} lineClamp={1}>{_.startCase(title)}</Title>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default function CreateAnnouncement() {
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan pengumuman, coba lagi nanti");
|
toast.error("Gagal menambahkan pengumuman, coba lagi nanti");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export default function EditAnnouncement() {
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mengedit pengumuman, coba lagi nanti");
|
toast.error("Gagal mengedit pengumuman, coba lagi nanti");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function CreateUserCalender({ onClose }: { onClose: (val: any) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function DateEventDivision() {
|
|||||||
}
|
}
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan list acara")
|
toast.error("Gagal mendapatkan list acara")
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
@@ -50,7 +50,7 @@ export default function DateEventDivision() {
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan list acara")
|
toast.error("Gagal mendapatkan list acara")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default function DetailEventDivision() {
|
|||||||
setLengthMember(response.data.total)
|
setLengthMember(response.data.total)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export default function DrawerDetailEvent() {
|
|||||||
}
|
}
|
||||||
setModal(false)
|
setModal(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
setModal(false)
|
setModal(false)
|
||||||
toast.error("Gagal hapus calender, coba lagi nanti");
|
toast.error("Gagal hapus calender, coba lagi nanti");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function HistoryDivisionCalender() {
|
|||||||
setData(response.data)
|
setData(response.data)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
setModal(false)
|
setModal(false)
|
||||||
toast.error("Gagal menambahkan pengumuman, coba lagi nanti");
|
toast.error("Gagal menambahkan pengumuman, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export default function UpdateDivisionCalender() {
|
|||||||
setDataCalender(response.data.calender)
|
setDataCalender(response.data.calender)
|
||||||
memberUser.set(response.data.member)
|
memberUser.set(response.data.member)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ export default function UpdateDivisionCalender() {
|
|||||||
}
|
}
|
||||||
setModal(false)
|
setModal(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Terjadi kesalahan! Silahkan coba kembali");
|
toast.error("Terjadi kesalahan! Silahkan coba kembali");
|
||||||
setModal(false)
|
setModal(false)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default function UpdateListUsers({ onClose }: { onClose: (val: any) => vo
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
|||||||
setData(response.data)
|
setData(response.data)
|
||||||
setIsLoad(false)
|
setIsLoad(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoad(false)
|
setIsLoad(false)
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default function DrawerDetailDiscussion({ onSuccess, id, status, idDivisi
|
|||||||
}
|
}
|
||||||
setValModalStatus(false)
|
setValModalStatus(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
setValModalStatus(false)
|
setValModalStatus(false)
|
||||||
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
@@ -58,7 +58,7 @@ export default function DrawerDetailDiscussion({ onSuccess, id, status, idDivisi
|
|||||||
}
|
}
|
||||||
setValModal(false)
|
setValModal(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
setValModal(false)
|
setValModal(false)
|
||||||
toast.error("Gagal hapus diskusi, coba lagi nanti");
|
toast.error("Gagal hapus diskusi, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export default function FormCreateDiscussion({ id }: { id: string }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setValModal(false)
|
setValModal(false)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function FormEditDiscussion() {
|
|||||||
const response = await funGetDiscussionById(param.detail)
|
const response = await funGetDiscussionById(param.detail)
|
||||||
setDataOne(response.data.desc)
|
setDataOne(response.data.desc)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
toast.error("Gagal menampilkan discussion, coba lagi nanti");
|
toast.error("Gagal menampilkan discussion, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
@@ -49,7 +49,7 @@ export default function FormEditDiscussion() {
|
|||||||
}
|
}
|
||||||
setValModal(false)
|
setValModal(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
setValModal(false)
|
setValModal(false)
|
||||||
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function ListDiscussion({ id }: { id: string }) {
|
|||||||
}
|
}
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export default function CreateAnggotaDivision() {
|
|||||||
setOpen(false)
|
setOpen(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
console.log(error);
|
console.error(error);
|
||||||
toast.error("Gagal menambahkan anggota divisi, coba lagi nanti");
|
toast.error("Gagal menambahkan anggota divisi, coba lagi nanti");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default function CreateReport() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export default function EditDivision() {
|
|||||||
}
|
}
|
||||||
setOpenModal(false)
|
setOpenModal(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
setOpenModal(false)
|
setOpenModal(false)
|
||||||
toast.error("Gagal mengedit divisi, coba lagi nanti");
|
toast.error("Gagal mengedit divisi, coba lagi nanti");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function NavbarAdminDivision({ data, onSuccess }: { data: any, on
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
onSuccess(false)
|
onSuccess(false)
|
||||||
toast.error("Gagal menambahkan divisi, coba lagi nanti");
|
toast.error("Gagal menambahkan divisi, coba lagi nanti");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export default function ReportDivisionId() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default function DrawerMore({ data }: { data: IDataDocument[] }) {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal memindahkan item, coba lagi nanti")
|
toast.error("Gagal memindahkan item, coba lagi nanti")
|
||||||
}
|
}
|
||||||
setIsCut(false)
|
setIsCut(false)
|
||||||
@@ -44,7 +44,7 @@ export default function DrawerMore({ data }: { data: IDataDocument[] }) {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal memindahkan item, coba lagi nanti")
|
toast.error("Gagal memindahkan item, coba lagi nanti")
|
||||||
}
|
}
|
||||||
setIsCopy(false)
|
setIsCopy(false)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default function DrawerShareDocument({ data }: { data: IShareDivision[]})
|
|||||||
toast.error(respon.message)
|
toast.error(respon.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal membagikan item, coba lagi nanti");
|
toast.error("Gagal membagikan item, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ export default function NavbarDocumentDivision() {
|
|||||||
toast.error(respon.message)
|
toast.error(respon.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menghapus item, coba lagi nanti")
|
toast.error("Gagal menghapus item, coba lagi nanti")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ export default function NavbarDocumentDivision() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mengganti nama item, coba lagi nanti")
|
toast.error("Gagal mengganti nama item, coba lagi nanti")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
toast.error("Gagal menambahkan grup, coba lagi nanti");
|
toast.error("Gagal menambahkan grup, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
|||||||
}
|
}
|
||||||
setModal(false);
|
setModal(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
setModal(false);
|
setModal(false);
|
||||||
toast.error("Edit jabatan gagal, coba lagi nanti");
|
toast.error("Edit jabatan gagal, coba lagi nanti");
|
||||||
onUpdated(false);
|
onUpdated(false);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export default function AddDetailTaskProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default function AddFileDetailProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan file, coba lagi nanti")
|
toast.error("Gagal menambahkan file, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ export default function AddFileDetailProject() {
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan file, coba lagi nanti");
|
toast.error("Gagal menambahkan file, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export default function AddMemberDetailProject() {
|
|||||||
}
|
}
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
@@ -97,7 +97,7 @@ export default function AddMemberDetailProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function CancelProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal membatalkan Kegiatan, coba lagi nanti")
|
toast.error("Gagal membatalkan Kegiatan, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { LayoutDrawer, LayoutNavbarNew, WARNA } from "@/module/_global";
|
import { globalRole, LayoutDrawer, LayoutNavbarNew, WARNA } from "@/module/_global";
|
||||||
import { Avatar, Box, Button, Center, Divider, Flex, Grid, Group, rem, Select, SimpleGrid, Stack, Text, TextInput } from "@mantine/core";
|
import { Avatar, Box, Button, Center, Divider, Flex, Grid, Group, rem, Select, SimpleGrid, Stack, Text, TextInput } from "@mantine/core";
|
||||||
import { useRouter, useSearchParams } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import React, { useRef, useState } from "react";
|
import React, { useRef, useState } from "react";
|
||||||
@@ -29,7 +29,6 @@ export default function CreateProject() {
|
|||||||
const [openDrawerTask, setOpenDrawerTask] = useState(false)
|
const [openDrawerTask, setOpenDrawerTask] = useState(false)
|
||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
const [dataGroup, setDataGroup] = useState<IDataGroup[]>([]);
|
const [dataGroup, setDataGroup] = useState<IDataGroup[]>([]);
|
||||||
const [roleUser, setRoleUser] = useState<any>("")
|
|
||||||
const [isChooseAnggota, setChooseAnggota] = useState(false)
|
const [isChooseAnggota, setChooseAnggota] = useState(false)
|
||||||
const member = useHookstate(globalMemberProject)
|
const member = useHookstate(globalMemberProject)
|
||||||
const memberValue = member.get() as IFormMemberProject[]
|
const memberValue = member.get() as IFormMemberProject[]
|
||||||
@@ -40,6 +39,8 @@ export default function CreateProject() {
|
|||||||
const [listFile, setListFile] = useState<IListFileTaskProject[]>([])
|
const [listFile, setListFile] = useState<IListFileTaskProject[]>([])
|
||||||
const [indexDelFile, setIndexDelFile] = useState<number>(0)
|
const [indexDelFile, setIndexDelFile] = useState<number>(0)
|
||||||
const [indexDelTask, setIndexDelTask] = useState<number>(0)
|
const [indexDelTask, setIndexDelTask] = useState<number>(0)
|
||||||
|
const roleLogin = useHookstate(globalRole)
|
||||||
|
|
||||||
const [body, setBody] = useState<any>({
|
const [body, setBody] = useState<any>({
|
||||||
idGroup: "",
|
idGroup: "",
|
||||||
title: "",
|
title: "",
|
||||||
@@ -69,12 +70,15 @@ export default function CreateProject() {
|
|||||||
toast.error(loadGroup.message);
|
toast.error(loadGroup.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadUser = await funGetUserByCookies();
|
if (roleLogin.get() != "supadmin") {
|
||||||
setRoleUser(loadUser.idUserRole)
|
const loadUser = await funGetUserByCookies();
|
||||||
|
setBody({ ...body, idGroup: loadUser.idGroup })
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onToChooseAnggota() {
|
function onToChooseAnggota() {
|
||||||
if (roleUser == "supadmin" && body.idGroup == "")
|
if (roleLogin.get() == "supadmin" && body.idGroup == "")
|
||||||
return toast.error("Error! grup harus diisi")
|
return toast.error("Error! grup harus diisi")
|
||||||
setChooseAnggota(true)
|
setChooseAnggota(true)
|
||||||
}
|
}
|
||||||
@@ -116,7 +120,7 @@ export default function CreateProject() {
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan kegiatan, coba lagi nanti");
|
toast.error("Gagal menambahkan kegiatan, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,7 +141,7 @@ export default function CreateProject() {
|
|||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Stack>
|
<Stack>
|
||||||
{
|
{
|
||||||
(roleUser == "supadmin") && (
|
(roleLogin.get() == "supadmin") && (
|
||||||
<Select
|
<Select
|
||||||
placeholder="Grup"
|
placeholder="Grup"
|
||||||
label="Grup"
|
label="Grup"
|
||||||
@@ -206,7 +210,10 @@ export default function CreateProject() {
|
|||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
}}
|
}}
|
||||||
onClick={() => setOpenDrawer(true)}
|
onClick={() =>
|
||||||
|
// setOpenDrawer(true)
|
||||||
|
openRef.current?.()
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Text>Upload File</Text>
|
<Text>Upload File</Text>
|
||||||
<IoIosArrowDropright size={25} />
|
<IoIosArrowDropright size={25} />
|
||||||
@@ -290,111 +297,127 @@ export default function CreateProject() {
|
|||||||
>
|
>
|
||||||
{member.get().map((v: any, i: any) => {
|
{member.get().map((v: any, i: any) => {
|
||||||
return (
|
return (
|
||||||
<Box key={i}>
|
<Box key={i}>
|
||||||
<Grid align='center' mt={10}
|
<Grid align='center' mt={10}
|
||||||
>
|
>
|
||||||
<Grid.Col span={9}>
|
<Grid.Col span={9}>
|
||||||
<Group>
|
<Group>
|
||||||
<Avatar src={`/api/file/img?jenis=image&cat=user&file=${v.img}`} alt="it's me" size="lg" />
|
<Avatar src={`/api/file/img?jenis=image&cat=user&file=${v.img}`} alt="it's me" size="lg" />
|
||||||
<Box w={{
|
<Box w={{
|
||||||
base: 140,
|
base: 140,
|
||||||
xl: 270
|
xl: 270
|
||||||
}}>
|
}}>
|
||||||
<Text c={WARNA.biruTua} fw={"bold"} lineClamp={1}>
|
<Text c={WARNA.biruTua} fw={"bold"} lineClamp={1}>
|
||||||
{v.name}
|
{v.name}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={3}>
|
<Grid.Col span={3}>
|
||||||
<Text c={WARNA.biruTua} fw={"bold"} ta={'end'}>
|
<Text c={WARNA.biruTua} fw={"bold"} ta={'end'}>
|
||||||
Anggota
|
Anggota
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Box mt={10}>
|
<Box mt={10}>
|
||||||
<Divider size={"xs"} />
|
<Divider size={"xs"} />
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
);
|
||||||
);
|
})}
|
||||||
})}
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
}
|
|
||||||
</Box>
|
</Box>
|
||||||
|
}
|
||||||
</Box>
|
|
||||||
<Box pos={'fixed'} bottom={0} p={rem(20)} w={"100%"} style={{
|
|
||||||
maxWidth: rem(550),
|
|
||||||
zIndex: 999,
|
|
||||||
backgroundColor: `${WARNA.bgWhite}`,
|
|
||||||
}}>
|
|
||||||
<Button
|
|
||||||
color="white"
|
|
||||||
bg={WARNA.biruTua}
|
|
||||||
size="lg"
|
|
||||||
radius={30}
|
|
||||||
fullWidth
|
|
||||||
onClick={() => {
|
|
||||||
if (
|
|
||||||
body.title !== "" &&
|
|
||||||
body.idGroup !== ""
|
|
||||||
) {
|
|
||||||
setModal(true)
|
|
||||||
} else {
|
|
||||||
toast.error("Mohon lengkapi data terlebih dahulu");
|
|
||||||
}
|
|
||||||
}}>
|
|
||||||
Simpan
|
|
||||||
</Button>
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
</Box>
|
||||||
|
<Box pos={'fixed'} bottom={0} p={rem(20)} w={"100%"} style={{
|
||||||
|
maxWidth: rem(550),
|
||||||
|
zIndex: 999,
|
||||||
|
backgroundColor: `${WARNA.bgWhite}`,
|
||||||
|
}}>
|
||||||
|
<Button
|
||||||
|
color="white"
|
||||||
|
bg={WARNA.biruTua}
|
||||||
|
size="lg"
|
||||||
|
radius={30}
|
||||||
|
fullWidth
|
||||||
|
onClick={() => {
|
||||||
|
if (
|
||||||
|
body.title !== "" &&
|
||||||
|
body.idGroup !== ""
|
||||||
|
) {
|
||||||
|
setModal(true)
|
||||||
|
} else {
|
||||||
|
toast.error("Mohon lengkapi data terlebih dahulu");
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Dropzone
|
||||||
|
openRef={openRef}
|
||||||
|
onDrop={async (files) => {
|
||||||
|
if (!files || _.isEmpty(files))
|
||||||
|
return toast.error('Tidak ada file yang dipilih')
|
||||||
|
setFileForm([...fileForm, files[0]])
|
||||||
|
setListFile([...listFile, { name: files[0].name, extension: files[0].type.split("/")[1] }])
|
||||||
|
}}
|
||||||
|
activateOnClick={false}
|
||||||
|
maxSize={3 * 1024 ** 2}
|
||||||
|
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
||||||
|
onReject={(files) => {
|
||||||
|
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||||
|
}}
|
||||||
|
></Dropzone>
|
||||||
|
|
||||||
|
|
||||||
{/* Drawer pilih file */}
|
|
||||||
<LayoutDrawer
|
{/* Drawer pilih file */}
|
||||||
opened={openDrawer}
|
{/* <LayoutDrawer
|
||||||
onClose={() => setOpenDrawer(false)}
|
opened={openDrawer}
|
||||||
title={"Pilih File"}
|
onClose={() => setOpenDrawer(false)}
|
||||||
>
|
title={"Pilih File"}
|
||||||
<Flex justify={"flex-start"} px={20}>
|
>
|
||||||
<Dropzone
|
<Flex justify={"flex-start"} px={20}>
|
||||||
openRef={openRef}
|
<Dropzone
|
||||||
onDrop={async (files) => {
|
openRef={openRef}
|
||||||
if (!files || _.isEmpty(files))
|
onDrop={async (files) => {
|
||||||
return toast.error('Tidak ada file yang dipilih')
|
if (!files || _.isEmpty(files))
|
||||||
setFileForm([...fileForm, files[0]])
|
return toast.error('Tidak ada file yang dipilih')
|
||||||
setListFile([...listFile, { name: files[0].name, extension: files[0].type.split("/")[1] }])
|
setFileForm([...fileForm, files[0]])
|
||||||
}}
|
setListFile([...listFile, { name: files[0].name, extension: files[0].type.split("/")[1] }])
|
||||||
activateOnClick={false}
|
}}
|
||||||
maxSize={3 * 1024 ** 2}
|
activateOnClick={false}
|
||||||
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
maxSize={3 * 1024 ** 2}
|
||||||
onReject={(files) => {
|
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
||||||
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
onReject={(files) => {
|
||||||
}}
|
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||||
>
|
}}
|
||||||
<Box onClick={() => openRef.current?.()}>
|
>
|
||||||
<Box
|
<Box onClick={() => openRef.current?.()}>
|
||||||
bg={"#DCEED8"}
|
<Box
|
||||||
style={{
|
bg={"#DCEED8"}
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
style={{
|
||||||
padding: 20,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
borderRadius: 10,
|
padding: 20,
|
||||||
}}
|
borderRadius: 10,
|
||||||
>
|
}}
|
||||||
<Center>
|
>
|
||||||
<BsFiletypeCsv size={40} />
|
<Center>
|
||||||
</Center>
|
<BsFiletypeCsv size={40} />
|
||||||
</Box>
|
</Center>
|
||||||
<Text mt={10} ta={"center"}>
|
|
||||||
Pilih file
|
|
||||||
</Text>
|
|
||||||
<Text ta={"center"}>diperangkat</Text>
|
|
||||||
</Box>
|
</Box>
|
||||||
</Dropzone>
|
<Text mt={10} ta={"center"}>
|
||||||
{/* <Box onClick={() => router.push("/project/create?page=file-save")}>
|
Pilih file
|
||||||
|
</Text>
|
||||||
|
<Text ta={"center"}>diperangkat</Text>
|
||||||
|
</Box>
|
||||||
|
</Dropzone>
|
||||||
|
<Box onClick={() => router.push("/project/create?page=file-save")}>
|
||||||
<Box
|
<Box
|
||||||
bg={"#DCEED8"}
|
bg={"#DCEED8"}
|
||||||
style={{
|
style={{
|
||||||
@@ -411,62 +434,62 @@ export default function CreateProject() {
|
|||||||
Pilih file yang
|
Pilih file yang
|
||||||
</Text>
|
</Text>
|
||||||
<Text ta={"center"}>sudah ada</Text>
|
<Text ta={"center"}>sudah ada</Text>
|
||||||
</Box> */}
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer> */}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Drawer hapus file */}
|
{/* Drawer hapus file */}
|
||||||
<LayoutDrawer
|
<LayoutDrawer
|
||||||
opened={openDrawerFile}
|
opened={openDrawerFile}
|
||||||
onClose={() => setOpenDrawerFile(false)}
|
onClose={() => setOpenDrawerFile(false)}
|
||||||
title={""}
|
title={""}
|
||||||
>
|
>
|
||||||
<Stack pt={10}>
|
<Stack pt={10}>
|
||||||
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||||
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteFile(indexDelFile)}>
|
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteFile(indexDelFile)}>
|
||||||
<Box>
|
<Box>
|
||||||
<FaTrash size={30} color={WARNA.biruTua} />
|
<FaTrash size={30} color={WARNA.biruTua} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={WARNA.biruTua} ta='center'>Hapus File</Text>
|
<Text c={WARNA.biruTua} ta='center'>Hapus File</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
|
|
||||||
{/* Drawer hapus tugas */}
|
{/* Drawer hapus tugas */}
|
||||||
<LayoutDrawer
|
<LayoutDrawer
|
||||||
opened={openDrawerTask}
|
opened={openDrawerTask}
|
||||||
onClose={() => setOpenDrawerTask(false)}
|
onClose={() => setOpenDrawerTask(false)}
|
||||||
title={""}
|
title={""}
|
||||||
>
|
>
|
||||||
<Stack pt={10}>
|
<Stack pt={10}>
|
||||||
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||||
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteTask(indexDelTask)}>
|
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteTask(indexDelTask)}>
|
||||||
<Box>
|
<Box>
|
||||||
<FaTrash size={30} color={WARNA.biruTua} />
|
<FaTrash size={30} color={WARNA.biruTua} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={WARNA.biruTua} ta='center'>Hapus Tugas</Text>
|
<Text c={WARNA.biruTua} ta='center'>Hapus Tugas</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
|
|
||||||
<LayoutModal opened={isModal} onClose={() => setModal(false)}
|
<LayoutModal opened={isModal} onClose={() => setModal(false)}
|
||||||
description="Apakah Anda yakin ingin menambahkan data?"
|
description="Apakah Anda yakin ingin menambahkan data?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
}
|
}
|
||||||
setModal(false)
|
setModal(false)
|
||||||
}} />
|
}} />
|
||||||
</Box >
|
</Box >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
import { Avatar, Box, Button, Center, Input, rem, SimpleGrid, Skeleton, Stack, Text, TextInput } from '@mantine/core';
|
import { ActionIcon, Avatar, Box, Button, Center, Input, rem, SimpleGrid, Skeleton, Stack, Text, TextInput } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { HiMagnifyingGlass } from 'react-icons/hi2';
|
import { HiChevronLeft, HiMagnifyingGlass } from 'react-icons/hi2';
|
||||||
import { funGetAllmember, TypeUser } from '@/module/user';
|
import { funGetAllmember, TypeUser } from '@/module/user';
|
||||||
import { funGetUserByCookies } from '@/module/auth';
|
import { funGetUserByCookies } from '@/module/auth';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
@@ -62,7 +62,13 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<LayoutNavbarNew title="Pilih Anggota" menu />
|
<LayoutNavbarNew state={
|
||||||
|
<Box>
|
||||||
|
<ActionIcon variant="light" onClick={() => { onClose(true) }} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||||
|
<HiChevronLeft size={20} color='white' />
|
||||||
|
</ActionIcon>
|
||||||
|
</Box>
|
||||||
|
} title="Pilih Anggota" menu />
|
||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<TextInput
|
<TextInput
|
||||||
@@ -128,22 +134,22 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
|
|||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
<Box pos={'fixed'} bottom={0} p={rem(20)} w={"100%"} style={{
|
<Box pos={'fixed'} bottom={0} p={rem(20)} w={"100%"} style={{
|
||||||
maxWidth: rem(550),
|
maxWidth: rem(550),
|
||||||
zIndex: 999,
|
zIndex: 999,
|
||||||
backgroundColor: `${WARNA.bgWhite}`,
|
backgroundColor: `${WARNA.bgWhite}`,
|
||||||
}}>
|
}}>
|
||||||
<Button
|
<Button
|
||||||
color="white"
|
color="white"
|
||||||
bg={WARNA.biruTua}
|
bg={WARNA.biruTua}
|
||||||
size="lg"
|
size="lg"
|
||||||
radius={30}
|
radius={30}
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={() => { onSubmit() }}
|
onClick={() => { onSubmit() }}
|
||||||
>
|
>
|
||||||
Simpan
|
Simpan
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default function EditTaskProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mengedit Kegiatan, coba lagi nanti")
|
toast.error("Gagal mengedit Kegiatan, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { LayoutDrawer, SkeletonSingle, WARNA } from '@/module/_global';
|
import { globalRole, LayoutDrawer, SkeletonSingle, WARNA } from '@/module/_global';
|
||||||
import { Avatar, Box, Flex, Grid, Group, SimpleGrid, Stack, Text } from '@mantine/core';
|
import { Avatar, Box, Flex, Grid, Group, SimpleGrid, Stack, Text } from '@mantine/core';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { funDeleteMemberProject, funGetOneProjectById } from '../lib/api_project';
|
import { funDeleteMemberProject, funGetOneProjectById } from '../lib/api_project';
|
||||||
@@ -10,6 +10,7 @@ import { IDataMemberProject } from '../lib/type_project';
|
|||||||
import { FaUser } from 'react-icons/fa6';
|
import { FaUser } from 'react-icons/fa6';
|
||||||
import { IoIosCloseCircle } from 'react-icons/io';
|
import { IoIosCloseCircle } from 'react-icons/io';
|
||||||
import LayoutModal from '@/module/_global/layout/layout_modal';
|
import LayoutModal from '@/module/_global/layout/layout_modal';
|
||||||
|
import { useHookstate } from '@hookstate/core';
|
||||||
|
|
||||||
|
|
||||||
export default function ListAnggotaDetailProject() {
|
export default function ListAnggotaDetailProject() {
|
||||||
@@ -20,6 +21,7 @@ export default function ListAnggotaDetailProject() {
|
|||||||
const [isOpenModal, setOpenModal] = useState(false)
|
const [isOpenModal, setOpenModal] = useState(false)
|
||||||
const [dataChoose, setDataChoose] = useState({ id: '', name: '' })
|
const [dataChoose, setDataChoose] = useState({ id: '', name: '' })
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const roleLogin = useHookstate(globalRole)
|
||||||
|
|
||||||
async function getOneData() {
|
async function getOneData() {
|
||||||
try {
|
try {
|
||||||
@@ -93,7 +95,7 @@ export default function ListAnggotaDetailProject() {
|
|||||||
<Grid align='center' mt={10}
|
<Grid align='center' mt={10}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setDataChoose({ id: v.idUser, name: v.name })
|
setDataChoose({ id: v.idUser, name: v.name })
|
||||||
setOpenDrawer(true)
|
setOpenDrawer(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Grid.Col span={9}>
|
<Grid.Col span={9}>
|
||||||
@@ -138,14 +140,17 @@ export default function ListAnggotaDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex onClick={() => { setOpenModal(true) }} justify={'center'} align={'center'} direction={'column'} >
|
{
|
||||||
<Box>
|
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
|
||||||
<IoIosCloseCircle size={30} color={WARNA.biruTua} />
|
<Flex onClick={() => { setOpenModal(true) }} justify={'center'} align={'center'} direction={'column'} >
|
||||||
</Box>
|
<Box>
|
||||||
<Box>
|
<IoIosCloseCircle size={30} color={WARNA.biruTua} />
|
||||||
<Text c={WARNA.biruTua}>Keluarkan anggota</Text>
|
</Box>
|
||||||
</Box>
|
<Box>
|
||||||
</Flex>
|
<Text c={WARNA.biruTua}>Keluarkan anggota</Text>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
}
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -183,7 +183,11 @@ export default function ListProject() {
|
|||||||
<Avatar>
|
<Avatar>
|
||||||
<MdAccountCircle size={32} color={WARNA.biruTua} />
|
<MdAccountCircle size={32} color={WARNA.biruTua} />
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<Avatar>+{v.member - 1}</Avatar>
|
<Avatar>
|
||||||
|
{
|
||||||
|
v.member > 0 ? '+' + (v.member - 1) : "0"
|
||||||
|
}
|
||||||
|
</Avatar>
|
||||||
</Avatar.Group>
|
</Avatar.Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global';
|
import { globalRole, LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||||
import { ActionIcon, Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
|
import { ActionIcon, Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
|
||||||
import { useParams, useRouter } from 'next/navigation';
|
import { useParams, useRouter } from 'next/navigation';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
@@ -10,12 +10,14 @@ import { IoAddCircle } from 'react-icons/io5';
|
|||||||
import { MdCancel } from 'react-icons/md';
|
import { MdCancel } from 'react-icons/md';
|
||||||
import { funGetOneProjectById } from '../lib/api_project';
|
import { funGetOneProjectById } from '../lib/api_project';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
|
import { useHookstate } from '@hookstate/core';
|
||||||
|
|
||||||
export default function NavbarDetailProject() {
|
export default function NavbarDetailProject() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
const [name, setName] = useState('')
|
const [name, setName] = useState('')
|
||||||
const [isOpen, setOpen] = useState(false)
|
const [isOpen, setOpen] = useState(false)
|
||||||
|
const roleLogin = useHookstate(globalRole)
|
||||||
|
|
||||||
async function getOneData() {
|
async function getOneData() {
|
||||||
try {
|
try {
|
||||||
@@ -73,22 +75,6 @@ export default function NavbarDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
|
||||||
style={{
|
|
||||||
cursor: 'pointer'
|
|
||||||
}}
|
|
||||||
onClick={() => {
|
|
||||||
router.push(param.id + '/add-member')
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box>
|
|
||||||
<FaUsers size={30} color={WARNA.biruTua} />
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text c={WARNA.biruTua} ta='center'>Tambah anggota</Text>
|
|
||||||
</Box>
|
|
||||||
</Flex>
|
|
||||||
|
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer'
|
cursor: 'pointer'
|
||||||
@@ -105,33 +91,54 @@ export default function NavbarDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
{
|
||||||
style={{
|
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
|
||||||
cursor: 'pointer'
|
<>
|
||||||
}}
|
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||||
onClick={() => { router.push(param.id + '/edit') }}
|
style={{
|
||||||
>
|
cursor: 'pointer'
|
||||||
<Box>
|
}}
|
||||||
<FaPencil size={30} color={WARNA.biruTua} />
|
onClick={() => {
|
||||||
</Box>
|
router.push(param.id + '/add-member')
|
||||||
<Box>
|
}}
|
||||||
<Text c={WARNA.biruTua} ta='center'>Edit</Text>
|
>
|
||||||
</Box>
|
<Box>
|
||||||
</Flex>
|
<FaUsers size={30} color={WARNA.biruTua} />
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text c={WARNA.biruTua} ta='center'>Tambah anggota</Text>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer'
|
cursor: 'pointer'
|
||||||
}}
|
}}
|
||||||
onClick={() => { router.push(param.id + '/cancel') }}
|
onClick={() => { router.push(param.id + '/edit') }}
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
<MdCancel size={30} color={WARNA.biruTua} />
|
<FaPencil size={30} color={WARNA.biruTua} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={WARNA.biruTua} ta='center'>Batal</Text>
|
<Text c={WARNA.biruTua} ta='center'>Edit</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||||
|
style={{
|
||||||
|
cursor: 'pointer'
|
||||||
|
}}
|
||||||
|
onClick={() => { router.push(param.id + '/cancel') }}
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<MdCancel size={30} color={WARNA.biruTua} />
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text c={WARNA.biruTua} ta='center'>Batal</Text>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export default function AddDetailTask() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default function AddFileDetailTask() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan file, coba lagi nanti")
|
toast.error("Gagal menambahkan file, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ export default function AddFileDetailTask() {
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan tugas divisi, coba lagi nanti");
|
toast.error("Gagal menambahkan tugas divisi, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default function AddMemberDetailTask() {
|
|||||||
|
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
@@ -115,7 +115,7 @@ export default function AddMemberDetailTask() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export default function CancelTask() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal membatalkan tugas, coba lagi nanti")
|
toast.error("Gagal membatalkan tugas, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export default function CreateTask() {
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan tugas divisi, coba lagi nanti");
|
toast.error("Gagal menambahkan tugas divisi, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export default function CreateUsersProject({ onClose }: { onClose: (val: any) =>
|
|||||||
}
|
}
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export default function EditTask() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mengedit tugas, coba lagi nanti")
|
toast.error("Gagal mengedit tugas, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default async function createLogUser({ act, desc, table, data }: { act: s
|
|||||||
return { success: true, message: "Success" }
|
return { success: true, message: "Success" }
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
return { success: false, message: "Internal Server Error" }
|
return { success: false, message: "Internal Server Error" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user