Merge pull request #43 from bipproduction/vote/main

Vote/main
This commit is contained in:
Bagasbanuna02
2024-02-16 17:21:57 +08:00
committed by GitHub
265 changed files with 11026 additions and 233 deletions

View File

@@ -13,6 +13,7 @@
"@emotion/server": "^11.11.0",
"@mantine/carousel": "^7.1.5",
"@mantine/core": "^6.0.17",
"@mantine/dates": "^6.0.17",
"@mantine/dropzone": "^7.1.3",
"@mantine/hooks": "^6.0.17",
"@mantine/next": "^6.0.17",
@@ -25,6 +26,7 @@
"@types/react-dom": "18.2.7",
"@types/uuid": "^9.0.4",
"autoprefixer": "10.4.14",
"dayjs": "^1.11.10",
"echarts": "^5.4.3",
"echarts-for-react": "^3.0.2",
"embla-carousel-react": "^8.0.0-rc14",

View File

@@ -26,6 +26,10 @@ model User {
Donasi Donasi[]
Donasi_Invoice Donasi_Invoice[]
Donasi_Notif Donasi_Notif[]
Event Event[]
Event_Peserta Event_Peserta[]
Voting Voting[]
Voting_Kontributor Voting_Kontributor[]
}
model MasterUserRole {
@@ -478,3 +482,114 @@ model Donasi_PencairanDana {
Images Images? @relation(fields: [imagesId], references: [id])
imagesId String?
}
// ========================================= EVENT ========================================= //
model Event {
id String @id @default(cuid())
title String
lokasi String
tanggal DateTime
deskripsi String
active Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
catatan String?
Author User? @relation(fields: [authorId], references: [id])
authorId String?
EventMaster_Status EventMaster_Status? @relation(fields: [eventMaster_StatusId], references: [id])
eventMaster_StatusId String? @default("2")
Event_Peserta Event_Peserta[]
EventMaster_TipeAcara EventMaster_TipeAcara? @relation(fields: [eventMaster_TipeAcaraId], references: [id])
eventMaster_TipeAcaraId Int?
}
model EventMaster_TipeAcara {
id Int @id @default(autoincrement())
name String
active Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Event Event[]
}
model EventMaster_Status {
id String @id @default(cuid())
name String
active Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Event Event[]
}
model Event_Peserta {
id String @id @default(cuid())
active Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Event Event? @relation(fields: [eventId], references: [id])
eventId String?
User User? @relation(fields: [userId], references: [id])
userId String?
}
// ========================================= VOTING ========================================= //
model Voting {
id String @id @default(cuid())
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
deskripsi String
awalVote DateTime
akhirVote DateTime
catatan String?
Author User @relation(fields: [authorId], references: [id])
authorId String
Voting_Status Voting_Status? @relation(fields: [voting_StatusId], references: [id])
voting_StatusId String? @default("2")
Voting_DaftarNamaVote Voting_DaftarNamaVote[]
Voting_Kontributor Voting_Kontributor[]
}
model Voting_Status {
id String @id @default(cuid())
name String
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Voting Voting[]
}
model Voting_DaftarNamaVote {
id String @id @default(cuid())
value String
jumlah Int @default(0)
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Voting Voting? @relation(fields: [votingId], references: [id])
votingId String?
Voting_Kontributor Voting_Kontributor[]
}
model Voting_Kontributor {
id String @id @default(cuid())
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Voting Voting? @relation(fields: [votingId], references: [id])
votingId String?
Author User? @relation(fields: [authorId], references: [id])
authorId String?
Voting_DaftarNamaVote Voting_DaftarNamaVote? @relation(fields: [voting_DaftarNamaVoteId], references: [id])
voting_DaftarNamaVoteId String?
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
public/aset/vote/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -13,8 +13,11 @@ import userSeeder from "../../../bin/seeder/user_seeder.json";
import donasi_status from "../../../bin/seeder/donasi/master_status.json";
import donasi_kategori from "../../../bin/seeder/donasi/master_kategori.json";
import donasi_durasi from "../../../bin/seeder/donasi/master_durasi.json";
import donasi_namaBank from "../../../bin/seeder/donasi/master_bank.json"
import donasi_status_invoice from "../../../bin/seeder/donasi/master_status_invoice.json"
import donasi_namaBank from "../../../bin/seeder/donasi/master_bank.json";
import donasi_status_invoice from "../../../bin/seeder/donasi/master_status_invoice.json";
import event_status from "../../../bin/seeder/event/master_status.json";
import event_tipe_acara from "../../../bin/seeder/event/master_tipe_acara.json";
import voting_status from "../../../bin/seeder/voting/master_status.json";
export async function GET(req: Request) {
const dev = new URL(req.url).searchParams.get("dev");
@@ -264,6 +267,51 @@ export async function GET(req: Request) {
});
}
for (let e of event_status) {
await prisma.eventMaster_Status.upsert({
where: {
id: e.id,
},
create: {
id: e.id,
name: e.name,
},
update: {
name: e.name,
},
});
}
for (let e of event_tipe_acara) {
await prisma.eventMaster_TipeAcara.upsert({
where: {
id: e.id,
},
create: {
id: e.id,
name: e.name,
},
update: {
name: e.name,
},
});
}
for (let v of voting_status) {
await prisma.voting_Status.upsert({
where: {
id: v.id,
},
create: {
id: v.id,
name: v.name,
},
update: {
name: v.name,
},
});
}
return NextResponse.json({ success: true });
}

View File

@@ -0,0 +1,13 @@
import { AdminEvent_Riwayat } from "@/app_modules/admin/event";
import { AdminEvent_getListAllRiwayat } from "@/app_modules/admin/event/fun/get/get_list_all_riwayat";
export default async function Page() {
const listRiwayat = await AdminEvent_getListAllRiwayat()
return (
<>
<AdminEvent_Riwayat listRiwayat={listRiwayat} />
</>
);
}

View File

@@ -0,0 +1,12 @@
import { AdminEvent_DetailTipeAcara } from "@/app_modules/admin/event";
import { AdminEvent_getListTipeAcara } from "@/app_modules/admin/event/fun/get/get_list_tipe_acara";
export default async function Page() {
const listTipe = await AdminEvent_getListTipeAcara()
return (
<>
<AdminEvent_DetailTipeAcara listTipe={listTipe}/>
</>
);
}

View File

@@ -0,0 +1,28 @@
import { AdminEvent_Main } from "@/app_modules/admin/event";
import AdminEvent_funCountByStatusId from "@/app_modules/admin/event/fun/count/fun_count_event_by_status_id";
import { AdminEvent_funCountRiwayat } from "@/app_modules/admin/event/fun/count/fun_count_riwayat";
import { AdminEvent_funCountTipeAcara } from "@/app_modules/admin/event/fun/count/fun_count_tipe_acara";
export default async function Page() {
const countPublish = await AdminEvent_funCountByStatusId("1");
const countReview = await AdminEvent_funCountByStatusId("2");
const countDraft = await AdminEvent_funCountByStatusId("3");
const countReject = await AdminEvent_funCountByStatusId("4");
const countTipeAcara = await AdminEvent_funCountTipeAcara()
const countRiwayat = await AdminEvent_funCountRiwayat()
return (
<>
<AdminEvent_Main
countPublish={countPublish as number}
countReview={countReview as number}
countDraft={countDraft as number}
countReject={countReject as number}
countTipeAcara={countTipeAcara as number}
countRiwayat={countRiwayat}
/>
</>
);
}

View File

@@ -0,0 +1,12 @@
import { AdminEvent_TablePublish } from "@/app_modules/admin/event";
import { AdminEvent_getListTableByStatusId } from "@/app_modules/admin/event/fun/get/get_list_table_by_status_id";
export default async function Page() {
const listPublish = await AdminEvent_getListTableByStatusId("1");
return (
<>
<AdminEvent_TablePublish listPublish={listPublish as any} />
</>
);
}

View File

@@ -0,0 +1,10 @@
import { AdminEvent_TableReject } from "@/app_modules/admin/event";
import { AdminEvent_getListTableByStatusId } from "@/app_modules/admin/event/fun/get/get_list_table_by_status_id";
export default async function Page() {
const listReject = await AdminEvent_getListTableByStatusId("4")
return <>
<AdminEvent_TableReject listReject={listReject as any}/>
</>
}

