# Admin Event

# feat
- Tampilan riwayat
- Tambah tipe acara
- Edit tipe acara
### No issuu
This commit is contained in:
2024-02-01 17:54:15 +08:00
parent c01906c063
commit aa203c0bc2
34 changed files with 1027 additions and 153 deletions

View File

@@ -30,6 +30,10 @@ import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
import { Event_funCreate } from "../fun/create/fun_create";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { kMaxLength } from "buffer";
import _ from "lodash";
import toast from "react-simple-toasts";
import moment from "moment";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
export default function Event_Create({
listTipeAcara,
@@ -43,7 +47,6 @@ export default function Event_Create({
const [listTipe, setListTipe] = useState(listTipeAcara);
const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
const [value, setValue] = useState({
title: "",
lokasi: "",
@@ -95,6 +98,12 @@ export default function Event_Create({
}
/>
<DateTimePicker
// onClick={() => {
// console.log(moment().diff(moment("2024-02-01"), "days"));
// }}
excludeDate={(date) => {
return moment(date).diff(Date.now(), "days") < 0;
}}
withAsterisk
label="Tanggal & Waktu "
placeholder="Masukan tangal dan waktu acara"
@@ -137,6 +146,10 @@ async function onSave(
value: any,
setHotMenu: any
) {
if (_.values(value).includes("")) return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
if (value.eventMaster_TipeAcaraId === 0) return ComponentGlobal_NotifikasiPeringatan("Pilih Tipe Acara");
if (moment(value.tanggal).format() === "Invalid date") return ComponentGlobal_NotifikasiPeringatan("Lengkapi Tanggal");
await Event_funCreate(value).then((res) => {
if (res.status === 201) {
ComponentGlobal_NotifikasiBerhasil(res.message);

View File

@@ -10,6 +10,9 @@ import { useState } from "react";
import { MODEL_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
import { Event_funEditById } from "../fun/edit/fun_edit_by_id";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import moment from "moment";
import _ from "lodash";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
export default function Event_Edit({
dataEvent,
@@ -69,6 +72,9 @@ export default function Event_Edit({
}}
/>
<DateTimePicker
excludeDate={(date) => {
return moment(date).diff(Date.now(), "days") < 0;
}}
withAsterisk
label="Tanggal & Waktu "
placeholder="Masukan tangal dan waktu acara"
@@ -104,6 +110,8 @@ export default function Event_Edit({
}
async function onUpdate(router: AppRouterInstance, value: MODEL_EVENT) {
if (_.values(value).includes("")) return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
await Event_funEditById(value).then((res) => {
if (res.status === 200) {
ComponentGlobal_NotifikasiBerhasil(res.message);

View File

@@ -21,14 +21,6 @@ export default function Event_StatusReview({
const router = useRouter();
const [data, setData] = useState(listReview);
useShallowEffect(() => {
setTimeout(() => loadData(authorId), 1000)
}, []);
async function loadData(authorId: string) {
const res : any = await Event_getByStatusId("2", authorId);
setData(res);
}
if (_.isEmpty(data))
return (