diff --git a/.gitignore b/.gitignore index cdedd88..f5d4bce 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,5 @@ next-env.d.ts # folder foto kandidat /public/image/ -/public/file/ \ No newline at end of file +/public/file/ +certificates \ No newline at end of file diff --git a/package.json b/package.json index 1b5e4d5..095601e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev --experimental-https", "build": "next build", "start": "next start", "lint": "next lint" @@ -77,4 +77,4 @@ "keywords": [], "author": "", "license": "ISC" -} +} \ No newline at end of file diff --git a/src/app/api/announcement/[id]/route.ts b/src/app/api/announcement/[id]/route.ts index 50cde58..c8fa7d2 100644 --- a/src/app/api/announcement/[id]/route.ts +++ b/src/app/api/announcement/[id]/route.ts @@ -5,7 +5,6 @@ import _ from "lodash"; import { NextResponse } from "next/server"; - // GET ONE PENGUMUMAN, UNTUK TAMPIL DETAIL PENGUMUMAN export async function GET(request: Request, context: { params: { id: string } }) { try { @@ -72,7 +71,9 @@ export async function GET(request: Request, context: { params: { id: string } }) division: v.Division.name })) - const fixMember = Object.groupBy(formatMember, ({ group }) => group); + // const fixMember = Object.groupBy(formatMember, ({ group }) => group); + const fixMember = _.groupBy(formatMember, ({ group }) => group); + return NextResponse.json( { @@ -88,7 +89,7 @@ export async function GET(request: Request, context: { params: { id: string } }) } catch (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 }); } } @@ -140,7 +141,7 @@ export async function DELETE(request: Request, context: { params: { id: string } ); } catch (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 }); } } @@ -217,7 +218,7 @@ export async function PUT(request: Request, context: { params: { id: string } }) } catch (error) { console.error(error); - return NextResponse.json({ success: false, message: "Gagal mengeupdate pengumuman, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); + return NextResponse.json({ success: false, message: "Gagal mengeupdate pengumuman, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 }); } } diff --git a/src/app/api/group/get-division/route.ts b/src/app/api/group/get-division/route.ts index ec52351..c11a98b 100644 --- a/src/app/api/group/get-division/route.ts +++ b/src/app/api/group/get-division/route.ts @@ -1,9 +1,10 @@ import { prisma } from "@/module/_global"; import { funGetUserByCookies } from "@/module/auth"; import { NextResponse } from "next/server"; - export const dynamic = 'force-dynamic' export const revalidate = true + + export async function GET(request: Request) { try { const user = await funGetUserByCookies() @@ -32,6 +33,9 @@ export async function GET(request: Request) { id: true, name: true, Division: { + where: { + isActive: true + }, select: { id: true, name: true @@ -44,6 +48,6 @@ export async function GET(request: Request) { } catch (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 }); } } \ No newline at end of file diff --git a/src/app/api/home/route.ts b/src/app/api/home/route.ts index 95342f9..0e1d147 100644 --- a/src/app/api/home/route.ts +++ b/src/app/api/home/route.ts @@ -287,6 +287,7 @@ export async function GET(request: Request) { isActive: true, dateStart: new Date(), Division: { + isActive: true, idVillage: idVillage, Group: { isActive: true, @@ -301,6 +302,7 @@ export async function GET(request: Request) { isActive: true, dateStart: new Date(), Division: { + isActive: true, idGroup: idGroup }, DivisionCalendar: { diff --git a/src/app/api/project/[id]/member/route.ts b/src/app/api/project/[id]/member/route.ts index a99aad7..a50fa59 100644 --- a/src/app/api/project/[id]/member/route.ts +++ b/src/app/api/project/[id]/member/route.ts @@ -49,7 +49,7 @@ export async function POST(request: Request, context: { params: { id: string } } } catch (error) { console.error(error); - return NextResponse.json({ success: false, message: "Gagal menambah anggota kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); + return NextResponse.json({ success: false, message: "Gagal menambah anggota kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 }); } } @@ -95,7 +95,7 @@ export async function DELETE(request: Request, context: { params: { id: string } } catch (error) { console.error(error); - return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); + return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 }); } } @@ -141,13 +141,16 @@ export async function GET(request: Request, context: { params: { id: string } }) contains: (name == undefined || name == "null") ? "" : name, mode: 'insensitive' } - + }, select: { id: true, name: true, email: true, img: true + }, + orderBy: { + name: 'asc' } }) @@ -167,6 +170,6 @@ export async function GET(request: Request, context: { params: { id: string } }) } catch (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 project, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 }); } } \ No newline at end of file diff --git a/src/app/api/project/[id]/route.ts b/src/app/api/project/[id]/route.ts index 792bdf2..1c114df 100644 --- a/src/app/api/project/[id]/route.ts +++ b/src/app/api/project/[id]/route.ts @@ -27,7 +27,7 @@ export async function GET(request: Request, context: { params: { id: string } }) }); if (!data) { - return NextResponse.json({ success: false, message: "Gagal mendapatkan project, data tidak ditemukan", }, { status: 404 }); + return NextResponse.json({ success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan", }, { status: 404 }); } @@ -133,11 +133,11 @@ export async function GET(request: Request, context: { params: { id: string } }) allData = fix } - return NextResponse.json({ success: true, message: "Berhasil mendapatkan project", data: allData, }, { status: 200 }); + return NextResponse.json({ success: true, message: "Berhasil mendapatkan kegiatan", data: allData, }, { status: 200 }); } catch (error) { console.error(error); - return NextResponse.json({ success: false, message: "Gagal mendapatkan project, coba lagi nantiiiiii", 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 }); } } @@ -186,7 +186,7 @@ export async function POST(request: Request, context: { params: { id: string } } } catch (error) { console.error(error); - return NextResponse.json({ success: false, message: "Gagal tambah tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); + return NextResponse.json({ success: false, message: "Gagal tambah tahapan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 }); } } @@ -210,7 +210,7 @@ export async function DELETE(request: Request, context: { params: { id: string } if (data == 0) { return NextResponse.json( { - success: false, message: "Gagal mendapatkan project, data tidak ditemukan", + success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan", }, { status: 404 } ); @@ -232,7 +232,7 @@ export async function DELETE(request: Request, context: { params: { id: string } } catch (error) { console.error(error); - return NextResponse.json({ success: false, message: "Gagal membatalkan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); + return NextResponse.json({ success: false, message: "Gagal membatalkan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 }); } } @@ -278,6 +278,6 @@ export async function PUT(request: Request, context: { params: { id: string } }) } catch (error) { console.error(error); - return NextResponse.json({ success: false, message: "Gagal mengupdate kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); + return NextResponse.json({ success: false, message: "Gagal mengupdate kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 }); } } \ No newline at end of file diff --git a/src/app/api/version-app/route.ts b/src/app/api/version-app/route.ts index a8fa37d..e9404ea 100644 --- a/src/app/api/version-app/route.ts +++ b/src/app/api/version-app/route.ts @@ -2,7 +2,7 @@ import { NextResponse } from "next/server"; export async function GET(request: Request) { try { - return NextResponse.json({ success: true, version: "0.1.4", mode: "staging" }, { status: 200 }); + return NextResponse.json({ success: true, version: "0.1.5", mode: "staging" }, { status: 200 }); } catch (error) { console.error(error); return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti", reason: (error as Error).message, }, { status: 500 }); diff --git a/src/module/division_new/ui/create_division.tsx b/src/module/division_new/ui/create_division.tsx index 4cfab78..c5819d0 100644 --- a/src/module/division_new/ui/create_division.tsx +++ b/src/module/division_new/ui/create_division.tsx @@ -48,8 +48,8 @@ export default function CreateDivision() { const cek = checkAll() if (!cek) return false - if (member.length == 0) - return toast.error("Error! belum ada anggota yang terdaftar") + if (member.length <= 1) + return toast.error("Error! Silahkan pilih anggota lebih dari 1") setChooseAdmin(true) } diff --git a/src/module/position/ui/drawer_list_position.tsx b/src/module/position/ui/drawer_list_position.tsx index 78a647b..82a60ae 100644 --- a/src/module/position/ui/drawer_list_position.tsx +++ b/src/module/position/ui/drawer_list_position.tsx @@ -152,14 +152,8 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo } - setOpenDrawerGroup(false)} title={'Tambah Jabatan'} size="lg"> - + setOpenDrawerGroup(false)} title={'Tambah Jabatan'}> + { roleLogin.get() == "supadmin" &&