View File

@@ -0,0 +1,10 @@
import { AdminEvent_TableReview } from "@/app_modules/admin/event";
import { AdminEvent_getListTableByStatusId } from "@/app_modules/admin/event/fun/get/get_list_table_by_status_id";
export default async function Page() {
const listReview = await AdminEvent_getListTableByStatusId("2")
return <>
<AdminEvent_TableReview listReview={listReview as any}/>
</>
}

View File

@@ -0,0 +1,12 @@
import { AdminVote_Riwayat } from "@/app_modules/admin/vote";
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
export default async function Page() {
const dataVote = await AdminVote_getListTableByStatusId("0");
return (
<>
<AdminVote_Riwayat dataVote={dataVote as any} />
</>
);
}

View File

@@ -0,0 +1,12 @@
import { AdminVote_TablePublish } from "@/app_modules/admin/vote";
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
export default async function Page() {
const dataVote = await AdminVote_getListTableByStatusId("1")
return (
<>
<AdminVote_TablePublish dataVote={dataVote} />
</>
);
}

View File

@@ -0,0 +1,11 @@
import { AdminVote_TableReject } from "@/app_modules/admin/vote";
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
export default async function Page() {
const dataVote = await AdminVote_getListTableByStatusId("4");
return (
<>
<AdminVote_TableReject dataVote={dataVote as any}/>
</>
);
}

View File

@@ -0,0 +1,13 @@
import { AdminVote_TableReview } from "@/app_modules/admin/vote";
import { AdminVote_getListTableByStatusId } from "@/app_modules/admin/vote/fun/get/get_list_table_by_status_id";
export default async function Page() {
const listVote = await AdminVote_getListTableByStatusId("2")
return (
<>
<AdminVote_TableReview listVote={listVote as any} />
</>
);
}

View File

@@ -0,0 +1,20 @@
import { AdminVote_Main } from "@/app_modules/admin/vote";
import AdminVote_funCountByStatusId from "@/app_modules/admin/vote/fun/count/fun_count_vote_by_status_id";
export default async function Page() {
const countPublish = await AdminVote_funCountByStatusId("1");
const countReview = await AdminVote_funCountByStatusId("2");
const countDraft = await AdminVote_funCountByStatusId("0");
const countReject = await AdminVote_funCountByStatusId("4");
return (
<>
<AdminVote_Main
countPublish={countPublish as number}
countReview={countReview as number}
countDraft={countDraft as number}
countReject={countReject as number}
/>
</>
);
}

View File

@@ -9,9 +9,9 @@ export default async function Layout({
children: React.ReactNode;
}) {
const userId = await User_getUserId();
// const dataDonasi = await DOnasi_getList
const isRead = await Donasi_getNotifByUserId(userId).then((res) =>
res.map((val: any) => val.isRead)
// console.log(userId)
const isRead = await Donasi_getNotifByUserId(userId).then((res: any) =>
res.map((val: any) => val.isRead)
);
// console.log(isRead)

View File

@@ -0,0 +1,13 @@
import { LayoutEvent_Create } from "@/app_modules/event";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutEvent_Create>{children}</LayoutEvent_Create>
</>
);
}

View File

@@ -0,0 +1,11 @@
import { Event_Create } from "@/app_modules/event";
import { Event_getMasterTipeAcara } from "@/app_modules/event/fun/master/get_tipe_acara";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
import _ from "lodash";
export default async function Page() {
const userId = await User_getUserId()
const listTipeAcara = await Event_getMasterTipeAcara();
return <Event_Create listTipeAcara={listTipeAcara as any} authorId={userId}/>;
}

View File

@@ -0,0 +1,16 @@
import { LayoutEvent_DetailDraft } from "@/app_modules/event";
import React from "react";
export default async function Page({
children,
params,
}: {
children: React.ReactNode;
params: { id: string };
}) {
let eventId = params.id
return <>
<LayoutEvent_DetailDraft eventId={eventId}>{children}</LayoutEvent_DetailDraft>;
</>
}

View File

@@ -0,0 +1,8 @@
import { Event_DetailDraft } from "@/app_modules/event";
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
export default async function Page({params}: {params: {id: string}}) {
let eventId = params.id
const dataEvent = await Event_getOneById(eventId)
return <Event_DetailDraft dataEvent={dataEvent as any} />;
}

View File

@@ -0,0 +1,14 @@
import { LayoutEvent_DetailKontribusi } from "@/app_modules/event";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutEvent_DetailKontribusi>{children}</LayoutEvent_DetailKontribusi>
</>
);
}

View File

@@ -0,0 +1,20 @@
import { Event_DetailKontribusi } from "@/app_modules/event";
import { Event_countTotalPesertaById } from "@/app_modules/event/fun/count/count_total_peserta_by_id";
import { Event_getListPesertaById } from "@/app_modules/event/fun/get/get_list_peserta_by_id";
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let eventId = params.id;
const dataEvent = await Event_getOneById(eventId);
const listKontributor = await Event_getListPesertaById(eventId);
const totalPeserta = await Event_countTotalPesertaById(eventId)
return (
<>
<Event_DetailKontribusi
dataEvent={dataEvent as any}
listKontributor={listKontributor as any}
totalPeserta={totalPeserta}
/>
</>
);
}

View File

@@ -0,0 +1,15 @@
import { LayoutEvent_DetailMain } from "@/app_modules/event";
import { AppShell } from "@mantine/core";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutEvent_DetailMain>{children}</LayoutEvent_DetailMain>
</>
);
}

View File

@@ -0,0 +1,27 @@
import { Event_DetailMain } from "@/app_modules/event";
import { Event_countTotalPesertaById } from "@/app_modules/event/fun/count/count_total_peserta_by_id";
import { Event_CekUserJoinById } from "@/app_modules/event/fun/get/cek_user_join_by_id";
import { Event_getListPesertaById } from "@/app_modules/event/fun/get/get_list_peserta_by_id";
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function Page({ params }: { params: { id: string } }) {
let eventId = params.id;
const dataEvent = await Event_getOneById(eventId);
const listPeserta = await Event_getListPesertaById(eventId);
const userLoginId = await User_getUserId();
const isJoin = await Event_CekUserJoinById(eventId, userLoginId);
const totalPeserta = await Event_countTotalPesertaById(eventId)
return (
<>
<Event_DetailMain
dataEvent={dataEvent as any}
listPeserta={listPeserta as any}
userLoginId={userLoginId}
isJoin={isJoin}
totalPeserta={totalPeserta as any}
/>
</>
);
}

View File

@@ -0,0 +1,11 @@
import { LayoutEvent_DetailPublish } from "@/app_modules/event";
import React from "react";
export default async function Page({
children,
}: {
children: React.ReactNode;
}) {
return <LayoutEvent_DetailPublish>{children}</LayoutEvent_DetailPublish>;
}

View File

@@ -0,0 +1,9 @@
import { Event_DetailPublish } from "@/app_modules/event";
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let eventId = params.id;
const dataEvent = await Event_getOneById(eventId);
return <Event_DetailPublish dataEvent={dataEvent as any} />;
}

View File

@@ -0,0 +1,11 @@
import { LayoutEvent_DetailReject } from "@/app_modules/event";
import React from "react";
export default async function Page({
children,
}: {
children: React.ReactNode;
}) {
return <LayoutEvent_DetailReject>{children}</LayoutEvent_DetailReject>;
}

View File

@@ -0,0 +1,9 @@
import { Event_DetailReject } from "@/app_modules/event";
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
export default async function Page({params}: {params: {id: string}}) {
let eventId = params.id
const dataEvent = await Event_getOneById(eventId)
return <Event_DetailReject dataEvent={dataEvent as any}/>;
}

View File

@@ -0,0 +1,11 @@
import { LayoutEvent_DetailReview } from "@/app_modules/event";
import React from "react";
export default async function Page({
children,
}: {
children: React.ReactNode;
}) {
return <LayoutEvent_DetailReview>{children}</LayoutEvent_DetailReview>
}

View File

