fix admin evnet
- fix detail reject
This commit is contained in:
@@ -24,7 +24,14 @@ function AdminEvent_ComponentDetailData({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Status",
|
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",
|
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 { 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 { IconPencilPlus } from "@tabler/icons-react";
|
||||||
|
import { useState } from "react";
|
||||||
import { Admin_ComponentBoxStyle } from "../../_admin_global/_component/comp_admin_boxstyle";
|
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_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 }) {
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<Admin_ComponentBoxStyle>
|
<Admin_ComponentBoxStyle>
|
||||||
<Stack>
|
<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">
|
<Group mt={100} spacing={"xl"} position="center">
|
||||||
<Button
|
<Button
|
||||||
color={"red"}
|
color={"red"}
|
||||||
leftIcon={<IconPencilPlus />}
|
leftIcon={<IconPencilPlus />}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
// onClick={openReject}
|
onClick={open}
|
||||||
>
|
>
|
||||||
Tambah catatan
|
Tambah catatan
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Admin_ComponentBoxStyle>
|
</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 { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import {
|
import {
|
||||||
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
Group,
|
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 { apiGetAdminEventRiwayat } from "@/app_modules/admin/event/_lib/api_fecth_admin_event";
|
||||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import Admin_DetailButton from "../../_admin_global/_component/button/detail_button";
|
||||||
|
|
||||||
export default function AdminEvent_Riwayat() {
|
export default function AdminEvent_Riwayat() {
|
||||||
return (
|
return (
|
||||||
@@ -96,45 +98,21 @@ function DetailRiwayat() {
|
|||||||
return data.map((e, i) => (
|
return data.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Button
|
<Center c={AdminColor.white}>
|
||||||
loaderPosition="center"
|
<Box w={100}>
|
||||||
loading={e.id === eventId && loading ? true : false}
|
<Text lineClamp={1}>{e?.Author?.username}</Text>
|
||||||
color={"green"}
|
</Box>
|
||||||
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>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={200}>
|
<Center c={AdminColor.white}>
|
||||||
<Text lineClamp={2}>{e.title}</Text>
|
<Box w={100}>
|
||||||
|
<Text lineClamp={2}>{e.title}</Text>
|
||||||
|
</Box>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={200}>
|
<Center c={AdminColor.white}>
|
||||||
<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}>
|
|
||||||
<Text align="center">
|
<Text align="center">
|
||||||
{new Intl.DateTimeFormat("id-ID", {
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
dateStyle: "full",
|
dateStyle: "full",
|
||||||
@@ -149,7 +127,7 @@ function DetailRiwayat() {
|
|||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={200}>
|
<Center c={AdminColor.white}>
|
||||||
<Text align="center">
|
<Text align="center">
|
||||||
{new Intl.DateTimeFormat("id-ID", {
|
{new Intl.DateTimeFormat("id-ID", {
|
||||||
dateStyle: "full",
|
dateStyle: "full",
|
||||||
@@ -165,14 +143,10 @@ function DetailRiwayat() {
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Center c={AdminColor.white} w={400}>
|
<Center>
|
||||||
<Spoiler
|
<Admin_DetailButton
|
||||||
hideLabel="sembunyikan"
|
path={RouterAdminEvent.new_detail({ id: e.id })}
|
||||||
maxHeight={50}
|
/>
|
||||||
showLabel="tampilkan"
|
|
||||||
>
|
|
||||||
{e.deskripsi}
|
|
||||||
</Spoiler>
|
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -188,7 +162,9 @@ function DetailRiwayat() {
|
|||||||
p={"xs"}
|
p={"xs"}
|
||||||
style={{ borderRadius: "6px" }}
|
style={{ borderRadius: "6px" }}
|
||||||
>
|
>
|
||||||
<Title c={AdminColor.white} order={4}>Riwayat</Title>
|
<Title c={AdminColor.white} order={4}>
|
||||||
|
Riwayat
|
||||||
|
</Title>
|
||||||
<TextInput
|
<TextInput
|
||||||
icon={<IconSearch size={20} />}
|
icon={<IconSearch size={20} />}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
@@ -209,13 +185,9 @@ function DetailRiwayat() {
|
|||||||
horizontalSpacing={"md"}
|
horizontalSpacing={"md"}
|
||||||
p={"md"}
|
p={"md"}
|
||||||
w={"100%"}
|
w={"100%"}
|
||||||
|
|
||||||
>
|
>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
|
||||||
<Center c={AdminColor.white}>Aksi</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Username</Center>
|
<Center c={AdminColor.white}>Username</Center>
|
||||||
</th>
|
</th>
|
||||||
@@ -223,19 +195,17 @@ function DetailRiwayat() {
|
|||||||
<Center c={AdminColor.white}>Judul</Center>
|
<Center c={AdminColor.white}>Judul</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Lokasi</Center>
|
<Center c={AdminColor.white}>
|
||||||
|
Tanggal & Waktu Mulai
|
||||||
|
</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Tipe Acara</Center>
|
<Center c={AdminColor.white}>
|
||||||
|
Tanggal & Waktu Selesai
|
||||||
|
</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Tanggal & Waktu Mulai</Center>
|
<Center c={AdminColor.white}>Aksi</Center>
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center c={AdminColor.white}>Tanggal & Waktu Selesai</Center>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Center c={AdminColor.white}>Deskripsi</Center>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
Reference in New Issue
Block a user