Merge pull request #312 from bipproduction/amalia/23-okt-24

Amalia/23 okt 24
This commit is contained in:
Amalia
2024-10-23 17:56:28 +08:00
committed by GitHub
57 changed files with 510 additions and 327 deletions

View File

@@ -1,14 +1,18 @@
import { ViewFilter } from '@/module/_global'; import { ViewFilter } from '@/module/_global';
import { CreateReport, ListDivision } from '@/module/division_new'; import { CreateReport, NavbarListDivision, TabListDivision } from '@/module/division_new';
import React from 'react'; import { Box } from '@mantine/core';
function Page({ searchParams }: { searchParams: { page: string } }) { function Page({ searchParams }: { searchParams: { page: string } }) {
if (searchParams.page == "filter") if (searchParams.page == "filter")
return <ViewFilter linkFilter='division' /> return <ViewFilter linkFilter='division' />
if (searchParams.page == "report") if (searchParams.page == "report")
return <CreateReport /> return <CreateReport />
return ( return (
<ListDivision/> <Box>
<NavbarListDivision />
<TabListDivision />
</Box>
); );
} }

View File

@@ -5,7 +5,6 @@ import moment from "moment";
import "moment/locale/id"; import "moment/locale/id";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import { createLogUser } from '@/module/user'; import { createLogUser } from '@/module/user';
export const dynamic = 'force-dynamic' export const dynamic = 'force-dynamic'
@@ -99,7 +98,7 @@ export async function GET(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil mendapatkan pengumuman", data: allData, }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan pengumuman", data: allData, }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -207,6 +206,6 @@ export async function POST(request: Request) {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal membuat pengumuman, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal membuat pengumuman, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -26,6 +26,6 @@ export async function POST(req: NextRequest) {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return Response.json({ message: "Internal Server Error", success: false }); return Response.json({ message: "Internal Server Error (error: 500)", success: false });
} }
} }

View File

@@ -22,7 +22,7 @@ export async function GET(request: Request, context: { params: { id: string } })
return NextResponse.json({ success: true, message: "Berhasil mendapatkan banner", data }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan banner", data }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan banner, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan banner, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -53,7 +53,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal menghapus banner, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal menghapus banner, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -108,6 +108,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengupdate banner, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengupdate banner, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -25,7 +25,7 @@ export async function GET() {
return NextResponse.json({ success: true, message: "Berhasil mendapatkan banner", data }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan banner", data }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan data banner, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan data banner, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -69,6 +69,6 @@ export async function POST(request: Request) {
} }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal menambahkan banner, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal menambahkan banner, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -26,7 +26,7 @@ export async function GET(request: Request, context: { params: { id: string } })
return NextResponse.json( return NextResponse.json(
{ {
success: false, success: false,
message: "Gagal mendapatkan calender, data tidak ditemukan", message: "Gagal mendapatkan kalender, data tidak ditemukan",
}, },
{ status: 404 } { status: 404 }
); );
@@ -56,15 +56,10 @@ export async function GET(request: Request, context: { params: { id: string } })
const result = { ...dataCalender, timeStart, timeEnd } const result = { ...dataCalender, timeStart, timeEnd }
return NextResponse.json({ success: true, message: "Berhasil mendapatkan calender", data: result }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan kalender", data: result }, { status: 200 });
} catch (error) { } catch (error) {
return NextResponse.json( return NextResponse.json( { success: false, message: "Gagal mendapatkan kalender, data tidak ditemukan (error: 500)", }, { status: 500 }
{
success: false,
message: "Gagal mendapatkan calender, data tidak ditemukan",
},
{ status: 404 }
); );
} }
} }
@@ -116,7 +111,7 @@ export async function POST(request: Request, context: { params: { id: string } }
return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota", }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota", }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal menambah anggota, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal menambah anggota, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
@@ -171,6 +166,6 @@ export async function DELETE(request: Request, context: { params: { id: string }
); );
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,7 +1,7 @@
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 { createLogUser } from "@/module/user";
import _, { remove } from "lodash"; import _ from "lodash";
import moment from "moment"; import moment from "moment";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import { Frequency, RRule } from 'rrule'; import { Frequency, RRule } from 'rrule';
@@ -100,16 +100,10 @@ export async function GET(request: Request, context: { params: { id: string } })
} }
return NextResponse.json({ success: true, message: "Berhasil mendapatkan calender", data: dataFix }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan kalender", data: dataFix }, { status: 200 });
} catch (error) { } catch (error) {
return NextResponse.json( return NextResponse.json({ success: false, message: "Gagal mendapatkan kalender, data tidak ditemukan (error: 500)", }, { status: 500 });
{
success: false,
message: "Gagal mendapatkan calender, data tidak ditemukan",
},
{ status: 404 }
);
} }
} }
@@ -154,12 +148,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
return NextResponse.json({ success: true, message: "Berhasil menghapus acara kalender", data }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil menghapus acara kalender", data }, { status: 200 });
} catch (error) { } catch (error) {
return NextResponse.json( return NextResponse.json({ success: false, message: "Gagal menghapus kalender, coba lagi nanti (error: 500)", }, { status: 500 }
{
success: false,
message: "Gagal menghapus calender, coba lagi nanti",
},
{ status: 500 }
); );
} }
} }
@@ -260,12 +249,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
return NextResponse.json({ success: true, message: "Berhasil mengedit acara" }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mengedit acara" }, { status: 200 });
} catch (error) { } catch (error) {
return NextResponse.json( return NextResponse.json({ success: false, message: "Gagal mengedit acara, coba lagi nanti (error: 500)", }, { status: 500 }
{
success: false,
message: "Gagal mengedit acara, coba lagi nanti",
},
{ status: 500 }
); );
} }
} }

View File

@@ -1,9 +1,9 @@
import moment from "moment";
import { NextResponse } from "next/server";
import "moment/locale/id";
import { funGetUserByCookies } from "@/module/auth";
import { prisma } from "@/module/_global"; import { prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth";
import _ from "lodash"; import _ from "lodash";
import moment from "moment";
import "moment/locale/id";
import { NextResponse } from "next/server";
// GET HISTORY // GET HISTORY
export async function GET(request: Request) { export async function GET(request: Request) {
@@ -104,6 +104,6 @@ export async function GET(request: Request) {
} catch (error) { } catch (error) {
console.error(error) console.error(error)
return NextResponse.json({ success: false, message: "Gagal mendapatkan riwayat acara kalender, coba lagi nanti" }, { status: 404 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan riwayat acara kalender, coba lagi nanti (error: 500)" }, { status: 404 });
} }
} }

View File

@@ -54,7 +54,7 @@ export async function GET(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil mendapatkan list acara", data: result }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan list acara", data: result }, { status: 200 });
} catch (error) { } catch (error) {
return NextResponse.json({ success: false, message: "Gagal mendapatkan list acara" }, { status: 401 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan list acara (error: 500)" }, { status: 401 });
} }
} }

View File