@@ -0,0 +1,10 @@
import { Event_DetailReview } from "@/app_modules/event";
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
export default async function Page({params}: {params: {id: string}}) {
let eventId = params.id
const dataEvent = await Event_getOneById(eventId)
return <Event_DetailReview dataEvent={dataEvent as any}/>;
}

View File

@@ -0,0 +1,14 @@
import { LayoutEvent_DetailRiwayat } from "@/app_modules/event";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutEvent_DetailRiwayat>{children}</LayoutEvent_DetailRiwayat>
</>
);
}

View File

@@ -0,0 +1,24 @@
import { Event_DetailRiwayat } from "@/app_modules/event";
import { Event_countTotalPesertaById } from "@/app_modules/event/fun/count/count_total_peserta_by_id";
import { Event_CekUserJoinById } from "@/app_modules/event/fun/get/cek_user_join_by_id";
import { Event_getListPesertaById } from "@/app_modules/event/fun/get/get_list_peserta_by_id";
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function Page({ params }: { params: { id: string } }) {
let eventId = params.id;
const dataEvent = await Event_getOneById(eventId);
const listPeserta = await Event_getListPesertaById(eventId);
const totalPeserta = await Event_countTotalPesertaById(eventId);
return (
<>
<Event_DetailRiwayat
dataEvent={dataEvent as any}
listPeserta={listPeserta as any}
totalPeserta={totalPeserta as any}
/>
</>
);
}

View File

@@ -0,0 +1,8 @@
import { LayoutEvent_Edit } from "@/app_modules/event";
import React from "react";
export default async function Layout({children}: {children: React.ReactNode}) {
return <>
<LayoutEvent_Edit>{children}</LayoutEvent_Edit>
</>
}

View File

@@ -0,0 +1,27 @@
import { Event_Edit } from "@/app_modules/event";
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
import { Event_getMasterTipeAcara } from "@/app_modules/event/fun/master/get_tipe_acara";
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
import _ from "lodash";
export default async function Page({ params }: { params: { id: string } }) {
let eventId = params.id;
const data = await Event_getOneById(eventId);
const dataEvent = _.omit(data, [
"Author",
"EventMaster_Status",
"Event_Peserta",
"createdAt",
"updatedAt",
"active",
]);
// console.log(dataEvent)
const listTipeAcara = await Event_getMasterTipeAcara()
return (
<>
<Event_Edit dataEvent={dataEvent as any} listTipeAcara={listTipeAcara as any}/>
</>
);
}

View File

@@ -0,0 +1,12 @@
import { Event_Beranda } from "@/app_modules/event";
import { Event_getListAllPublish } from "@/app_modules/event/fun/get/get_list_all_publish";
export default async function Page() {
const dataEvent = await Event_getListAllPublish()
return (
<>
<Event_Beranda dataEvent={dataEvent as any}/>
</>
);
}

View File

@@ -0,0 +1,14 @@
import { Event_Kontribusi } from "@/app_modules/event";
import { Event_getListKontibusiByUserId } from "@/app_modules/event/fun/get/get_list_kontribusi_by_user_id";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function Page() {
const userLoginId = await User_getUserId();
const listKontribusi = await Event_getListKontibusiByUserId(userLoginId)
return (
<>
<Event_Kontribusi listKontribusi={listKontribusi as any}/>
</>
);
}

View File

@@ -0,0 +1,8 @@
import { LayoutEvent_Main } from "@/app_modules/event";
import React from "react";
export default async function Layout({children}:{children: React.ReactNode}) {
return<>
<LayoutEvent_Main>{children}</LayoutEvent_Main>
</>
}

View File

@@ -0,0 +1,19 @@
import { Event_Riwayat } from "@/app_modules/event";
import { Event_getListRiwayatSaya } from "@/app_modules/event/fun/get/get_list_riwayat_saya";
import { Event_getListSemuaRiwayat } from "@/app_modules/event/fun/get/get_list_semua_riwayat";
import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function Page({ params }: { params: { id: string } }) {
let eventId = params.id;
const authorId = await User_getUserId();
const dataSemuaRiwayat = await Event_getListSemuaRiwayat();
const dataRiwayatSaya = await Event_getListRiwayatSaya(authorId);
return (
<Event_Riwayat
dataSemuaRiwayat={dataSemuaRiwayat as any}
dataRiwayatSaya={dataRiwayatSaya as any}
/>
);
}

View File

@@ -0,0 +1,21 @@
import { Event_StatusPage } from "@/app_modules/event";
import { Event_getByStatusId } from "@/app_modules/event/fun/get/get_event_by_status_id";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function Page() {
const authorId = await User_getUserId();
const listPublish = await Event_getByStatusId("1", authorId);
const listReview = await Event_getByStatusId("2", authorId);
const listDraft = await Event_getByStatusId("3", authorId);
const listReject = await Event_getByStatusId("4", authorId);
return (
<Event_StatusPage
authorId={authorId}
listPublish={listPublish}
listReview={listReview}
listDraft={listDraft}
listReject={listReject}
/>
);
}

View File

@@ -0,0 +1,5 @@
import { Event_SplashScreen } from "@/app_modules/event";
export default async function Page() {
return <Event_SplashScreen />;
}

View File

@@ -0,0 +1,14 @@
import { LayoutVote_Create } from "@/app_modules/vote";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutVote_Create>{children}</LayoutVote_Create>
</>
);
}

View File

@@ -0,0 +1,9 @@
import { Vote_Create } from "@/app_modules/vote";
export default async function Page() {
return (
<>
<Vote_Create />
</>
);
}

View File

@@ -0,0 +1,19 @@
import { LayoutVote_DetailDraft } from "@/app_modules/vote";
import React from "react";
export default function Layout({
children,
params,
}: {
children: React.ReactNode;
params: { id: string };
}) {
let voteId = params.id;
return (
<>
<LayoutVote_DetailDraft voteId={voteId}>
{children}
</LayoutVote_DetailDraft>
</>
);
}

View File

@@ -0,0 +1,13 @@
import { Vote_DetailDraft } from "@/app_modules/vote";
import { Vote_getOnebyId } from "@/app_modules/vote/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
const voteId = params.id;
const dataVote = await Vote_getOnebyId(voteId);
return (
<>
<Vote_DetailDraft dataVote={dataVote as any} />
</>
);
}

View File

@@ -0,0 +1,14 @@
import { LayoutVote_DetailKontribusi } from "@/app_modules/vote";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutVote_DetailKontribusi>{children}</LayoutVote_DetailKontribusi>
</>
);
}

View File

@@ -0,0 +1,19 @@
import { Vote_DetailKontribusi } from "@/app_modules/vote";
import { Vote_getListKontributorById } from "@/app_modules/vote/fun/get/get_list_kontributor_by_id";
import { Vote_getOnebyId } from "@/app_modules/vote/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let voteId = params.id;
const dataVote = await Vote_getOnebyId(voteId)
const listKontributor = await Vote_getListKontributorById(voteId)
return (
<>
<Vote_DetailKontribusi
dataVote={dataVote as any}
listKontributor={listKontributor as any}
/>
</>
);
}

View File

@@ -0,0 +1,14 @@
import { LayoutVote_MainDetail } from "@/app_modules/vote";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutVote_MainDetail>{children}</LayoutVote_MainDetail>
</>
);
}

View File

@@ -0,0 +1,29 @@
import prisma from "@/app/lib/prisma";
import { Vote_MainDetail } from "@/app_modules/vote";
import { Vote_getHasilVoteById } from "@/app_modules/vote/fun/get/get_list_hasil_by_id";
import { Vote_cekKontributorById } from "@/app_modules/vote/fun/get/cek_kontributor_by_id";
import { Vote_getOnebyId } from "@/app_modules/vote/fun/get/get_one_by_id";
import { Vote_getOnePilihanVotingByUserId } from "@/app_modules/vote/fun/get/get_one_pilihan_voting_by_user_id";
import { Vote_getListKontributorById } from "@/app_modules/vote/fun/get/get_list_kontributor_by_id";
export default async function Page({ params }: { params: { id: string } }) {
const voteId = params.id;
const dataVote = await Vote_getOnebyId(voteId);
const hasilVoting = await Vote_getHasilVoteById(voteId as any);
const isKontributor = await Vote_cekKontributorById(voteId);
const pilihanKontributor = await Vote_getOnePilihanVotingByUserId(voteId);
const listKontributor = await Vote_getListKontributorById(voteId);
return (
<>
<Vote_MainDetail
dataVote={dataVote as any}
hasilVoting={hasilVoting}
isKontributor={isKontributor}
pilihanKontributor={pilihanKontributor as any}
listKontributor={listKontributor as any}
/>
</>
);
}

