fix admin evnet
- fix detail reject
This commit is contained in:
@@ -24,7 +24,14 @@ function AdminEvent_ComponentDetailData({
|
||||
},
|
||||
{
|
||||
label: "Status",
|
||||
value: <Badge>{data?.EventMaster_Status.name}</Badge>,
|
||||
value: (
|
||||
<Badge>
|
||||
{data?.EventMaster_Status.name === "Publish" &&
|
||||
moment(data.tanggalSelesai).diff(new Date(), "minutes") < 0
|
||||
? "Riwayat"
|
||||
: data?.EventMaster_Status.name}
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: "Judul",
|
||||
|
||||
@@ -1,28 +1,118 @@
|
||||
import {
|
||||
ComponentGlobal_NotifikasiBerhasil,
|
||||
ComponentGlobal_NotifikasiGagal,
|
||||
ComponentGlobal_NotifikasiPeringatan,
|
||||
} from "@/app_modules/_global/notif_global";
|
||||
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
|
||||
import { Button, Group, Stack } from "@mantine/core";
|
||||
import { Button, Grid, Group, Stack, Textarea, Text} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconPencilPlus } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import { Admin_ComponentBoxStyle } from "../../_admin_global/_component/comp_admin_boxstyle";
|
||||
import { Admin_ComponentModal } from "../../_admin_global/_component/comp_admin_modal";
|
||||
import AdminEvent_ComponentDetailData from "../_component/comp_detail_data";
|
||||
import { AdminEvent_funEditCatatanById } from "../fun/edit/fun_edit_status_reject_by_id";
|
||||
|
||||
export function AdminEvent_ViewDetailReject({ data }: { data: MODEL_EVENT }) {
|
||||
const [newData, setNewData] = useState<MODEL_EVENT>(data);
|
||||
const [catatan, setCatatan] = useState(data.catatan);
|
||||
const [opened, { open, close }] = useDisclosure(false);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
async function handleUpdateReject() {
|
||||
if (catatan === "")
|
||||
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Catatan");
|
||||
|
||||
const body = {
|
||||
id: newData.id,
|
||||
catatan: catatan,
|
||||
};
|
||||
|
||||
try {
|
||||
setLoading(true);
|
||||
const res = await AdminEvent_funEditCatatanById(body as any, "4");
|
||||
if (res.status === 200) {
|
||||
setNewData({
|
||||
...newData,
|
||||
catatan: catatan,
|
||||
});
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
close();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error add note reject", error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Admin_ComponentBoxStyle>
|
||||
<Stack>
|
||||
<AdminEvent_ComponentDetailData data={data} />
|
||||
<AdminEvent_ComponentDetailData data={newData} />
|
||||
<Grid>
|
||||
<Grid.Col span={3}>
|
||||
<Text fw={"bold"}>Catatan report</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={1}>
|
||||
<Text>:</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>{newData.catatan}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Group mt={100} spacing={"xl"} position="center">
|
||||
<Button
|
||||
color={"red"}
|
||||
leftIcon={<IconPencilPlus />}
|
||||
radius={"xl"}
|
||||
// onClick={openReject}
|
||||
onClick={open}
|
||||
>
|
||||
Tambah catatan
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Admin_ComponentBoxStyle>
|
||||
|
||||
<Admin_ComponentModal
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
title="Tambah alasan penolakan"
|
||||
>
|
||||
<Stack>
|
||||
<Textarea
|
||||
minRows={2}
|
||||
maxRows={5}
|
||||
maxLength={300}
|
||||
value={catatan}
|
||||
autosize
|
||||
placeholder="Contoh: Karena deskripsi kurang lengkap, dll"
|
||||
onChange={(val) => {
|
||||
setCatatan(val.target.value);
|
||||
}}
|
||||
/>
|
||||
<Group position="right">
|
||||
<Button radius={"xl"} onClick={close}>
|
||||
Batal
|
||||
</Button>
|
||||
<Button
|
||||
color="green"
|
||||
loading={isLoading}
|
||||
loaderPosition="center"
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
handleUpdateReject();
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Admin_ComponentModal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { RouterAdminEvent } from "@/lib/router_admin/router_admin_event";
|
||||
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
@@ -25,6 +26,7 @@ import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamp
|
||||
import { apiGetAdminEventRiwayat } from "@/app_modules/admin/event/_lib/api_fecth_admin_event";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import Admin_DetailButton from "../../_admin_global/_component/button/detail_button";
|
||||
|
||||
export default function AdminEvent_Riwayat() {
|
||||
return (
|
||||
@@ -96,45 +98,21 @@ function DetailRiwayat() {
|
||||
return data.map((e, i) => (
|
||||
<tr key={i}>
|
||||
<td>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={e.id === eventId && loading ? true : false}
|
||||
color={"green"}
|
||||
leftIcon={<IconCircleCheck />}
|
||||
radius={"xl"}
|
||||
onClick={() => {
|
||||
setEventId(e.id);
|
||||
setLoading(true);
|
||||
router.push(RouterAdminEvent.detail_peserta + e.id);
|
||||
}}
|
||||
>
|
||||
Lihat Peserta
|
||||
</Button>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Text>{e?.Author?.username}</Text>
|
||||
<Center c={AdminColor.white}>
|
||||
<Box w={100}>
|
||||
<Text lineClamp={1}>{e?.Author?.username}</Text>
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Text lineClamp={2}>{e.title}</Text>
|
||||
<Center c={AdminColor.white}>
|
||||
<Box w={100}>
|
||||
<Text lineClamp={2}>{e.title}</Text>
|
||||
</Box>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Text>{e.lokasi}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Text>{e.EventMaster_TipeAcara.name}</Text>
|
||||
</Center>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Center c={AdminColor.white}>
|
||||
<Text align="center">
|
||||
{new Intl.DateTimeFormat("id-ID", {
|
||||
dateStyle: "full",
|
||||
@@ -149,7 +127,7 @@ function DetailRiwayat() {
|
||||
</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={200}>
|
||||
<Center c={AdminColor.white}>
|
||||
<Text align="center">
|
||||
{new Intl.DateTimeFormat("id-ID", {
|
||||
dateStyle: "full",
|
||||
@@ -165,14 +143,10 @@ function DetailRiwayat() {
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<Center c={AdminColor.white} w={400}>
|
||||
<Spoiler
|
||||
hideLabel="sembunyikan"
|
||||
maxHeight={50}
|
||||
showLabel="tampilkan"
|
||||
>
|
||||
{e.deskripsi}
|
||||
</Spoiler>
|
||||
<Center>
|
||||
<Admin_DetailButton
|
||||
path={RouterAdminEvent.new_detail({ id: e.id })}
|
||||
/>
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -188,7 +162,9 @@ function DetailRiwayat() {
|
||||
p={"xs"}
|
||||
style={{ borderRadius: "6px" }}
|
||||
>
|
||||
<Title c={AdminColor.white} order={4}>Riwayat</Title>
|
||||
<Title c={AdminColor.white} order={4}>
|
||||
Riwayat
|
||||
</Title>
|
||||
<TextInput
|
||||
icon={<IconSearch size={20} />}
|
||||
radius={"xl"}
|
||||
@@ -209,13 +185,9 @@ function DetailRiwayat() {
|
||||
horizontalSpacing={"md"}
|
||||
p={"md"}
|
||||
w={"100%"}
|
||||
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Aksi</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Username</Center>
|
||||
</th>
|
||||
@@ -223,19 +195,17 @@ function DetailRiwayat() {
|
||||
<Center c={AdminColor.white}>Judul</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Lokasi</Center>
|
||||
<Center c={AdminColor.white}>
|
||||
Tanggal & Waktu Mulai
|
||||
</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Tipe Acara</Center>
|
||||
<Center c={AdminColor.white}>
|
||||
Tanggal & Waktu Selesai
|
||||
</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Tanggal & Waktu Mulai</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Tanggal & Waktu Selesai</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center c={AdminColor.white}>Deskripsi</Center>
|
||||
<Center c={AdminColor.white}>Aksi</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Reference in New Issue
Block a user