Fix: Event

Deskripsi:
- Fix database event
- Fix style detal
This commit is contained in:
2024-11-29 16:15:54 +08:00
parent 517b2bb9b0
commit 45279cd37f
36 changed files with 714 additions and 611 deletions

View File

@@ -4,6 +4,7 @@ import { MainColor } from "@/app_modules/_global/color";
import {
ComponentGlobal_NotifikasiBerhasil,
ComponentGlobal_NotifikasiGagal,
ComponentGlobal_NotifikasiPeringatan,
} from "@/app_modules/_global/notif_global";
import { notifikasiToAdmin_funCreate } from "@/app_modules/notifikasi/fun";
import { Button } from "@mantine/core";
@@ -14,13 +15,23 @@ import { useState } from "react";
import { WibuRealtime } from "wibu-pkg";
import { Event_funCreate } from "../../fun/create/fun_create";
import { gs_event_hotMenu } from "../../global_state";
import { event_checkStatus } from "../../fun/get/fun_check_status_by_id";
export default function Event_ComponentCreateButton({ value }: { value: any }) {
export default function Event_ComponentCreateButton({
value,
diffTimeStart,
diffTimeEnd,
}: {
value: any;
diffTimeStart: number;
diffTimeEnd: number;
}) {
const router = useRouter();
const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
const [isLoading, setLoading] = useState(false);
async function onSave() {
const res = await Event_funCreate(value);
if (res.status === 201) {
@@ -71,7 +82,8 @@ export default function Event_ComponentCreateButton({ value }: { value: any }) {
value.deskripsi === "" ||
value.eventMaster_TipeAcaraId === 0 ||
value.tanggal === "function Date() { [native code] }" ||
moment(value.tanggal).diff(moment(), "minutes") < 0
// moment(value.tanggal).diff(moment(), "minutes") < 0
diffTimeEnd - 1 < diffTimeStart
}
loaderPosition="center"
loading={isLoading ? true : false}

View File

@@ -9,26 +9,16 @@ export default function ComponentEvent_DetailData({
}: {
data: MODEL_EVENT;
}) {
const tgl = data.tanggal;
const hari = tgl.toLocaleString("id-ID", { dateStyle: "full" });
const jam = tgl.toLocaleTimeString([], {
timeStyle: "short",
hourCycle: "h24",
});
return (
<>
<ComponentGlobal_CardStyles marginBottom={"16px"}>
<Stack px={"sm"} spacing={"lg"}>
<Stack px={"sm"} spacing={"xl"}>
<Title lineClamp={2} align="center" w={"100%"} order={4}>
{data ? data?.title : null}
</Title>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"} fz={"sm"}>
Lokasi
</Text>
<Text fw={"bold"}>Lokasi</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>
@@ -37,37 +27,59 @@ export default function ComponentEvent_DetailData({
</Grid>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"} fz={"sm"}>
Tipe Acara
</Text>
<Text fw={"bold"}>Tipe Acara</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>
<Text>{data ? data.EventMaster_TipeAcara?.name : null}</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"} fz={"sm"}>
Tanggal
</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>{hari ? hari : ""}</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"} fz={"sm"}>
Jam
</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>{jam ? jam : ""}</Grid.Col>
</Grid>
<Stack spacing={"xs"}>
<Text fw={"bold"}>Tanggal & Waktu</Text>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"}>Mulai</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>
<Text>
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(data?.tanggal)}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(data?.tanggal)}
</Text>
</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"}>Selesai</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>
<Text>
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(data?.tanggalSelesai)}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(data?.tanggalSelesai)}
</Text>
</Text>
</Grid.Col>
</Grid>
</Stack>
<Stack spacing={2}>
<Text fw={"bold"} fz={"sm"}>
Deskripsi
</Text>
<Text fw={"bold"}>Deskripsi</Text>
<Text>{data ? data?.deskripsi : null}</Text>
</Stack>
</Stack>

View File

@@ -28,15 +28,13 @@ export default function ComponentEvent_DetailMainData({
profile={data?.Author?.Profile as any}
/>
<Stack>
<Stack spacing={"xl"}>
<Title align="center" order={4}>
{data ? data.title : null}
</Title>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"} fz={"sm"}>
Lokasi
</Text>
<Text fw={"bold"}>Lokasi</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>
@@ -45,37 +43,60 @@ export default function ComponentEvent_DetailMainData({
</Grid>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"} fz={"sm"}>
Tipe Acara
</Text>
<Text fw={"bold"}>Tipe Acara</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>
<Text>{data ? data.EventMaster_TipeAcara.name : null}</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"} fz={"sm"}>
Tanggal
</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>{hari}</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"} fz={"sm"}>
Jam
</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>{jam}</Grid.Col>
</Grid>
<Stack spacing={"xs"}>
<Text fw={"bold"}>Tanggal & Waktu</Text>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"}>Mulai</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>
<Text>
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(data?.tanggal)}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(data?.tanggal)}
</Text>
</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={4}>
<Text fw={"bold"}>Selesai</Text>
</Grid.Col>
<Grid.Col span={1}>:</Grid.Col>
<Grid.Col span={"auto"}>
<Text>
{" "}
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
}).format(data?.tanggalSelesai)}
,{" "}
<Text span inherit>
{new Intl.DateTimeFormat("id-ID", {
timeStyle: "short",
}).format(data?.tanggalSelesai)}
</Text>
</Text>
</Grid.Col>
</Grid>
</Stack>
<Stack spacing={2}>
<Text fw={"bold"} fz={"sm"}>
Deskripsi
</Text>
<Text fw={"bold"}>Deskripsi</Text>
<Text>{data ? data?.deskripsi : null}</Text>
</Stack>
</Stack>