@@ -1,10 +1,10 @@
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 "moment/locale/id"; import "moment/locale/id";
import { createLogUser } from '@/module/user'; import { NextResponse } from "next/server";
import { Frequency, RRule } from 'rrule'; import { Frequency, RRule } from 'rrule';
//GET ALL CALENDER //GET ALL CALENDER
@@ -85,15 +85,15 @@ export async function GET(request: Request) {
})) }))
return NextResponse.json({ success: true, message: "Berhasil mendapatkan calender", data: allOmit }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan kalender", data: allOmit }, { status: 200 });
} else { } else {
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, data tidak ditemukan" }, { status: 404 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan kalender, data tidak ditemukan" }, { status: 404 });
} }
} catch (error) { } catch (error) {
console.error(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 kalender, data tidak ditemukan (error: 500)" }, { status: 404 });
} }
} }
@@ -191,6 +191,6 @@ export async function POST(request: Request) {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal membuat acara kalender, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal membuat acara kalender, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -48,6 +48,6 @@ export async function POST(request: Request, context: { params: { id: string } }
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -91,7 +91,7 @@ export async function GET(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -140,7 +140,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -178,7 +178,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.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -218,6 +218,6 @@ export async function POST(request: Request, context: { params: { id: string } }
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,10 +1,10 @@
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 "moment/locale/id"; import "moment/locale/id";
import { createLogUser } from "@/module/user"; import { NextResponse } from "next/server";
// GET ALL DISCUSSION DIVISION ACTIVE = TRUE // GET ALL DISCUSSION DIVISION ACTIVE = TRUE
@@ -86,7 +86,7 @@ export async function GET(request: Request) {
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -180,6 +180,6 @@ export async function POST(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil menambahkan diskusi", notif: dataNotif }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil menambahkan diskusi", notif: dataNotif }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };

View File

@@ -23,7 +23,7 @@ export async function GET(request: Request, context: { params: { id: string } })
const data = await prisma.division.findUnique({ const data = await prisma.division.findUnique({
where: { where: {
id: String(id), id: String(id),
isActive: true // isActive: true
} }
}); });
@@ -179,7 +179,7 @@ export async function GET(request: Request, context: { params: { id: string } })
catch (error) { catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -232,7 +232,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
); );
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -286,7 +286,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
); );
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -337,6 +337,6 @@ 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.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };

View File

@@ -65,6 +65,6 @@ export async function GET(request: Request, context: { params: { id: string } })
return NextResponse.json({ success: true, data: fixMember }) return NextResponse.json({ success: true, data: fixMember })
} catch (error) { } catch (error) {
return NextResponse.json({ success: false, message: "Gagal mendapatkan member, data tidak ditemukan", }, { status: 404 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan anggota, data tidak ditemukan (error: 500)", }, { status: 500 });
} }
} }

View File