View File

@@ -0,0 +1,10 @@
import { LayoutVote_DetailPublish } from "@/app_modules/vote";
import React from "react";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<>
<LayoutVote_DetailPublish>{children}</LayoutVote_DetailPublish>
</>
);
}

View File

@@ -0,0 +1,18 @@
import { Vote_DetailPublish } from "@/app_modules/vote";
import { Vote_getListKontributorById } from "@/app_modules/vote/fun/get/get_list_kontributor_by_id";
import { Vote_getOnebyId } from "@/app_modules/vote/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let voteId = params.id;
const dataVote = await Vote_getOnebyId(voteId);
const listKontributor = await Vote_getListKontributorById(voteId);
return (
<>
<Vote_DetailPublish
dataVote={dataVote as any}
listKontributor={listKontributor as any}
/>
</>
);
}

View File

@@ -0,0 +1,8 @@
import { LayoutVote_DetailReject } from "@/app_modules/vote";
import React from "react";
export default async function Layout({children}: {children: React.ReactNode}) {
return<>
<LayoutVote_DetailReject>{children}</LayoutVote_DetailReject>
</>
}

View File

@@ -0,0 +1,13 @@
import { Vote_DetailReject } from "@/app_modules/vote";
import { Vote_getOnebyId } from "@/app_modules/vote/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let voteId = params.id;
const dataVote = await Vote_getOnebyId(voteId);
return (
<>
<Vote_DetailReject dataVote={dataVote as any} />
</>
);
}

View File

@@ -0,0 +1,10 @@
import { LayoutVote_DetailReview } from "@/app_modules/vote";
import React from "react";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<>
<LayoutVote_DetailReview>{children}</LayoutVote_DetailReview>
</>
);
}

View File

@@ -0,0 +1,13 @@
import { Vote_DetailReview } from "@/app_modules/vote";
import { Vote_getOnebyId } from "@/app_modules/vote/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let voteId = params.id;
const dataVote = await Vote_getOnebyId(voteId);
return (
<>
<Vote_DetailReview dataVote={dataVote as any} />
</>
);
}

View File

@@ -0,0 +1,14 @@
import { LayoutVote_DetailRiwayatSaya } from "@/app_modules/vote";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutVote_DetailRiwayatSaya>{children}</LayoutVote_DetailRiwayatSaya>
</>
);
}

View File

@@ -0,0 +1,19 @@
import { Vote_DetailRiwayatSaya } from "@/app_modules/vote";
import { Vote_getListKontributorById } from "@/app_modules/vote/fun/get/get_list_kontributor_by_id";
import { Vote_getOnePublishbyId } from "@/app_modules/vote/fun/get/get_one_publish_by_id";
export default async function Page({params}: {params: {id: string}}) {
let voteId = params.id;
const dataVote = await Vote_getOnePublishbyId(voteId);
const listKontributor = await Vote_getListKontributorById(voteId);
return (
<>
<Vote_DetailRiwayatSaya
dataVote={dataVote as any}
listKontributor={listKontributor}
/>
</>
);
}

View File

@@ -0,0 +1,14 @@
import { LayoutVote_DetailSemuaRiwayat } from "@/app_modules/vote";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutVote_DetailSemuaRiwayat>{children}</LayoutVote_DetailSemuaRiwayat>
</>
);
}

View File

@@ -0,0 +1,19 @@
import { Vote_DetailSemuaRiwayat } from "@/app_modules/vote";
import { Vote_getListKontributorById } from "@/app_modules/vote/fun/get/get_list_kontributor_by_id";
import { Vote_getOnePublishbyId } from "@/app_modules/vote/fun/get/get_one_publish_by_id";
export default async function Page({params}: {params: {id: string}}) {
let voteId = params.id
const dataVote = await Vote_getOnePublishbyId(voteId)
const listKontributor = await Vote_getListKontributorById(voteId)
return (
<>
<Vote_DetailSemuaRiwayat
dataVote={dataVote as any}
listKontributor={listKontributor as any}
/>
</>
);
}

View File

@@ -0,0 +1,14 @@
import { LayoutVote_Edit } from "@/app_modules/vote";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutVote_Edit>{children}</LayoutVote_Edit>
</>
);
}

View File

@@ -0,0 +1,20 @@
import { Vote_Edit } from "@/app_modules/vote";
import { Vote_getListDaftarNamaById } from "@/app_modules/vote/fun/get/get_list_daftar_vote_by_id";
import { Vote_getOnebyId } from "@/app_modules/vote/fun/get/get_one_by_id";
import _ from "lodash";
export default async function Page({ params }: { params: { id: string } }) {
let voteId = params.id;
const dataVote = await Vote_getOnebyId(voteId);
const data = _.omit(dataVote, ["Voting_DaftarNamaVote"]);
const listDaftarVote = await Vote_getListDaftarNamaById(voteId);
return (
<>
<Vote_Edit
dataVote={data as any}
listDaftarVote={listDaftarVote as any}
/>
</>
);
}

View File

@@ -0,0 +1,12 @@
import { Vote_Beranda } from "@/app_modules/vote";
import { Vote_getAllListPublish } from "@/app_modules/vote/fun/get/get_all_list_publish";
export default async function Page() {
const dataVote = await Vote_getAllListPublish()
return (
<>
<Vote_Beranda dataVote={dataVote as any} />
</>
);
}

View File

@@ -0,0 +1,12 @@
import { Vote_Kontribusi } from "@/app_modules/vote";
import { Vote_getAllListKontribusiByAuthorId } from "@/app_modules/vote/fun/get/get_list_kontribusi_by_author_id";
export default async function Page() {
const dataKontribusi = await Vote_getAllListKontribusiByAuthorId()
return (
<>
<Vote_Kontribusi dataKontribusi={dataKontribusi as any} />
</>
);
}

View File

@@ -0,0 +1,14 @@
import { LayoutVote_Main } from "@/app_modules/vote";
import React from "react";
export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<>
<LayoutVote_Main>{children}</LayoutVote_Main>
</>
);
}

View File

@@ -0,0 +1,17 @@
import { Vote_Riwayat } from "@/app_modules/vote";
import { Vote_getAllListRiwayat } from "@/app_modules/vote/fun/get/get_all_list_riwayat";
import { Vote_getAllListRiwayatSaya } from "@/app_modules/vote/fun/get/get_all_list_riwayat_saya";
export default async function Page() {
const listRiwayat = await Vote_getAllListRiwayat();
const listRiwayatSaya = await Vote_getAllListRiwayatSaya()
return (
<>
<Vote_Riwayat
listRiwayat={listRiwayat as any}
listRiwayatSaya={listRiwayatSaya as any}
/>
</>
);
}

View File

@@ -0,0 +1,21 @@
import { Vote_Status } from "@/app_modules/vote";
import { Vote_getListByStatusId } from "@/app_modules/vote/fun/get/get_list_status_by_status_id";
export default async function Page() {
const listPublish = await Vote_getListByStatusId("1");
const listReview = await Vote_getListByStatusId("2");
const listDraft = await Vote_getListByStatusId("3");
const listReject = await Vote_getListByStatusId("4");
return (
<>
<Vote_Status
listPublish={listPublish as any}
listReview={listReview as any}
listDraft={listDraft as any}
listReject={listReject as any}
/>
</>
);
}

View File

@@ -0,0 +1,9 @@
import { Vote_Splash } from "@/app_modules/vote";
export default async function Page() {
return (
<>
<Vote_Splash />
</>
);
}

View File

