@@ -13,6 +13,7 @@
|
|||||||
"@emotion/server": "^11.11.0",
|
"@emotion/server": "^11.11.0",
|
||||||
"@mantine/carousel": "^7.1.5",
|
"@mantine/carousel": "^7.1.5",
|
||||||
"@mantine/core": "^6.0.17",
|
"@mantine/core": "^6.0.17",
|
||||||
|
"@mantine/dates": "^6.0.17",
|
||||||
"@mantine/dropzone": "^7.1.3",
|
"@mantine/dropzone": "^7.1.3",
|
||||||
"@mantine/hooks": "^6.0.17",
|
"@mantine/hooks": "^6.0.17",
|
||||||
"@mantine/next": "^6.0.17",
|
"@mantine/next": "^6.0.17",
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
"@types/react-dom": "18.2.7",
|
"@types/react-dom": "18.2.7",
|
||||||
"@types/uuid": "^9.0.4",
|
"@types/uuid": "^9.0.4",
|
||||||
"autoprefixer": "10.4.14",
|
"autoprefixer": "10.4.14",
|
||||||
|
"dayjs": "^1.11.10",
|
||||||
"echarts": "^5.4.3",
|
"echarts": "^5.4.3",
|
||||||
"echarts-for-react": "^3.0.2",
|
"echarts-for-react": "^3.0.2",
|
||||||
"embla-carousel-react": "^8.0.0-rc14",
|
"embla-carousel-react": "^8.0.0-rc14",
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ model User {
|
|||||||
Donasi Donasi[]
|
Donasi Donasi[]
|
||||||
Donasi_Invoice Donasi_Invoice[]
|
Donasi_Invoice Donasi_Invoice[]
|
||||||
Donasi_Notif Donasi_Notif[]
|
Donasi_Notif Donasi_Notif[]
|
||||||
|
Event Event[]
|
||||||
|
Event_Peserta Event_Peserta[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model MasterUserRole {
|
model MasterUserRole {
|
||||||
@@ -478,3 +480,55 @@ model Donasi_PencairanDana {
|
|||||||
Images Images? @relation(fields: [imagesId], references: [id])
|
Images Images? @relation(fields: [imagesId], references: [id])
|
||||||
imagesId String?
|
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?
|
||||||
|
}
|
||||||
|
|||||||
BIN
public/aset/event/splash-event.png
Normal file
BIN
public/aset/event/splash-event.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
public/aset/global/upload_icon.png
Normal file
BIN
public/aset/global/upload_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
BIN
public/portofolio/logo/6fec9ab1-6989-4bb8-8050-ab46ba431d11.png
Normal file
BIN
public/portofolio/logo/6fec9ab1-6989-4bb8-8050-ab46ba431d11.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
public/portofolio/logo/e6be54b3-b536-408d-afcb-da38415cfec1.jpg
Normal file
BIN
public/portofolio/logo/e6be54b3-b536-408d-afcb-da38415cfec1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
1
src/app/admin/layout.tsx
Normal file
1
src/app/admin/layout.tsx
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#! apa
|
||||||
@@ -13,8 +13,10 @@ import userSeeder from "../../../bin/seeder/user_seeder.json";
|
|||||||
import donasi_status from "../../../bin/seeder/donasi/master_status.json";
|
import donasi_status from "../../../bin/seeder/donasi/master_status.json";
|
||||||
import donasi_kategori from "../../../bin/seeder/donasi/master_kategori.json";
|
import donasi_kategori from "../../../bin/seeder/donasi/master_kategori.json";
|
||||||
import donasi_durasi from "../../../bin/seeder/donasi/master_durasi.json";
|
import donasi_durasi from "../../../bin/seeder/donasi/master_durasi.json";
|
||||||
import donasi_namaBank from "../../../bin/seeder/donasi/master_bank.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_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";
|
||||||
|
|
||||||
export async function GET(req: Request) {
|
export async function GET(req: Request) {
|
||||||
const dev = new URL(req.url).searchParams.get("dev");
|
const dev = new URL(req.url).searchParams.get("dev");
|
||||||
@@ -264,6 +266,36 @@ 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,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return NextResponse.json({ success: true });
|
return NextResponse.json({ success: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
src/app/dev/admin/event/main/page.tsx
Normal file
24
src/app/dev/admin/event/main/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
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_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()
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AdminEvent_Main
|
||||||
|
countPublish={countPublish as number}
|
||||||
|
countReview={countReview as number}
|
||||||
|
countDraft={countDraft as number}
|
||||||
|
countReject={countReject as number}
|
||||||
|
countTipeAcara={countTipeAcara as number}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
12
src/app/dev/admin/event/table/publish/page.tsx
Normal file
12
src/app/dev/admin/event/table/publish/page.tsx
Normal 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} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
10
src/app/dev/admin/event/table/reject/page.tsx
Normal file
10
src/app/dev/admin/event/table/reject/page.tsx
Normal 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}/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
10
src/app/dev/admin/event/table/review/page.tsx
Normal file
10
src/app/dev/admin/event/table/review/page.tsx
Normal 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}/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
@@ -9,9 +9,9 @@ export default async function Layout({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const userId = await User_getUserId();
|
const userId = await User_getUserId();
|
||||||
// const dataDonasi = await DOnasi_getList
|
// console.log(userId)
|
||||||
const isRead = await Donasi_getNotifByUserId(userId).then((res) =>
|
const isRead = await Donasi_getNotifByUserId(userId).then((res: any) =>
|
||||||
res.map((val: any) => val.isRead)
|
res.map((val: any) => val.isRead)
|
||||||
);
|
);
|
||||||
// console.log(isRead)
|
// console.log(isRead)
|
||||||
|
|
||||||
|
|||||||
13
src/app/dev/event/create/layout.tsx
Normal file
13
src/app/dev/event/create/layout.tsx
Normal 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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
11
src/app/dev/event/create/page.tsx
Normal file
11
src/app/dev/event/create/page.tsx
Normal 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}/>;
|
||||||
|
}
|
||||||
16
src/app/dev/event/detail/draft/[id]/layout.tsx
Normal file
16
src/app/dev/event/detail/draft/[id]/layout.tsx
Normal 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>;
|
||||||
|
</>
|
||||||
|
}
|
||||||
8
src/app/dev/event/detail/draft/[id]/page.tsx
Normal file
8
src/app/dev/event/detail/draft/[id]/page.tsx
Normal 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} />;
|
||||||
|
}
|
||||||
14
src/app/dev/event/detail/kontribusi/[id]/layout.tsx
Normal file
14
src/app/dev/event/detail/kontribusi/[id]/layout.tsx
Normal 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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
20
src/app/dev/event/detail/kontribusi/[id]/page.tsx
Normal file
20
src/app/dev/event/detail/kontribusi/[id]/page.tsx
Normal 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}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
15
src/app/dev/event/detail/main/[id]/layout.tsx
Normal file
15
src/app/dev/event/detail/main/[id]/layout.tsx
Normal 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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
27
src/app/dev/event/detail/main/[id]/page.tsx
Normal file
27
src/app/dev/event/detail/main/[id]/page.tsx
Normal 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}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
11
src/app/dev/event/detail/publish/[id]/layout.tsx
Normal file
11
src/app/dev/event/detail/publish/[id]/layout.tsx
Normal 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>;
|
||||||
|
}
|
||||||
9
src/app/dev/event/detail/publish/[id]/page.tsx
Normal file
9
src/app/dev/event/detail/publish/[id]/page.tsx
Normal 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} />;
|
||||||
|
}
|
||||||
11
src/app/dev/event/detail/reject/[id]/layout.tsx
Normal file
11
src/app/dev/event/detail/reject/[id]/layout.tsx
Normal 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>;
|
||||||
|
}
|
||||||
9
src/app/dev/event/detail/reject/[id]/page.tsx
Normal file
9
src/app/dev/event/detail/reject/[id]/page.tsx
Normal 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}/>;
|
||||||
|
}
|
||||||
11
src/app/dev/event/detail/review/[id]/layout.tsx
Normal file
11
src/app/dev/event/detail/review/[id]/layout.tsx
Normal 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>
|
||||||
|
}
|
||||||
10
src/app/dev/event/detail/review/[id]/page.tsx
Normal file
10
src/app/dev/event/detail/review/[id]/page.tsx
Normal 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}/>;
|
||||||
|
}
|
||||||
14
src/app/dev/event/detail/riwayat/[id]/layout.tsx
Normal file
14
src/app/dev/event/detail/riwayat/[id]/layout.tsx
Normal 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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
24
src/app/dev/event/detail/riwayat/[id]/page.tsx
Normal file
24
src/app/dev/event/detail/riwayat/[id]/page.tsx
Normal 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}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
8
src/app/dev/event/edit/[id]/layout.tsx
Normal file
8
src/app/dev/event/edit/[id]/layout.tsx
Normal 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>
|
||||||
|
</>
|
||||||
|
}
|
||||||
27
src/app/dev/event/edit/[id]/page.tsx
Normal file
27
src/app/dev/event/edit/[id]/page.tsx
Normal 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}/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
12
src/app/dev/event/main/beranda/page.tsx
Normal file
12
src/app/dev/event/main/beranda/page.tsx
Normal 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}/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
14
src/app/dev/event/main/kontribusi/page.tsx
Normal file
14
src/app/dev/event/main/kontribusi/page.tsx
Normal 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}/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
8
src/app/dev/event/main/layout.tsx
Normal file
8
src/app/dev/event/main/layout.tsx
Normal 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>
|
||||||
|
</>
|
||||||
|
}
|
||||||
19
src/app/dev/event/main/riwayat/page.tsx
Normal file
19
src/app/dev/event/main/riwayat/page.tsx
Normal 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}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
21
src/app/dev/event/main/status_page/page.tsx
Normal file
21
src/app/dev/event/main/status_page/page.tsx
Normal 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}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
5
src/app/dev/event/splash/page.tsx
Normal file
5
src/app/dev/event/splash/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { Event_SplashScreen } from "@/app_modules/event";
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
return <Event_SplashScreen />;
|
||||||
|
}
|
||||||
8
src/app/lib/router_admin/router_admin_event.ts
Normal file
8
src/app/lib/router_admin/router_admin_event.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
export const RouterAdminEvent = {
|
||||||
|
main_event: "/dev/admin/event/main",
|
||||||
|
|
||||||
|
// table
|
||||||
|
table_review: "/dev/admin/event/table/review",
|
||||||
|
table_publish: "/dev/admin/event/table/publish",
|
||||||
|
table_reject: "/dev/admin/event/table/reject",
|
||||||
|
};
|
||||||
@@ -15,17 +15,14 @@ export const RouterAdminInvestasi = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const RouterAdminDonasi = {
|
export const RouterAdminDonasi = {
|
||||||
|
|
||||||
api_gambar_bukti_transfer: "/api/donasi/gambar_bukti_transfer/",
|
api_gambar_bukti_transfer: "/api/donasi/gambar_bukti_transfer/",
|
||||||
|
|
||||||
|
|
||||||
main_donasi: "/dev/admin/donasi/main",
|
main_donasi: "/dev/admin/donasi/main",
|
||||||
// table
|
// table
|
||||||
table_publish: "/dev/admin/donasi/table/publish",
|
table_publish: "/dev/admin/donasi/table/publish",
|
||||||
table_review: "/dev/admin/donasi/table/review",
|
table_review: "/dev/admin/donasi/table/review",
|
||||||
table_reject: "/dev/admin/donasi/table/reject",
|
table_reject: "/dev/admin/donasi/table/reject",
|
||||||
|
|
||||||
|
|
||||||
// detail
|
// detail
|
||||||
detail_publish: "/dev/admin/donasi/detail/publish/",
|
detail_publish: "/dev/admin/donasi/detail/publish/",
|
||||||
detail_review: "/dev/admin/donasi/detail/review/",
|
detail_review: "/dev/admin/donasi/detail/review/",
|
||||||
@@ -33,14 +30,11 @@ export const RouterAdminDonasi = {
|
|||||||
|
|
||||||
// proses
|
// proses
|
||||||
proses_transaksi: "/dev/admin/donasi/proses_transaksi/",
|
proses_transaksi: "/dev/admin/donasi/proses_transaksi/",
|
||||||
pencairan_dana :"/dev/admin/donasi/pencairan_dana/",
|
pencairan_dana: "/dev/admin/donasi/pencairan_dana/",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const RouterAdminAward = {
|
export const RouterAdminAward = {
|
||||||
main_award: "/dev/admin/award/main",
|
main_award: "/dev/admin/award/main",
|
||||||
};
|
};
|
||||||
|
|||||||
29
src/app/lib/router_hipmi/router_event.ts
Normal file
29
src/app/lib/router_hipmi/router_event.ts
Normal 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/",
|
||||||
|
};
|
||||||
14
src/app_modules/admin/component/header_tamplate.tsx
Normal file
14
src/app_modules/admin/component/header_tamplate.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Box, Title, Divider } from "@mantine/core";
|
||||||
|
|
||||||
|
export default function ComponentAdminGlobal_HeaderTamplate({name}: {name: string}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Box>
|
||||||
|
<Title>{name ? name : null}</Title>
|
||||||
|
<Divider/>
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
import { atomWithStorage } from "jotai/utils";
|
import { atomWithStorage } from "jotai/utils";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param index | 0 - 3 | 0: Main dahsboard, 1: Investasi, 2: Donasi, 3: Event
|
||||||
|
* @type number
|
||||||
|
* @
|
||||||
|
*/
|
||||||
export const gs_adminDonasi_hotMenu = atomWithStorage("gs_adminDonasi_hotMenu", 0)
|
export const gs_adminDonasi_hotMenu = atomWithStorage("gs_adminDonasi_hotMenu", 0)
|
||||||
5
src/app_modules/admin/event/create/tipe_acara.tsx
Normal file
5
src/app_modules/admin/event/create/tipe_acara.tsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
export default function AdminEvent_CreateTipeAcara(){
|
||||||
|
|
||||||
|
}
|
||||||
22
src/app_modules/admin/event/detail/tipe_acara.tsx
Normal file
22
src/app_modules/admin/event/detail/tipe_acara.tsx
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { Stack } from "@mantine/core";
|
||||||
|
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
|
||||||
|
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function AdminEvent_DetailTipeAcara() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||||
|
<ComponentAdminDonasi_TombolKembali />
|
||||||
|
<DetailTipeAcara/>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DetailTipeAcara(){
|
||||||
|
return <>
|
||||||
|
|
||||||
|
disiin tipe nya
|
||||||
|
</>
|
||||||
|
}
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -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",
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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",
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/app_modules/admin/event/index.tsx
Normal file
13
src/app_modules/admin/event/index.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
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 "./detail/tipe_acara";
|
||||||
|
|
||||||
|
export {
|
||||||
|
AdminEvent_Main,
|
||||||
|
AdminEvent_TableReview,
|
||||||
|
AdminEvent_TablePublish,
|
||||||
|
AdminEvent_TableReject,
|
||||||
|
AdminEvent_DetailTipeAcara,
|
||||||
|
};
|
||||||
147
src/app_modules/admin/event/main/index.tsx
Normal file
147
src/app_modules/admin/event/main/index.tsx
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
"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,
|
||||||
|
}: {
|
||||||
|
countPublish: number;
|
||||||
|
countReview: number;
|
||||||
|
countDraft: number;
|
||||||
|
countReject: number;
|
||||||
|
countTipeAcara: 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: countPublish,
|
||||||
|
path: RouterAdminEvent.table_publish,
|
||||||
|
color: "gray",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: "Kategori",
|
||||||
|
// jumlah: countPublish,
|
||||||
|
path: RouterAdminEvent.table_publish,
|
||||||
|
color: "green",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
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="apart">
|
||||||
|
<IconChevronsRight color={`${e.color}.2`} />
|
||||||
|
<Stack align="center" spacing={0}>
|
||||||
|
<Text>{e.name}</Text>
|
||||||
|
<Title>{e.jumlah}</Title>
|
||||||
|
</Stack>
|
||||||
|
{e.path !== "" ? (
|
||||||
|
<ActionIcon radius={"xl"} onClick={() => router.push(e.path)}>
|
||||||
|
{" "}
|
||||||
|
<IconChevronsRight />
|
||||||
|
</ActionIcon>
|
||||||
|
) : (
|
||||||
|
<ActionIcon variant="transparent" disabled></ActionIcon>
|
||||||
|
)}
|
||||||
|
</Group>
|
||||||
|
</Paper>
|
||||||
|
))}
|
||||||
|
</SimpleGrid>
|
||||||
|
<Paper
|
||||||
|
shadow="md"
|
||||||
|
radius="md"
|
||||||
|
p="md"
|
||||||
|
bg={"gray.3"}
|
||||||
|
// w={{ lg: "62rem", md: "48rem", sm: "36rem" }}
|
||||||
|
w={300}
|
||||||
|
>
|
||||||
|
<Group position="apart">
|
||||||
|
<ActionIcon disabled variant="transparent"></ActionIcon>
|
||||||
|
<Stack align="center" spacing={0}>
|
||||||
|
<Text>Tipe Acara</Text>
|
||||||
|
<Title>{countTipeAcara}</Title>
|
||||||
|
</Stack>
|
||||||
|
<ActionIcon radius={"xl"} onClick={() => router.push("")}>
|
||||||
|
<IconChevronsRight color="gray" />
|
||||||
|
</ActionIcon>
|
||||||
|
</Group>
|
||||||
|
</Paper>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
142
src/app_modules/admin/event/table_status/table_publish.tsx
Normal file
142
src/app_modules/admin/event/table_status/table_publish.tsx
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
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 } 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";
|
||||||
|
|
||||||
|
export default function AdminEvent_TablePublish({
|
||||||
|
listPublish,
|
||||||
|
}: {
|
||||||
|
listPublish: MODEL_EVENT[];
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||||
|
<ComponentAdminDonasi_TombolKembali />
|
||||||
|
<TableStatus listPublish={listPublish} />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
const [data, setData] = useState(listPublish);
|
||||||
|
|
||||||
|
async function onClick() {
|
||||||
|
// router.push(RouterAdminDonasi.detail_publish);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TableRows = data.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>{e.title}</td>
|
||||||
|
<td>{e.lokasi}</td>
|
||||||
|
<td>{e.EventMaster_TipeAcara.name}</td>
|
||||||
|
<td>
|
||||||
|
{moment(e.tanggal).format("dddd")}, {moment(e.tanggal).format("ll")}
|
||||||
|
</td>
|
||||||
|
<td>{moment(e.tanggal).format("LT")}</td>
|
||||||
|
<td>
|
||||||
|
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||||
|
{e.deskripsi}
|
||||||
|
</Spoiler>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Button
|
||||||
|
color={"green"}
|
||||||
|
leftIcon={<IconEyeShare />}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => console.log("cooming soon")}
|
||||||
|
>
|
||||||
|
Lihat Peserta
|
||||||
|
</Button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
234
src/app_modules/admin/event/table_status/table_reject.tsx
Normal file
234
src/app_modules/admin/event/table_status/table_reject.tsx
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
"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" />
|
||||||
|
<ComponentAdminDonasi_TombolKembali />
|
||||||
|
<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}>
|
||||||
|
{moment(e.tanggal).format("dddd")}, {moment(e.tanggal).format("ll")}
|
||||||
|
</Box>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Box w={100}>{moment(e.tanggal).format("LT")}</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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
226
src/app_modules/admin/event/table_status/table_review.tsx
Normal file
226
src/app_modules/admin/event/table_status/table_review.tsx
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterAdminDonasi } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
Spoiler,
|
||||||
|
Stack,
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Textarea,
|
||||||
|
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 } from "@/app_modules/event/model/interface";
|
||||||
|
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
import moment from "moment";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
|
import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
|
||||||
|
import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
|
||||||
|
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_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_TableReview({
|
||||||
|
listReview,
|
||||||
|
}: {
|
||||||
|
listReview: MODEL_EVENT[];
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack>
|
||||||
|
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||||
|
<ComponentAdminDonasi_TombolKembali />
|
||||||
|
<TableStatus listReview={listReview} />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
const [data, setData] = useState(listReview);
|
||||||
|
const [catatan, setCatatan] = useState("");
|
||||||
|
const [eventId, setEventId] = useState("");
|
||||||
|
|
||||||
|
const TableRows = data.map((e, i) => (
|
||||||
|
<tr key={i}>
|
||||||
|
<td>{e.Author.Profile.name}</td>
|
||||||
|
<td>{e.title}</td>
|
||||||
|
<td>{e.lokasi}</td>
|
||||||
|
<td>{e.EventMaster_TipeAcara.name}</td>
|
||||||
|
<td>
|
||||||
|
{moment(e.tanggal).format("dddd")}, {moment(e.tanggal).format("ll")}
|
||||||
|
</td>
|
||||||
|
<td>{moment(e.tanggal).format("LT")}</td>
|
||||||
|
<td>
|
||||||
|
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||||
|
{e.deskripsi}
|
||||||
|
</Spoiler>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Stack>
|
||||||
|
<Button
|
||||||
|
color={"green"}
|
||||||
|
leftIcon={<IconEyeShare />}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => onPublish(e.id, setData)}
|
||||||
|
>
|
||||||
|
Publish
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
color={"red"}
|
||||||
|
leftIcon={<IconBan />}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
open();
|
||||||
|
setEventId(e.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Reject
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Modal
|
||||||
|
opened={opened}
|
||||||
|
onClose={close}
|
||||||
|
centered
|
||||||
|
withCloseButton={false}
|
||||||
|
size={"lg"}
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
<Textarea
|
||||||
|
minRows={2}
|
||||||
|
maxRows={5}
|
||||||
|
maxLength={300}
|
||||||
|
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={() => {
|
||||||
|
onReject(eventId, catatan, setData, close);
|
||||||
|
|
||||||
|
// console.log("hehe")
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Box>
|
||||||
|
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
|
||||||
|
<Box bg={"orange.1"} p={"xs"}>
|
||||||
|
<Title order={6} c={"orange"}>
|
||||||
|
REVIEW
|
||||||
|
</Title>
|
||||||
|
</Box>
|
||||||
|
<Table
|
||||||
|
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>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>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onPublish(eventId: string, setData: any) {
|
||||||
|
await AdminEvent_funEditStatusPublishById(eventId, "1").then(async (res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
await AdminEvent_getListTableByStatusId("2").then((res) => {
|
||||||
|
setData(res);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil("Berhasil update status");
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onReject(eventId: string, catatan: string, setData: any, close: any) {
|
||||||
|
if (catatan === "")
|
||||||
|
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Catatan");
|
||||||
|
const body = {
|
||||||
|
id: eventId,
|
||||||
|
catatan: catatan,
|
||||||
|
};
|
||||||
|
|
||||||
|
await AdminEvent_funEditCatatanById(body as any, "4").then(async (res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
await AdminEvent_getListTableByStatusId("2").then((val) => {
|
||||||
|
setData(val);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
close()
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import AdminMain from "./main/view";
|
import AdminMain from "./main/view";
|
||||||
import AdminLayout from "./main/layout";
|
import AdminLayout from "./main/layout";
|
||||||
import SplashDashboardAdmin from "./splash";
|
import SplashDashboardAdmin from "../splash/splash";
|
||||||
|
|
||||||
export { AdminMain, AdminLayout, SplashDashboardAdmin };
|
export { AdminMain, AdminLayout, SplashDashboardAdmin };
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import { Logout } from "@/app_modules/auth";
|
|||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { gs_adminDonasi_hotMenu } from "../../donasi/global_state";
|
import { gs_adminDonasi_hotMenu } from "../../donasi/global_state";
|
||||||
import Admin_Logout from "../../component/logout";
|
import Admin_Logout from "../../component/logout";
|
||||||
|
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||||
|
|
||||||
export default function AdminLayout({
|
export default function AdminLayout({
|
||||||
children,
|
children,
|
||||||
@@ -62,6 +63,11 @@ export default function AdminLayout({
|
|||||||
name: "Donasi",
|
name: "Donasi",
|
||||||
route: RouterAdminDonasi.main_donasi,
|
route: RouterAdminDonasi.main_donasi,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: "Event",
|
||||||
|
route: RouterAdminEvent.main_event,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
|
||||||
import { AspectRatio, Center, Image, Stack, Text, Title } from "@mantine/core";
|
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
|
|
||||||
export default function SplashDashboardAdmin() {
|
|
||||||
const router = useRouter();
|
|
||||||
useShallowEffect(() => {
|
|
||||||
setTimeout(() => router.push(RouterAdminDashboard.main_admin), 2000)
|
|
||||||
}, []);
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{/* <Stack align="center" justify="center" h={"100vh"}>
|
|
||||||
<Title order={4} c={"orange"}>
|
|
||||||
Selamat Datang, ADMIN
|
|
||||||
</Title>
|
|
||||||
<Title c={"red"}>HIPMI</Title>
|
|
||||||
|
|
||||||
</Stack> */}
|
|
||||||
<AspectRatio ratio={16 / 9}>
|
|
||||||
<Image src={"/aset/logo/logo-hipmi.png"} alt="Logo" />
|
|
||||||
</AspectRatio>
|
|
||||||
<Center>
|
|
||||||
<Title>Welcome Admin</Title>
|
|
||||||
</Center>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
33
src/app_modules/admin/splash/splash.tsx
Normal file
33
src/app_modules/admin/splash/splash.tsx
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||||
|
import { AspectRatio, Center, Image, Stack, Text, Title } from "@mantine/core";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { gs_adminDonasi_hotMenu } from "../donasi/global_state";
|
||||||
|
|
||||||
|
export default function SplashDashboardAdmin() {
|
||||||
|
const router = useRouter();
|
||||||
|
const [active, setActive] = useAtom(gs_adminDonasi_hotMenu);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
router.push(RouterAdminDashboard.main_admin);
|
||||||
|
setActive(0);
|
||||||
|
}, 2000);
|
||||||
|
}, []);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Center h={"100vh"}>
|
||||||
|
<Stack spacing={0} >
|
||||||
|
<Title>Welcome Admin</Title>
|
||||||
|
|
||||||
|
<AspectRatio ratio={1 / 1} mah={700} maw={700}>
|
||||||
|
<Image src={"/aset/logo/logo-hipmi.png"} alt="Logo" />
|
||||||
|
</AspectRatio>
|
||||||
|
</Stack>
|
||||||
|
</Center>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import { gs_nomor, gs_otp } from "../state/state";
|
|||||||
import { IconLogout } from "@tabler/icons-react";
|
import { IconLogout } from "@tabler/icons-react";
|
||||||
import { Warna } from "@/app/lib/warna";
|
import { Warna } from "@/app/lib/warna";
|
||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
|
|
||||||
export default function User_Logout() {
|
export default function User_Logout() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -24,6 +25,7 @@ export default function User_Logout() {
|
|||||||
setnomor(null);
|
setnomor(null);
|
||||||
setCode(null);
|
setCode(null);
|
||||||
|
|
||||||
|
ComponentGlobal_NotifikasiBerhasil("Anda Berhasil Logout")
|
||||||
return router.push("/dev/auth/login");
|
return router.push("/dev/auth/login");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
47
src/app_modules/component_global/author_name_on_header.tsx
Normal file
47
src/app_modules/component_global/author_name_on_header.tsx
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||||
|
import { Stack, Grid, Avatar, Divider, Text } from "@mantine/core";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
export default function ComponentGlobal_AuthorNameOnHeader({
|
||||||
|
profileId,
|
||||||
|
imagesId,
|
||||||
|
authorName,
|
||||||
|
}: {
|
||||||
|
profileId: string;
|
||||||
|
imagesId: string;
|
||||||
|
authorName: string;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xs"}>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col
|
||||||
|
span={"content"}
|
||||||
|
onClick={() => {
|
||||||
|
router.push(RouterProfile.katalog + profileId);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Avatar
|
||||||
|
size={30}
|
||||||
|
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
|
||||||
|
radius={"xl"}
|
||||||
|
bg={"gray.1"}
|
||||||
|
src={RouterProfile.api_foto_profile + imagesId}
|
||||||
|
/>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Stack justify="center" h={"100%"}>
|
||||||
|
<Text truncate fz={"sm"} fw={"bold"}>
|
||||||
|
{authorName}
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Divider />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,14 +1,23 @@
|
|||||||
import { Center, Text } from "@mantine/core";
|
import { Center, Text } from "@mantine/core";
|
||||||
import { notifications } from "@mantine/notifications";
|
import { notifications } from "@mantine/notifications";
|
||||||
import { IconAlertTriangle, IconChecklist, IconCircleCheck } from "@tabler/icons-react";
|
import {
|
||||||
|
IconAlertTriangle,
|
||||||
|
IconChecklist,
|
||||||
|
IconCircleCheck,
|
||||||
|
} from "@tabler/icons-react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param text | masukan text untuk peringatan
|
* @param text | masukan text untuk peringatan
|
||||||
* @type string
|
* @type string
|
||||||
* @returns notifikasi peringatan
|
* @param durasi | durasi autoClose
|
||||||
|
* @type number
|
||||||
|
* @returns notifikasi berhasil warna hijau
|
||||||
*/
|
*/
|
||||||
export async function ComponentGlobal_NotifikasiBerhasil(text: string) {
|
export async function ComponentGlobal_NotifikasiBerhasil(
|
||||||
|
text: string,
|
||||||
|
durasi?: number
|
||||||
|
) {
|
||||||
return notifications.show({
|
return notifications.show({
|
||||||
message: (
|
message: (
|
||||||
<Center>
|
<Center>
|
||||||
@@ -17,7 +26,7 @@ export async function ComponentGlobal_NotifikasiBerhasil(text: string) {
|
|||||||
),
|
),
|
||||||
color: "green",
|
color: "green",
|
||||||
radius: "md",
|
radius: "md",
|
||||||
autoClose: 1000,
|
autoClose: durasi ? durasi : 1000,
|
||||||
icon: <IconCircleCheck color="white" />,
|
icon: <IconCircleCheck color="white" />,
|
||||||
withCloseButton: false,
|
withCloseButton: false,
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,6 @@
|
|||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
export async function Donasi_getNotifByUserId(userId: string) {
|
export async function Donasi_getNotifByUserId(userId: string) {
|
||||||
const dataInvoice = await prisma.donasi_Invoice.findFirst({
|
|
||||||
where: {
|
|
||||||
authorId: userId
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// console.log(dataInvoice)
|
// console.log(dataInvoice)
|
||||||
|
|
||||||
// return null
|
// return null
|
||||||
@@ -22,10 +16,10 @@ export async function Donasi_getNotifByUserId(userId: string) {
|
|||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
isRead: true,
|
isRead: true,
|
||||||
active: true,
|
// active: true,
|
||||||
createdAt: true,
|
// createdAt: true,
|
||||||
donasi_KabarId: true,
|
// donasi_KabarId: true,
|
||||||
Donasi_Kabar: true,
|
// Donasi_Kabar: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return dataNotif;
|
return dataNotif;
|
||||||
|
|||||||
@@ -50,16 +50,16 @@ export default function Donasi_NotifPage({
|
|||||||
<Stack>
|
<Stack>
|
||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<Text fw={"bold"} truncate>
|
<Text fw={"bold"} truncate>
|
||||||
{e.Donasi_Kabar.title}
|
{e.Donasi_Kabar?.title}
|
||||||
</Text>
|
</Text>
|
||||||
<Text fz={"xs"}>{moment(e.createdAt).format("ll")}</Text>
|
<Text fz={"xs"}>{moment(e.createdAt).format("ll")}</Text>
|
||||||
</Group>
|
</Group>
|
||||||
<Stack spacing={0}>
|
<Stack spacing={0}>
|
||||||
<Text lineClamp={2}>{e.Donasi_Kabar.deskripsi}</Text>
|
<Text lineClamp={2}>{e.Donasi_Kabar?.deskripsi}</Text>
|
||||||
<Text
|
<Text
|
||||||
c={"blue"}
|
c={"blue"}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
onClick(router as any, e.Donasi_Kabar.id, e.id)
|
onClick(router as any, e.Donasi_Kabar?.id, e.id)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Buka Kabar
|
Buka Kabar
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { MODEL_USER } from "@/app_modules/home/model/interface";
|
import { MODEL_USER } from "@/app_modules/home/model/interface";
|
||||||
import { Model_Nama_Bank } from "@/app_modules/investasi/model/model_investasi";
|
import { Model_Nama_Bank } from "@/app_modules/investasi/model/model_investasi";
|
||||||
import { MODEL_IMAGES } from "@/app_modules/models/interface";
|
import { MODEL_IMAGES } from "@/app_modules/model_global/interface";
|
||||||
|
|
||||||
export interface MODEL_DONASI {
|
export interface MODEL_DONASI {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
48
src/app_modules/event/component/box_list_status.tsx
Normal file
48
src/app_modules/event/component/box_list_status.tsx
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||||
|
import { Paper, Stack, Group, Title, Text, Grid } from "@mantine/core";
|
||||||
|
import moment from "moment";
|
||||||
|
import { MODEL_EVENT } from "../model/interface";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
export default function ComponentEvent_BoxListStatus({
|
||||||
|
data,
|
||||||
|
path,
|
||||||
|
}: {
|
||||||
|
data: MODEL_EVENT;
|
||||||
|
path: string;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Paper
|
||||||
|
shadow="lg"
|
||||||
|
radius={"md"}
|
||||||
|
p={"md"}
|
||||||
|
withBorder
|
||||||
|
mb={"sm"}
|
||||||
|
onClick={() => router.push(path + data.id)}
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={8}>
|
||||||
|
<Title order={6} truncate>
|
||||||
|
{data.title}
|
||||||
|
</Title>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fz={"sm"} truncate>
|
||||||
|
{moment(data.tanggal).format("ll")}
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Text fz={"sm"} lineClamp={2}>
|
||||||
|
{data.deskripsi}
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
18
src/app_modules/event/component/catatan_reject.tsx
Normal file
18
src/app_modules/event/component/catatan_reject.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { Paper, Stack, Text } from "@mantine/core"
|
||||||
|
|
||||||
|
export default function ComponentEvent_CatatanReject({catatan}: {catatan:string}){
|
||||||
|
return<>
|
||||||
|
<Paper bg={"blue.3"} p={"sm"}>
|
||||||
|
<Stack spacing={0}>
|
||||||
|
<Text fz={"xs"} fw={"bold"} fs={"italic"}>
|
||||||
|
* Alasan Penolakan
|
||||||
|
</Text>
|
||||||
|
<Text fz={"xs"} fs={"italic"}>
|
||||||
|
{catatan}
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</>
|
||||||
|
}
|
||||||
82
src/app_modules/event/component/detail/detail_data.tsx
Normal file
82
src/app_modules/event/component/detail/detail_data.tsx
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Stack, Title, Grid, Text, Paper, Spoiler } from "@mantine/core";
|
||||||
|
import moment from "moment";
|
||||||
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
|
||||||
|
export default function ComponentEvent_DetailData({
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
data: MODEL_EVENT;
|
||||||
|
}) {
|
||||||
|
const tgl = data.tanggal;
|
||||||
|
const hari = tgl.toLocaleString("id-ID", { dateStyle: "full" });
|
||||||
|
|
||||||
|
const jam = tgl.toLocaleTimeString([], {
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
hour12: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Paper withBorder p={"md"} shadow="lg">
|
||||||
|
<Stack px={"sm"}>
|
||||||
|
<Title order={4}>{data ? data?.title : null}</Title>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Lokasi
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Text>{data ? data?.lokasi : null}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Tipe Acara
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Text>{data ? data.EventMaster_TipeAcara?.name : null}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Tanggal
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>{hari}</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Jam
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>{jam}</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Stack spacing={2}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Deskripsi
|
||||||
|
</Text>
|
||||||
|
<Spoiler
|
||||||
|
hideLabel="Lihat sedikit"
|
||||||
|
maxHeight={50}
|
||||||
|
showLabel="Lihat banyak"
|
||||||
|
>
|
||||||
|
{data ? data?.deskripsi : null}
|
||||||
|
</Spoiler>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
90
src/app_modules/event/component/detail/detail_main.tsx
Normal file
90
src/app_modules/event/component/detail/detail_main.tsx
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Stack, Title, Grid, Text, Paper, Spoiler } from "@mantine/core";
|
||||||
|
import moment from "moment";
|
||||||
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||||
|
|
||||||
|
export default function ComponentEvent_DetailMainData({
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
data: MODEL_EVENT;
|
||||||
|
}) {
|
||||||
|
const tgl = data.tanggal;
|
||||||
|
const hari = tgl.toLocaleString("id-ID", { dateStyle: "full" });
|
||||||
|
|
||||||
|
const jam = tgl.toLocaleTimeString([], {
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
hour12: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Paper withBorder p={"md"} shadow="lg">
|
||||||
|
<Stack>
|
||||||
|
<ComponentGlobal_AuthorNameOnHeader
|
||||||
|
authorName={data.Author.Profile.name}
|
||||||
|
imagesId={data.Author.Profile.imagesId}
|
||||||
|
profileId={data.Author.Profile.id}
|
||||||
|
/>
|
||||||
|
<Stack px={"sm"}>
|
||||||
|
<Title order={4}>{data ? data.title : null}</Title>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Lokasi
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Text>{data ? data.lokasi : null}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Tipe Acara
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Text>{data ? data.EventMaster_TipeAcara.name : null}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Tanggal
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>{hari}</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Jam
|
||||||
|
</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>{jam}</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Stack spacing={2}>
|
||||||
|
<Text fw={"bold"} fz={"sm"}>
|
||||||
|
Deskripsi
|
||||||
|
</Text>
|
||||||
|
<Spoiler
|
||||||
|
hideLabel="Lihat sedikit"
|
||||||
|
maxHeight={50}
|
||||||
|
showLabel="Lihat banyak"
|
||||||
|
>
|
||||||
|
{data ? data.deskripsi : null}
|
||||||
|
</Spoiler>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
77
src/app_modules/event/component/detail/list_peserta.tsx
Normal file
77
src/app_modules/event/component/detail/list_peserta.tsx
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||||
|
import {
|
||||||
|
Paper,
|
||||||
|
Stack,
|
||||||
|
Center,
|
||||||
|
Title,
|
||||||
|
Grid,
|
||||||
|
Avatar,
|
||||||
|
Divider,
|
||||||
|
Text,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import _ from "lodash";
|
||||||
|
import router from "next/router";
|
||||||
|
import peserta from "../../main/kontribusi/peserta";
|
||||||
|
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
||||||
|
|
||||||
|
export default function ComponentEvent_ListPeserta({
|
||||||
|
listPeserta,
|
||||||
|
total,
|
||||||
|
}: {
|
||||||
|
listPeserta: MODEL_EVENT_PESERTA[];
|
||||||
|
total: number;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Paper withBorder mt={"lg"}>
|
||||||
|
<Stack spacing={"md"} p={"md"}>
|
||||||
|
<Center>
|
||||||
|
<Title order={5}>Daftar Peserta ({total})</Title>
|
||||||
|
</Center>
|
||||||
|
|
||||||
|
{_.isEmpty(listPeserta) ? (
|
||||||
|
<Center>
|
||||||
|
<Text fz={"xs"} fw={"bold"}>
|
||||||
|
- Tidak ada peserta -
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
) : (
|
||||||
|
<Stack>
|
||||||
|
{listPeserta.map((e, i) => (
|
||||||
|
<Stack key={i} spacing={"sm"}>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col
|
||||||
|
span={"content"}
|
||||||
|
onClick={() => {
|
||||||
|
router.push(RouterProfile.katalog + e.User.Profile.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Avatar
|
||||||
|
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
|
||||||
|
radius={"xl"}
|
||||||
|
bg={"gray"}
|
||||||
|
size={30}
|
||||||
|
src={
|
||||||
|
RouterProfile.api_foto_profile +
|
||||||
|
e.User.Profile.imagesId
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Stack justify="center" h={"100%"}>
|
||||||
|
<Text>{e.User.Profile.name}</Text>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Divider />
|
||||||
|
</Stack>
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
69
src/app_modules/event/component/header_tamplate.tsx
Normal file
69
src/app_modules/event/component/header_tamplate.tsx
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Header, Group, ActionIcon, Text, Title } from "@mantine/core";
|
||||||
|
import { IconArrowLeft, IconChevronLeft } from "@tabler/icons-react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export default function ComponentEvent_HeaderTamplate({
|
||||||
|
hideBack,
|
||||||
|
changeIconBack,
|
||||||
|
route,
|
||||||
|
route2,
|
||||||
|
title,
|
||||||
|
icon,
|
||||||
|
bg,
|
||||||
|
}: {
|
||||||
|
hideBack?: boolean;
|
||||||
|
changeIconBack?: any
|
||||||
|
route?: any;
|
||||||
|
route2?: any;
|
||||||
|
title: string;
|
||||||
|
icon?: any;
|
||||||
|
bg?: any;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Header
|
||||||
|
height={50}
|
||||||
|
sx={{ borderStyle: "none" }}
|
||||||
|
bg={bg === null ? "" : bg}
|
||||||
|
>
|
||||||
|
<Group h={50} position="apart" px={"md"}>
|
||||||
|
{hideBack ? (
|
||||||
|
<ActionIcon variant="transparent" disabled></ActionIcon>
|
||||||
|
) : (
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
onClick={() => {
|
||||||
|
if (route === null || route === undefined) {
|
||||||
|
return router.back();
|
||||||
|
} else {
|
||||||
|
return router.push(route);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{changeIconBack ? changeIconBack: <IconChevronLeft />}
|
||||||
|
</ActionIcon>
|
||||||
|
)}
|
||||||
|
<Title order={5}>{title}</Title>
|
||||||
|
{(() => {
|
||||||
|
if (route2 === null || route2 === undefined) {
|
||||||
|
return <ActionIcon disabled variant="transparent"></ActionIcon>;
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
onClick={() => router.push(route2)}
|
||||||
|
>
|
||||||
|
{icon}
|
||||||
|
</ActionIcon>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})()}
|
||||||
|
</Group>
|
||||||
|
</Header>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
150
src/app_modules/event/create/create.tsx
Normal file
150
src/app_modules/event/create/create.tsx
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { MODEL_USER } from "@/app_modules/home/model/interface";
|
||||||
|
import {
|
||||||
|
AspectRatio,
|
||||||
|
Avatar,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
FileButton,
|
||||||
|
Image,
|
||||||
|
MultiSelect,
|
||||||
|
Paper,
|
||||||
|
Select,
|
||||||
|
Stack,
|
||||||
|
TextInput,
|
||||||
|
Textarea,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { DateInput, DatePicker, DateTimePicker } from "@mantine/dates";
|
||||||
|
import { TimeInput } from "@mantine/dates";
|
||||||
|
import { IconCamera } from "@tabler/icons-react";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { gs_event_hotMenu, gs_event_status } from "../global_state";
|
||||||
|
import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
||||||
|
import { Event_funCreate } from "../fun/create/fun_create";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
import { kMaxLength } from "buffer";
|
||||||
|
|
||||||
|
export default function Event_Create({
|
||||||
|
listTipeAcara,
|
||||||
|
authorId,
|
||||||
|
}: {
|
||||||
|
listTipeAcara: MODEL_DEFAULT_MASTER[];
|
||||||
|
authorId: string;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
|
||||||
|
const [listTipe, setListTipe] = useState(listTipeAcara);
|
||||||
|
const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
|
||||||
|
|
||||||
|
|
||||||
|
const [value, setValue] = useState({
|
||||||
|
title: "",
|
||||||
|
lokasi: "",
|
||||||
|
deskripsi: "",
|
||||||
|
tanggal: Date,
|
||||||
|
eventMaster_TipeAcaraId: 0,
|
||||||
|
authorId: authorId,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack px={"sm"}>
|
||||||
|
<TextInput
|
||||||
|
label="Judul"
|
||||||
|
placeholder="Masukan judul"
|
||||||
|
withAsterisk
|
||||||
|
onChange={(val) =>
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
title: val.target.value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Select
|
||||||
|
label="Tipe Acara"
|
||||||
|
placeholder="Pilih Tipe Acara"
|
||||||
|
data={listTipe.map((e) => ({
|
||||||
|
value: e.id,
|
||||||
|
label: e.name,
|
||||||
|
}))}
|
||||||
|
onChange={(val: any) =>
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
eventMaster_TipeAcaraId: val,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextInput
|
||||||
|
label="Lokasi"
|
||||||
|
placeholder="Masukan lokasi acara"
|
||||||
|
withAsterisk
|
||||||
|
onChange={(val) =>
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
lokasi: val.target.value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<DateTimePicker
|
||||||
|
withAsterisk
|
||||||
|
label="Tanggal & Waktu "
|
||||||
|
placeholder="Masukan tangal dan waktu acara"
|
||||||
|
onChange={(val: any) =>
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
tanggal: val,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Textarea
|
||||||
|
label="Deskripsi"
|
||||||
|
placeholder="Deskripsikan acara yang akan di selenggarakan"
|
||||||
|
withAsterisk
|
||||||
|
maxLength={500}
|
||||||
|
autosize
|
||||||
|
onChange={(val) =>
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
deskripsi: val.target.value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
mt={"xl"}
|
||||||
|
onClick={() => onSave(router, setTabsStatus, value, setHotMenu)}
|
||||||
|
>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onSave(
|
||||||
|
router: AppRouterInstance,
|
||||||
|
setTabsStatus: any,
|
||||||
|
value: any,
|
||||||
|
setHotMenu: any
|
||||||
|
) {
|
||||||
|
await Event_funCreate(value).then((res) => {
|
||||||
|
if (res.status === 201) {
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
setTabsStatus("Review");
|
||||||
|
setHotMenu(1)
|
||||||
|
router.push(RouterEvent.status_page);
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
19
src/app_modules/event/create/layout.tsx
Normal file
19
src/app_modules/event/create/layout.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppShell } from "@mantine/core";
|
||||||
|
import React from "react";
|
||||||
|
import ComponentEvent_HeaderTamplate from "../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function LayoutEvent_Create({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell header={<ComponentEvent_HeaderTamplate title="Tambah Event" />}>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
61
src/app_modules/event/detail/draft/index.tsx
Normal file
61
src/app_modules/event/detail/draft/index.tsx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Button, Stack } from "@mantine/core";
|
||||||
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { gs_event_status } from "../../global_state";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
import { useState } from "react";
|
||||||
|
import ComponentEvent_CatatanReject from "../../component/catatan_reject";
|
||||||
|
|
||||||
|
export default function Event_DetailDraft({
|
||||||
|
dataEvent,
|
||||||
|
}: {
|
||||||
|
dataEvent: MODEL_EVENT;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <pre>{JSON.stringify(dataEvent.catatan)}</pre> */}
|
||||||
|
<Stack spacing={"lg"}>
|
||||||
|
{dataEvent.catatan ? (
|
||||||
|
<ComponentEvent_CatatanReject catatan={dataEvent.catatan} />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
<ComponentEvent_DetailData data={dataEvent} />
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
color="yellow"
|
||||||
|
onClick={() => {
|
||||||
|
onClick(router, setTabsStatus, dataEvent.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Ajukan Review
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onClick(
|
||||||
|
router: AppRouterInstance,
|
||||||
|
setTabsStatus: any,
|
||||||
|
eventId: string
|
||||||
|
) {
|
||||||
|
await Event_funEditStatusById("2", eventId).then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message, 1500);
|
||||||
|
setTabsStatus("Review");
|
||||||
|
router.back();
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
25
src/app_modules/event/detail/draft/layout.tsx
Normal file
25
src/app_modules/event/detail/draft/layout.tsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppShell } from "@mantine/core";
|
||||||
|
import React from "react";
|
||||||
|
import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
import { IconEdit } from "@tabler/icons-react";
|
||||||
|
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||||
|
|
||||||
|
export default function LayoutEvent_DetailDraft({
|
||||||
|
children,
|
||||||
|
eventId
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
eventId: string
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell
|
||||||
|
header={<ComponentEvent_HeaderTamplate title="Detail Draft" icon={<IconEdit/>} route2={RouterEvent.edit + eventId}/>}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
63
src/app_modules/event/detail/kontribusi/index.tsx
Normal file
63
src/app_modules/event/detail/kontribusi/index.tsx
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Avatar,
|
||||||
|
Center,
|
||||||
|
Divider,
|
||||||
|
Grid,
|
||||||
|
Paper,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
|
import { MODEL_EVENT, MODEL_EVENT_PESERTA } from "../../model/interface";
|
||||||
|
import { useState } from "react";
|
||||||
|
import ComponentEvent_DetailMainData from "../../component/detail/detail_main";
|
||||||
|
import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
|
||||||
|
|
||||||
|
export default function Event_DetailKontribusi({
|
||||||
|
dataEvent,
|
||||||
|
listKontributor,
|
||||||
|
totalPeserta,
|
||||||
|
}: {
|
||||||
|
dataEvent: MODEL_EVENT;
|
||||||
|
listKontributor: MODEL_EVENT_PESERTA[];
|
||||||
|
totalPeserta: number;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"lg"}>
|
||||||
|
<ComponentEvent_DetailMainData data={dataEvent} />
|
||||||
|
<ComponentEvent_ListPeserta
|
||||||
|
listPeserta={listKontributor}
|
||||||
|
total={totalPeserta}
|
||||||
|
/>
|
||||||
|
{/* <Paper withBorder mt={"lg"} shadow="lg">
|
||||||
|
<Stack spacing={"md"} p={"md"}>
|
||||||
|
<Center>
|
||||||
|
<Title order={5}>Daftar Peserta</Title>
|
||||||
|
</Center>
|
||||||
|
|
||||||
|
{peserta
|
||||||
|
.map((e, i) => (
|
||||||
|
<Stack key={i} spacing={"sm"}>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={2}>
|
||||||
|
<Avatar radius={"xl"} bg={"gray"} size={"md"} />
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Stack justify="center" h={"100%"}>
|
||||||
|
<Text>Nama peserta</Text>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Divider />
|
||||||
|
</Stack>
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
</Paper> */}
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
21
src/app_modules/event/detail/kontribusi/layout.tsx
Normal file
21
src/app_modules/event/detail/kontribusi/layout.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppShell } from "@mantine/core";
|
||||||
|
import React from "react";
|
||||||
|
import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function LayoutEvent_DetailKontribusi({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell
|
||||||
|
header={<ComponentEvent_HeaderTamplate title="Detail Kontibutor" />}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
145
src/app_modules/event/detail/main_detail/index.tsx
Normal file
145
src/app_modules/event/detail/main_detail/index.tsx
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Avatar,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Divider,
|
||||||
|
Grid,
|
||||||
|
Paper,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
|
import { MODEL_EVENT, MODEL_EVENT_PESERTA } from "../../model/interface";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { Event_funJoinEvent } from "../../fun/create/fun_join_event";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { Event_getListPesertaById } from "../../fun/get/get_list_peserta_by_id";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||||
|
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||||
|
import ComponentEvent_DetailMainData from "../../component/detail/detail_main";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { Event_countTotalPesertaById } from "../../fun/count/count_total_peserta_by_id";
|
||||||
|
import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
|
||||||
|
|
||||||
|
export default function Event_DetailMain({
|
||||||
|
dataEvent,
|
||||||
|
listPeserta,
|
||||||
|
userLoginId,
|
||||||
|
isJoin,
|
||||||
|
totalPeserta,
|
||||||
|
}: {
|
||||||
|
dataEvent: MODEL_EVENT;
|
||||||
|
listPeserta: MODEL_EVENT_PESERTA[];
|
||||||
|
userLoginId: string;
|
||||||
|
isJoin: boolean;
|
||||||
|
totalPeserta: number;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [total, setTotal] = useState(totalPeserta);
|
||||||
|
const [peserta, setPeserta] = useState(listPeserta);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"lg"}>
|
||||||
|
<ComponentEvent_DetailMainData data={dataEvent} />
|
||||||
|
{isJoin ? (
|
||||||
|
<Button disabled radius={"xl"} color="green">
|
||||||
|
Anda Telah Ikut Serta
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
color="green"
|
||||||
|
onClick={() => {
|
||||||
|
onJoin(userLoginId, dataEvent.id, setPeserta, setTotal);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
JOIN
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<ComponentEvent_ListPeserta listPeserta={listPeserta} total={total} />
|
||||||
|
{/* <Paper withBorder mt={"lg"}>
|
||||||
|
<Stack spacing={"md"} p={"md"}>
|
||||||
|
<Center>
|
||||||
|
<Title order={5}>Daftar Peserta ({total})</Title>
|
||||||
|
</Center>
|
||||||
|
|
||||||
|
{_.isEmpty(peserta) ? (
|
||||||
|
<Center>
|
||||||
|
<Text fz={"xs"} fw={"bold"}>
|
||||||
|
- Tidak ada peserta -
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
) : (
|
||||||
|
<Stack>
|
||||||
|
{peserta.map((e, i) => (
|
||||||
|
<Stack key={i} spacing={"sm"}>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col
|
||||||
|
span={"content"}
|
||||||
|
onClick={() => {
|
||||||
|
router.push(
|
||||||
|
RouterProfile.katalog + e.User.Profile.id
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Avatar
|
||||||
|
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
|
||||||
|
radius={"xl"}
|
||||||
|
bg={"gray"}
|
||||||
|
size={30}
|
||||||
|
src={
|
||||||
|
RouterProfile.api_foto_profile +
|
||||||
|
e.User.Profile.imagesId
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Stack justify="center" h={"100%"}>
|
||||||
|
<Text>{e.User.Profile.name}</Text>
|
||||||
|
</Stack>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Divider />
|
||||||
|
</Stack>
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</Paper> */}
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onJoin(
|
||||||
|
userId: string,
|
||||||
|
eventId: string,
|
||||||
|
setPeserta: any,
|
||||||
|
setTotal: any
|
||||||
|
) {
|
||||||
|
const body = {
|
||||||
|
userId: userId,
|
||||||
|
eventId: eventId,
|
||||||
|
};
|
||||||
|
|
||||||
|
await Event_funJoinEvent(body as any).then(async (res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
await Event_getListPesertaById(eventId).then(async (val) => {
|
||||||
|
await Event_countTotalPesertaById(eventId).then((ttl) => {
|
||||||
|
setPeserta(val);
|
||||||
|
setTotal(ttl);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
19
src/app_modules/event/detail/main_detail/layout.tsx
Normal file
19
src/app_modules/event/detail/main_detail/layout.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppShell } from "@mantine/core";
|
||||||
|
import React from "react";
|
||||||
|
import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function LayoutEvent_DetailMain({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell header={<ComponentEvent_HeaderTamplate title="Detail Event" />}>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
14
src/app_modules/event/detail/publish/index.tsx
Normal file
14
src/app_modules/event/detail/publish/index.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Button, Grid, Group, Stack, Text, Title } from "@mantine/core";
|
||||||
|
import moment from "moment";
|
||||||
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
|
||||||
|
export default function Event_DetailPublish({dataEvent}: {dataEvent: MODEL_EVENT}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ComponentEvent_DetailData data={dataEvent}/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
21
src/app_modules/event/detail/publish/layout.tsx
Normal file
21
src/app_modules/event/detail/publish/layout.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppShell } from "@mantine/core";
|
||||||
|
import React from "react";
|
||||||
|
import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function LayoutEvent_DetailPublish({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell
|
||||||
|
header={<ComponentEvent_HeaderTamplate title="Detail Publish" />}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
109
src/app_modules/event/detail/reject/index.tsx
Normal file
109
src/app_modules/event/detail/reject/index.tsx
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Grid,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
Paper,
|
||||||
|
SimpleGrid,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { gs_event_status } from "../../global_state";
|
||||||
|
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 { useDisclosure } from "@mantine/hooks";
|
||||||
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
import ComponentEvent_CatatanReject from "../../component/catatan_reject";
|
||||||
|
import { Event_funDeleteById } from "../../fun/delete/fun_delete";
|
||||||
|
|
||||||
|
export default function Event_DetailReject({
|
||||||
|
dataEvent,
|
||||||
|
}: {
|
||||||
|
dataEvent: MODEL_EVENT;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"lg"}>
|
||||||
|
<ComponentEvent_CatatanReject catatan={dataEvent.catatan} />
|
||||||
|
<ComponentEvent_DetailData data={dataEvent} />
|
||||||
|
<SimpleGrid cols={2}>
|
||||||
|
<Button
|
||||||
|
w={"100%"}
|
||||||
|
radius={"xl"}
|
||||||
|
color="yellow"
|
||||||
|
onClick={() => onUpdate(router, setTabsStatus, dataEvent.id)}
|
||||||
|
>
|
||||||
|
Edit Kembali
|
||||||
|
</Button>
|
||||||
|
<Button w={"100%"} radius={"xl"} color="red" onClick={() => open()}>
|
||||||
|
Hapus
|
||||||
|
</Button>
|
||||||
|
</SimpleGrid>
|
||||||
|
</Stack>
|
||||||
|
<Modal opened={opened} onClose={close} centered withCloseButton={false}>
|
||||||
|
<Stack>
|
||||||
|
<Title order={6}>Yakin akan menghapus event ini?</Title>
|
||||||
|
<Group position="center">
|
||||||
|
<Button radius={"xl"} onClick={close}>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
onDelete(router, dataEvent.id, close);
|
||||||
|
close();
|
||||||
|
router.back();
|
||||||
|
}}
|
||||||
|
color="red"
|
||||||
|
>
|
||||||
|
Hapus
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onUpdate(
|
||||||
|
router: AppRouterInstance,
|
||||||
|
setTabsStatus: any,
|
||||||
|
eventId: string
|
||||||
|
) {
|
||||||
|
await Event_funEditStatusById("3", eventId).then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
setTabsStatus("Draft");
|
||||||
|
router.back();
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onDelete(
|
||||||
|
router: AppRouterInstance,
|
||||||
|
eventId: string,
|
||||||
|
close: any
|
||||||
|
) {
|
||||||
|
await Event_funDeleteById(eventId).then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
21
src/app_modules/event/detail/reject/layout.tsx
Normal file
21
src/app_modules/event/detail/reject/layout.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppShell } from "@mantine/core";
|
||||||
|
import React from "react";
|
||||||
|
import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function LayoutEvent_DetailReject({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell
|
||||||
|
header={<ComponentEvent_HeaderTamplate title="Detail Reject" />}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
53
src/app_modules/event/detail/review/index.tsx
Normal file
53
src/app_modules/event/detail/review/index.tsx
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { Button, Stack } from "@mantine/core";
|
||||||
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { gs_event_status } from "../../global_state";
|
||||||
|
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 { MODEL_EVENT } from "../../model/interface";
|
||||||
|
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
import ComponentEvent_CatatanReject from "../../component/catatan_reject";
|
||||||
|
|
||||||
|
export default function Event_DetailReview({
|
||||||
|
dataEvent,
|
||||||
|
}: {
|
||||||
|
dataEvent: MODEL_EVENT;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"xl"}>
|
||||||
|
<ComponentEvent_DetailData data={dataEvent} />
|
||||||
|
<Button
|
||||||
|
radius={"xl"}
|
||||||
|
color={"red"}
|
||||||
|
onClick={() => onClick(router, setTabsStatus, dataEvent.id)}
|
||||||
|
>
|
||||||
|
Batalkan Review
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onClick(
|
||||||
|
router: AppRouterInstance,
|
||||||
|
setTabsStatus: any,
|
||||||
|
eventId: string
|
||||||
|
) {
|
||||||
|
await Event_funEditStatusById("3", eventId).then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message, 1500);
|
||||||
|
setTabsStatus("Draft");
|
||||||
|
router.back();
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
21
src/app_modules/event/detail/review/layout.tsx
Normal file
21
src/app_modules/event/detail/review/layout.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppShell } from "@mantine/core";
|
||||||
|
import React from "react";
|
||||||
|
import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function LayoutEvent_DetailReview({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell
|
||||||
|
header={<ComponentEvent_HeaderTamplate title="Detail Review" />}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
76
src/app_modules/event/detail/riwayat/index.tsx
Normal file
76
src/app_modules/event/detail/riwayat/index.tsx
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Avatar,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Divider,
|
||||||
|
Grid,
|
||||||
|
Paper,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
|
import { MODEL_EVENT, MODEL_EVENT_PESERTA } from "../../model/interface";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { Event_funJoinEvent } from "../../fun/create/fun_join_event";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { Event_getListPesertaById } from "../../fun/get/get_list_peserta_by_id";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||||
|
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||||
|
import ComponentEvent_DetailMainData from "../../component/detail/detail_main";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { Event_countTotalPesertaById } from "../../fun/count/count_total_peserta_by_id";
|
||||||
|
import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
|
||||||
|
|
||||||
|
export default function Event_DetailRiwayat({
|
||||||
|
dataEvent,
|
||||||
|
listPeserta,
|
||||||
|
totalPeserta,
|
||||||
|
}: {
|
||||||
|
dataEvent: MODEL_EVENT;
|
||||||
|
listPeserta: MODEL_EVENT_PESERTA[];
|
||||||
|
totalPeserta: number;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [total, setTotal] = useState(totalPeserta);
|
||||||
|
const [peserta, setPeserta] = useState(listPeserta);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"lg"}>
|
||||||
|
<ComponentEvent_DetailMainData data={dataEvent} />
|
||||||
|
<ComponentEvent_ListPeserta listPeserta={listPeserta} total={total} />
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onJoin(
|
||||||
|
userId: string,
|
||||||
|
eventId: string,
|
||||||
|
setPeserta: any,
|
||||||
|
setTotal: any
|
||||||
|
) {
|
||||||
|
const body = {
|
||||||
|
userId: userId,
|
||||||
|
eventId: eventId,
|
||||||
|
};
|
||||||
|
|
||||||
|
await Event_funJoinEvent(body as any).then(async (res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
await Event_getListPesertaById(eventId).then(async (val) => {
|
||||||
|
await Event_countTotalPesertaById(eventId).then((ttl) => {
|
||||||
|
setPeserta(val);
|
||||||
|
setTotal(ttl);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
19
src/app_modules/event/detail/riwayat/layout.tsx
Normal file
19
src/app_modules/event/detail/riwayat/layout.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppShell } from "@mantine/core";
|
||||||
|
import React from "react";
|
||||||
|
import ComponentEvent_HeaderTamplate from "../../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function LayoutEvent_DetailRiwayat({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell header={<ComponentEvent_HeaderTamplate title="Detail Riwayat" />}>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
115
src/app_modules/event/edit/index.tsx
Normal file
115
src/app_modules/event/edit/index.tsx
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { Stack, TextInput, Textarea, Button, Select } from "@mantine/core";
|
||||||
|
import { DateTimePicker } from "@mantine/dates";
|
||||||
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { MODEL_EVENT } from "../model/interface";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
||||||
|
import { Event_funEditById } from "../fun/edit/fun_edit_by_id";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
|
||||||
|
export default function Event_Edit({
|
||||||
|
dataEvent,
|
||||||
|
listTipeAcara,
|
||||||
|
}: {
|
||||||
|
dataEvent: MODEL_EVENT;
|
||||||
|
listTipeAcara: MODEL_DEFAULT_MASTER[];
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [value, setValue] = useState(dataEvent);
|
||||||
|
const [tipe, setTipe] = useState(listTipeAcara);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
|
||||||
|
<Stack px={"sm"}>
|
||||||
|
<TextInput
|
||||||
|
label="Judul"
|
||||||
|
placeholder="Masukan judul"
|
||||||
|
withAsterisk
|
||||||
|
value={value.title}
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
title: val.target.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Select
|
||||||
|
label="Tipe Acara"
|
||||||
|
placeholder="Pilih Tipe Acara"
|
||||||
|
data={tipe.map((e) => ({
|
||||||
|
value: e.id,
|
||||||
|
label: e.name,
|
||||||
|
}))}
|
||||||
|
value={value.EventMaster_TipeAcara.id}
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...(value as any),
|
||||||
|
EventMaster_TipeAcara: {
|
||||||
|
id: val,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextInput
|
||||||
|
label="Lokasi"
|
||||||
|
placeholder="Masukan lokasi acara"
|
||||||
|
withAsterisk
|
||||||
|
value={value.lokasi}
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
lokasi: val.target.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<DateTimePicker
|
||||||
|
withAsterisk
|
||||||
|
label="Tanggal & Waktu "
|
||||||
|
placeholder="Masukan tangal dan waktu acara"
|
||||||
|
value={value.tanggal}
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...(value as any),
|
||||||
|
tanggal: val,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Textarea
|
||||||
|
label="Deskripsi"
|
||||||
|
placeholder="Deskripsikan acara yang akan di selenggarakan"
|
||||||
|
withAsterisk
|
||||||
|
autosize
|
||||||
|
maxLength={500}
|
||||||
|
value={value.deskripsi}
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
deskripsi: val.target.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button radius={"xl"} mt={"xl"} onClick={() => onUpdate(router, value)}>
|
||||||
|
Update
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onUpdate(router: AppRouterInstance, value: MODEL_EVENT) {
|
||||||
|
await Event_funEditById(value).then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
router.back();
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
19
src/app_modules/event/edit/layout.tsx
Normal file
19
src/app_modules/event/edit/layout.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppShell } from "@mantine/core";
|
||||||
|
import React from "react";
|
||||||
|
import ComponentEvent_HeaderTamplate from "../component/header_tamplate";
|
||||||
|
|
||||||
|
export default function LayoutEvent_Edit({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<AppShell header={<ComponentEvent_HeaderTamplate title="Edit Event" />}>
|
||||||
|
{children}
|
||||||
|
</AppShell>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
13
src/app_modules/event/fun/count/count_total_peserta_by_id.ts
Normal file
13
src/app_modules/event/fun/count/count_total_peserta_by_id.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export async function Event_countTotalPesertaById(eventId: string) {
|
||||||
|
const data = await prisma.event_Peserta.count({
|
||||||
|
where: {
|
||||||
|
eventId: eventId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
25
src/app_modules/event/fun/create/fun_create.ts
Normal file
25
src/app_modules/event/fun/create/fun_create.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
export async function Event_funCreate(req: MODEL_EVENT) {
|
||||||
|
const res = await prisma.event.create({
|
||||||
|
data: {
|
||||||
|
title: req.title,
|
||||||
|
lokasi: req.lokasi,
|
||||||
|
deskripsi: req.deskripsi,
|
||||||
|
eventMaster_TipeAcaraId: req.eventMaster_TipeAcaraId,
|
||||||
|
tanggal: req.tanggal,
|
||||||
|
authorId: req.authorId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res) return { status: 400, message: "Gagal Disimpan" };
|
||||||
|
revalidatePath("/dev/event/main/status_page");
|
||||||
|
return {
|
||||||
|
status: 201,
|
||||||
|
message: "Berhasil Disimpan",
|
||||||
|
};
|
||||||
|
}
|
||||||
21
src/app_modules/event/fun/create/fun_join_event.ts
Normal file
21
src/app_modules/event/fun/create/fun_join_event.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
export async function Event_funJoinEvent(data: MODEL_EVENT_PESERTA) {
|
||||||
|
const crt = await prisma.event_Peserta.create({
|
||||||
|
data: {
|
||||||
|
eventId: data.eventId,
|
||||||
|
userId: data.userId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!crt) return { status: 400, message: "Gagal Join" };
|
||||||
|
revalidatePath("/dev/event/detail/main");
|
||||||
|
return {
|
||||||
|
status: 200,
|
||||||
|
message: "Berhasil Join",
|
||||||
|
};
|
||||||
|
}
|
||||||
19
src/app_modules/event/fun/delete/fun_delete.ts
Normal file
19
src/app_modules/event/fun/delete/fun_delete.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
export async function Event_funDeleteById(eventId: string) {
|
||||||
|
const del = await prisma.event.delete({
|
||||||
|
where: {
|
||||||
|
id: eventId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!del) return { status: 400, message: "Gagal hapus data" };
|
||||||
|
revalidatePath("/dev/event/main/status_page");
|
||||||
|
return {
|
||||||
|
status: 200,
|
||||||
|
message: "Hapus data berhasil",
|
||||||
|
};
|
||||||
|
}
|
||||||
27
src/app_modules/event/fun/edit/fun_edit_by_id.ts
Normal file
27
src/app_modules/event/fun/edit/fun_edit_by_id.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { MODEL_EVENT } from "../../model/interface";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
export async function Event_funEditById(data: MODEL_EVENT) {
|
||||||
|
const updt = await prisma.event.update({
|
||||||
|
where: {
|
||||||
|
id: data.id,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
title: data.title,
|
||||||
|
lokasi: data.lokasi,
|
||||||
|
deskripsi: data.deskripsi,
|
||||||
|
tanggal: data.tanggal,
|
||||||
|
eventMaster_TipeAcaraId: data.EventMaster_TipeAcara.id as any,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!updt) return { status: 400, message: "Update Gagal" };
|
||||||
|
revalidatePath("/dev/event/detail/event");
|
||||||
|
return {
|
||||||
|
status: 200,
|
||||||
|
message: "Berhasil Update",
|
||||||
|
};
|
||||||
|
}
|
||||||
29
src/app_modules/event/fun/edit/fun_edit_status_by_id.ts
Normal file
29
src/app_modules/event/fun/edit/fun_edit_status_by_id.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param statusid | Review: 2, Draft: 3, Reject: 4
|
||||||
|
* @param eventId
|
||||||
|
* @type string
|
||||||
|
* @returns Update status id dari setiap event
|
||||||
|
*/
|
||||||
|
export async function Event_funEditStatusById(statusid: string, eventId: string) {
|
||||||
|
const updt = await prisma.event.update({
|
||||||
|
where: {
|
||||||
|
id: eventId,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
eventMaster_StatusId: statusid,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!updt) return { status: 400, message: "Gagal Update Status" };
|
||||||
|
revalidatePath("/dev/event/main/status_page");
|
||||||
|
return {
|
||||||
|
status: 200,
|
||||||
|
message: "Berhasil Update Status",
|
||||||
|
};
|
||||||
|
}
|
||||||
18
src/app_modules/event/fun/get/cek_user_join_by_id.ts
Normal file
18
src/app_modules/event/fun/get/cek_user_join_by_id.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export async function Event_CekUserJoinById(eventId: string, userId: string) {
|
||||||
|
const cek = await prisma.event_Peserta.count({
|
||||||
|
where: {
|
||||||
|
eventId: eventId,
|
||||||
|
userId: userId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (cek > 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
75
src/app_modules/event/fun/get/get_event_by_status_id.ts
Normal file
75
src/app_modules/event/fun/get/get_event_by_status_id.ts
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export async function Event_getByStatusId(statusId: string, authorId: string) {
|
||||||
|
if (statusId === "1") {
|
||||||
|
const data = await prisma.event.findMany({
|
||||||
|
orderBy: {
|
||||||
|
tanggal: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
eventMaster_StatusId: "1",
|
||||||
|
authorId: authorId,
|
||||||
|
tanggal: {
|
||||||
|
gte: new Date(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
deskripsi: true,
|
||||||
|
tanggal: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
if (statusId === "2") {
|
||||||
|
const data = await prisma.event.findMany({
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
eventMaster_StatusId: "2",
|
||||||
|
authorId: authorId,
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
deskripsi: true,
|
||||||
|
tanggal: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
if (statusId === "3") {
|
||||||
|
const data = await prisma.event.findMany({
|
||||||
|
where: {
|
||||||
|
eventMaster_StatusId: "3",
|
||||||
|
authorId: authorId,
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
deskripsi: true,
|
||||||
|
tanggal: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
if (statusId === "4") {
|
||||||
|
const data = await prisma.event.findMany({
|
||||||
|
where: {
|
||||||
|
eventMaster_StatusId: "4",
|
||||||
|
authorId: authorId,
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
deskripsi: true,
|
||||||
|
tanggal: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
src/app_modules/event/fun/get/get_list_all_publish.ts
Normal file
35
src/app_modules/event/fun/get/get_list_all_publish.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
|
export async function Event_getListAllPublish() {
|
||||||
|
const data = 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,
|
||||||
|
active: true,
|
||||||
|
catatan: true,
|
||||||
|
authorId: true,
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export async function Event_getListKontibusiByUserId(userId: string) {
|
||||||
|
const data = await prisma.event_Peserta.findMany({
|
||||||
|
where: {
|
||||||
|
userId: userId,
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
Event: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
tanggal: true,
|
||||||
|
deskripsi: true,
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Event_Peserta: {
|
||||||
|
take: 5,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
userId: true,
|
||||||
|
User: {
|
||||||
|
select: {
|
||||||
|
Profile: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// console.log(data);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
27
src/app_modules/event/fun/get/get_list_peserta_by_id.ts
Normal file
27
src/app_modules/event/fun/get/get_list_peserta_by_id.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export async function Event_getListPesertaById(eventId: string) {
|
||||||
|
const data = await prisma.event_Peserta.findMany({
|
||||||
|
where: {
|
||||||
|
eventId: eventId,
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
active: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: true,
|
||||||
|
userId: true,
|
||||||
|
User: {
|
||||||
|
select: {
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// Event: true,
|
||||||
|
eventId: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
34
src/app_modules/event/fun/get/get_list_riwayat_saya.ts
Normal file
34
src/app_modules/event/fun/get/get_list_riwayat_saya.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
|
export async function Event_getListRiwayatSaya(authorId: string) {
|
||||||
|
const data = await prisma.event.findMany({
|
||||||
|
orderBy: {
|
||||||
|
tanggal: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
authorId: authorId,
|
||||||
|
eventMaster_StatusId: "1",
|
||||||
|
tanggal: {
|
||||||
|
lte: new Date(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
tanggal: true,
|
||||||
|
deskripsi: true,
|
||||||
|
active: true,
|
||||||
|
authorId: true,
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user