@@ -17,7 +17,7 @@ export async function GET(request: Request, context: { params: { id: string } })
const data = await prisma.division.findUnique({ const data = await prisma.division.findUnique({
where: { where: {
id: String(id), id: String(id),
isActive: true // isActive: true
} }
}); });
@@ -63,7 +63,7 @@ export async function GET(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -117,6 +117,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
); );
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -0,0 +1,48 @@
import { prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth";
import { createLogUser } from "@/module/user";
import { NextResponse } from "next/server";
export async function POST(request: Request, context: { params: { id: string } }) {
try {
const user = await funGetUserByCookies()
if (user.id == undefined) {
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
}
const { id } = context.params;
const { isActive } = (await request.json());
const data = await prisma.division.count({
where: {
id: id,
},
});
if (data == 0) {
return NextResponse.json(
{
success: false,
message: "Edit status divisi gagal, data tidak ditemukan",
},
{ status: 404 }
);
}
const update = await prisma.division.update({
where: {
id: id,
},
data: {
isActive: !isActive,
},
});
// create log user
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengedit status data divisi', table: 'division', data: id })
return NextResponse.json({ success: true, message: "Status divisi berhasil diupdate", }, { status: 200 });
} catch (error) {
console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengubah status divisi, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
}
}

View File

@@ -1,6 +1,5 @@
import { prisma } from "@/module/_global"; import { prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth"; import { funGetUserByCookies } from "@/module/auth";
import _ from "lodash";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
// GET LIST DIVISI BY ID DIVISI (CONTOH : UNTUK SHARE DOKUMEN) // GET LIST DIVISI BY ID DIVISI (CONTOH : UNTUK SHARE DOKUMEN)
@@ -48,6 +47,6 @@ export async function GET(request: Request) {
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,12 +1,11 @@
import { prisma } from "@/module/_global"; import { prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth"; import { funGetUserByCookies } from "@/module/auth";
import _, { ceil } from "lodash"; import _ from "lodash";
import moment from "moment"; import moment from "moment";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
export async function GET(request: Request) { export async function GET(request: Request) {
try { try {
const user = await funGetUserByCookies() const user = await funGetUserByCookies()
const { searchParams } = new URL(request.url) const { searchParams } = new URL(request.url)
const group = searchParams.get("group") const group = searchParams.get("group")
@@ -193,6 +192,6 @@ export async function GET(request: Request) {
} }
catch (error) { catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -20,6 +20,7 @@ export async function GET(request: Request) {
const idGroup = searchParams.get("group"); const idGroup = searchParams.get("group");
const name = searchParams.get('search'); const name = searchParams.get('search');
const page = searchParams.get('page'); const page = searchParams.get('page');
const active = searchParams.get("active");
const dataSkip = Number(page) * 10 - 10; const dataSkip = Number(page) * 10 - 10;
if (idGroup == "null" || idGroup == undefined) { if (idGroup == "null" || idGroup == undefined) {
@@ -30,7 +31,7 @@ export async function GET(request: Request) {
let kondisi: any = { let kondisi: any = {
isActive: true, isActive: active == 'false' ? false : true,
idVillage: String(villaId), idVillage: String(villaId),
idGroup: grup, idGroup: grup,
name: { name: {
@@ -41,7 +42,7 @@ export async function GET(request: Request) {
if (roleUser != "supadmin" && roleUser != "cosupadmin" && roleUser != "admin") { if (roleUser != "supadmin" && roleUser != "cosupadmin" && roleUser != "admin") {
kondisi = { kondisi = {
isActive: true, isActive: active == 'false' ? false : true,
idVillage: String(villaId), idVillage: String(villaId),
idGroup: grup, idGroup: grup,
name: { name: {
@@ -104,7 +105,7 @@ export async function GET(request: Request) {
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -226,6 +227,6 @@ export async function POST(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil menambahkan divisi", notif: dataNotif, }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil menambahkan divisi", notif: dataNotif, }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };

View File

@@ -73,7 +73,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.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };
@@ -157,7 +157,7 @@ export async function PUT(request: Request) {
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };
@@ -197,6 +197,6 @@ 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.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };

View File

@@ -220,7 +220,7 @@ export async function GET(request: Request) {
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -296,7 +296,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.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };
@@ -356,7 +356,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.error(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 (error: 500), coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
} }
}; };
@@ -390,6 +390,6 @@ 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.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };

View File

@@ -1,10 +1,8 @@
import { DIR, funUploadFile, prisma } from "@/module/_global"; import { DIR, funUploadFile, 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";
import fs from "fs";
import path from "path";
import { createLogUser } from "@/module/user";
// UPLOAD FILE // UPLOAD FILE
@@ -95,6 +93,6 @@ export async function POST(request: Request) {
} }
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };

View File

@@ -5,6 +5,7 @@ import { NextResponse } from "next/server";
export const dynamic = 'force-dynamic' export const dynamic = 'force-dynamic'
export const revalidate = true export const revalidate = true
export async function GET(request: Request, context: { params: { id: string } }) { export async function GET(request: Request, context: { params: { id: string } }) {
try { try {
const { id } = context.params; const { id } = context.params;
@@ -39,7 +40,7 @@ export async function GET(request: Request, context: { params: { id: string } })
); );
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -83,7 +84,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -128,6 +129,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -6,6 +6,7 @@ import { NextResponse } from "next/server";
export const dynamic = 'force-dynamic' export const dynamic = 'force-dynamic'
export const revalidate = true export const revalidate = true
export async function GET(request: Request) { export async function GET(request: Request) {
try { try {
const user = await funGetUserByCookies() const user = await funGetUserByCookies()
@@ -41,7 +42,7 @@ export async function GET(request: Request) {
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -77,6 +78,6 @@ 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.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };

View File

@@ -44,7 +44,7 @@ export async function GET(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil mendapatkan notifikasi", data: allData, }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan notifikasi", data: allData, }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan notifikasi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan notifikasi, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -90,6 +90,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan notifikasi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan notifikasi, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,6 +1,6 @@
import { prisma } from "@/module/_global"; import { prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth"; import { funGetUserByCookies } from "@/module/auth";
import _, { ceil, some } from "lodash"; import _, { ceil } from "lodash";
import moment from "moment"; import moment from "moment";
import "moment/locale/id"; import "moment/locale/id";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
@@ -451,6 +451,6 @@ export async function GET(request: Request) {
} }
catch (error) { catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti 99", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,12 +1,9 @@
// SEARCH USER, DIVISION, PROJECT
import { prisma } from "@/module/_global"; import { prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth"; import { funGetUserByCookies } from "@/module/auth";
import _ from "lodash"; import _ from "lodash";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
// SEARCH USER, DIVISION, PROJECT
export async function GET(request: Request) { export async function GET(request: Request) {
try { try {
const { searchParams } = new URL(request.url) const { searchParams } = new URL(request.url)
@@ -136,6 +133,6 @@ export async function GET(request: Request) {
return NextResponse.json({ success: true, data: allDataSearch }, { status: 200 }); return NextResponse.json({ success: true, data: allDataSearch }, { status: 200 });
} catch (error) { } catch (error) {
return NextResponse.json({ success: false, message: error }, { status: 500 }); return NextResponse.json({ success: false, message: 'Gagal mendapatkan data, coba lagi nanti (error: 500)' }, { status: 500 });
} }
} }

View File

@@ -1,7 +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 { createLogUser } from "@/module/user";
import { revalidatePath } from "next/cache";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
// GET ONE JABATAN // GET ONE JABATAN
@@ -42,7 +41,7 @@ export async function GET(request: Request, context: { params: { id: string } })
); );
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan jabatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan jabatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -89,7 +88,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
); );
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengubah status jabatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengubah status jabatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -135,6 +134,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengedit jabatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengedit jabatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -9,7 +9,6 @@ import { NextResponse } from "next/server";
// GET ALL POSITION // GET ALL POSITION
export async function GET(request: Request) { export async function GET(request: Request) {
try { try {
let grup let grup
const { searchParams } = new URL(request.url); const { searchParams } = new URL(request.url);
const idGroup = searchParams.get("group"); const idGroup = searchParams.get("group");
@@ -76,7 +75,7 @@ export async function GET(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil mendapatkan jabatan", data: allData, filter }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan jabatan", data: allData, filter }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan jabatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan jabatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -135,6 +134,6 @@ export async function POST(request: Request) {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal menambahkan jabatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal menambahkan jabatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -166,10 +166,10 @@ export async function GET(request: Request, context: { params: { id: string } })
member: fixMember member: fixMember
} }
return NextResponse.json({ success: true, message: "Berhasil mendapatkan project", data: dataFix, }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan kegiatan", data: dataFix, }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan project, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -82,7 +82,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
); );
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal menghapus tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal menghapus tahapan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -159,7 +159,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengupdate status tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengupdate status tahapan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -183,16 +183,16 @@ export async function GET(request: Request, context: { params: { id: string } })
if (!data) { if (!data) {
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 }
); );
} }
return NextResponse.json({ success: true, message: "Detail project berhasil ditemukan", data }, { status: 200 }); return NextResponse.json({ success: true, message: "Detail kegiatan berhasil ditemukan", data }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -243,6 +243,6 @@ export async function POST(request: Request, context: { params: { id: string } }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengupdate detail tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengupdate detail tahapan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,10 +1,8 @@
import { DIR, funDeleteFile, funUploadFile, prisma } from "@/module/_global"; import { DIR, funDeleteFile, funUploadFile, prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth"; import { funGetUserByCookies } from "@/module/auth";
import { NextResponse } from "next/server";
import fs from "fs";
import path from "path";
import _ from "lodash";
import { createLogUser } from "@/module/user"; import { createLogUser } from "@/module/user";
import _ from "lodash";
import { NextResponse } from "next/server";
// 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 } }) {
@@ -59,7 +57,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -122,7 +120,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -196,6 +194,6 @@ export async function POST(request: Request, context: { params: { id: string } }
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,9 +1,9 @@
import { DIR, funUploadFile, prisma } from "@/module/_global"; import { DIR, funUploadFile, 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";
import { createLogUser } from "@/module/user";
// GET ALL DATA PROJECT // GET ALL DATA PROJECT
@@ -120,7 +120,7 @@ export async function GET(request: Request) {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -277,6 +277,6 @@ export async function POST(request: Request) {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal membuat kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal membuat kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -21,6 +21,6 @@ export async function GET(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil mendapatkan role user", data: res, }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan role user", data: res, }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan role user, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan role user, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -51,7 +51,7 @@ export async function POST(request: Request, context: { params: { id: string } }
return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota tugas", }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota tugas", }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -96,6 +96,6 @@ export async function DELETE(request: Request, context: { params: { id: string }
return NextResponse.json({ success: true, message: "Berhasil mengeluarkan anggota", }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mengeluarkan anggota", }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -3,7 +3,7 @@ import { funGetUserByCookies } from "@/module/auth";
import { createLogUser } from "@/module/user"; import { createLogUser } from "@/module/user";
import _ from "lodash"; import _ from "lodash";
import moment from "moment"; import moment from "moment";
import "moment/locale/id" import "moment/locale/id";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
@@ -157,7 +157,7 @@ export async function GET(request: Request, context: { params: { id: string } })
} }
catch (error) { catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -235,7 +235,7 @@ export async function POST(request: Request, context: { params: { id: string } }
return NextResponse.json({ success: true, message: "Detail tugas berhasil ditambahkan", data, }, { status: 200 }); return NextResponse.json({ success: true, message: "Detail tugas berhasil ditambahkan", data, }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -283,7 +283,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
return NextResponse.json({ success: true, message: "Tugas berhasil dibatalkan", }, { status: 200 }); return NextResponse.json({ success: true, message: "Tugas berhasil dibatalkan", }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -329,7 +329,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
return NextResponse.json({ success: true, message: "Tugas berhasil diedit", }, { status: 200 }); return NextResponse.json({ success: true, message: "Tugas berhasil diedit", }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -74,7 +74,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
return NextResponse.json({ success: true, message: "Tugas berhasil dihapus", data, }, { status: 200 }); return NextResponse.json({ success: true, message: "Tugas berhasil dihapus", data, }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -149,7 +149,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
return NextResponse.json({ success: true, message: "Status detail tugas berhasil diupdate", data, }, { status: 200 }); return NextResponse.json({ success: true, message: "Status detail tugas berhasil diupdate", data, }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -180,7 +180,7 @@ export async function GET(request: Request, context: { params: { id: string } })
} }
catch (error) { catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -229,6 +229,6 @@ export async function POST(request: Request, context: { params: { id: string } }
return NextResponse.json({ success: true, message: "Detail tugas berhasil diedit", data, }, { status: 200 }); return NextResponse.json({ success: true, message: "Detail tugas berhasil diedit", data, }, { status: 200 });
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,10 +1,9 @@
import { DIR, funDeleteFile, funUploadFile, prisma } from "@/module/_global"; import { DIR, funDeleteFile, funUploadFile, 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";
import fs from "fs";
import path from "path"; import path from "path";
import { createLogUser } from "@/module/user";
// HAPUS DETAIL FILE, HAPUS FILE DI ASSETS DAN DATABASE (BUKAN PAKE ISACTIVE) // HAPUS DETAIL FILE, HAPUS FILE DI ASSETS DAN DATABASE (BUKAN PAKE ISACTIVE)
export async function DELETE(request: Request, context: { params: { id: string } }) { export async function DELETE(request: Request, context: { params: { id: string } }) {
@@ -63,7 +62,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -152,7 +151,7 @@ export async function POST(request: Request, context: { params: { id: string } }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal menambahkan filae, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal menambahkan filae, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -219,6 +218,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -94,7 +94,7 @@ export async function GET(request: Request) {
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -265,6 +265,6 @@ export async function POST(request: Request) {
} catch (error) { } catch (error) {
console.error(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 (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,7 +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 { createLogUser } from "@/module/user";
import _ from "lodash";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
// GET ONE THEME // GET ONE THEME
@@ -24,7 +23,7 @@ export async function GET(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan member, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan tema, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -69,7 +68,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal menghapus tema, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal menghapus tema, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -122,7 +121,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengedit tema, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengedit tema, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -175,6 +174,6 @@ export async function POST(request: Request, context: { params: { id: string } }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengganti tema, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengganti tema, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -45,7 +45,7 @@ export async function GET(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil mendapatkan tema", data: result }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil mendapatkan tema", data: result }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan tema, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan tema, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -83,6 +83,6 @@ export async function POST(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil menambahkan tema" }, { status: 200 }); return NextResponse.json({ success: true, message: "Berhasil menambahkan tema" }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal menambahkan tema, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal menambahkan tema, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
}; };

View File

@@ -1,10 +1,8 @@
import { DIR, funDeleteFile, funUploadFile, prisma } from "@/module/_global"; import { DIR, funDeleteFile, funUploadFile, prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth"; import { funGetUserByCookies } from "@/module/auth";
import { createLogUser } from "@/module/user"; import { createLogUser } from "@/module/user";
import _, { update } from "lodash"; import _ from "lodash";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import path from "path";
import fs from "fs";
// GET ONE MEMBER / USER // GET ONE MEMBER / USER
export async function GET(request: Request, context: { params: { id: string } }) { export async function GET(request: Request, context: { params: { id: string } }) {
@@ -74,7 +72,7 @@ export async function GET(request: Request, context: { params: { id: string } })
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan member, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan anggota, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -131,7 +129,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengupdate status anggota, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengupdate status anggota, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -234,6 +232,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
} }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mengupdate data anggota, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengupdate data anggota, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -1,10 +1,8 @@
import { DIR, funDeleteFile, funUploadFile, prisma } from "@/module/_global"; import { DIR, funDeleteFile, funUploadFile, 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";
import path from "path";
import fs from "fs";
import { createLogUser } from "@/module/user";
// GET PROFILE BY COOKIES // GET PROFILE BY COOKIES
@@ -51,7 +49,7 @@ export async function GET(request: Request) {
return NextResponse.json({ success: true, data: result }); return NextResponse.json({ success: true, data: result });
} catch (error) { } catch (error) {
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan data profile (error: 500)" }, { status: 500 });
} }
} }
@@ -140,7 +138,7 @@ export async function PUT(request: Request) {
return NextResponse.json({ success: true, message: "Berhasil ubah profile" }); return NextResponse.json({ success: true, message: "Berhasil ubah profile" });
} catch (error) { } catch (error) {
return NextResponse.json({ success: false, message: "Gagal ubah profile" }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mengubah profile (error: 500)" }, { status: 500 });
} }
} }

View File

@@ -3,8 +3,6 @@ import { funGetUserByCookies } from "@/module/auth";
import { createLogUser } from "@/module/user"; import { createLogUser } from "@/module/user";
import _ from "lodash"; import _ from "lodash";
import { NextResponse } from "next/server"; import { NextResponse } from "next/server";
import path from "path";
import fs from "fs";
// GET ALL MEMBER / USER // GET ALL MEMBER / USER
export async function GET(request: Request) { export async function GET(request: Request) {
@@ -129,7 +127,7 @@ export async function GET(request: Request) {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, message: "Gagal mendapatkan member, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, message: "Gagal mendapatkan anggota, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }
@@ -137,7 +135,6 @@ export async function GET(request: Request) {
// CREATE MEMBER / USER // CREATE MEMBER / USER
export async function POST(request: Request) { export async function POST(request: Request) {
try { try {
const user = await funGetUserByCookies() const user = await funGetUserByCookies()
if (user.id == undefined) { if (user.id == undefined) {
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 });
@@ -219,6 +216,6 @@ export async function POST(request: Request) {
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 }); return Response.json({ success: false, message: "Gagal membuat anggota, coba lagi nanti (error: 500)" }, { status: 500 });
} }
} }

View File

@@ -5,6 +5,6 @@ export async function GET(request: Request) {
return NextResponse.json({ success: true, version: "0.1.5", mode: "staging" }, { status: 200 }); return NextResponse.json({ success: true, version: "0.1.5", mode: "staging" }, { status: 200 });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
} }
} }

View File

@@ -8,7 +8,7 @@ export default function LayoutDrawer({ opened, onClose, title, children, size }:
const tema = useHookstate(TEMA) const tema = useHookstate(TEMA)
return ( return (
<Box> <Box>
<Drawer opened={opened} title={<Text c={tema.get().utama} fw={'bold'}>{title}</Text>} onClose={onClose} position={"bottom"} size={(size == 'lg') ? '80%' : '40%' } <Drawer opened={opened} title={<Text c={tema.get().utama} fw={'bold'}>{title}</Text>} onClose={onClose} position={"bottom"} size={(size == 'lg') ? '80%' : (size == 'md') ? '45%' : '40%'}
styles={{ styles={{
content: { content: {
backgroundColor: "white", backgroundColor: "white",

View File

@@ -17,6 +17,8 @@ import ReportDivisionId from './ui/report_division_id';
import { funGetDivisionById, funGetListDivisionByIdDivision, funGetSearchMemberDivision } from './lib/api_division'; import { funGetDivisionById, funGetListDivisionByIdDivision, funGetSearchMemberDivision } from './lib/api_division';
import { globalIsAdminDivision } from './lib/val_division'; import { globalIsAdminDivision } from './lib/val_division';
import WrapLayoutDivision from './ui/wrap_division'; import WrapLayoutDivision from './ui/wrap_division';
import TabListDivision from './ui/tab_list_division';
import NavbarListDivision from './ui/navbar_list_division';
export { CreateUsers }; export { CreateUsers };
export { CreateAdminDivision }; export { CreateAdminDivision };
@@ -39,3 +41,5 @@ export { funGetListDivisionByIdDivision }
export { funGetSearchMemberDivision } export { funGetSearchMemberDivision }
export { globalIsAdminDivision } export { globalIsAdminDivision }
export { WrapLayoutDivision } export { WrapLayoutDivision }
export { TabListDivision }
export { NavbarListDivision }

View File

@@ -88,3 +88,14 @@ export const funGetSearchMemberDivision = async (path: string, id: string) => {
const response = await fetch(`/api/division/${id}/member/${(path) ? path : ''}`, { next: { tags: ['division'] } }); const response = await fetch(`/api/division/${id}/member/${(path) ? path : ''}`, { next: { tags: ['division'] } });
return await response.json().catch(() => null); return await response.json().catch(() => null);
} }
export const funUpdateStatusDivision = async (path: string, data: { isActive: boolean }) => {
const response = await fetch(`/api/division/${path}/status`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
}

View File

@@ -3,7 +3,7 @@ import { LayoutNavbarNew, TEMA } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth"; import { funGetUserByCookies } from "@/module/auth";
import { funGetAllGroup, IDataGroup } from "@/module/group"; import { funGetAllGroup, IDataGroup } from "@/module/group";
import { useHookstate } from "@hookstate/core"; import { useHookstate } from "@hookstate/core";
import { Avatar, Box, Button, Divider, Grid, Group, rem, Select, Stack, Text, Textarea, TextInput } from "@mantine/core"; import { ActionIcon, Avatar, Box, Button, Divider, Grid, Group, rem, Select, Stack, Text, Textarea, TextInput } from "@mantine/core";
import { useMediaQuery, useShallowEffect } from "@mantine/hooks"; import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
@@ -12,6 +12,7 @@ import { IoIosArrowDropright } from "react-icons/io";
import { globalMemberDivision } from "../lib/val_division"; import { globalMemberDivision } from "../lib/val_division";
import NavbarAdminDivision from "./navbar_admin_division"; import NavbarAdminDivision from "./navbar_admin_division";
import NavbarCreateUsers from "./navbar_create_users"; import NavbarCreateUsers from "./navbar_create_users";
import { HiChevronLeft } from "react-icons/hi2";
export default function CreateDivision() { export default function CreateDivision() {
const router = useRouter(); const router = useRouter();
@@ -105,6 +106,10 @@ export default function CreateDivision() {
return nilai return nilai
} }
function onBack() {
member.set([])
router.push('/division')
}
if (isChooseAdmin) return <NavbarAdminDivision data={body} onSuccess={(val) => { if (isChooseAdmin) return <NavbarAdminDivision data={body} onSuccess={(val) => {
@@ -125,7 +130,15 @@ export default function CreateDivision() {
return ( return (
<Box> <Box>
<LayoutNavbarNew back="/division" title="Tambah Divisi" menu /> <LayoutNavbarNew
state={
<>
<ActionIcon variant="light" onClick={() => { onBack() }} bg={tema.get().bgIcon} size="lg" radius="lg" aria-label="Settings">
<HiChevronLeft size={20} color='white' />
</ActionIcon>
</>
}
title="Tambah Divisi" menu />
<Box p={20}> <Box p={20}>
<Stack> <Stack>
{ {

View File

@@ -1,24 +1,26 @@
"use client" "use client"
import { globalRole, LayoutDrawer, LayoutNavbarNew, SkeletonList, SkeletonSingle, TEMA } from '@/module/_global'; import { globalRole, LayoutDrawer, LayoutNavbarNew, SkeletonList, TEMA } from '@/module/_global';
import { ActionIcon, Avatar, Box, Button, Divider, Flex, Grid, Group, Skeleton, Stack, Text } from '@mantine/core'; import LayoutModal from '@/module/_global/layout/layout_modal';
import { funGetUserByCookies } from '@/module/auth';
import { useHookstate } from '@hookstate/core';
import { ActionIcon, Avatar, Box, Divider, Flex, Grid, Group, SimpleGrid, Skeleton, Stack, Text } from '@mantine/core';
import { useMediaQuery, useShallowEffect } from '@mantine/hooks'; import { useMediaQuery, useShallowEffect } from '@mantine/hooks';
import { useParams, useRouter } from 'next/navigation'; import { useParams, useRouter } from 'next/navigation';
import React, { useState } from 'react'; import { useState } from 'react';
import toast from 'react-hot-toast'; import toast from 'react-hot-toast';
import { AiOutlineUserAdd } from 'react-icons/ai'; import { AiOutlineUserAdd } from 'react-icons/ai';
import { FaUserTie } from 'react-icons/fa6'; import { FaPencil, FaToggleOff, FaUserTie } from 'react-icons/fa6';
import { IoIosCloseCircle } from 'react-icons/io'; import { HiMenu } from 'react-icons/hi';
import { LuClipboardEdit } from 'react-icons/lu'; import { IoIosCloseCircle, IoIosWarning } from 'react-icons/io';
import { funDeleteMemberDivision, funEditStatusAdminDivision, funGetDivisionById } from '../lib/api_division'; import { funDeleteMemberDivision, funEditStatusAdminDivision, funGetDivisionById, funUpdateStatusDivision } from '../lib/api_division';
import { IDataMemberDivision } from '../lib/type_division'; import { IDataMemberDivision } from '../lib/type_division';
import LayoutModal from '@/module/_global/layout/layout_modal';
import { useHookstate } from '@hookstate/core';
import { funGetUserByCookies } from '@/module/auth';
export default function InformationDivision() { export default function InformationDivision() {
const router = useRouter() const router = useRouter()
const [openDrawer, setDrawer] = useState(false) const [openDrawer, setDrawer] = useState(false)
const [openDrawerInfo, setDrawerInfo] = useState(false)
const [valActive, setValActive] = useState(true)
const param = useParams<{ id: string }>() const param = useParams<{ id: string }>()
const [name, setName] = useState('') const [name, setName] = useState('')
const [deskripsi, setDeskripsi] = useState('') const [deskripsi, setDeskripsi] = useState('')
@@ -28,11 +30,13 @@ export default function InformationDivision() {
const [valChooseMemberStatus, setChooseMemberStatus] = useState<boolean>(false) const [valChooseMemberStatus, setChooseMemberStatus] = useState<boolean>(false)
const [valChooseMemberName, setChooseMemberName] = useState("") const [valChooseMemberName, setChooseMemberName] = useState("")
const [isOpenModal, setOpenModal] = useState(false) const [isOpenModal, setOpenModal] = useState(false)
const [isOpenModalStatus, setOpenModalStatus] = useState(false)
const roleLogin = useHookstate(globalRole) const roleLogin = useHookstate(globalRole)
const [isAdmin, setAdmin] = useState(false) const [isAdmin, setAdmin] = useState(false)
const isMobile = useMediaQuery('(max-width: 455px)'); const isMobile = useMediaQuery('(max-width: 455px)');
const isMobile2 = useMediaQuery("(max-width: 438px)"); const isMobile2 = useMediaQuery("(max-width: 438px)");
const tema = useHookstate(TEMA) const tema = useHookstate(TEMA)
const [loadingStatus, setLoadingStatus] = useState(false)
async function getOneData() { async function getOneData() {
try { try {
@@ -43,6 +47,7 @@ export default function InformationDivision() {
setName(res.data.division.name); setName(res.data.division.name);
setDeskripsi(res.data.division.desc); setDeskripsi(res.data.division.desc);
setMember(res.data.member) setMember(res.data.member)
setValActive(res.data.division.isActive)
const cek = res.data.member.some((i: any) => i.idUser == login.id && i.isAdmin == true) const cek = res.data.member.some((i: any) => i.idUser == login.id && i.isAdmin == true)
setAdmin(cek) setAdmin(cek)
} else { } else {
@@ -105,20 +110,53 @@ export default function InformationDivision() {
} }
} }
async function editStatusDivisi() {
try {
setLoadingStatus(true)
const res = await funUpdateStatusDivision(param.id, { isActive: valActive })
if (res.success) {
toast.success(res.message)
getOneData()
} else {
toast.error(res.message)
}
} catch (error) {
console.error(error);
toast.error("Gagal mendapatkan divisi, coba lagi nanti");
} finally {
setDrawerInfo(false)
setLoadingStatus(false)
setOpenModalStatus(false)
}
}
return ( return (
<Box> <Box>
<LayoutNavbarNew back={"/division/" + param.id} title={name} <LayoutNavbarNew back={"/division/" + param.id} title={name}
menu={ menu={
((roleLogin.get() != 'user' && roleLogin.get() != 'coadmin') || isAdmin) ? ((roleLogin.get() != 'user' && roleLogin.get() != 'coadmin') || isAdmin) ?
<ActionIcon variant="light" onClick={() => { <ActionIcon variant="light" onClick={() => { setDrawerInfo(true) }} bg={tema.get().bgIcon} size="lg" radius="lg" aria-label="Settings">
router.push('/division/edit/' + param.id) <HiMenu size={20} color='white' />
}} bg={tema.get().bgIcon} size="lg" radius="lg" aria-label="Settings">
<LuClipboardEdit size={20} color='white' />
</ActionIcon> </ActionIcon>
: <></> : <></>
} }
/> />
<Box p={20}> <Box p={20}>
{
!valActive ?
<Box mb={10}>
<Box p={15} bg={"#FFF2CD"} style={{
borderRadius: 10,
}}>
<Group align='center'>
<IoIosWarning size={25} />
<Text fw={"bold"}>Divisi dinonaktifkan</Text>
</Group>
</Box>
</Box>
: <></>
}
<Box> <Box>
<Text fw={"bold"}>Deskripsi Divisi</Text> <Text fw={"bold"}>Deskripsi Divisi</Text>
<Box p={20} bg={"white"} style={{ <Box p={20} bg={"white"} style={{
@@ -163,7 +201,7 @@ export default function InformationDivision() {
</Box> </Box>
: :
((roleLogin.get() != 'user' && roleLogin.get() != 'coadmin') || isAdmin) ? (((roleLogin.get() != 'user' && roleLogin.get() != 'coadmin') || isAdmin) && valActive) ?
<Group align='center' onClick={() => router.push('/division/add-member/' + param.id)}> <Group align='center' onClick={() => router.push('/division/add-member/' + param.id)}>
<Avatar size={'lg'}> <Avatar size={'lg'}>
<AiOutlineUserAdd size={30} color={tema.get().utama} /> <AiOutlineUserAdd size={30} color={tema.get().utama} />
@@ -223,17 +261,17 @@ export default function InformationDivision() {
<LayoutDrawer opened={openDrawer} onClose={() => setDrawer(false)} title={valChooseMemberName}> <LayoutDrawer opened={openDrawer} onClose={() => setDrawer(false)} title={valChooseMemberName}>
<Box> <Box>
<Group align='center' mb={20} onClick={() => editStatusAdmin()}> <Group align='center' mb={20} onClick={() => valActive ? editStatusAdmin() : undefined}>
<ActionIcon variant="light" size={60} aria-label="admin" radius="xl"> <ActionIcon variant="light" size={60} aria-label="admin" radius="xl">
<FaUserTie size={30} color={tema.get().utama} /> <FaUserTie size={30} color={valActive ? tema.get().utama : "gray"} />
</ActionIcon> </ActionIcon>
<Text c={tema.get().utama}>{(valChooseMemberStatus == false) ? "Jadikan admin" : "Memberhentikan sebagai admin"}</Text> <Text c={valActive ? tema.get().utama : "gray"}>{(valChooseMemberStatus == false) ? "Jadikan admin" : "Memberhentikan sebagai admin"}</Text>
</Group> </Group>
<Group align='center' onClick={() => setOpenModal(true)}> <Group align='center' onClick={() => valActive ? setOpenModal(true) : undefined}>
<ActionIcon variant="light" size={60} aria-label="admin" radius="xl"> <ActionIcon variant="light" size={60} aria-label="admin" radius="xl">
<IoIosCloseCircle size={40} color={tema.get().utama} /> <IoIosCloseCircle size={40} color={valActive ? tema.get().utama : "gray"} />
</ActionIcon> </ActionIcon>
<Text c={tema.get().utama}>Keluarkan dari divisi</Text> <Text c={valActive ? tema.get().utama : "gray"}>Keluarkan dari divisi</Text>
</Group> </Group>
</Box> </Box>
</LayoutDrawer> </LayoutDrawer>
@@ -247,6 +285,41 @@ export default function InformationDivision() {
deleteMember() deleteMember()
} }
}} /> }} />
<LayoutDrawer opened={openDrawerInfo} onClose={() => setDrawerInfo(false)} title={"Menu"}>
<Box>
<Stack pt={10}>
<SimpleGrid cols={{ base: 2, sm: 2, lg: 3 }} >
<Flex onClick={() => router.push('/division/edit/' + param.id)} justify={'center'} align={'center'} direction={'column'} >
<Box>
<FaPencil size={30} color={tema.get().utama} />
</Box>
<Box>
<Text c={tema.get().utama}>Edit Divisi</Text>
</Box>
</Flex>
<Flex onClick={() => { setOpenModalStatus(true) }} justify={'center'} align={'center'} direction={'column'} >
<Box>
<FaToggleOff size={30} color={tema.get().utama} />
</Box>
<Box>
<Text c={tema.get().utama}>{valActive ? "Non Aktifkan Divisi" : "Aktifkan Divisi"}</Text>
</Box>
</Flex>
</SimpleGrid>
</Stack>
</Box>
</LayoutDrawer>
<LayoutModal loading={loadingStatus} opened={isOpenModalStatus} onClose={() => setOpenModalStatus(false)}
description="Apakah Anda yakin ingin mangubah status aktifasi divisi?"
onYes={(val) => {
if (!val) {
setOpenModalStatus(false)
} else {
editStatusDivisi()
}
}} />
</Box> </Box>
); );
} }

View File

@@ -17,7 +17,6 @@ import DrawerDivision from './drawer_division';
export default function ListDivision() { export default function ListDivision() {
const [isList, setIsList] = useState(false) const [isList, setIsList] = useState(false)
const router = useRouter() const router = useRouter()
const [openDrawer, setOpenDrawer] = useState(false)
const [data, setData] = useState<IDataDivison[]>([]) const [data, setData] = useState<IDataDivison[]>([])
const [jumlah, setJumlah] = useState(0) const [jumlah, setJumlah] = useState(0)
const [searchQuery, setSearchQuery] = useState('') const [searchQuery, setSearchQuery] = useState('')
@@ -32,6 +31,7 @@ export default function ListDivision() {
const paddingLift = useMediaQuery('(max-width: 505px)') const paddingLift = useMediaQuery('(max-width: 505px)')
const [isRefresh, setRefresh] = useState(false) const [isRefresh, setRefresh] = useState(false)
const notifLoadPage = useHookstate(globalNotifPage) const notifLoadPage = useHookstate(globalNotifPage)
const status = searchParams.get('active')
const handleList = () => { const handleList = () => {
@@ -45,7 +45,7 @@ export default function ListDivision() {
if (isPage == 1) { if (isPage == 1) {
setData([]) setData([])
} }
const response = await funGetAllDivision('?search=' + searchQuery + '&group=' + group + '&page=' + isPage) const response = await funGetAllDivision('?active=' + status + '&search=' + searchQuery + '&group=' + group + '&page=' + isPage)
if (response.success) { if (response.success) {
setJumlah(response.total) setJumlah(response.total)
setNameGroup(response.filter.name) setNameGroup(response.filter.name)
@@ -65,14 +65,10 @@ export default function ListDivision() {
} }
}; };
function searchDivision(search: string) {
setSearchQuery(search)
setPage(1)
}
useShallowEffect(() => { useShallowEffect(() => {
setPage(1)
fetchData(true) fetchData(true)
}, [searchQuery]) }, [status, searchQuery])
useShallowEffect(() => { useShallowEffect(() => {
@@ -121,15 +117,7 @@ export default function ListDivision() {
return ( return (
<Box> <Box>
<LayoutNavbarNew back='/home' title='Divisi' <Box py={20}>
menu={
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
<ActionIcon variant="light" onClick={() => (setOpenDrawer(true))} bg={tema.get().bgIcon} size="lg" radius="lg" aria-label="Settings">
<HiMenu size={20} color='white' />
</ActionIcon>
} />
<Box p={20}>
{ {
isRefresh && isRefresh &&
<ReloadButtonTop <ReloadButtonTop
@@ -153,7 +141,7 @@ export default function ListDivision() {
leftSection={<HiMagnifyingGlass size={20} />} leftSection={<HiMagnifyingGlass size={20} />}
placeholder="Pencarian" placeholder="Pencarian"
value={searchQuery} value={searchQuery}
onChange={(val) => { searchDivision(val.target.value) }} onChange={(val) => { setSearchQuery(val.target.value) }}
/> />
</Grid.Col> </Grid.Col>
<Grid.Col span={2}> <Grid.Col span={2}>
@@ -289,9 +277,6 @@ export default function ListDivision() {
</Box> </Box>
)} )}
</Box> </Box>
<LayoutDrawer opened={openDrawer} title={'Menu'} onClose={() => setOpenDrawer(false)}>
<DrawerDivision />
</LayoutDrawer>
</Box> </Box>
); );
} }

View File

@@ -0,0 +1,30 @@
'use client'
import { globalRole, LayoutDrawer, LayoutNavbarNew, TEMA } from "@/module/_global";
import { useHookstate } from "@hookstate/core";
import { ActionIcon } from "@mantine/core";
import { useState } from "react";
import { HiMenu } from "react-icons/hi";
import DrawerDivision from "./drawer_division";
export default function NavbarListDivision() {
const roleLogin = useHookstate(globalRole)
const tema = useHookstate(TEMA)
const [openDrawer, setOpenDrawer] = useState(false)
return (
<>
<LayoutNavbarNew back='/home' title='Divisi'
menu={
roleLogin.get() != '' ?
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
<ActionIcon variant="light" onClick={() => (setOpenDrawer(true))} bg={tema.get().bgIcon} size="lg" radius="lg" aria-label="Settings">
<HiMenu size={20} color='white' />
</ActionIcon>
: <></>
} />
<LayoutDrawer opened={openDrawer} title={'Menu'} onClose={() => setOpenDrawer(false)}>
<DrawerDivision />
</LayoutDrawer>
</>
)
}

View File

@@ -0,0 +1,65 @@
"use client";
import { globalRole, TEMA } from "@/module/_global";
import { useHookstate } from "@hookstate/core";
import { Box, rem, Tabs } from "@mantine/core";
import { useRouter, useSearchParams } from "next/navigation";
import { IoMdCheckmarkCircleOutline } from "react-icons/io";
import { IoCloseCircleOutline } from "react-icons/io5";
import ListDivision from "./list_division";
export default function TabListDivision() {
const iconStyle = { width: rem(20), height: rem(20) };
const router = useRouter();
const searchParams = useSearchParams();
const status = searchParams.get("active");
const group = searchParams.get("group");
const tema = useHookstate(TEMA)
const roleLogin = useHookstate(globalRole)
return (
<Box p={20}>
<Tabs
variant="pills"
color={tema.get().bgFiturHome}
radius="xl"
defaultValue={status == "false" ? "false" : "true"}
>
{
roleLogin.get() != '' ?
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
<Tabs.List
bg={"white"}
style={{
border: `1px solid ${"#EDEDED"}`,
padding: 5,
borderRadius: 100,
}}
>
<Tabs.Tab
value="true"
w={"45%"}
leftSection={<IoMdCheckmarkCircleOutline style={iconStyle} />}
onClick={() => {
router.push("/division?active=true&group=" + group);
}}
>
Aktif
</Tabs.Tab>
<Tabs.Tab
value="false"
w={"53%"}
leftSection={<IoCloseCircleOutline style={iconStyle} />}
onClick={() => {
router.push("/division?active=false&group=" + group);
}}
>
Tidak Aktif
</Tabs.Tab>
</Tabs.List>
: <></>
}
<ListDivision />
</Tabs>
</Box>
);
}

View File

@@ -1,14 +1,6 @@
import { LayoutDrawer, TEMA } from "@/module/_global"; import { LayoutDrawer, TEMA } from "@/module/_global";
import { useHookstate } from "@hookstate/core"; import { useHookstate } from "@hookstate/core";
import { import { Box, Button, Flex, SimpleGrid, Stack, Text, TextInput } from "@mantine/core";
Box,
Button,
Flex,
SimpleGrid,
Stack,
Text,
TextInput
} from "@mantine/core";
import { useState } from "react"; import { useState } from "react";
import toast from "react-hot-toast"; import toast from "react-hot-toast";
import { IoAddCircle } from "react-icons/io5"; import { IoAddCircle } from "react-icons/io5";
@@ -102,7 +94,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
borderColor: tema.get().utama, borderColor: tema.get().utama,
}, },
}} }}
size="lg" size="md"
radius={10} radius={10}
label="Grup" label="Grup"
required required

View File

@@ -1,16 +1,16 @@
import { WARNA, LayoutDrawer, globalRole, TEMA, keyWibu } from "@/module/_global"; import { globalRole, keyWibu, LayoutDrawer, TEMA } from "@/module/_global";
import { funGetAllGroup, IDataGroup } from "@/module/group"; import { funGetAllGroup, IDataGroup } from "@/module/group";
import { Box, Stack, SimpleGrid, Flex, TextInput, Button, Text, Select } from "@mantine/core"; import { useHookstate } from "@hookstate/core";
import { Box, Button, Flex, Select, SimpleGrid, Stack, Text, TextInput } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks"; import { useShallowEffect } from "@mantine/hooks";
import { useRouter, useSearchParams } from "next/navigation"; import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState } from "react"; import { useState } from "react";
import toast from "react-hot-toast"; import toast from "react-hot-toast";
import { IoAddCircle } from "react-icons/io5"; import { IoAddCircle } from "react-icons/io5";
import { RiFilter2Line } from "react-icons/ri"; import { RiFilter2Line } from "react-icons/ri";
import { funCreatePosition } from "../lib/api_position";
import { useHookstate } from "@hookstate/core";
import { globalRefreshPosition } from "../lib/val_posisition";
import { useWibuRealtime } from "wibu-realtime"; import { useWibuRealtime } from "wibu-realtime";
import { funCreatePosition } from "../lib/api_position";
import { globalRefreshPosition } from "../lib/val_posisition";
export default function DrawerListPosition({ onCreated }: { onCreated: (val: boolean) => void }) { export default function DrawerListPosition({ onCreated }: { onCreated: (val: boolean) => void }) {
@@ -99,7 +99,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
nilai = false nilai = false
} }
if (roleLogin.get() == "supadmin" && listData.idGroup == "") { if (roleLogin.get() == "supadmin" && (listData.idGroup == "" || String(listData.idGroup) == "null")) {
setTouched(touched => ({ ...touched, idGroup: true })) setTouched(touched => ({ ...touched, idGroup: true }))
nilai = false nilai = false
} }
@@ -117,7 +117,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
} }
} else if (kategori == 'idGroup') { } else if (kategori == 'idGroup') {
setListData({ ...listData, idGroup: val }) setListData({ ...listData, idGroup: val })
if (val == "") { if (val == "" || String(val) == "null") {
setTouched({ ...touched, idGroup: true }) setTouched({ ...touched, idGroup: true })
} else { } else {
setTouched({ ...touched, idGroup: false }) setTouched({ ...touched, idGroup: false })
@@ -152,8 +152,8 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
} }
</SimpleGrid> </SimpleGrid>
</Stack> </Stack>
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'}> <LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'} size="md">
<Box pt={10} pos={"relative"} h={"28.5vh"}> <Box pos={"relative"} h={"35vh"}>
{ {
roleLogin.get() == "supadmin" && roleLogin.get() == "supadmin" &&
<Select <Select
@@ -171,8 +171,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
radius={10} radius={10}
mb={5} mb={5}
withAsterisk withAsterisk
onChange={(e: any) => { onValidation('idGroup', e) } onChange={(e: any) => { onValidation('idGroup', e) }}
}
styles={{ styles={{
input: { input: {
color: tema.get().utama, color: tema.get().utama,
@@ -182,7 +181,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
}} }}
error={ error={
touched.idGroup && ( touched.idGroup && (
listData.idGroup == "" ? "Grup Tidak Boleh Kosong" : null listData.idGroup == "" || String(listData.idGroup) == "null" ? "Grup Tidak Boleh Kosong" : null
) )
} }
/> />
@@ -209,7 +208,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
} }
required required
/> />
<Box pos={"absolute"} bottom={10} left={0} right={0}> <Box pos={"absolute"} bottom={0} left={0} right={0}>
<Button <Button
c={"white"} c={"white"}
bg={tema.get().utama} bg={tema.get().utama}

View File

@@ -1,13 +1,11 @@
"use client"; "use client";
import { TEMA, WARNA } from "@/module/_global"; import { TEMA } from "@/module/_global";
import { Box, rem, Tabs, TextInput } from "@mantine/core"; import { useHookstate } from "@hookstate/core";
import React from "react"; import { Box, rem, Tabs } from "@mantine/core";
import { HiMagnifyingGlass, HiMiniUser } from "react-icons/hi2"; import { useRouter, useSearchParams } from "next/navigation";
import { IoMdCheckmarkCircleOutline } from "react-icons/io"; import { IoMdCheckmarkCircleOutline } from "react-icons/io";
import { IoCloseCircleOutline } from "react-icons/io5"; import { IoCloseCircleOutline } from "react-icons/io5";
import TabListMember from "./tab_list_member"; import TabListMember from "./tab_list_member";
import { useRouter, useSearchParams } from "next/navigation";
import { useHookstate } from "@hookstate/core";
export default function ListMember() { export default function ListMember() {
const iconStyle = { width: rem(20), height: rem(20) }; const iconStyle = { width: rem(20), height: rem(20) };