@@ -2,7 +2,7 @@
import AppNotif from "@/app_modules/notif";
// import './globals.css'
import { CacheProvider } from "@emotion/react";
import { MantineProvider, useEmotionCache } from "@mantine/core";
import { Image, MantineProvider, useEmotionCache } from "@mantine/core";
import { Notifications } from "@mantine/notifications";
import { useServerInsertedHTML } from "next/navigation";
import { ToastContainer, toast } from "react-toastify";
@@ -27,10 +27,13 @@ export default function RootStyleRegistry({
return (
<html lang="en" data-theme="light">
<head>
<title>HIPMI</title>
</head>
<body suppressHydrationWarning={true}>
<CacheProvider value={cache}>
<MantineProvider withGlobalStyles withNormalizeCSS>
<Notifications position="top-center" containerWidth="250px" />
<Notifications position="top-center" containerWidth="250px" />
{children}
{/* <ToastContainer position="bottom-center" />
<AppNotif /> */}

View File

@@ -0,0 +1,12 @@
export const RouterAdminEvent = {
main_event: "/dev/admin/event/main",
// detail
detail_tipe_acara: "/dev/admin/event/child/tipe_acara",
detail_riwayat: "/dev/admin/event/child/riwayat",
// table
table_review: "/dev/admin/event/table/review",
table_publish: "/dev/admin/event/table/publish",
table_reject: "/dev/admin/event/table/reject",
};

View File

@@ -0,0 +1,8 @@
export const RouterAdminVote = {
// main
main: "/dev/admin/vote/main",
table_publish: "/dev/admin/vote/child/table_publish",
table_review: "/dev/admin/vote/child/table_review",
table_reject: "/dev/admin/vote/child/table_reject",
riwayat: "/dev/admin/vote/child/riwayat",
};

View File

@@ -15,17 +15,14 @@ export const RouterAdminInvestasi = {
};
export const RouterAdminDonasi = {
api_gambar_bukti_transfer: "/api/donasi/gambar_bukti_transfer/",
main_donasi: "/dev/admin/donasi/main",
// table
table_publish: "/dev/admin/donasi/table/publish",
table_review: "/dev/admin/donasi/table/review",
table_reject: "/dev/admin/donasi/table/reject",
// detail
detail_publish: "/dev/admin/donasi/detail/publish/",
detail_review: "/dev/admin/donasi/detail/review/",
@@ -33,14 +30,11 @@ export const RouterAdminDonasi = {
// proses
proses_transaksi: "/dev/admin/donasi/proses_transaksi/",
pencairan_dana :"/dev/admin/donasi/pencairan_dana/",
pencairan_dana: "/dev/admin/donasi/pencairan_dana/",
};
export const RouterAdminAward = {
main_award: "/dev/admin/award/main",
};

View File

@@ -0,0 +1,29 @@
export const RouterEvent = {
//main
splash: "/dev/event/splash",
beranda: "/dev/event/main/beranda",
status_page: "/dev/event/main/status_page",
kontribusi: "/dev/event/main/kontribusi",
riwayat: "/dev/event/main/riwayat",
// status
status_publish: "/dev/event/main/status_page/publish",
status_review: "/dev/event/main/status_page/review",
status_draft: "/dev/event/main/status_page/draft",
status_reject: "/dev/event/main/status_page/reject",
//create
create: "/dev/event/create",
// edit
edit: "/dev/event/edit/",
// detail
detail_main: "/dev/event/detail/main/",
detail_kontribusi: "/dev/event/detail/kontribusi/",
detail_publish: "/dev/event/detail/publish/",
detail_review: "/dev/event/detail/review/",
detail_draft: "/dev/event/detail/draft/",
detail_reject: "/dev/event/detail/reject/",
detail_riwayat: "/dev/event/detail/riwayat/",
};

View File

@@ -0,0 +1,24 @@
export const RouterVote = {
// main
splash: "/dev/vote/splash",
beranda: "/dev/vote/main/beranda",
status: "/dev/vote/main/status",
kontribusi: "/dev/vote/main/kontribusi",
riwayat: "/dev/vote/main/riwayat",
// create
create: "/dev/vote/create",
//
edit: "/dev/vote/edit/",
//detail
main_detail: "/dev/vote/detail/main/",
detail_publish: "/dev/vote/detail/publish/",
detail_review: "/dev/vote/detail/review/",
detail_draft: "/dev/vote/detail/draft/",
detail_reject: "/dev/vote/detail/reject/",
detail_kontribusi: "/dev/vote/detail/kontribusi/",
detail_semua_riwayat: "/dev/vote/detail/semua_riwayat/",
detail_riwayat_saya: "/dev/vote/detail/riwayat_saya/",
};

View File

@@ -1,13 +1,54 @@
'use client'
"use client";
import { Button } from "@mantine/core";
import { Box, Button, Stack, TextInput } from "@mantine/core";
import makuro_test from "./makuro_test";
import { useState } from "react";
import _, { forIn } from "lodash";
export default function ViewMakuro() {
const [listnya, setListnya] = useState<any[]>([
{
name: "Voting",
value: "",
},
{ name: "Voting", value: "" },
]);
return <>
return (
<>
<Stack p={24}>
{listnya.map((e, k) => (
<Box key={k}>
<TextInput
onChange={(v) => {
const val = _.clone(listnya);
val[k].value = v.currentTarget.value;
setListnya([...val]);
}}
label={e.name}
/>
</Box>
))}
<Button
onClick={() => makuro_test()}
>Tekan Aja</Button>
onClick={() => {
// const cek = listnya[listnya.length - 1]
// console.log(cek.id + 1);
if (listnya.length > 4) return console.log("ga bisa lebih");
setListnya([...listnya, { name: "Voting", value: "" }]);
}}
>
{" "}
Tambah
</Button>
<Button
onClick={() => {
console.log(JSON.stringify(listnya, null, 4));
}}
>
Hasilnya
</Button>
</Stack>
</>
}
);
}

View File

@@ -0,0 +1,14 @@
"use client";
import { Box, Title, Divider, Stack } from "@mantine/core";
export default function ComponentAdminGlobal_HeaderTamplate({name}: {name: string}) {
return (
<>
<Stack spacing={"xs"}>
<Title>{name ? name : null}</Title>
<Divider/>
</Stack>
</>
);
}

View File

@@ -1,3 +0,0 @@
import { atomWithStorage } from "jotai/utils";
export const gs_adminDonasi_hotMenu = atomWithStorage("gs_adminDonasi_hotMenu", 0)

View File

@@ -0,0 +1,195 @@
"use client";
import {
Avatar,
Box,
Button,
Center,
Divider,
Grid,
Group,
Loader,
Modal,
Paper,
SimpleGrid,
Spoiler,
Stack,
Table,
Text,
Title,
} from "@mantine/core";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
import {
MODEL_EVENT,
MODEL_EVENT_PESERTA,
} from "@/app_modules/event/model/interface";
import { data } from "autoprefixer";
import _ from "lodash";
import moment from "moment";
import { IconEyeShare } from "@tabler/icons-react";
import { useDisclosure, useShallowEffect } from "@mantine/hooks";
import { useState } from "react";
import { AdminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
export default function AdminEvent_Riwayat({
listRiwayat,
}: {
listRiwayat: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Event: Riwayat" />
<DetailRiwayat listRiwayat={listRiwayat} />
</Stack>
</>
);
}
function DetailRiwayat({ listRiwayat }: { listRiwayat: MODEL_EVENT[] }) {
const [opened, setOpen] = useState(false);
const [peserta, setPeserta] = useState<MODEL_EVENT_PESERTA[]>();
const [eventId, setEventId] = useState("");
const [loading, setLoading] = useState(false);
const TableRows = listRiwayat.map((e, i) => (
<tr key={e.id}>
<td>
<Button
loading={e.id === eventId ? (loading === true ? true : false) : false}
color={"green"}
leftIcon={<IconEyeShare />}
radius={"xl"}
onClick={async () => {
setEventId(e.id);
setLoading(true);
await new Promise((r) => setTimeout(r, 500));
await AdminEvent_getListPesertaById(e.id).then((res: any) => {
setLoading(false);
setPeserta(res);
});
setOpen(true);
}}
>
Peserta
</Button>
</td>
<td>{e.title}</td>
<td>{e.lokasi}</td>
<td>{e.EventMaster_TipeAcara.name}</td>
<td>{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}</td>
<td>
{e.tanggal.toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
hour12: false,
})}
</td>
<td>
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
{e.deskripsi}
</Spoiler>
</td>
</tr>
));
useShallowEffect(() => {
getAllPeserta(eventId);
}, [eventId]);
async function getAllPeserta(eventId: string) {
await AdminEvent_getListPesertaById(eventId).then((res: any) =>
setPeserta(res)
);
}
return (
<>
<Modal
opened={opened}
onClose={() => setOpen(false)}
size={"md"}
// closeOnClickOutside={false}
withCloseButton={false}
>
<Paper>
<Stack>
<Center>
<Title order={3}>Daftar Peserta</Title>
</Center>
<Stack>
{peserta?.map((e) => (
<Stack key={e.id} spacing={"xs"}>
<Grid >
<Grid.Col span={"content"}>
<Avatar
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
radius={"xl"}
src={
RouterProfile.api_foto_profile + e.User.Profile.imagesId
}
/>
</Grid.Col>
<Grid.Col span={"auto"}>
<Group align="center" h={"100%"}>
<Text>{e.User.Profile.name}</Text>
</Group>
</Grid.Col>
</Grid>
<Divider/>
</Stack>
))}
</Stack>
</Stack>
</Paper>
</Modal>
<Box>
<Box bg={"gray.1"} p={"xs"}>
<Title order={6} c={"gray"}>
RIWAYAT
</Title>
</Box>
<Table
withBorder
verticalSpacing={"md"}
horizontalSpacing={"xl"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Aksi</Center>
</th>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
</th>
<th>Tipe Acara</th>
<th>Tanggal</th>
<th>Jam</th>
<th>
<Center>Deskripsi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
<Center>
{_.isEmpty(TableRows) ? (
<Center h={"50vh"}>
<Title order={6}>Tidak Ada Data</Title>
</Center>
) : (
""
)}
</Center>
</Box>
</>
);
}

View File

@@ -0,0 +1,238 @@
"use client";
import {
ActionIcon,
Box,
Button,
Divider,
Group,
List,
Modal,
Paper,
SimpleGrid,
Stack,
Text,
TextInput,
Title,
} from "@mantine/core";
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
import { useState } from "react";
import { AdminEvent_funCreateTipeAcara } from "../fun/create/fun_create_tipe_acara";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { AdminEvent_getListTipeAcara } from "../fun/get/get_list_tipe_acara";
import { IconEditCircle, IconTrash } from "@tabler/icons-react";
import { AdminEvent_funEditTipeAcara } from "../fun/edit/fun_edit_tipe_acara";
import { useDisclosure } from "@mantine/hooks";
import { AdminEvent_funEditActivationTipeAcaraById } from "../fun/edit/fun_edit_activation_tipe_acara";
import { number } from "echarts";
export default function AdminEvent_DetailTipeAcara({
listTipe,
}: {
listTipe: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Event: Tipe Acara" />
<DetailTipeAcara listTipe={listTipe} />
</Stack>
</>
);
}
function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER[] }) {
const [tipe, setTipe] = useState(listTipe);
const [name, setName] = useState("");
const [openEditor, setOpenEditor] = useState(false);
const [edit, setEdit] = useState<MODEL_DEFAULT_MASTER | null>(null);
const [opened, { open, close }] = useDisclosure(false);
const [hapusTipe, setHapusTipe] = useState({
id: "",
name: "",
});
return (
<>
<Modal opened={opened} onClose={close} centered withCloseButton={false}>
<Stack>
<Title order={6}>
Anda yakin akan menghapus{" "}
<Text span c={"red"} inherit>
{hapusTipe.name}
</Text>{" "}
?
</Title>
<Group position="center">
<Button onClick={() => close()}>Batal</Button>
<Button
onClick={() => onDelete(hapusTipe as any, close, setTipe)}
color="red"
>
Hapus
</Button>
</Group>
</Stack>
</Modal>
<SimpleGrid
cols={3}
spacing="lg"
breakpoints={[
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
]}
>
<div>
<Paper p={"sm"} shadow="lg" withBorder>
<Stack>
<TextInput
value={name ? name : ""}
label="Masukan Tipe"
placeholder="Contoh: Seminar, Workshop, dll."
onChange={(val) => {
setName(val.target.value);
}}
/>
<Group position="right">
<Button onClick={() => onSave(name, setName, setTipe)}>
Tambah
</Button>
</Group>
</Stack>
</Paper>
</div>
<div>
<Paper p={"md"} shadow="lg" withBorder>
<Stack>
<Title order={3}>Tipe Acara Yang Tersedia </Title>
<Stack px={"md"}>
{tipe.map((e, i) => (
<Stack key={e.id} spacing={"xs"}>
<Group position="apart">
<Text>{e.name}</Text>
<Group>
<ActionIcon
variant="transparent"
onClick={() => {
setOpenEditor(true);
setEdit(e);
}}
>
<IconEditCircle color="green" />
</ActionIcon>{" "}
<ActionIcon
variant="transparent"
onClick={() => {
open();
setHapusTipe({
...hapusTipe,
id: e.id,
name: e.name,
});
}}
>
<IconTrash color="red" />
</ActionIcon>
</Group>
</Group>
<Divider />
</Stack>
))}
</Stack>
</Stack>
</Paper>
</div>
<div>
{openEditor ? (
<Paper p={"sm"} shadow="lg" withBorder>
<Stack>
<TextInput
value={edit?.name ? edit?.name : ""}
label="Edit Tipe Event"
placeholder="Contoh: Ramah Tamah, dll"
onChange={(val) => {
setEdit({
...(edit as any),
name: val.target.value,
});
}}
/>
<Group position="right">
<Group position="apart">
<Button color="red" onClick={() => setOpenEditor(false)}>
Batal
</Button>
<Button
color="green"
onClick={() =>
onUpdate(edit?.id, edit?.name, setTipe, setOpenEditor)
}
>
Update
</Button>
</Group>
</Group>
</Stack>
</Paper>
) : (
""
)}
</div>
</SimpleGrid>
</>
);
}
async function onSave(name: string, setName: any, setTipe: any) {
if (name === "")
return ComponentGlobal_NotifikasiPeringatan("Isi Tipe Acara");
await AdminEvent_funCreateTipeAcara(name).then(async (res) => {
if (res.status === 201) {
await AdminEvent_getListTipeAcara().then((val) => {
setTipe(val);
setName("");
ComponentGlobal_NotifikasiBerhasil("Berhasil Menyimpan Data");
});
} else {
ComponentGlobal_NotifikasiGagal("Gagal Menyimpan Data");
}
});
}
async function onUpdate(id: any, edit: any, setTipe: any, setOpenEditor: any) {
await AdminEvent_funEditTipeAcara(id, edit).then(async (res) => {
if (res.status === 200) {
await AdminEvent_getListTipeAcara().then((val) => {
setTipe(val);
ComponentGlobal_NotifikasiBerhasil(res.message);
setOpenEditor(false);
});
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}
async function onDelete(data: MODEL_DEFAULT_MASTER, close: any, setTipe: any) {
await AdminEvent_funEditActivationTipeAcaraById(data.id as any).then(
async (res) => {
if (res.status === 200) {
const data = await AdminEvent_getListTipeAcara();
setTipe(data);
ComponentGlobal_NotifikasiBerhasil(res.message);
close();
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
}
);
}

View File

@@ -0,0 +1,53 @@
"use server";
import prisma from "@/app/lib/prisma";
/**
*
* @param statusId | string > 1 - 4
* @returns jumlah dari donasi per status
*/
export default async function AdminEvent_funCountByStatusId(statusId: string) {
if (statusId === "1") {
const count = await prisma.event.count({
where: {
eventMaster_StatusId: "1",
tanggal: {
gte: new Date
}
},
});
return count;
}
if (statusId === "2") {
const count = await prisma.event.count({
where: {
eventMaster_StatusId: "2",
},
});
return count;
}
if (statusId === "3") {
const count = await prisma.event.count({
where: {
eventMaster_StatusId: "3",
},
});
return count;
}
if (statusId === "4") {
const count = await prisma.event.count({
where: {
eventMaster_StatusId: "4",
},
});
return count;
}
if (statusId === undefined || statusId === null) {
return {
status: 400,
message: "Parameter tidak sesuai"
}
}
}

View File

@@ -0,0 +1,16 @@
"use server";
import prisma from "@/app/lib/prisma";
export async function AdminEvent_funCountRiwayat() {
const data = await prisma.event.count({
where: {
eventMaster_StatusId: "1",
tanggal: {
lte: new Date(),
},
},
});
return data;
}

View File

@@ -0,0 +1,8 @@
"use server"
import prisma from "@/app/lib/prisma"
export async function AdminEvent_funCountTipeAcara() {
const data = await prisma.eventMaster_TipeAcara.count({})
return data
}

View File

@@ -0,0 +1,26 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function AdminEvent_funCreateTipeAcara(name: string) {
const dataAwal = await prisma.eventMaster_TipeAcara.findFirst({
orderBy: {
id: "desc",
},
});
const res = await prisma.eventMaster_TipeAcara.create({
data: {
id: Number(dataAwal?.id) + 1,
name: name,
},
});
if (!res) return { status: 400, message: "Gagal Menambahkan" };
revalidatePath("/dev/admin/event/detail/tipe_acara");
return {
status: 201,
message: "Berhasil Menambahkan",
};
}

View File

@@ -0,0 +1,22 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function AdminEvent_funEditActivationTipeAcaraById(id: number) {
const updt = await prisma.eventMaster_TipeAcara.update({
where: {
id: id,
},
data: {
active: false,
},
});
if(!updt) return {status: 400, message: "Gagal Update"}
revalidatePath("/dev/admin/event/child/tipe_acara");
return {
status: 200,
message: "Update Berhasil"
}
}

View File

@@ -0,0 +1,26 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function AdminEvent_funEditStatusPublishById(
eventId: string,
statusId: string
) {
console.log(eventId);
const updt = await prisma.event.update({
where: {
id: eventId,
},
data: {
eventMaster_StatusId: statusId,
},
});
if (!updt) return { status: 400, message: "Update Gagal" };
revalidatePath("/dev/admin/event/main");
return {
status: 200,
message: "Berhasil Update Status",
};
}

View File

@@ -0,0 +1,27 @@
"use server";
import prisma from "@/app/lib/prisma";
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
import { revalidatePath } from "next/cache";
export async function AdminEvent_funEditCatatanById(
data: MODEL_EVENT,
statudId: string
) {
const updt = await prisma.event.update({
where: {
id: data.id,
},
data: {
eventMaster_StatusId: statudId,
catatan: data.catatan
},
});
if (!updt) return { status: 400, message: "Update Gagal" };
revalidatePath("/dev/admin/event/main");
return {
status: 200,
message: "Berhasil Update Status",
};
}

View File

@@ -0,0 +1,22 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function AdminEvent_funEditTipeAcara(id: number, name: string) {
const updt = await prisma.eventMaster_TipeAcara.update({
where: {
id: id,
},
data: {
name: name,
},
});
if(!updt) return {status: 400, message: "Gagal Update"}
revalidatePath("/dev/admin/event/detail/tipe_acara")
return {
status: 200,
message: "Update Berhasil"
}
}

View File

@@ -0,0 +1,45 @@
"use server";
import prisma from "@/app/lib/prisma";
import _ from "lodash";
export async function AdminEvent_getListAllRiwayat() {
const data = await prisma.event.findMany({
orderBy: {
tanggal: "desc",
},
where: {
eventMaster_StatusId: "1",
tanggal: {
lte: new Date(),
},
},
select: {
id: true,
title: true,
lokasi: true,
tanggal: true,
deskripsi: true,
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_TipeAcara: {
select: {
id: true,
name: true,
},
},
},
});
return data;
}

View File

@@ -0,0 +1,21 @@
"use server";
import prisma from "@/app/lib/prisma";
export async function AdminEvent_getListPesertaById(eventId: string) {
const data = await prisma.event_Peserta.findMany({
where: {
eventId: eventId,
},
select: {
id: true,
User: {
select: {
Profile: true,
},
},
},
});
return data;
}

View File

@@ -0,0 +1,146 @@
"use server";
import prisma from "@/app/lib/prisma";
export async function AdminEvent_getListTableByStatusId(statudId: string) {
if (statudId === "1") {
const getPublish = await prisma.event.findMany({
orderBy: {
tanggal: "desc",
},
where: {
eventMaster_StatusId: "1",
tanggal: {
gte: new Date
}
},
select: {
id: true,
title: true,
lokasi: true,
tanggal: true,
deskripsi: true,
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: {
select: {
id: true,
name: true,
},
},
EventMaster_TipeAcara: {
select: {
id: true,
name: true,
},
},
Event_Peserta: true,
},
});
return getPublish;
}
if (statudId === "2") {
const getReview = await prisma.event.findMany({
orderBy: {
createdAt: "desc",
},
where: {
eventMaster_StatusId: "2",
},
select: {
id: true,
title: true,
lokasi: true,
tanggal: true,
deskripsi: true,
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: {
select: {
id: true,
name: true,
},
},
EventMaster_TipeAcara: {
select: {
id: true,
name: true,
},
},
},
});
return getReview;
}
if (statudId === "3") {
const getDraft = await prisma.event.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
eventMaster_StatusId: "3",
},
});
return getDraft;
}
if (statudId === "4") {
const getReject = await prisma.event.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
eventMaster_StatusId: "4",
},
select: {
id: true,
title: true,
lokasi: true,
tanggal: true,
deskripsi: true,
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true,
},
},
},
},
EventMaster_Status: {
select: {
id: true,
name: true,
},
},
EventMaster_TipeAcara: {
select: {
id: true,
name: true,
},
},
catatan: true,
},
});
return getReject;
}
}

