Event Done
This commit is contained in:
@@ -63,7 +63,7 @@ function DetailTipeAcara({ listTipe }: { listTipe: MODEL_DEFAULT_MASTER[] }) {
|
|||||||
<TextInput
|
<TextInput
|
||||||
value={name ? name : ""}
|
value={name ? name : ""}
|
||||||
label="Masukan Tipe"
|
label="Masukan Tipe"
|
||||||
placeholder="Contoh: Ramah Tamah, dll"
|
placeholder="Contoh: Seminar, Workshop, dll."
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setName(val.target.value);
|
setName(val.target.value);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
"use client"
|
|
||||||
|
|
||||||
export default function AdminEvent_CreateTipeAcara(){
|
|
||||||
|
|
||||||
}
|
|
||||||
17
src/app_modules/event/component/error_maksimal_input.tsx
Normal file
17
src/app_modules/event/component/error_maksimal_input.tsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { Group, Text } from "@mantine/core";
|
||||||
|
import { IconAlertTriangle } from "@tabler/icons-react";
|
||||||
|
|
||||||
|
export default function ComponentEvent_ErrorMaximalInput({max}:{max: number}){
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Group spacing={"xs"}>
|
||||||
|
<IconAlertTriangle size={15} />
|
||||||
|
<Text fz={10} fs={"italic"}>
|
||||||
|
Maksimal {max} karakter !
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
Paper,
|
Paper,
|
||||||
Select,
|
Select,
|
||||||
Stack,
|
Stack,
|
||||||
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
Textarea,
|
Textarea,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
@@ -34,6 +35,7 @@ import _ from "lodash";
|
|||||||
import toast from "react-simple-toasts";
|
import toast from "react-simple-toasts";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||||
|
import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input";
|
||||||
|
|
||||||
export default function Event_Create({
|
export default function Event_Create({
|
||||||
listTipeAcara,
|
listTipeAcara,
|
||||||
@@ -47,6 +49,11 @@ export default function Event_Create({
|
|||||||
const [listTipe, setListTipe] = useState(listTipeAcara);
|
const [listTipe, setListTipe] = useState(listTipeAcara);
|
||||||
const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
|
const [hotMenu, setHotMenu] = useAtom(gs_event_hotMenu);
|
||||||
|
|
||||||
|
// Masimal karakter state
|
||||||
|
const [maxTitle, setMaxTitle] = useState("");
|
||||||
|
const [maxLokasi, setMaxLokasi] = useState("");
|
||||||
|
const [maxDeskripsi, setMaxDeskripsi] = useState("");
|
||||||
|
|
||||||
const [value, setValue] = useState({
|
const [value, setValue] = useState({
|
||||||
title: "",
|
title: "",
|
||||||
lokasi: "",
|
lokasi: "",
|
||||||
@@ -63,15 +70,25 @@ export default function Event_Create({
|
|||||||
label="Judul"
|
label="Judul"
|
||||||
placeholder="Masukan judul"
|
placeholder="Masukan judul"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
onChange={(val) =>
|
maxLength={100}
|
||||||
|
error={
|
||||||
|
maxTitle.length >= 100 ? (
|
||||||
|
<ComponentEvent_ErrorMaximalInput max={100} />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onChange={(val) => {
|
||||||
|
setMaxTitle(val.target.value);
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
title: val.target.value,
|
title: val.target.value,
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
withAsterisk
|
||||||
label="Tipe Acara"
|
label="Tipe Acara"
|
||||||
placeholder="Pilih Tipe Acara"
|
placeholder="Pilih Tipe Acara"
|
||||||
data={listTipe.map((e) => ({
|
data={listTipe.map((e) => ({
|
||||||
@@ -90,12 +107,21 @@ export default function Event_Create({
|
|||||||
label="Lokasi"
|
label="Lokasi"
|
||||||
placeholder="Masukan lokasi acara"
|
placeholder="Masukan lokasi acara"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
onChange={(val) =>
|
maxLength={200}
|
||||||
|
error={
|
||||||
|
maxLokasi.length >= 200 ? (
|
||||||
|
<ComponentEvent_ErrorMaximalInput max={200} />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onChange={(val) => {
|
||||||
|
setMaxLokasi(val.target.value);
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
lokasi: val.target.value,
|
lokasi: val.target.value,
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
// onClick={() => {
|
// onClick={() => {
|
||||||
@@ -118,14 +144,22 @@ export default function Event_Create({
|
|||||||
label="Deskripsi"
|
label="Deskripsi"
|
||||||
placeholder="Deskripsikan acara yang akan di selenggarakan"
|
placeholder="Deskripsikan acara yang akan di selenggarakan"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
maxLength={500}
|
|
||||||
autosize
|
autosize
|
||||||
onChange={(val) =>
|
maxLength={500}
|
||||||
|
error={
|
||||||
|
maxDeskripsi.length >= 500 ? (
|
||||||
|
<ComponentEvent_ErrorMaximalInput max={500} />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onChange={(val) => {
|
||||||
|
setMaxDeskripsi(val.target.value);
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
deskripsi: val.target.value,
|
deskripsi: val.target.value,
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -146,15 +180,17 @@ async function onSave(
|
|||||||
value: any,
|
value: any,
|
||||||
setHotMenu: any
|
setHotMenu: any
|
||||||
) {
|
) {
|
||||||
if (_.values(value).includes("")) return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
if (_.values(value).includes(""))
|
||||||
if (value.eventMaster_TipeAcaraId === 0) return ComponentGlobal_NotifikasiPeringatan("Pilih Tipe Acara");
|
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
||||||
if (moment(value.tanggal).format() === "Invalid date") return ComponentGlobal_NotifikasiPeringatan("Lengkapi Tanggal");
|
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) => {
|
await Event_funCreate(value).then((res) => {
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
setTabsStatus("Review");
|
setTabsStatus("Review");
|
||||||
setHotMenu(1)
|
setHotMenu(1);
|
||||||
router.push(RouterEvent.status_page);
|
router.push(RouterEvent.status_page);
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiGagal(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
import { Stack, TextInput, Textarea, Button, Select } from "@mantine/core";
|
import {
|
||||||
|
Stack,
|
||||||
|
TextInput,
|
||||||
|
Textarea,
|
||||||
|
Button,
|
||||||
|
Select,
|
||||||
|
Text,
|
||||||
|
Group,
|
||||||
|
} from "@mantine/core";
|
||||||
import { DateTimePicker } from "@mantine/dates";
|
import { DateTimePicker } from "@mantine/dates";
|
||||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
@@ -13,6 +21,8 @@ import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/
|
|||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||||
|
import { IconAlertTriangle } from "@tabler/icons-react";
|
||||||
|
import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input";
|
||||||
|
|
||||||
export default function Event_Edit({
|
export default function Event_Edit({
|
||||||
dataEvent,
|
dataEvent,
|
||||||
@@ -24,6 +34,11 @@ export default function Event_Edit({
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [value, setValue] = useState(dataEvent);
|
const [value, setValue] = useState(dataEvent);
|
||||||
const [tipe, setTipe] = useState(listTipeAcara);
|
const [tipe, setTipe] = useState(listTipeAcara);
|
||||||
|
|
||||||
|
// Masimal karakter state
|
||||||
|
const [maxTitle, setMaxTitle] = useState("");
|
||||||
|
const [maxLokasi, setMaxLokasi] = useState("");
|
||||||
|
const [maxDeskripsi, setMaxDeskripsi] = useState("");
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
|
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
|
||||||
@@ -33,7 +48,16 @@ export default function Event_Edit({
|
|||||||
placeholder="Masukan judul"
|
placeholder="Masukan judul"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
value={value.title}
|
value={value.title}
|
||||||
|
maxLength={100}
|
||||||
|
error={
|
||||||
|
maxTitle.length >= 100 ? (
|
||||||
|
<ComponentEvent_ErrorMaximalInput max={100} />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
|
setMaxTitle(val.target.value);
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
title: val.target.value,
|
title: val.target.value,
|
||||||
@@ -42,6 +66,7 @@ export default function Event_Edit({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
withAsterisk
|
||||||
label="Tipe Acara"
|
label="Tipe Acara"
|
||||||
placeholder="Pilih Tipe Acara"
|
placeholder="Pilih Tipe Acara"
|
||||||
data={tipe.map((e) => ({
|
data={tipe.map((e) => ({
|
||||||
@@ -64,7 +89,16 @@ export default function Event_Edit({
|
|||||||
placeholder="Masukan lokasi acara"
|
placeholder="Masukan lokasi acara"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
value={value.lokasi}
|
value={value.lokasi}
|
||||||
|
maxLength={200}
|
||||||
|
error={
|
||||||
|
maxLokasi.length >= 200 ? (
|
||||||
|
<ComponentEvent_ErrorMaximalInput max={200} />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
|
setMaxLokasi(val.target.value);
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
lokasi: val.target.value,
|
lokasi: val.target.value,
|
||||||
@@ -91,9 +125,17 @@ export default function Event_Edit({
|
|||||||
placeholder="Deskripsikan acara yang akan di selenggarakan"
|
placeholder="Deskripsikan acara yang akan di selenggarakan"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
autosize
|
autosize
|
||||||
maxLength={500}
|
|
||||||
value={value.deskripsi}
|
value={value.deskripsi}
|
||||||
|
maxLength={500}
|
||||||
|
error={
|
||||||
|
maxDeskripsi.length >= 500 ? (
|
||||||
|
<ComponentEvent_ErrorMaximalInput max={500} />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
|
setMaxDeskripsi(val.target.value);
|
||||||
setValue({
|
setValue({
|
||||||
...value,
|
...value,
|
||||||
deskripsi: val.target.value,
|
deskripsi: val.target.value,
|
||||||
@@ -110,7 +152,8 @@ export default function Event_Edit({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onUpdate(router: AppRouterInstance, value: MODEL_EVENT) {
|
async function onUpdate(router: AppRouterInstance, value: MODEL_EVENT) {
|
||||||
if (_.values(value).includes("")) return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
if (_.values(value).includes(""))
|
||||||
|
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
|
||||||
|
|
||||||
await Event_funEditById(value).then((res) => {
|
await Event_funEditById(value).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||||
import {
|
import {
|
||||||
|
ActionIcon,
|
||||||
Affix,
|
Affix,
|
||||||
Avatar,
|
Avatar,
|
||||||
Badge,
|
Badge,
|
||||||
@@ -47,16 +48,17 @@ export default function Event_Beranda({
|
|||||||
// );
|
// );
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <Affix position={{ bottom: rem(100), right: rem(20) }}>
|
<Affix position={{ bottom: rem(100), right: rem(30) }}>
|
||||||
<Button
|
<ActionIcon
|
||||||
|
size={"xl"}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
color="blue"
|
variant="transparent"
|
||||||
leftIcon={<IconCirclePlus />}
|
bg={"blue"}
|
||||||
onClick={() => router.push(RouterEvent.create)}
|
onClick={() => router.push(RouterEvent.create)}
|
||||||
>
|
>
|
||||||
<Text fz={"sm"}> Tambah Event</Text>
|
<IconCirclePlus color="white" size={40} />
|
||||||
</Button>
|
</ActionIcon>
|
||||||
</Affix> */}
|
</Affix>
|
||||||
|
|
||||||
{_.isEmpty(dataEvent) ? (
|
{_.isEmpty(dataEvent) ? (
|
||||||
<Center h={"80vh"}>
|
<Center h={"80vh"}>
|
||||||
|
|||||||
@@ -71,19 +71,7 @@ export default function LayoutEvent_Main({
|
|||||||
}
|
}
|
||||||
footer={
|
footer={
|
||||||
<Footer height={70} bg={"dark"} sx={{ borderTop: "px solid blue" }}>
|
<Footer height={70} bg={"dark"} sx={{ borderTop: "px solid blue" }}>
|
||||||
<Center>
|
|
||||||
<ActionIcon
|
|
||||||
sx={{ zIndex: 1, position: "absolute" }}
|
|
||||||
mt={-5}
|
|
||||||
size={"xl"}
|
|
||||||
radius={"xl"}
|
|
||||||
variant="transparent"
|
|
||||||
bg={"white"}
|
|
||||||
onClick={() => router.push(RouterEvent.create)}
|
|
||||||
>
|
|
||||||
<IconCirclePlus color="#347aeb" size={40} />
|
|
||||||
</ActionIcon>
|
|
||||||
</Center>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
{listFooter.map((e, i) => (
|
{listFooter.map((e, i) => (
|
||||||
<Grid.Col
|
<Grid.Col
|
||||||
|
|||||||
@@ -19,10 +19,9 @@ export default function Event_StatusReview({
|
|||||||
authorId: string;
|
authorId: string;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [data, setData] = useState(listReview);
|
|
||||||
|
|
||||||
|
|
||||||
if (_.isEmpty(data))
|
if (_.isEmpty(listReview))
|
||||||
return (
|
return (
|
||||||
<Center h={"50vh"} fz={"sm"} fw={"bold"}>
|
<Center h={"50vh"} fz={"sm"} fw={"bold"}>
|
||||||
Tidak Ada Event
|
Tidak Ada Event
|
||||||
@@ -30,7 +29,7 @@ export default function Event_StatusReview({
|
|||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{data.map((e, i) => (
|
{listReview.map((e, i) => (
|
||||||
<Box key={e.id}>
|
<Box key={e.id}>
|
||||||
<ComponentEvent_BoxListStatus
|
<ComponentEvent_BoxListStatus
|
||||||
data={e}
|
data={e}
|
||||||
|
|||||||
Reference in New Issue
Block a user