# Event Join
## feat - Join event - kontribusi event - histoty in progress ### No Issue
This commit is contained in:
@@ -26,6 +26,8 @@ model User {
|
||||
Donasi Donasi[]
|
||||
Donasi_Invoice Donasi_Invoice[]
|
||||
Donasi_Notif Donasi_Notif[]
|
||||
Event Event[]
|
||||
Event_Peserta Event_Peserta[]
|
||||
}
|
||||
|
||||
model MasterUserRole {
|
||||
@@ -478,3 +480,55 @@ model Donasi_PencairanDana {
|
||||
Images Images? @relation(fields: [imagesId], references: [id])
|
||||
imagesId String?
|
||||
}
|
||||
|
||||
// ========================================= EVENT ========================================= //
|
||||
|
||||
model Event {
|
||||
id String @id @default(cuid())
|
||||
title String
|
||||
lokasi String
|
||||
tanggal DateTime
|
||||
deskripsi String
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
catatan String?
|
||||
|
||||
Author User? @relation(fields: [authorId], references: [id])
|
||||
authorId String?
|
||||
EventMaster_Status EventMaster_Status? @relation(fields: [eventMaster_StatusId], references: [id])
|
||||
eventMaster_StatusId String? @default("2")
|
||||
Event_Peserta Event_Peserta[]
|
||||
EventMaster_TipeAcara EventMaster_TipeAcara? @relation(fields: [eventMaster_TipeAcaraId], references: [id])
|
||||
eventMaster_TipeAcaraId Int?
|
||||
}
|
||||
|
||||
model EventMaster_TipeAcara {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
Event Event[]
|
||||
}
|
||||
|
||||
model EventMaster_Status {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
Event Event[]
|
||||
}
|
||||
|
||||
model Event_Peserta {
|
||||
id String @id @default(cuid())
|
||||
active Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
Event Event? @relation(fields: [eventId], references: [id])
|
||||
eventId String?
|
||||
User User? @relation(fields: [userId], references: [id])
|
||||
userId String?
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ import userSeeder from "../../../bin/seeder/user_seeder.json";
|
||||
import donasi_status from "../../../bin/seeder/donasi/master_status.json";
|
||||
import donasi_kategori from "../../../bin/seeder/donasi/master_kategori.json";
|
||||
import donasi_durasi from "../../../bin/seeder/donasi/master_durasi.json";
|
||||
import donasi_namaBank from "../../../bin/seeder/donasi/master_bank.json"
|
||||
import donasi_status_invoice from "../../../bin/seeder/donasi/master_status_invoice.json"
|
||||
import donasi_namaBank from "../../../bin/seeder/donasi/master_bank.json";
|
||||
import donasi_status_invoice from "../../../bin/seeder/donasi/master_status_invoice.json";
|
||||
import event_status from "../../../bin/seeder/event/master_status.json";
|
||||
import event_tipe_acara from "../../../bin/seeder/event/master_tipe_acara.json";
|
||||
|
||||
export async function GET(req: Request) {
|
||||
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 });
|
||||
}
|
||||
|
||||
|
||||
20
src/app/dev/admin/event/main/page.tsx
Normal file
20
src/app/dev/admin/event/main/page.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { AdminEvent_Main } from "@/app_modules/admin/event";
|
||||
import AdminEvent_funCountByStatusId from "@/app_modules/admin/event/fun/count/fun_count_event_by_status_id";
|
||||
|
||||
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");
|
||||
|
||||
return (
|
||||
<>
|
||||
<AdminEvent_Main
|
||||
countPublish={countPublish as number}
|
||||
countReview={countReview as number}
|
||||
countDraft={countDraft as number}
|
||||
countReject={countReject 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}/>
|
||||
</>
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Event_Create } from "@/app_modules/event";
|
||||
import { Event_getListUser } from "@/app_modules/event/fun/get/get_list_user";
|
||||
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 listUser = await Event_getListUser();
|
||||
const userId = await User_getUserId()
|
||||
const listTipeAcara = await Event_getMasterTipeAcara();
|
||||
|
||||
return <Event_Create listUser={listUser as any} />;
|
||||
return <Event_Create listTipeAcara={listTipeAcara as any} authorId={userId}/>;
|
||||
}
|
||||
|
||||
@@ -1,11 +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 };
|
||||
}) {
|
||||
return <LayoutEvent_DetailDraft>{children}</LayoutEvent_DetailDraft>;
|
||||
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} />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { Event_DetailDraft } from "@/app_modules/event";
|
||||
|
||||
export default async function Page() {
|
||||
return <Event_DetailDraft />;
|
||||
}
|
||||
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}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Event_DetailKontribusi } from "@/app_modules/event";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<Event_DetailKontribusi />
|
||||
</>
|
||||
);
|
||||
}
|
||||
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}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { Event_DetailMain } from "@/app_modules/event";
|
||||
|
||||
export default async function Page() {
|
||||
return <>
|
||||
<Event_DetailMain/>
|
||||
</>
|
||||
}
|
||||
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} />;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { Event_DetailPublish } from "@/app_modules/event";
|
||||
|
||||
export default async function Page() {
|
||||
return <Event_DetailPublish />;
|
||||
}
|
||||
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}/>;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { Event_DetailReject } from "@/app_modules/event";
|
||||
|
||||
export default async function Page() {
|
||||
return <Event_DetailReject />;
|
||||
}
|
||||
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}/>;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import { Event_DetailReview } from "@/app_modules/event";
|
||||
|
||||
|
||||
export default async function Page() {
|
||||
return <Event_DetailReview />;
|
||||
}
|
||||
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}/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { Event_Edit } from "@/app_modules/event";
|
||||
|
||||
export default async function Page() {
|
||||
return<>
|
||||
<Event_Edit/>
|
||||
</>
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
"use client";
|
||||
|
||||
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()
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<>
|
||||
<Event_Beranda />
|
||||
<Event_Beranda dataEvent={dataEvent as any}/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
7
src/app/dev/event/main/history/page.tsx
Normal file
7
src/app/dev/event/main/history/page.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Event_History } from "@/app_modules/event";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let eventId = params.id;
|
||||
console.log(eventId);
|
||||
return <Event_History />;
|
||||
}
|
||||
@@ -1,8 +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() {
|
||||
return<>
|
||||
<Event_Kontribusi/>
|
||||
const userLoginId = await User_getUserId();
|
||||
const listKontribusi = await Event_getListKontibusiByUserId(userLoginId)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Event_Kontribusi listKontribusi={listKontribusi as any}/>
|
||||
</>
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
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() {
|
||||
return <Event_StatusPage/>
|
||||
}
|
||||
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
|
||||
listPublish={listPublish}
|
||||
listReview={listReview}
|
||||
listDraft={listDraft}
|
||||
listReject={listReject}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
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 = {
|
||||
|
||||
api_gambar_bukti_transfer: "/api/donasi/gambar_bukti_transfer/",
|
||||
|
||||
|
||||
main_donasi: "/dev/admin/donasi/main",
|
||||
// table
|
||||
table_publish: "/dev/admin/donasi/table/publish",
|
||||
table_review: "/dev/admin/donasi/table/review",
|
||||
table_reject: "/dev/admin/donasi/table/reject",
|
||||
|
||||
|
||||
// detail
|
||||
detail_publish: "/dev/admin/donasi/detail/publish/",
|
||||
detail_review: "/dev/admin/donasi/detail/review/",
|
||||
@@ -33,14 +30,11 @@ export const RouterAdminDonasi = {
|
||||
|
||||
// proses
|
||||
proses_transaksi: "/dev/admin/donasi/proses_transaksi/",
|
||||
pencairan_dana :"/dev/admin/donasi/pencairan_dana/",
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
pencairan_dana: "/dev/admin/donasi/pencairan_dana/",
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const RouterAdminAward = {
|
||||
main_award: "/dev/admin/award/main",
|
||||
};
|
||||
|
||||
@@ -2,10 +2,11 @@ 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",
|
||||
history: "/dev/event/main/history",
|
||||
|
||||
// status
|
||||
status_page: "/dev/event/main/status_page",
|
||||
status_publish: "/dev/event/main/status_page/publish",
|
||||
status_review: "/dev/event/main/status_page/review",
|
||||
status_draft: "/dev/event/main/status_page/draft",
|
||||
@@ -15,13 +16,13 @@ export const RouterEvent = {
|
||||
create: "/dev/event/create",
|
||||
|
||||
// edit
|
||||
edit: "/dev/event/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_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/",
|
||||
};
|
||||
|
||||
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";
|
||||
|
||||
/**
|
||||
* @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)
|
||||
@@ -0,0 +1,50 @@
|
||||
"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",
|
||||
},
|
||||
});
|
||||
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,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,142 @@
|
||||
"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: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "1",
|
||||
},
|
||||
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;
|
||||
}
|
||||
}
|
||||
11
src/app_modules/admin/event/index.tsx
Normal file
11
src/app_modules/admin/event/index.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
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";
|
||||
|
||||
export {
|
||||
AdminEvent_Main,
|
||||
AdminEvent_TableReview,
|
||||
AdminEvent_TablePublish,
|
||||
AdminEvent_TableReject,
|
||||
};
|
||||
107
src/app_modules/admin/event/main/index.tsx
Normal file
107
src/app_modules/admin/event/main/index.tsx
Normal file
@@ -0,0 +1,107 @@
|
||||
"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,
|
||||
}: {
|
||||
countPublish: number;
|
||||
countReview: number;
|
||||
countDraft: number;
|
||||
countReject: number;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const listBox = [
|
||||
{
|
||||
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",
|
||||
},
|
||||
];
|
||||
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" },
|
||||
]}
|
||||
>
|
||||
{listBox.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>
|
||||
</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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import { Logout } from "@/app_modules/auth";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_adminDonasi_hotMenu } from "../../donasi/global_state";
|
||||
import Admin_Logout from "../../component/logout";
|
||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||
|
||||
export default function AdminLayout({
|
||||
children,
|
||||
@@ -62,6 +63,11 @@ export default function AdminLayout({
|
||||
name: "Donasi",
|
||||
route: RouterAdminDonasi.main_donasi,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Event",
|
||||
route: RouterAdminEvent.main_event,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,28 +3,31 @@
|
||||
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), 2000)
|
||||
setTimeout(() => {
|
||||
router.push(RouterAdminDashboard.main_admin);
|
||||
setActive(0);
|
||||
}, 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>
|
||||
<Center h={"100vh"}>
|
||||
<Stack spacing={0} >
|
||||
<Title>Welcome Admin</Title>
|
||||
</Center>
|
||||
|
||||
<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 { Warna } from "@/app/lib/warna";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
|
||||
export default function User_Logout() {
|
||||
const router = useRouter();
|
||||
@@ -24,6 +25,7 @@ export default function User_Logout() {
|
||||
setnomor(null);
|
||||
setCode(null);
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil("Anda Berhasil Logout")
|
||||
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,6 +1,6 @@
|
||||
import { MODEL_USER } from "@/app_modules/home/model/interface";
|
||||
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 {
|
||||
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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { Stack, Title, Grid, Text, Paper } from "@mantine/core";
|
||||
import moment from "moment";
|
||||
|
||||
export default function ComponentEvent_DetailData() {
|
||||
return (
|
||||
<>
|
||||
<Paper withBorder p={"md"} shadow="lg">
|
||||
<Stack px={"sm"}>
|
||||
<Title order={4}>Nama Event</Title>
|
||||
<Grid>
|
||||
<Grid.Col span={3}>
|
||||
<Text fw={"bold"}>Lokasi</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={1}>:</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>Lokasi Acara</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={3}>
|
||||
<Text fw={"bold"}>Tanggal</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={1}>:</Grid.Col>
|
||||
<Grid.Col span={"auto"}>{moment(Date.now()).format("ll")}</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={3}>
|
||||
<Text fw={"bold"}>Jam</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={1}>:</Grid.Col>
|
||||
<Grid.Col span={"auto"}>{moment(Date.now()).format("LT")}</Grid.Col>
|
||||
</Grid>
|
||||
<Stack spacing={2}>
|
||||
<Text fw={"bold"}>Deskripsi</Text>
|
||||
<Text>
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Harum
|
||||
ipsum voluptate doloremque optio explicabo temporibus delectus
|
||||
voluptatum similique tempora voluptatem. Exercitationem veritatis
|
||||
tempora impedit ipsam, fugit vitae repellat sint fugiat
|
||||
</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -13,11 +13,12 @@ import {
|
||||
Image,
|
||||
MultiSelect,
|
||||
Paper,
|
||||
Select,
|
||||
Stack,
|
||||
TextInput,
|
||||
Textarea,
|
||||
} from "@mantine/core";
|
||||
import { DateTimePicker } from "@mantine/dates";
|
||||
import { DateInput, DatePicker, DateTimePicker } from "@mantine/dates";
|
||||
import { TimeInput } from "@mantine/dates";
|
||||
import { IconCamera } from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
@@ -25,38 +26,101 @@ import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.share
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { 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({ listUser }: { listUser: MODEL_USER[] }) {
|
||||
export default function Event_Create({
|
||||
listTipeAcara,
|
||||
authorId,
|
||||
}: {
|
||||
listTipeAcara: MODEL_DEFAULT_MASTER[];
|
||||
authorId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [img, setImg] = useState<any>();
|
||||
const [file, setFile] = useState<any>();
|
||||
const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
|
||||
const [listTipe, setListTipe] = useState(listTipeAcara);
|
||||
|
||||
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 />
|
||||
<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) => console.log(val)}
|
||||
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)}
|
||||
onClick={() => onSave(router, setTabsStatus, value)}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
@@ -65,8 +129,18 @@ export default function Event_Create({ listUser }: { listUser: MODEL_USER[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
async function onSave(router: AppRouterInstance, setTabsStatus: any) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil disimpan");
|
||||
setTabsStatus("Review");
|
||||
router.push(RouterEvent.status_page);
|
||||
async function onSave(
|
||||
router: AppRouterInstance,
|
||||
setTabsStatus: any,
|
||||
value: any
|
||||
) {
|
||||
await Event_funCreate(value).then((res) => {
|
||||
if (res.status === 201) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
setTabsStatus("Review");
|
||||
router.push(RouterEvent.status_page);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,25 +1,40 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Stack } from "@mantine/core";
|
||||
import ComponentEvent_DetailData from "../../component/detail_data";
|
||||
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() {
|
||||
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"}>
|
||||
<ComponentEvent_DetailData />
|
||||
{dataEvent.catatan ? (
|
||||
<ComponentEvent_CatatanReject catatan={dataEvent.catatan} />
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
<ComponentEvent_DetailData data={dataEvent} />
|
||||
<Button
|
||||
radius={"xl"}
|
||||
color="yellow"
|
||||
onClick={() => {
|
||||
onClick(router, setTabsStatus);
|
||||
onClick(router, setTabsStatus, dataEvent.id);
|
||||
}}
|
||||
>
|
||||
Ajukan Review
|
||||
@@ -29,8 +44,18 @@ export default function Event_DetailDraft() {
|
||||
);
|
||||
}
|
||||
|
||||
async function onClick(router: AppRouterInstance, setTabsStatus: any) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Diajukan", 1500)
|
||||
setTabsStatus("Review")
|
||||
router.back()
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,13 +8,15 @@ 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}/>}
|
||||
header={<ComponentEvent_HeaderTamplate title="Detail Draft" icon={<IconEdit/>} route2={RouterEvent.edit + eventId}/>}
|
||||
>
|
||||
{children}
|
||||
</AppShell>
|
||||
|
||||
@@ -10,21 +10,36 @@ import {
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import ComponentEvent_DetailData from "../../component/detail_data";
|
||||
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() {
|
||||
export default function Event_DetailKontribusi({
|
||||
dataEvent,
|
||||
listKontributor,
|
||||
totalPeserta,
|
||||
}: {
|
||||
dataEvent: MODEL_EVENT;
|
||||
listKontributor: MODEL_EVENT_PESERTA[];
|
||||
totalPeserta: number;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"lg"}>
|
||||
<ComponentEvent_DetailData />
|
||||
<Paper withBorder mt={"lg"} shadow="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>
|
||||
|
||||
{Array(10)
|
||||
.fill(0)
|
||||
{peserta
|
||||
.map((e, i) => (
|
||||
<Stack key={i} spacing={"sm"}>
|
||||
<Grid>
|
||||
@@ -41,7 +56,7 @@ export default function Event_DetailKontribusi() {
|
||||
</Stack>
|
||||
))}
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Paper> */}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -12,43 +12,134 @@ import {
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import ComponentEvent_DetailData from "../../component/detail_data";
|
||||
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() {
|
||||
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_DetailData />
|
||||
<Button radius={"xl"} color="green">
|
||||
JOIN
|
||||
</Button>
|
||||
<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>
|
||||
)}
|
||||
|
||||
<Paper withBorder mt={"lg"}>
|
||||
<ComponentEvent_ListPeserta listPeserta={listPeserta} total={total} />
|
||||
{/* <Paper withBorder mt={"lg"}>
|
||||
<Stack spacing={"md"} p={"md"}>
|
||||
<Center>
|
||||
<Title order={5}>Daftar Peserta</Title>
|
||||
<Title order={5}>Daftar Peserta ({total})</Title>
|
||||
</Center>
|
||||
|
||||
{Array(10)
|
||||
.fill(0)
|
||||
.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>
|
||||
))}
|
||||
{_.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>
|
||||
</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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
import { Button, Grid, Group, Stack, Text, Title } from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import ComponentEvent_DetailData from "../../component/detail_data";
|
||||
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
|
||||
export default function Event_DetailPublish() {
|
||||
export default function Event_DetailPublish({dataEvent}: {dataEvent: MODEL_EVENT}) {
|
||||
return (
|
||||
<>
|
||||
<ComponentEvent_DetailData/>
|
||||
<ComponentEvent_DetailData data={dataEvent}/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,19 +6,30 @@ import {
|
||||
Grid,
|
||||
Group,
|
||||
Modal,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import ComponentEvent_DetailData from "../../component/detail_data";
|
||||
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() {
|
||||
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);
|
||||
@@ -26,13 +37,14 @@ export default function Event_DetailReject() {
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"lg"}>
|
||||
<ComponentEvent_DetailData />
|
||||
<ComponentEvent_CatatanReject catatan={dataEvent.catatan} />
|
||||
<ComponentEvent_DetailData data={dataEvent} />
|
||||
<SimpleGrid cols={2}>
|
||||
<Button
|
||||
w={"100%"}
|
||||
radius={"xl"}
|
||||
color="yellow"
|
||||
onClick={() => onUpdate(router, setTabsStatus)}
|
||||
onClick={() => onUpdate(router, setTabsStatus, dataEvent.id)}
|
||||
>
|
||||
Edit Kembali
|
||||
</Button>
|
||||
@@ -48,7 +60,15 @@ export default function Event_DetailReject() {
|
||||
<Button radius={"xl"} onClick={close}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button radius={"xl"} onClick={() => onDelete(router)} color="red">
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onDelete(router, dataEvent.id, close);
|
||||
close();
|
||||
router.back();
|
||||
}}
|
||||
color="red"
|
||||
>
|
||||
Hapus
|
||||
</Button>
|
||||
</Group>
|
||||
@@ -58,13 +78,32 @@ export default function Event_DetailReject() {
|
||||
);
|
||||
}
|
||||
|
||||
async function onUpdate(router: AppRouterInstance, setTabsStatus: any) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Silahkan Edit Kembali");
|
||||
setTabsStatus("Draft");
|
||||
router.back();
|
||||
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) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Hapus Event");
|
||||
router.back();
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,22 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Stack } from "@mantine/core";
|
||||
import ComponentEvent_DetailData from "../../component/detail_data";
|
||||
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() {
|
||||
|
||||
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 />
|
||||
<Button radius={"xl"} color={"red"} onClick={() => onClick(router, setTabsStatus)}>
|
||||
<ComponentEvent_DetailData data={dataEvent} />
|
||||
<Button
|
||||
radius={"xl"}
|
||||
color={"red"}
|
||||
onClick={() => onClick(router, setTabsStatus, dataEvent.id)}
|
||||
>
|
||||
Batalkan Review
|
||||
</Button>
|
||||
</Stack>
|
||||
@@ -24,8 +36,18 @@ export default function Event_DetailReview() {
|
||||
);
|
||||
}
|
||||
|
||||
async function onClick(router: AppRouterInstance, setTabsStatus: any) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Review Dibatalkan", 1500)
|
||||
setTabsStatus("Draft")
|
||||
router.back()
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,35 +1,101 @@
|
||||
"use client";
|
||||
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import { Stack, TextInput, Textarea, Button } from "@mantine/core";
|
||||
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() {
|
||||
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 />
|
||||
<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"
|
||||
onChange={(val) => console.log(val)}
|
||||
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)}>
|
||||
<Button radius={"xl"} mt={"xl"} onClick={() => onUpdate(router, value)}>
|
||||
Update
|
||||
</Button>
|
||||
</Stack>
|
||||
@@ -37,7 +103,13 @@ export default function Event_Edit() {
|
||||
);
|
||||
}
|
||||
|
||||
async function onUpdate(router: AppRouterInstance) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Update berhasil");
|
||||
router.back();
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
66
src/app_modules/event/fun/get/get_event_by_status_id.ts
Normal file
66
src/app_modules/event/fun/get/get_event_by_status_id.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
"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({
|
||||
where: {
|
||||
eventMaster_StatusId: "1",
|
||||
authorId: authorId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
deskripsi: true,
|
||||
tanggal: true,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
}
|
||||
if (statusId === "2") {
|
||||
const data = await prisma.event.findMany({
|
||||
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;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
"use server"
|
||||
|
||||
import prisma from "@/app/lib/prisma"
|
||||
|
||||
export async function Event_getListUser() {
|
||||
const data = await prisma.user.findMany({
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: true
|
||||
}
|
||||
})
|
||||
return data
|
||||
}
|
||||
35
src/app_modules/event/fun/get/get_one_by_id.ts
Normal file
35
src/app_modules/event/fun/get/get_one_by_id.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function Event_getOneById(eventId: string) {
|
||||
const data = await prisma.event.findFirst({
|
||||
where: {
|
||||
id: eventId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
lokasi: true,
|
||||
tanggal: true,
|
||||
deskripsi: true,
|
||||
active: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
catatan: true,
|
||||
authorId: true,
|
||||
Author: {
|
||||
select: {
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
eventMaster_StatusId: true,
|
||||
EventMaster_Status: true,
|
||||
eventMaster_TipeAcaraId: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
// Event_Peserta: true,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
8
src/app_modules/event/fun/master/get_tipe_acara.ts
Normal file
8
src/app_modules/event/fun/master/get_tipe_acara.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
"use server"
|
||||
|
||||
import prisma from "@/app/lib/prisma"
|
||||
|
||||
export async function Event_getMasterTipeAcara(){
|
||||
const data = await prisma.eventMaster_TipeAcara.findMany()
|
||||
return data
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import Event_DetailMain from "./detail/main_detail";
|
||||
import LayoutEvent_DetailMain from "./detail/main_detail/layout";
|
||||
import Event_DetailKontribusi from "./detail/kontribusi";
|
||||
import LayoutEvent_DetailKontribusi from "./detail/kontribusi/layout";
|
||||
import Event_History from "./main/history";
|
||||
|
||||
export {
|
||||
Event_SplashScreen,
|
||||
@@ -42,4 +43,5 @@ export {
|
||||
LayoutEvent_DetailMain,
|
||||
Event_DetailKontribusi,
|
||||
LayoutEvent_DetailKontribusi,
|
||||
Event_History,
|
||||
};
|
||||
|
||||
@@ -4,62 +4,70 @@ import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
Button,
|
||||
Card,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Image,
|
||||
Paper,
|
||||
Skeleton,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { MODEL_EVENT } from "../model/interface";
|
||||
import ComponentEvent_BoxListStatus from "../component/box_list_status";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||
|
||||
export default function Event_Beranda() {
|
||||
export default function Event_Beranda({
|
||||
dataEvent,
|
||||
}: {
|
||||
dataEvent: MODEL_EVENT[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Card
|
||||
key={i}
|
||||
shadow="sm"
|
||||
padding="md"
|
||||
radius="md"
|
||||
withBorder
|
||||
mb={"md"}
|
||||
onClick={() => router.push(RouterEvent.detail_main)}
|
||||
{dataEvent.map((e, i) => (
|
||||
<Card key={e.id} shadow="lg" radius={"md"} withBorder mb={"sm"}>
|
||||
<Card.Section px={"sm"} pt={"sm"}>
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
profileId={e.Author.Profile.id}
|
||||
imagesId={e.Author.Profile.imagesId}
|
||||
authorName={e.Author.Profile.name}
|
||||
/>
|
||||
</Card.Section>
|
||||
<Card.Section
|
||||
p={"sm"}
|
||||
onClick={() => router.push(RouterEvent.detail_main + e.id)}
|
||||
>
|
||||
{/* <Card.Section p={"xs"}>
|
||||
<Skeleton visible={loading} h={200}></Skeleton>
|
||||
</Card.Section> */}
|
||||
|
||||
<Stack>
|
||||
<Group position="apart" mt="md" mb="xs">
|
||||
<Text weight={500}>Nama Event</Text>
|
||||
<Text fz={"sm"}>{moment(new Date()).format("ll")}</Text>
|
||||
</Group>
|
||||
<Grid>
|
||||
<Grid.Col span={8}>
|
||||
<Title order={6} truncate>
|
||||
{e.title}
|
||||
</Title>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<Text fz={"sm"} truncate>
|
||||
{moment(e.tanggal).format("ll")}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Text size="sm" color="dimmed" lineClamp={2}>
|
||||
Deskripsi: Lorem ipsum dolor sit amet consectetur adipisicing
|
||||
elit. Nisi non ducimus voluptatibus vel, officiis assumenda
|
||||
explicabo reiciendis consequatur consequuntur expedita maiores
|
||||
fugit natus est rem sapiente iusto earum dicta labore.
|
||||
<Text fz={"sm"} lineClamp={2}>
|
||||
{e.deskripsi}
|
||||
</Text>
|
||||
|
||||
{/* <Group position="apart">
|
||||
{Array(6)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Avatar key={i} bg="blue" radius={"xl"} />
|
||||
))}
|
||||
</Group> */}
|
||||
</Stack>
|
||||
</Card>
|
||||
))}
|
||||
</Card.Section>
|
||||
</Card>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
8
src/app_modules/event/main/history/index.tsx
Normal file
8
src/app_modules/event/main/history/index.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
"use client"
|
||||
|
||||
export default function Event_History(){
|
||||
return<>
|
||||
ini history
|
||||
|
||||
</>
|
||||
}
|
||||
@@ -1,14 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import { Avatar, Box, Card, Group, Stack, Tabs, Text } from "@mantine/core";
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Card,
|
||||
Flex,
|
||||
Grid,
|
||||
Group,
|
||||
Stack,
|
||||
Tabs,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import Event_KontribusiPanitia from "./panitia";
|
||||
import Event_KontribusiPeserta from "./peserta";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
||||
import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
|
||||
export default function Event_Kontribusi() {
|
||||
export default function Event_Kontribusi({
|
||||
listKontribusi,
|
||||
}: {
|
||||
listKontribusi: MODEL_EVENT_PESERTA[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [tabsKontribusi, setTabsKontribusi] = useState<string | any>("Panitia");
|
||||
const listTabs = [
|
||||
@@ -26,45 +44,56 @@ export default function Event_Kontribusi() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Card
|
||||
key={i}
|
||||
shadow="sm"
|
||||
padding="md"
|
||||
radius="md"
|
||||
withBorder
|
||||
mb={"md"}
|
||||
onClick={() => router.push(RouterEvent.detail_kontribusi)}
|
||||
{/* <pre>{JSON.stringify(listKontribusi, null,2)}</pre> */}
|
||||
{listKontribusi.map((e, i) => (
|
||||
<Card key={e.id} shadow="lg" radius={"md"} withBorder mb={"sm"}>
|
||||
<Card.Section px={"sm"} pt={"sm"}>
|
||||
<ComponentGlobal_AuthorNameOnHeader
|
||||
profileId={e.Event.Author.Profile.id}
|
||||
imagesId={e.Event.Author.Profile.imagesId}
|
||||
authorName={e.Event.Author.Profile.name}
|
||||
/>
|
||||
</Card.Section>
|
||||
<Card.Section
|
||||
p={"sm"}
|
||||
onClick={() => router.push(RouterEvent.detail_kontribusi + e.Event.id)}
|
||||
>
|
||||
{/* <Card.Section p={"xs"}>
|
||||
<Skeleton visible={loading} h={200}></Skeleton>
|
||||
</Card.Section> */}
|
||||
|
||||
<Stack>
|
||||
<Group position="apart" mt="md" mb="xs">
|
||||
<Text weight={500}>Nama Event</Text>
|
||||
<Text fz={"sm"}>{moment(new Date()).format("ll")}</Text>
|
||||
</Group>
|
||||
<Grid>
|
||||
<Grid.Col span={8}>
|
||||
<Title order={6} truncate>
|
||||
{e.Event.title}
|
||||
</Title>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={4}>
|
||||
<Text fz={"sm"} truncate>
|
||||
{moment(e.Event.tanggal).format("ll")}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{/* <Text size="sm" color="dimmed" lineClamp={2}>
|
||||
Deskripsi: Lorem ipsum dolor sit amet consectetur adipisicing
|
||||
elit. Nisi non ducimus voluptatibus vel, officiis assumenda
|
||||
explicabo reiciendis consequatur consequuntur expedita maiores
|
||||
fugit natus est rem sapiente iusto earum dicta labore.
|
||||
</Text> */}
|
||||
{/* <Text fz={"sm"} lineClamp={2}>
|
||||
{e.Event.deskripsi}
|
||||
</Text> */}
|
||||
|
||||
<Group position="apart">
|
||||
{Array(6)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Avatar key={i} bg="blue" radius={"xl"} />
|
||||
))}
|
||||
<Group position="center">
|
||||
{e.Event.Event_Peserta.map((val) => (
|
||||
<Box key={val.id}>
|
||||
<Avatar
|
||||
size={"lg"}
|
||||
radius={"xl"}
|
||||
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
|
||||
src={
|
||||
RouterProfile.api_foto_profile + val.User.Profile.imagesId
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Group>
|
||||
</Stack>
|
||||
</Card>
|
||||
))}
|
||||
</Card.Section>
|
||||
</Card>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import ComponentEvent_HeaderTamplate from "../component/header_tamplate";
|
||||
import {
|
||||
IconCalendarEvent,
|
||||
IconCirclePlus,
|
||||
IconHistory,
|
||||
IconHome,
|
||||
IconTimelineEvent,
|
||||
IconTimelineEventText,
|
||||
} from "@tabler/icons-react";
|
||||
@@ -36,12 +38,12 @@ export default function LayoutEvent_Main({
|
||||
id: "1",
|
||||
name: "Beranda",
|
||||
path: RouterEvent.beranda,
|
||||
icon: <IconTimelineEvent />,
|
||||
icon: <IconHome />,
|
||||
},
|
||||
|
||||
{
|
||||
id: "2",
|
||||
name: "Status event",
|
||||
name: "Status Event",
|
||||
path: RouterEvent.status_page,
|
||||
icon: <IconTimelineEventText />,
|
||||
},
|
||||
@@ -51,28 +53,24 @@ export default function LayoutEvent_Main({
|
||||
path: RouterEvent.kontribusi,
|
||||
icon: <IconCalendarEvent />,
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
name: "History",
|
||||
path: RouterEvent.history,
|
||||
icon: <IconHistory />,
|
||||
}
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<AppShell
|
||||
header={<ComponentEvent_HeaderTamplate title="Event" route={RouterHome.main_home}/>}
|
||||
header={
|
||||
<ComponentEvent_HeaderTamplate
|
||||
title="Event"
|
||||
route={RouterHome.main_home}
|
||||
/>
|
||||
}
|
||||
footer={
|
||||
<Footer height={70} bg={"dark"} sx={{ borderTop: "px solid blue" }}>
|
||||
{/* <Center>
|
||||
<ActionIcon
|
||||
sx={{
|
||||
zIndex: 1,
|
||||
position: "absolute",
|
||||
}}
|
||||
variant="transparent"
|
||||
bg={"blue"}
|
||||
radius={"xl"}
|
||||
size={"lg"}
|
||||
onClick={() => router.push(RouterEvent.create)}
|
||||
>
|
||||
<IconCirclePlus color="white" size={30} />
|
||||
</ActionIcon>
|
||||
</Center> */}
|
||||
<Grid>
|
||||
{listFooter.map((e, i) => (
|
||||
<Grid.Col
|
||||
@@ -82,7 +80,6 @@ export default function LayoutEvent_Main({
|
||||
onClick={() => {
|
||||
router.replace(e.path);
|
||||
setHotMenu(i);
|
||||
|
||||
}}
|
||||
>
|
||||
<Center>
|
||||
|
||||
@@ -1,39 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import { Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import { Box, Center, Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
import { useState } from "react";
|
||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function Event_StatusDraft() {
|
||||
const router = useRouter()
|
||||
export default function Event_StatusDraft({
|
||||
listDraft,
|
||||
}: {
|
||||
listDraft: MODEL_EVENT[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(listDraft))
|
||||
return (
|
||||
<Center h={"50vh"} fz={"sm"} fw={"bold"}>
|
||||
Tidak Ada Event
|
||||
</Center>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
{listDraft
|
||||
.map((e, i) => (
|
||||
<Paper
|
||||
key={i}
|
||||
shadow="lg"
|
||||
radius={"md"}
|
||||
p={"md"}
|
||||
withBorder
|
||||
mb={"md"}
|
||||
onClick={() => router.push(RouterEvent.detail_draft)}
|
||||
>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Title order={6}>Nama Event</Title>
|
||||
<Text fz={"sm"}>{moment(new Date()).format("ll")}</Text>
|
||||
</Group>
|
||||
<Text fz={"sm"} lineClamp={2}>
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Aperiam
|
||||
velit modi ut consequatur, iure eaque numquam id iste, nihil
|
||||
laborum facilis dolores vel possimus earum ullam, necessitatibus
|
||||
omnis tenetur repellendus.
|
||||
</Text>
|
||||
</Stack>
|
||||
</Paper>
|
||||
<Box key={e.id}>
|
||||
<ComponentEvent_BoxListStatus data={e} path={RouterEvent.detail_draft}/>
|
||||
</Box>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -11,29 +11,40 @@ import Event_StatusPublish from "./publish";
|
||||
import Event_StatusReview from "./review";
|
||||
import Event_StatusDraft from "./draft";
|
||||
import Event_StatusReject from "./reject";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
|
||||
export default function Event_StatusPage() {
|
||||
export default function Event_StatusPage({
|
||||
listPublish,
|
||||
listReview,
|
||||
listDraft,
|
||||
listReject,
|
||||
}: {
|
||||
listPublish: any;
|
||||
listReview: any;
|
||||
listDraft: any;
|
||||
listReject: any;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
|
||||
const listTabs = [
|
||||
{
|
||||
id: 1,
|
||||
path: <Event_StatusPublish/>,
|
||||
path: <Event_StatusPublish listPublish={listPublish} />,
|
||||
value: "Publish",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
path: <Event_StatusReview/>,
|
||||
path: <Event_StatusReview listReview={listReview} />,
|
||||
value: "Review",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
path: <Event_StatusDraft/>,
|
||||
path: <Event_StatusDraft listDraft={listDraft} />,
|
||||
value: "Draft",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
path: <Event_StatusReject/>,
|
||||
path: <Event_StatusReject listReject={listReject} />,
|
||||
value: "Reject",
|
||||
},
|
||||
];
|
||||
@@ -65,6 +76,7 @@ export default function Event_StatusPage() {
|
||||
key={e.id}
|
||||
value={e.value}
|
||||
bg={tabsStatus === e.value ? "blue" : "gray.1"}
|
||||
fw={tabsStatus === e.value ? "bold" : "normal"}
|
||||
>
|
||||
{e.value}
|
||||
</Tabs.Tab>
|
||||
|
||||
@@ -1,39 +1,35 @@
|
||||
"use client";
|
||||
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import { Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import { Box, Center, Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function Event_StatusPublish() {
|
||||
export default function Event_StatusPublish({
|
||||
listPublish,
|
||||
}: {
|
||||
listPublish: MODEL_EVENT[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(listPublish))
|
||||
return (
|
||||
<Center h={"50vh"} fz={"sm"} fw={"bold"}>
|
||||
Tidak Ada Event
|
||||
</Center>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
{listPublish
|
||||
.map((e, i) => (
|
||||
<Paper
|
||||
key={i}
|
||||
shadow="lg"
|
||||
radius={"md"}
|
||||
p={"md"}
|
||||
withBorder
|
||||
mb={"md"}
|
||||
onClick={() => router.push(RouterEvent.detail_publish)}
|
||||
>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Title order={6}>Nama Event</Title>
|
||||
<Text fz={"sm"}>{moment(new Date()).format("ll")}</Text>
|
||||
</Group>
|
||||
<Text fz={"sm"} lineClamp={2}>
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Aperiam
|
||||
velit modi ut consequatur, iure eaque numquam id iste, nihil
|
||||
laborum facilis dolores vel possimus earum ullam, necessitatibus
|
||||
omnis tenetur repellendus.
|
||||
</Text>
|
||||
</Stack>
|
||||
</Paper>
|
||||
<Box key={e.id}>
|
||||
<ComponentEvent_BoxListStatus data={e} path={RouterEvent.detail_publish}/>
|
||||
|
||||
</Box>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,40 +1,35 @@
|
||||
"use client";
|
||||
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import { Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import { Box, Center, Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function Event_StatusReject() {
|
||||
const router = useRouter()
|
||||
export default function Event_StatusReject({
|
||||
listReject,
|
||||
}: {
|
||||
listReject: MODEL_EVENT[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
if (_.isEmpty(listReject))
|
||||
return (
|
||||
<Center h={"50vh"} fz={"sm"} fw={"bold"}>
|
||||
Tidak Ada Event
|
||||
</Center>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Paper
|
||||
key={i}
|
||||
shadow="lg"
|
||||
radius={"md"}
|
||||
p={"md"}
|
||||
withBorder
|
||||
mb={"md"}
|
||||
onClick={() => router.push(RouterEvent.detail_reject)}
|
||||
>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Title order={6}>Nama Event</Title>
|
||||
<Text fz={"sm"}>{moment(new Date()).format("ll")}</Text>
|
||||
</Group>
|
||||
<Text fz={"sm"} lineClamp={2}>
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Aperiam
|
||||
velit modi ut consequatur, iure eaque numquam id iste, nihil
|
||||
laborum facilis dolores vel possimus earum ullam, necessitatibus
|
||||
omnis tenetur repellendus.
|
||||
</Text>
|
||||
</Stack>
|
||||
</Paper>
|
||||
))}
|
||||
{listReject.map((e, i) => (
|
||||
<Box key={e.id}>
|
||||
<ComponentEvent_BoxListStatus
|
||||
data={e}
|
||||
path={RouterEvent.detail_reject}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,40 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import { Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import { Box, Center, Group, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
import { useState } from "react";
|
||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||
import _ from "lodash";
|
||||
|
||||
export default function Event_StatusReview() {
|
||||
const router = useRouter()
|
||||
export default function Event_StatusReview({
|
||||
listReview,
|
||||
}: {
|
||||
listReview: MODEL_EVENT[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
if (_.isEmpty(listReview))
|
||||
return (
|
||||
<Center h={"50vh"} fz={"sm"} fw={"bold"}>
|
||||
Tidak Ada Event
|
||||
</Center>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
{Array(5)
|
||||
.fill(0)
|
||||
.map((e, i) => (
|
||||
<Paper
|
||||
key={i}
|
||||
shadow="lg"
|
||||
radius={"md"}
|
||||
p={"md"}
|
||||
withBorder
|
||||
mb={"md"}
|
||||
onClick={() => router.push(RouterEvent.detail_review)}
|
||||
>
|
||||
<Stack>
|
||||
<Group position="apart">
|
||||
<Title order={6}>Nama Event</Title>
|
||||
<Text fz={"sm"}>{moment(new Date()).format("ll")}</Text>
|
||||
</Group>
|
||||
<Text fz={"sm"} lineClamp={2}>
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Aperiam
|
||||
velit modi ut consequatur, iure eaque numquam id iste, nihil
|
||||
laborum facilis dolores vel possimus earum ullam, necessitatibus
|
||||
omnis tenetur repellendus.
|
||||
</Text>
|
||||
</Stack>
|
||||
</Paper>
|
||||
))}
|
||||
{listReview.map((e, i) => (
|
||||
<Box key={e.id}>
|
||||
<ComponentEvent_BoxListStatus
|
||||
data={e}
|
||||
path={RouterEvent.detail_review}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
32
src/app_modules/event/model/interface.ts
Normal file
32
src/app_modules/event/model/interface.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { MODEL_USER } from "@/app_modules/home/model/interface";
|
||||
import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
||||
|
||||
export interface MODEL_EVENT {
|
||||
id: string;
|
||||
title: string;
|
||||
lokasi: string;
|
||||
tanggal: Date;
|
||||
deskripsi: string;
|
||||
active: boolean;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
catatan: string;
|
||||
authorId: string;
|
||||
Author: MODEL_USER;
|
||||
eventMaster_StatusId: string;
|
||||
EventMaster_Status: MODEL_DEFAULT_MASTER;
|
||||
eventMaster_TipeAcaraId: number;
|
||||
EventMaster_TipeAcara: MODEL_DEFAULT_MASTER;
|
||||
Event_Peserta: MODEL_EVENT_PESERTA[];
|
||||
}
|
||||
|
||||
export interface MODEL_EVENT_PESERTA {
|
||||
id: string;
|
||||
active: boolean;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
userId: string;
|
||||
User: MODEL_USER;
|
||||
eventId: string;
|
||||
Event: MODEL_EVENT;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MODEL_IMAGES } from "@/app_modules/models/interface";
|
||||
import { MODEL_IMAGES } from "@/app_modules/model_global/interface";
|
||||
|
||||
export interface MODEL_PROFILE_OLD {
|
||||
id: string;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { ApiHipmi } from "@/app/lib/api";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { MODEL_DEFAULT_MASTER } from "@/app_modules/models/model_default_master";
|
||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
|
||||
import {
|
||||
AspectRatio,
|
||||
Box,
|
||||
@@ -37,9 +37,9 @@ export default function InvestasiCreate({
|
||||
pembagianDeviden,
|
||||
}: {
|
||||
id: string;
|
||||
pencarianInvestor: MODEL_DEFAULT_MASTER[];
|
||||
periodeDeviden: MODEL_DEFAULT_MASTER[];
|
||||
pembagianDeviden: MODEL_DEFAULT_MASTER[];
|
||||
pencarianInvestor: MODEL_DEFAULT_MASTER_OLD[];
|
||||
periodeDeviden: MODEL_DEFAULT_MASTER_OLD[];
|
||||
pembagianDeviden: MODEL_DEFAULT_MASTER_OLD[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [fl, setFl] = useState<File | null>(null);
|
||||
|
||||
@@ -29,7 +29,7 @@ import toast from "react-simple-toasts";
|
||||
import { MODEL_Investasi } from "../model/model_investasi";
|
||||
import { RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import _ from "lodash";
|
||||
import { MODEL_DEFAULT_MASTER } from "@/app_modules/models/model_default_master";
|
||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
|
||||
import funEditInvestasi from "../fun/fun_edit_investasi";
|
||||
import { useDisclosure, useWindowScroll } from "@mantine/hooks";
|
||||
|
||||
@@ -40,9 +40,9 @@ export default function EditIntroInvestasi({
|
||||
listPembagian,
|
||||
}: {
|
||||
dataInvestasi: MODEL_Investasi;
|
||||
listPencarian: MODEL_DEFAULT_MASTER[];
|
||||
listPeriode: MODEL_DEFAULT_MASTER[];
|
||||
listPembagian: MODEL_DEFAULT_MASTER[];
|
||||
listPencarian: MODEL_DEFAULT_MASTER_OLD[];
|
||||
listPeriode: MODEL_DEFAULT_MASTER_OLD[];
|
||||
listPembagian: MODEL_DEFAULT_MASTER_OLD[];
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { ApiHipmi } from "@/app/lib/api";
|
||||
import { MODEL_DEFAULT_MASTER } from "@/app_modules/models/model_default_master";
|
||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/model_default_master";
|
||||
import {
|
||||
AspectRatio,
|
||||
Badge,
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import { ProfileView } from "../profile";
|
||||
import { ListPortofolioView } from "../portofolio";
|
||||
import { MODEL_PROFILE_OLD } from "@/app_modules/home/model/user_profile";
|
||||
import { LIST_PORTOFOLIO } from "@/app_modules/models/portofolio";
|
||||
import { LIST_PORTOFOLIO } from "@/app_modules/model_global/portofolio";
|
||||
import User_Logout from "@/app_modules/auth/logout/view";
|
||||
import { MODEL_PORTOFOLIO } from "../portofolio/model/interface";
|
||||
import { MODEL_PROFILE } from "../profile/model/interface";
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Warna } from "@/app/lib/warna";
|
||||
import {
|
||||
BIDANG_BISNIS_OLD,
|
||||
MODEL_PORTOFOLIO_OLD,
|
||||
} from "@/app_modules/models/portofolio";
|
||||
} from "@/app_modules/model_global/portofolio";
|
||||
import {
|
||||
AspectRatio,
|
||||
Button,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { MODEL_PORTOFOLIO_OLD } from "@/app_modules/models/portofolio";
|
||||
import { MODEL_PORTOFOLIO_OLD } from "@/app_modules/model_global/portofolio";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { MODEL_PORTOFOLIO, MODEL_PORTOFOLIO_MEDSOS } from "../model/interface";
|
||||
import _ from "lodash";
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
Grid,
|
||||
Group,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
@@ -14,12 +15,15 @@ import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useState } from "react";
|
||||
import _ from "lodash";
|
||||
import {
|
||||
IconCaretRight,
|
||||
IconCaretRightFilled,
|
||||
IconChevronRight,
|
||||
IconCirclePlus,
|
||||
IconEyeCheck,
|
||||
IconPencilPlus,
|
||||
} from "@tabler/icons-react";
|
||||
|
||||
import { LIST_PORTOFOLIO } from "@/app_modules/models/portofolio";
|
||||
import { LIST_PORTOFOLIO } from "@/app_modules/model_global/portofolio";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
@@ -65,31 +69,43 @@ export default function ListPortofolioView({
|
||||
</Text>
|
||||
</Center>
|
||||
) : (
|
||||
<Box>
|
||||
{porto.map((e: any) => (
|
||||
<Paper
|
||||
key={e.id}
|
||||
h={50}
|
||||
bg={"gray"}
|
||||
mb={"lg"}
|
||||
radius={"xl"}
|
||||
onClick={() => router.push(`/dev/portofolio/main/${e.id}/`)}
|
||||
>
|
||||
<Grid h={50} align="center" px={"md"}>
|
||||
<Grid.Col span={10}>
|
||||
<Text fw={"bold"}>{e.namaBisnis}</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"} h={50}>
|
||||
<IconCaretRightFilled size={35} />
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
))}
|
||||
</Box>
|
||||
<SimpleGrid
|
||||
cols={4}
|
||||
spacing="md"
|
||||
breakpoints={[
|
||||
{ maxWidth: "md", cols: 3, spacing: "md" },
|
||||
{ maxWidth: "sm", cols: 2, spacing: "sm" },
|
||||
{ maxWidth: "xs", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
{porto.map((e: any) => (
|
||||
<Paper
|
||||
key={e.id}
|
||||
bg={"gray.5"}
|
||||
radius={"md"}
|
||||
onClick={() => router.push(`/dev/portofolio/main/${e.id}/`)}
|
||||
>
|
||||
<Grid align="center" p={"sm"}>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text fw={"bold"} truncate>
|
||||
{e.namaBisnis}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={2}>
|
||||
<Stack>
|
||||
<IconCaretRight color="black" size={35} />
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Paper>
|
||||
))}
|
||||
</SimpleGrid>
|
||||
)}
|
||||
</Box>
|
||||
</Stack>
|
||||
</Paper>
|
||||
|
||||
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
RouterProfile,
|
||||
} from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { MODEL_PORTOFOLIO_OLD } from "@/app_modules/models/portofolio";
|
||||
import { MODEL_PORTOFOLIO_OLD } from "@/app_modules/model_global/portofolio";
|
||||
import {
|
||||
AspectRatio,
|
||||
Box,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user