View File

@@ -0,0 +1,15 @@
"use server"
import prisma from "@/app/lib/prisma"
export async function AdminEvent_getListTipeAcara(){
const data = await prisma.eventMaster_TipeAcara.findMany({
orderBy:{
id: "asc"
},
where: {
active: true
}
})
return data
}

View File

@@ -0,0 +1,15 @@
import AdminEvent_Main from "./main";
import AdminEvent_TableReview from "./table_status/table_review";
import AdminEvent_TablePublish from "./table_status/table_publish";
import AdminEvent_TableReject from "./table_status/table_reject";
import AdminEvent_DetailTipeAcara from "./child/tipe_acara";
import AdminEvent_Riwayat from "./child/riwayat";
export {
AdminEvent_Main,
AdminEvent_TableReview,
AdminEvent_TablePublish,
AdminEvent_TableReject,
AdminEvent_DetailTipeAcara,
AdminEvent_Riwayat,
};

View File

@@ -0,0 +1,148 @@
"use client";
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
import {
Stack,
Title,
Divider,
SimpleGrid,
Paper,
Center,
Text,
Box,
Group,
ActionIcon,
} from "@mantine/core";
import { IconChevronsRight } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
export default function AdminEvent_Main({
countPublish,
countReview,
countDraft,
countReject,
countTipeAcara,
countRiwayat,
}: {
countPublish: number;
countReview: number;
countDraft: number;
countReject: number;
countTipeAcara: number;
countRiwayat: number
}) {
const router = useRouter();
const listStatus = [
{
id: 1,
name: "Publish",
jumlah: countPublish,
path: RouterAdminEvent.table_publish,
color: "green",
},
{
id: 2,
name: "Review",
jumlah: countReview,
path: RouterAdminEvent.table_review,
color: "orange",
},
{
id: 3,
name: "Draft",
jumlah: countDraft,
path: "",
color: "yellow",
},
{
id: 4,
name: "Reject",
jumlah: countReject,
path: RouterAdminEvent.table_reject,
color: "red",
},
];
const listBox2 = [
{
id: 1,
name: "Riwayat Event",
jumlah: countRiwayat,
path: RouterAdminEvent.table_publish,
color: "gray",
},
{
id: 2,
name: "Tipe Acara",
jumlah: countTipeAcara,
path: RouterAdminEvent.table_publish,
color: "gray",
},
];
return (
<>
<Stack spacing={"xl"}>
<ComponentAdminGlobal_HeaderTamplate name="Event" />
<SimpleGrid
cols={4}
spacing="lg"
breakpoints={[
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
]}
>
{listStatus.map((e, i) => (
<Paper
key={i}
bg={`${e.color}.2`}
shadow="md"
radius="md"
p="md"
// sx={{ borderColor: e.color, borderStyle: "solid" }}
>
<Group position="center">
<Stack align="center" spacing={0}>
<Text>{e.name}</Text>
<Title>{e.jumlah}</Title>
</Stack>
</Group>
</Paper>
))}
</SimpleGrid>
<SimpleGrid
cols={4}
spacing="lg"
breakpoints={[
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
]}
>
{listBox2.map((e, i) => (
<Paper
key={i}
bg={`${e.color}.2`}
shadow="md"
radius="md"
p="md"
// sx={{ borderColor: e.color, borderStyle: "solid" }}
>
<Group position="center">
<Stack align="center" spacing={0}>
<Text>{e.name}</Text>
<Title>{e.jumlah}</Title>
</Stack>
</Group>
</Paper>
))}
</SimpleGrid>
</Stack>
</>
);
}

