|
|
|
|
@@ -3,17 +3,32 @@ import {
|
|
|
|
|
SelectCustom,
|
|
|
|
|
StackCustom,
|
|
|
|
|
TextAreaCustom,
|
|
|
|
|
TextCustom,
|
|
|
|
|
TextInputCustom,
|
|
|
|
|
ViewWrapper,
|
|
|
|
|
} from "@/components";
|
|
|
|
|
import DateTimePickerCustom from "@/components/DateInput/DateTimePickerCustom";
|
|
|
|
|
import { useAuth } from "@/hooks/use-auth";
|
|
|
|
|
import { masterTypeEvent } from "@/lib/dummy-data/event/master-type-event";
|
|
|
|
|
import { DateTimePickerEvent } from "@react-native-community/datetimepicker";
|
|
|
|
|
import { router } from "expo-router";
|
|
|
|
|
import React, { useState } from "react";
|
|
|
|
|
import { Platform } from "react-native";
|
|
|
|
|
|
|
|
|
|
interface EventCreateProps {
|
|
|
|
|
title?: string;
|
|
|
|
|
lokasi?: string;
|
|
|
|
|
deskripsi?: string;
|
|
|
|
|
eventMaster_TipeAcaraId?: string;
|
|
|
|
|
tanggal?: string;
|
|
|
|
|
tanggalSelesai?: string;
|
|
|
|
|
authorId?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function EventCreate() {
|
|
|
|
|
const [data, setData] = useState<EventCreateProps>();
|
|
|
|
|
const { user } = useAuth();
|
|
|
|
|
|
|
|
|
|
const [selectedDate, setSelectedDate] = useState<
|
|
|
|
|
Date | DateTimePickerEvent | null
|
|
|
|
|
>(null);
|
|
|
|
|
@@ -24,24 +39,24 @@ export default function EventCreate() {
|
|
|
|
|
|
|
|
|
|
const handlerSubmit = () => {
|
|
|
|
|
try {
|
|
|
|
|
if (selectedDate) {
|
|
|
|
|
console.log("Tanggal yang dipilih:", selectedDate);
|
|
|
|
|
console.log(`ISO Format ${Platform.OS}:`, selectedDate.toString());
|
|
|
|
|
// Kirim ke API atau proses lanjutan
|
|
|
|
|
} else {
|
|
|
|
|
console.log("Tanggal belum dipilih");
|
|
|
|
|
}
|
|
|
|
|
// if (selectedDate) {
|
|
|
|
|
// console.log("Tanggal yang dipilih:", selectedDate);
|
|
|
|
|
// console.log(`ISO Format ${Platform.OS}:`, selectedDate.toString());
|
|
|
|
|
// // Kirim ke API atau proses lanjutan
|
|
|
|
|
// } else {
|
|
|
|
|
// console.log("Tanggal belum dipilih");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (selectedEndDate) {
|
|
|
|
|
console.log("Tanggal yang dipilih:", selectedEndDate);
|
|
|
|
|
console.log(`ISO Format ${Platform.OS}:`, selectedEndDate.toString());
|
|
|
|
|
// Kirim ke API atau proses lanjutan
|
|
|
|
|
} else {
|
|
|
|
|
console.log("Tanggal berakhir belum dipilih");
|
|
|
|
|
}
|
|
|
|
|
// if (selectedEndDate) {
|
|
|
|
|
// console.log("Tanggal yang dipilih:", selectedEndDate);
|
|
|
|
|
// console.log(`ISO Format ${Platform.OS}:`, selectedEndDate.toString());
|
|
|
|
|
// // Kirim ke API atau proses lanjutan
|
|
|
|
|
// } else {
|
|
|
|
|
// console.log("Tanggal berakhir belum dipilih");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
console.log("Data berhasil disimpan");
|
|
|
|
|
router.navigate("/event/status");
|
|
|
|
|
console.log("Data berhasil disimpan", JSON.stringify(data, null, 2));
|
|
|
|
|
// router.navigate("/event/status");
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
@@ -61,17 +76,21 @@ export default function EventCreate() {
|
|
|
|
|
placeholder="Masukkan nama event"
|
|
|
|
|
label="Nama Event"
|
|
|
|
|
required
|
|
|
|
|
onChangeText={(value: any) => setData({ ...data, title: value })}
|
|
|
|
|
/>
|
|
|
|
|
<SelectCustom
|
|
|
|
|
label="Tipe Event"
|
|
|
|
|
placeholder="Pilih tipe event"
|
|
|
|
|
data={masterTypeEvent}
|
|
|
|
|
onChange={(value) => console.log(value)}
|
|
|
|
|
onChange={(value: any) =>
|
|
|
|
|
setData({ ...data, eventMaster_TipeAcaraId: value })
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<TextInputCustom
|
|
|
|
|
label="Lokasi"
|
|
|
|
|
placeholder="Masukkan lokasi event"
|
|
|
|
|
required
|
|
|
|
|
onChangeText={(value: any) => setData({ ...data, lokasi: value })}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<DateTimePickerCustom
|
|
|
|
|
|