# Event Join
## feat - Join event - kontribusi event - histoty in progress ### No Issue
This commit is contained in:
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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user