View File

@@ -0,0 +1,194 @@
"use client";
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
import {
ActionIcon,
Avatar,
Box,
Button,
Center,
Divider,
Grid,
Group,
Modal,
Paper,
Spoiler,
Stack,
Table,
Text,
Title,
} from "@mantine/core";
import {
IconBan,
IconChevronLeft,
IconEyeCheck,
IconEyeShare,
IconShare,
} from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useDisclosure } from "@mantine/hooks";
import { useState } from "react";
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
import {
MODEL_EVENT,
MODEL_EVENT_PESERTA,
} from "@/app_modules/event/model/interface";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
import moment from "moment";
import _ from "lodash";
import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import { AdminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
export default function AdminEvent_TablePublish({
listPublish,
}: {
listPublish: MODEL_EVENT[];
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Event: Table Publish" />
<TableStatus listPublish={listPublish} />
</Stack>
</>
);
}
function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listPublish);
const [peserta, setPeserta] = useState<MODEL_EVENT_PESERTA[]>();
const [eventId, setEventId] = useState("");
const [loading, setLoading] = useState(false);
const TableRows = data.map((e, i) => (
<tr key={i}>
<td>{e.title}</td>
<td>{e.lokasi}</td>
<td>{e.EventMaster_TipeAcara.name}</td>
<td>{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}</td>
<td>
{e.tanggal.toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
hour12: false,
})}
</td>
<td>
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
{e.deskripsi}
</Spoiler>
</td>
<td>
<Button
loading={e.id === eventId ? (loading === true ? true : false) : false}
color={"green"}
leftIcon={<IconEyeShare />}
radius={"xl"}
onClick={async () => {
setEventId(e.id);
setLoading(true);
await new Promise((v) => setTimeout(v, 500));
await AdminEvent_getListPesertaById(e.id).then((res: any) => {
setPeserta(res);
setLoading(false);
});
open();
}}
>
Lihat Peserta
</Button>
</td>
</tr>
));
return (
<>
<Modal opened={opened} onClose={close}>
<Paper>
<Stack>
<Center>
<Title order={3}>Daftar Peserta</Title>
</Center>
<Stack>
{peserta?.map((e) => (
<Stack key={e.id} spacing={"xs"}>
<Grid>
<Grid.Col span={"content"}>
<Avatar
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
radius={"xl"}
src={
RouterProfile.api_foto_profile +
e.User.Profile.imagesId
}
/>
</Grid.Col>
<Grid.Col span={"auto"}>
<Group align="center" h={"100%"}>
<Text>{e.User.Profile.name}</Text>
</Group>
</Grid.Col>
</Grid>
<Divider />
</Stack>
))}
</Stack>
</Stack>
</Paper>
</Modal>
<Box>
<Box bg={"green.1"} p={"xs"}>
<Title order={6} c={"green"}>
PUBLISH
</Title>
</Box>
<Table
withBorder
verticalSpacing={"md"}
horizontalSpacing={"xl"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>Judul</th>
<th>Lokasi</th>
<th>Tipe Acara</th>
<th>Tanggal</th>
<th>Jam</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
<Center>
{_.isEmpty(TableRows) ? (
<Center h={"50vh"}>
<Title order={6}>Tidak Ada Data</Title>
</Center>
) : (
""
)}
</Center>
</Box>
</>
);
}

