"use client"; import { MainColor } from "@/app_modules/_global/color"; import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown"; import Component_V3_Label_TextInput from "@/app_modules/_global/component/new/comp_V3_label_text_input"; import { Component_V3_TextEditor } from "@/app_modules/_global/component/new/comp_V3_text_editor"; import { funReplaceHtml } from "@/app_modules/_global/fun/fun_replace_html"; import { apiNewGetUserIdByToken } from "@/app_modules/_global/lib/api_fetch_global"; import { baseStylesTextInput } from "@/app_modules/_global/lib/base_style_text_input"; import { maxInputLength } from "@/app_modules/_global/lib/maximal_setting"; import CustomSkeleton from "@/app_modules/components/CustomSkeleton"; import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface"; import { Select, Stack, TextInput } from "@mantine/core"; import { DateTimePicker } from "@mantine/dates"; import { useShallowEffect } from "@mantine/hooks"; import _ from "lodash"; import moment from "moment"; import { useState } from "react"; import { apiGetMasterTipeAcara } from "../_lib/api_event"; import { Event_ComponentCreateButton } from "../component"; import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input"; export default function Event_Create() { const [listTipe, setListTipe] = useState(); const [isTimeStart, setIsTimeStart] = useState(false); const [diffTimeStart, setDiffTimeStart] = useState(0); const [isTimeEnd, setIsTimeEnd] = useState(false); const [diffTimeEnd, setDiffTimeEnd] = useState(0); const [value, setValue] = useState({ title: "", lokasi: "", deskripsi: "", tanggal: Date.toString(), tanggalSelesai: Date.toString(), eventMaster_TipeAcaraId: 0, authorId: "", }); useShallowEffect(() => { handleGetUserLoginId(); }, []); async function handleGetUserLoginId() { try { const response = await apiNewGetUserIdByToken(); if (response.success) { setValue({ ...value, authorId: response.userId, }); } } catch (error) { setValue({ ...value, authorId: "", }); } } useShallowEffect(() => { handleGetMasterTipeAcara(); }, []); async function handleGetMasterTipeAcara() { try { const response = await apiGetMasterTipeAcara(); if (response.success) { setListTipe(response.data); } else { setListTipe([]); } } catch (error) { setListTipe([]); } } if (!listTipe || !value.authorId) { return ; } return ( <> {/*
{JSON.stringify(value, null, 2)}
*/} { setValue({ ...value, title: val.target.value, }); }} />