fix: Admin
Deskripsi: - Penambahan field nama rekening di db bank - Optimalisasi event ## No Issue
This commit is contained in:
3
src/app_modules/admin/event/_ui/index.ts
Normal file
3
src/app_modules/admin/event/_ui/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { AdminEvent_UiDetailPeserta } from "./ui_detail_peserta";
|
||||
|
||||
export { AdminEvent_UiDetailPeserta };
|
||||
28
src/app_modules/admin/event/_ui/ui_detail_peserta.tsx
Normal file
28
src/app_modules/admin/event/_ui/ui_detail_peserta.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { Stack } from "@mantine/core";
|
||||
import ComponentAdminGlobal_BackButton from "../../_admin_global/back_button";
|
||||
import { AdminEvent_ViewDetailPeserta } from "../_view";
|
||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global";
|
||||
|
||||
export function AdminEvent_UiDetailPeserta({
|
||||
dataPeserta,
|
||||
eventId,
|
||||
}: {
|
||||
dataPeserta: any;
|
||||
eventId: string
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_BackButton />
|
||||
<ComponentAdminGlobal_TitlePage name="Detail Peserta" />
|
||||
<AdminEvent_ViewDetailPeserta
|
||||
dataPeserta={dataPeserta as any}
|
||||
eventId={eventId}
|
||||
/>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
3
src/app_modules/admin/event/_view/index.ts
Normal file
3
src/app_modules/admin/event/_view/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { AdminEvent_ViewDetailPeserta } from "./view_detail_peserta";
|
||||
|
||||
export { AdminEvent_ViewDetailPeserta };
|
||||
112
src/app_modules/admin/event/_view/view_detail_peserta.tsx
Normal file
112
src/app_modules/admin/event/_view/view_detail_peserta.tsx
Normal file
@@ -0,0 +1,112 @@
|
||||
"use client";
|
||||
|
||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
||||
import {
|
||||
Button,
|
||||
Center,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Stack,
|
||||
Table,
|
||||
} from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import { adminEvent_getListPesertaById } from "../fun";
|
||||
import _ from "lodash";
|
||||
import ComponentAdminGlobal_IsEmptyData from "../../_admin_global/is_empty_data";
|
||||
|
||||
export function AdminEvent_ViewDetailPeserta({
|
||||
dataPeserta,
|
||||
eventId,
|
||||
}: {
|
||||
dataPeserta: any;
|
||||
eventId: string;
|
||||
}) {
|
||||
const [data, setData] = useState<MODEL_EVENT_PESERTA[]>(dataPeserta.data);
|
||||
const [isNPage, setNPage] = useState(dataPeserta.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_getListPesertaById({
|
||||
eventId: eventId,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
const tableRow = _.isEmpty(data)
|
||||
? []
|
||||
: data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Center>{e?.User?.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e?.User?.Profile?.name}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>+{e?.User?.nomor}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>{e?.User?.Profile?.email}</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"75vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Name</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Nomor</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Email</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{tableRow}</tbody>
|
||||
</Table>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentAdminGlobal_IsEmptyData
|
||||
text="Tidak ada peserta"
|
||||
marginTop={100}
|
||||
/>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
|
||||
{/* <pre>{JSON.stringify(dataPeserta, null, 2)}</pre> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,36 +1,36 @@
|
||||
"use client";
|
||||
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import {
|
||||
MODEL_EVENT,
|
||||
MODEL_EVENT_PESERTA,
|
||||
} from "@/app_modules/event/model/interface";
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Divider,
|
||||
Grid,
|
||||
Group,
|
||||
Loader,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import {
|
||||
MODEL_EVENT,
|
||||
MODEL_EVENT_PESERTA,
|
||||
} from "@/app_modules/event/model/interface";
|
||||
import { data } from "autoprefixer";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { IconEyeShare } from "@tabler/icons-react";
|
||||
import { useDisclosure, useShallowEffect } from "@mantine/hooks";
|
||||
import { IconCircleCheck, IconSearch } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import { AdminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { adminEvent_funGetListAllRiwayat } from "../fun";
|
||||
import { adminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||
|
||||
export default function AdminEvent_Riwayat({
|
||||
listRiwayat,
|
||||
@@ -47,68 +47,192 @@ export default function AdminEvent_Riwayat({
|
||||
);
|
||||
}
|
||||
|
||||
function DetailRiwayat({ listRiwayat }: { listRiwayat: MODEL_EVENT[] }) {
|
||||
const [opened, setOpen] = useState(false);
|
||||
function DetailRiwayat({ listRiwayat }: { listRiwayat: any }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [peserta, setPeserta] = useState<MODEL_EVENT_PESERTA[]>();
|
||||
const [eventId, setEventId] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const TableRows = listRiwayat.map((e, i) => (
|
||||
<tr key={e.id}>
|
||||
const [data, setData] = useState<MODEL_EVENT[]>(listRiwayat.data);
|
||||
const [isNPage, setNPage] = useState(listRiwayat.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminEvent_funGetListAllRiwayat({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_funGetListAllRiwayat({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Button
|
||||
loading={e.id === eventId ? (loading === true ? true : false) : false}
|
||||
loading={e.id === eventId && loading ? true : false}
|
||||
color={"green"}
|
||||
leftIcon={<IconEyeShare />}
|
||||
leftIcon={<IconCircleCheck />}
|
||||
radius={"xl"}
|
||||
onClick={async () => {
|
||||
setEventId(e.id);
|
||||
setLoading(true);
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
await AdminEvent_getListPesertaById(e.id).then((res: any) => {
|
||||
setLoading(false);
|
||||
setPeserta(res);
|
||||
});
|
||||
setOpen(true);
|
||||
onClick={() => {
|
||||
router.push(RouterAdminEvent.detail_peserta + e.id);
|
||||
// setEventId(e.id);
|
||||
// setLoading(true);
|
||||
// await new Promise((v) => setTimeout(v, 500));
|
||||
// await AdminEvent_getListPesertaById(e.id).then((res: any) => {
|
||||
// setPeserta(res);
|
||||
// setLoading(false);
|
||||
// });
|
||||
// open();
|
||||
}}
|
||||
>
|
||||
Peserta
|
||||
Lihat Peserta
|
||||
</Button>
|
||||
</td>
|
||||
<td>{e?.Author?.Profile?.name}</td>
|
||||
<td>{e?.title}</td>
|
||||
<td>{e?.lokasi}</td>
|
||||
<td>{e?.EventMaster_TipeAcara?.name}</td>
|
||||
<td>{e?.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}</td>
|
||||
|
||||
<td>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
})}
|
||||
<Center w={200}>
|
||||
<Text>{e?.Author?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
<Center w={200}>
|
||||
<Text lineClamp={2}>{e.title}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.lokasi}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={400}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
useShallowEffect(() => {
|
||||
getAllPeserta(eventId);
|
||||
}, [eventId]);
|
||||
// useShallowEffect(() => {
|
||||
// getAllPeserta(eventId);
|
||||
// }, [eventId]);
|
||||
|
||||
async function getAllPeserta(eventId: string) {
|
||||
await AdminEvent_getListPesertaById(eventId).then((res: any) =>
|
||||
setPeserta(res)
|
||||
);
|
||||
}
|
||||
// async function getAllPeserta(eventId: string) {
|
||||
// await adminEvent_getListPesertaById(eventId).then((res: any) =>
|
||||
// setPeserta(res)
|
||||
// );
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"gray.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Riwayat</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tipe Acara</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Jam</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={() => setOpen(false)}
|
||||
onClose={close}
|
||||
size={"md"}
|
||||
// closeOnClickOutside={false}
|
||||
withCloseButton={false}
|
||||
@@ -145,55 +269,6 @@ function DetailRiwayat({ listRiwayat }: { listRiwayat: MODEL_EVENT[] }) {
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Modal>
|
||||
|
||||
<Box>
|
||||
<Box bg={"gray.1"} p={"xs"}>
|
||||
<Title order={6} c={"gray"}>
|
||||
RIWAYAT
|
||||
</Title>
|
||||
</Box>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Author</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>Tipe Acara</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Jam</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
<Center>
|
||||
{_.isEmpty(TableRows) ? (
|
||||
<Center h={"50vh"}>
|
||||
<Title order={6}>Tidak Ada Data</Title>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Center>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||
import {
|
||||
ActionIcon,
|
||||
Box,
|
||||
Button,
|
||||
Divider,
|
||||
Group,
|
||||
List,
|
||||
Modal,
|
||||
Paper,
|
||||
SimpleGrid,
|
||||
@@ -15,20 +17,14 @@ import {
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import ComponentAdminDonasi_TombolKembali from "../../donasi/component/tombol_kembali";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||
import { useState } from "react";
|
||||
import { AdminEvent_funCreateTipeAcara } from "../fun/create/fun_create_tipe_acara";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { AdminEvent_getListTipeAcara } from "../fun/get/get_list_tipe_acara";
|
||||
import { IconEditCircle, IconTrash } from "@tabler/icons-react";
|
||||
import { AdminEvent_funEditTipeAcara } from "../fun/edit/fun_edit_tipe_acara";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconCirclePlus, IconEditCircle, IconTrash } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { AdminEvent_funCreateTipeAcara } from "../fun/create/fun_create_tipe_acara";
|
||||
import { AdminEvent_funEditActivationTipeAcaraById } from "../fun/edit/fun_edit_activation_tipe_acara";
|
||||
import { number } from "echarts";
|
||||
import { AdminEvent_funEditTipeAcara } from "../fun/edit/fun_edit_tipe_acara";
|
||||
import { AdminEvent_getListTipeAcara } from "../fun/get/get_list_tipe_acara";
|
||||
|
||||
export default function AdminEvent_DetailTipeAcara({
|
||||
listTipe,
|
||||
@@ -38,14 +34,19 @@ export default function AdminEvent_DetailTipeAcara({
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event: Tipe Acara" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||
|
||||
<DetailTipeAcara listTipe={listTipe} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] }) {
|
||||
function DetailTipeAcara({
|
||||
listTipe,
|
||||
}: {
|
||||
listTipe: MODEL_DEFAULT_MASTER_OLD[];
|
||||
}) {
|
||||
const [tipe, setTipe] = useState(listTipe);
|
||||
const [name, setName] = useState("");
|
||||
const [openEditor, setOpenEditor] = useState(false);
|
||||
@@ -55,6 +56,7 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
id: "",
|
||||
name: "",
|
||||
});
|
||||
const [openCreate, setOpenCreate] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -79,8 +81,28 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
</Stack>
|
||||
</Modal>
|
||||
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"gray.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Tipe Acara</Title>
|
||||
<Button
|
||||
leftIcon={<IconCirclePlus />}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => {
|
||||
setOpenCreate(true);
|
||||
setOpenEditor(false);
|
||||
}}
|
||||
>
|
||||
Tambah
|
||||
</Button>
|
||||
</Group>
|
||||
|
||||
<SimpleGrid
|
||||
cols={3}
|
||||
cols={2}
|
||||
spacing="lg"
|
||||
breakpoints={[
|
||||
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
|
||||
@@ -88,26 +110,6 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
|
||||
]}
|
||||
>
|
||||
<div>
|
||||
<Paper p={"sm"} shadow="lg" withBorder>
|
||||
<Stack>
|
||||
<TextInput
|
||||
value={name ? name : ""}
|
||||
label="Masukan Tipe"
|
||||
placeholder="Contoh: Seminar, Workshop, dll."
|
||||
onChange={(val) => {
|
||||
setName(val.target.value);
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button onClick={() => onSave(name, setName, setTipe)}>
|
||||
Tambah
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Paper p={"md"} shadow="lg" withBorder>
|
||||
<Stack>
|
||||
@@ -122,6 +124,7 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
setOpenEditor(true);
|
||||
setOpenCreate(false);
|
||||
setEdit(e);
|
||||
}}
|
||||
>
|
||||
@@ -150,27 +153,67 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER_OLD[] })
|
||||
</Paper>
|
||||
</div>
|
||||
|
||||
{openCreate ? (
|
||||
<div>
|
||||
<Paper p={"sm"} shadow="lg" withBorder>
|
||||
<Stack>
|
||||
<TextInput
|
||||
value={name ? name : ""}
|
||||
label="Masukan Tipe"
|
||||
placeholder="Contoh: Seminar, Workshop, dll."
|
||||
onChange={(val) => {
|
||||
setName(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button radius={"xl"} onClick={() => setOpenCreate(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
disabled={!name}
|
||||
style={{
|
||||
transition: "all 0.5s ease",
|
||||
}}
|
||||
color="green"
|
||||
radius={"xl"}
|
||||
onClick={() => onSave(name, setName, setTipe)}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
<div>
|
||||
{openEditor ? (
|
||||
<Paper p={"sm"} shadow="lg" withBorder>
|
||||
<Stack>
|
||||
<TextInput
|
||||
value={edit?.name ? edit?.name : ""}
|
||||
label="Edit Tipe Event"
|
||||
label="Edit Tipe"
|
||||
placeholder="Contoh: Ramah Tamah, dll"
|
||||
onChange={(val) => {
|
||||
setEdit({
|
||||
...(edit as any),
|
||||
name: val.target.value,
|
||||
namaBank: val.target.value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Group position="apart">
|
||||
<Button color="red" onClick={() => setOpenEditor(false)}>
|
||||
<Button radius={"xl"} onClick={() => setOpenEditor(false)}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
disabled={!edit?.name}
|
||||
style={{
|
||||
transition: "all 0.5s ease",
|
||||
}}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() =>
|
||||
onUpdate(edit?.id, edit?.name, setTipe, setOpenEditor)
|
||||
@@ -222,7 +265,11 @@ async function onUpdate(id: any, edit: any, setTipe: any, setOpenEditor: any) {
|
||||
});
|
||||
}
|
||||
|
||||
async function onDelete(data: MODEL_DEFAULT_MASTER_OLD, close: any, setTipe: any) {
|
||||
async function onDelete(
|
||||
data: MODEL_DEFAULT_MASTER_OLD,
|
||||
close: any,
|
||||
setTipe: any
|
||||
) {
|
||||
await AdminEvent_funEditActivationTipeAcaraById(data.id as any).then(
|
||||
async (res) => {
|
||||
if (res.status === 200) {
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import _ from "lodash";
|
||||
import _, { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_funGetListAllRiwayat({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
export async function AdminEvent_getListAllRiwayat() {
|
||||
const data = await prisma.event.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
@@ -13,33 +24,45 @@ export async function AdminEvent_getListAllRiwayat() {
|
||||
tanggal: {
|
||||
lte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
lokasi: true,
|
||||
tanggal: true,
|
||||
deskripsi: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_TipeAcara: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
const nCount = await prisma.event.count({
|
||||
where: {
|
||||
eventMaster_StatusId: "1",
|
||||
tanggal: {
|
||||
lte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,45 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_getListPesertaById({
|
||||
eventId,
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
eventId: string;
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
export async function AdminEvent_getListPesertaById(eventId: string) {
|
||||
const data = await prisma.event_Peserta.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
where: {
|
||||
eventId: eventId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
User: {
|
||||
select: {
|
||||
include: {
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
const nCount = await prisma.event_Peserta.count({
|
||||
where: {
|
||||
eventId: eventId,
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_funGetListPublish({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.event.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "1",
|
||||
tanggal: {
|
||||
gte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event.count({
|
||||
where: {
|
||||
eventMaster_StatusId: "1",
|
||||
tanggal: {
|
||||
gte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_funGetListReject({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.event.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "4",
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event.count({
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "4",
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { ceil } from "lodash";
|
||||
|
||||
export async function adminEvent_funGetListReview({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
let takeData = 10;
|
||||
let skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.event.findMany({
|
||||
skip: skipData,
|
||||
take: takeData,
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "2",
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
EventMaster_Status: true,
|
||||
EventMaster_TipeAcara: true,
|
||||
},
|
||||
});
|
||||
|
||||
const nCount = await prisma.event.count({
|
||||
orderBy: {
|
||||
tanggal: "desc",
|
||||
},
|
||||
where: {
|
||||
eventMaster_StatusId: "2",
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const allData = {
|
||||
data: data,
|
||||
nPage: ceil(nCount / takeData),
|
||||
};
|
||||
|
||||
return allData;
|
||||
}
|
||||
11
src/app_modules/admin/event/fun/index.ts
Normal file
11
src/app_modules/admin/event/fun/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { adminEvent_funGetListAllRiwayat } from "./get/get_list_all_riwayat";
|
||||
import { adminEvent_getListPesertaById } from "./get/get_list_peserta_by_id";
|
||||
import { adminEvent_funGetListPublish } from "./get/status/fun_get_list_publish";
|
||||
import { adminEvent_funGetListReject } from "./get/status/fun_get_list_reject";
|
||||
import { adminEvent_funGetListReview } from "./get/status/fun_get_list_review";
|
||||
|
||||
export { adminEvent_funGetListReview };
|
||||
export { adminEvent_funGetListReject };
|
||||
export { adminEvent_funGetListPublish };
|
||||
export { adminEvent_funGetListAllRiwayat };
|
||||
export { adminEvent_getListPesertaById };
|
||||
@@ -1,8 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import {
|
||||
ActionIcon,
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
@@ -11,99 +9,137 @@ import {
|
||||
Grid,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconBan,
|
||||
IconChevronLeft,
|
||||
IconEyeCheck,
|
||||
IconEyeShare,
|
||||
IconShare,
|
||||
} from "@tabler/icons-react";
|
||||
import { IconCircleCheck, IconEyeShare, IconSearch } 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 { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import {
|
||||
MODEL_EVENT,
|
||||
MODEL_EVENT_PESERTA,
|
||||
} from "@/app_modules/event/model/interface";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/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/_global/notif_global/notifikasi_berhasil";
|
||||
import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { AdminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { adminEvent_getListPesertaById } from "../fun/get/get_list_peserta_by_id";
|
||||
import { adminEvent_funGetListPublish } from "../fun";
|
||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||
|
||||
export default function AdminEvent_TablePublish({
|
||||
listPublish,
|
||||
}: {
|
||||
listPublish: MODEL_EVENT[];
|
||||
listPublish: any;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event: Table Publish" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||
<TableStatus listPublish={listPublish} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
|
||||
function TableStatus({ listPublish }: { listPublish: any }) {
|
||||
const router = useRouter();
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listPublish);
|
||||
const [data, setData] = useState<MODEL_EVENT[]>(listPublish.data);
|
||||
const [isNPage, setNPage] = useState(listPublish.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
const [peserta, setPeserta] = useState<MODEL_EVENT_PESERTA[]>();
|
||||
const [eventId, setEventId] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminEvent_funGetListPublish({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_funGetListPublish({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
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>{e?.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}</td>
|
||||
<td>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
<Center w={200}>
|
||||
<Text>{e?.Author?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
<Center w={200}>
|
||||
<Text lineClamp={2}>{e.title}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.lokasi}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={400}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Button
|
||||
loading={e.id === eventId ? (loading === true ? true : false) : false}
|
||||
color={"green"}
|
||||
leftIcon={<IconEyeShare />}
|
||||
leftIcon={<IconCircleCheck />}
|
||||
radius={"xl"}
|
||||
onClick={async () => {
|
||||
setEventId(e.id);
|
||||
setLoading(true);
|
||||
await new Promise((v) => setTimeout(v, 500));
|
||||
await AdminEvent_getListPesertaById(e.id).then((res: any) => {
|
||||
setPeserta(res);
|
||||
setLoading(false);
|
||||
});
|
||||
open();
|
||||
router.push(RouterAdminEvent.detail_peserta + e.id);
|
||||
// setEventId(e.id);
|
||||
// setLoading(true);
|
||||
// await new Promise((v) => setTimeout(v, 500));
|
||||
// await adminEvent_getListPesertaById(e.id).then((res: any) => {
|
||||
// setPeserta(res);
|
||||
// setLoading(false);
|
||||
// });
|
||||
// open();
|
||||
}}
|
||||
>
|
||||
Lihat Peserta
|
||||
@@ -114,6 +150,78 @@ function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"green.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Publish</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tipe Acara</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Jam</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal opened={opened} onClose={close}>
|
||||
<Paper>
|
||||
<Stack>
|
||||
@@ -153,49 +261,6 @@ function TableStatus({ listPublish }: { listPublish: MODEL_EVENT[] }) {
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Modal>
|
||||
<Box>
|
||||
<Box bg={"green.1"} p={"xs"}>
|
||||
<Title order={6} c={"green"}>
|
||||
PUBLISH
|
||||
</Title>
|
||||
</Box>
|
||||
<Table
|
||||
withBorder
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"xl"}
|
||||
p={"md"}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,112 +1,138 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAdminDonasi_OLD } from "@/app/lib/router_hipmi/router_admin";
|
||||
import {
|
||||
ActionIcon,
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Flex,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import {
|
||||
IconBan,
|
||||
IconChevronLeft,
|
||||
IconEyeCheck,
|
||||
IconEyeShare,
|
||||
IconPencilPlus,
|
||||
IconShare,
|
||||
} from "@tabler/icons-react";
|
||||
import { IconPencilPlus, IconSearch } 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 "../../_admin_global/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/_global/notif_global/notifikasi_berhasil";
|
||||
import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
||||
import { useState } from "react";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import { adminEvent_funGetListReject } from "../fun";
|
||||
import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_reject_by_id";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
|
||||
export default function AdminEvent_TableReject({
|
||||
listReject,
|
||||
}: {
|
||||
listReject: MODEL_EVENT[];
|
||||
listReject: any;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event: Table Reject" />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||
<TableStatus listReject={listReject} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
|
||||
function TableStatus({ listReject }: { listReject: any }) {
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState<MODEL_EVENT[]>(listReject.data);
|
||||
const [isNPage, setNPage] = useState(listReject.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listReject);
|
||||
const [eventId, setEventId] = useState("");
|
||||
const [catatan, setCatatan] = useState("");
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminEvent_funGetListReject({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_funGetListReject({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onUpdate(eventId: string, catatan: string) {
|
||||
const body = {
|
||||
id: eventId,
|
||||
catatan: catatan,
|
||||
};
|
||||
const res = await AdminEvent_funEditCatatanById(body as any, "4");
|
||||
if (res.status === 200) {
|
||||
const loadData = await adminEvent_funGetListReject({
|
||||
search: isSearch,
|
||||
page: isActivePage,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
const TableRows = data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Box w={200}>{e?.Author?.Profile?.name}</Box>
|
||||
<Center w={200}>{e?.Author?.username}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={200}>{e.title}</Box>
|
||||
<Center w={200}>{e.title}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={200}>{e.lokasi}</Box>
|
||||
<Center w={200}>{e.lokasi}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={200}>{e.EventMaster_TipeAcara.name}</Box>
|
||||
<Center w={200}>{e.EventMaster_TipeAcara.name}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={200}>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={100}>
|
||||
<Center w={100}>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Box w={500}>
|
||||
<Center w={500}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
{" "}
|
||||
<Box w={400}>
|
||||
<Center w={400}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.catatan}
|
||||
</Spoiler>
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@@ -128,12 +154,87 @@ function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"red.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Reject</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tipe Acara</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Jam</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Cacatan</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
size={"lg"}
|
||||
size={"md"}
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
@@ -152,7 +253,7 @@ function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onUpdate(eventId, catatan, close as any, setData);
|
||||
onUpdate(eventId, catatan);
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
@@ -160,79 +261,6 @@ function TableStatus({ listReject }: { listReject: MODEL_EVENT[] }) {
|
||||
</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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,110 +1,322 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Modal,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Textarea,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconBan, IconEyeShare } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import _ from "lodash";
|
||||
import {
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Modal,
|
||||
Pagination,
|
||||
Paper,
|
||||
ScrollArea,
|
||||
Spoiler,
|
||||
Stack,
|
||||
Table,
|
||||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconBan, IconCircleCheck, IconSearch } from "@tabler/icons-react";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { ComponentAdminGlobal_NotifikasiBerhasil } from "../../_admin_global/admin_notifikasi/notifikasi_berhasil";
|
||||
import { ComponentAdminGlobal_NotifikasiGagal } from "../../_admin_global/admin_notifikasi/notifikasi_gagal";
|
||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||
import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user";
|
||||
import { adminEvent_funGetListReview } from "../fun";
|
||||
import { AdminEvent_funEditStatusPublishById } from "../fun/edit/fun_edit_status_publish_by_id";
|
||||
import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_reject_by_id";
|
||||
import { AdminEvent_getListTableByStatusId } from "../fun/get/get_list_table_by_status_id";
|
||||
|
||||
export default function AdminEvent_TableReview({
|
||||
listReview,
|
||||
listData,
|
||||
}: {
|
||||
listReview: MODEL_EVENT[];
|
||||
listData: any;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event: Table Review" />
|
||||
<TableStatus listReview={listReview} />
|
||||
<ComponentAdminGlobal_HeaderTamplate name="Event" />
|
||||
<TableStatus listData={listData} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
|
||||
function TableStatus({ listData }: { listData: any }) {
|
||||
const router = useRouter();
|
||||
const [data, setData] = useState<MODEL_EVENT[]>(listData.data);
|
||||
const [isNPage, setNPage] = useState(listData.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
const [isSearch, setSearch] = useState("");
|
||||
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [data, setData] = useState(listReview);
|
||||
const [catatan, setCatatan] = useState("");
|
||||
const [eventId, setEventId] = useState("");
|
||||
|
||||
// const dataEvent = {} as Prisma.UserUncheckedCreateInput;
|
||||
|
||||
async function onSearch(s: string) {
|
||||
setSearch(s);
|
||||
const loadData = await adminEvent_funGetListReview({
|
||||
page: 1,
|
||||
search: s,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_funGetListReview({
|
||||
search: isSearch,
|
||||
page: p,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
}
|
||||
|
||||
async function onPublish(eventId: string, tanggal: Date) {
|
||||
if (moment(tanggal).diff(Date.now(), "minutes") < 0)
|
||||
return ComponentGlobal_NotifikasiPeringatan(
|
||||
"Waktu acara telah lewat, Report untuk memberitahu user !"
|
||||
);
|
||||
|
||||
const res = await AdminEvent_funEditStatusPublishById(eventId, "1");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Event publish",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
const loadData = await adminEvent_funGetListReview({
|
||||
search: isSearch,
|
||||
page: isActivePage,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
ComponentAdminGlobal_NotifikasiBerhasil("Berhasil update status");
|
||||
} else {
|
||||
ComponentAdminGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function onReject(eventId: string, catatan: string) {
|
||||
if (catatan === "")
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Catatan");
|
||||
const body = {
|
||||
id: eventId,
|
||||
catatan: catatan,
|
||||
};
|
||||
|
||||
const res = await AdminEvent_funEditCatatanById(body as any, "4");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Event anda di tolak !",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
const loadData = await adminEvent_funGetListReview({
|
||||
search: isSearch,
|
||||
page: isActivePage,
|
||||
});
|
||||
setData(loadData.data as any);
|
||||
setNPage(loadData.nPage);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
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>{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}</td>
|
||||
<td>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
<Center w={200}>
|
||||
<Text>{e?.Author?.username}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
<Center w={200}>
|
||||
<Text lineClamp={2}>{e.title}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.lokasi}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleString("id-ID", { dateStyle: "full" })}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={200}>
|
||||
{e.tanggal.toLocaleTimeString([], {
|
||||
timeStyle: "short",
|
||||
hourCycle: "h24",
|
||||
})}
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center w={400}>
|
||||
<Spoiler hideLabel="sembunyikan" maxHeight={50} showLabel="tampilkan">
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Stack>
|
||||
<Button
|
||||
color={"green"}
|
||||
leftIcon={<IconEyeShare />}
|
||||
radius={"xl"}
|
||||
onClick={() => onPublish(e.id, setData, e.tanggal)}
|
||||
>
|
||||
Publish
|
||||
</Button>
|
||||
<Button
|
||||
color={"red"}
|
||||
leftIcon={<IconBan />}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
open();
|
||||
setEventId(e.id);
|
||||
}}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
</Stack>
|
||||
<Center>
|
||||
<Stack>
|
||||
<Button
|
||||
color={"green"}
|
||||
leftIcon={<IconCircleCheck />}
|
||||
radius={"xl"}
|
||||
onClick={() => onPublish(e.id, e.tanggal)}
|
||||
>
|
||||
Publish
|
||||
</Button>
|
||||
<Button
|
||||
color={"red"}
|
||||
leftIcon={<IconBan />}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
open();
|
||||
setEventId(e.id);
|
||||
}}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
</Stack>
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"} h={"100%"}>
|
||||
<Group
|
||||
position="apart"
|
||||
bg={"orange.4"}
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title order={4}>Review</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
placeholder="Masukan judul"
|
||||
onChange={(val) => {
|
||||
onSearch(val.currentTarget.value);
|
||||
}}
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
|
||||
<ScrollArea w={"100%"} h={"90%"}>
|
||||
<Table
|
||||
verticalSpacing={"md"}
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={1500}
|
||||
striped
|
||||
highlightOnHover
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center>Username</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Lokasi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tipe Acara</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Tanggal</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Jam</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Deskripsi</Center>
|
||||
</th>
|
||||
|
||||
<th>
|
||||
<Center>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{TableRows}</tbody>
|
||||
</Table>
|
||||
</ScrollArea>
|
||||
|
||||
<Center mt={"xl"}>
|
||||
<Pagination
|
||||
value={isActivePage}
|
||||
total={isNPage}
|
||||
onChange={(val) => {
|
||||
onPageClick(val);
|
||||
}}
|
||||
/>
|
||||
</Center>
|
||||
</Paper>
|
||||
</Stack>
|
||||
|
||||
<Modal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
centered
|
||||
withCloseButton={false}
|
||||
size={"lg"}
|
||||
size={"md"}
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
@@ -119,10 +331,13 @@ function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button radius={"xl"} onClick={close}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
onReject(eventId, catatan, setData, close);
|
||||
onReject(eventId, catatan);
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
@@ -130,133 +345,6 @@ function TableStatus({ listReview }: { listReview: MODEL_EVENT[] }) {
|
||||
</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, tanggal: Date) {
|
||||
if (moment(tanggal).diff(Date.now(), "minutes") < 0)
|
||||
return ComponentGlobal_NotifikasiPeringatan(
|
||||
"Waktu acara telah lewat, Report untuk memberitahu user !"
|
||||
);
|
||||
|
||||
const res = await AdminEvent_funEditStatusPublishById(eventId, "1");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Event publish",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
const res = await AdminEvent_funEditCatatanById(body as any, "4");
|
||||
if (res.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: res.data?.id,
|
||||
status: res.data?.EventMaster_Status?.name as any,
|
||||
userId: res.data?.authorId as any,
|
||||
pesan: res.data?.title as any,
|
||||
kategoriApp: "EVENT",
|
||||
title: "Event anda di tolak !",
|
||||
};
|
||||
|
||||
const notif = await adminNotifikasi_funCreateToUser({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({ userId: res?.data?.authorId, count: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
await AdminEvent_getListTableByStatusId("2").then((val) => {
|
||||
setData(val);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user