View File

@@ -0,0 +1,239 @@
"use client";
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
import {
ActionIcon,
Box,
Button,
Center,
Flex,
Group,
Modal,
ScrollArea,
Spoiler,
Stack,
Table,
Text,
Textarea,
Title,
} from "@mantine/core";
import {
IconBan,
IconChevronLeft,
IconEyeCheck,
IconEyeShare,
IconPencilPlus,
IconShare,
} from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useDisclosure } from "@mantine/hooks";
import { useState } from "react";
import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah";
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
import moment from "moment";
import _ from "lodash";
import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_reject_by_id";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
export default function AdminEvent_TableReject({
listReject,
}: {
listReject: MODEL_EVENT[];
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Event: Table Reject" />
<TableStatus listReject={listReject} />
</Stack>
</>
);
}
function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listReject);
const [eventId, setEventId] = useState("");
const [catatan, setCatatan] = useState("");
const TableRows = data.map((e, i) => (
<tr key={i}>
<td>
<Box w={200}>{e.Author.Profile.name}</Box>
</td>
<td>
<Box w={200}>{e.title}</Box>
</td>
<td>
<Box w={200}>{e.lokasi}</Box>
</td>
<td>
<Box w={200}>{e.EventMaster_TipeAcara.name}</Box>
</td>
<td>
<Box w={200}>
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
</Box>
</td>
<td>
<Box w={100}>
{e.tanggal.toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
hour12: false,
})}
</Box>
</td>
<td>
<Box w={500}>
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
{e.deskripsi}
</Spoiler>
</Box>
</td>
<td>
{" "}
<Box w={400}>
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
{e.catatan}
</Spoiler>
</Box>
</td>
<td>
<Button
color={"red"}
leftIcon={<IconPencilPlus />}
radius={"xl"}
onClick={() => {
setEventId(e.id);
setCatatan(e.catatan);
open();
}}
>
Tambah Catatan
</Button>
</td>
</tr>
));
return (
<>
<Modal
opened={opened}
onClose={close}
centered
withCloseButton={false}
size={"lg"}
>
<Stack>
<Textarea
minRows={2}
maxRows={5}
maxLength={300}
value={catatan}
autosize
label="Masukan Alasan Penolakan"
placeholder="Contoh: Karena deskripsi kurang lengkap, dll"
onChange={(val) => {
setCatatan(val.target.value);
}}
/>
<Group position="right">
<Button
radius={"xl"}
onClick={() => {
onUpdate(eventId, catatan, close as any, setData);
}}
>
Simpan
</Button>
</Group>
</Stack>
</Modal>
<Box>
<Box bg={"red.1"} p={"xs"}>
<Title order={6} c={"red"}>
REJECT
</Title>
</Box>
<ScrollArea w={"100%"}>
<Table
w={2000}
withBorder
verticalSpacing={"md"}
horizontalSpacing={"xl"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>Author</th>
<th>Judul</th>
<th>Lokasi</th>
<th>Tipe Acara</th>
<th>Tanggal</th>
<th>Jam</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Catatan</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
<Center>
{_.isEmpty(TableRows) ? (
<Center h={"50vh"}>
<Title order={6}>Tidak Ada Data</Title>
</Center>
) : (
""
)}
</Center>
</Box>
</>
);
}
async function onUpdate(
eventId: string,
catatan: string,
close: any,
setData: any
) {
const body = {
id: eventId,
catatan: catatan,
};
await AdminEvent_funEditCatatanById(body as any, "4").then(async (res) => {
if (res.status === 200) {
await AdminEvent_getListTableByStatusId("4").then((val) => {
setData(val);
ComponentGlobal_NotifikasiBerhasil(res.message);
close();
});
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}

Some files were not shown because too many files have changed in this diff Show More