Fix:
- Create event
- api master tipe event

## NO Issue
This commit is contained in:
2025-09-10 17:43:01 +08:00
parent fc181bda7c
commit 3854db9330
3 changed files with 41 additions and 18 deletions

View File

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

View File

@@ -15,7 +15,7 @@ import { apiUser } from "@/service/api-client/api-user";
import { GStyles } from "@/styles/global-styles"; import { GStyles } from "@/styles/global-styles";
import { Ionicons } from "@expo/vector-icons"; import { Ionicons } from "@expo/vector-icons";
import { Stack, useFocusEffect, useLocalSearchParams } from "expo-router"; import { Stack, useFocusEffect, useLocalSearchParams } from "expo-router";
import { useCallback, useEffect, useState } from "react"; import { useCallback, useState } from "react";
import { TouchableOpacity } from "react-native"; import { TouchableOpacity } from "react-native";
export default function Portofolio() { export default function Portofolio() {

View File

@@ -20,3 +20,7 @@ export async function apiMasterSubBidangBisnis({ id }: { id?: string }) {
throw error; throw error;
} }
} }
// export async function apiMasterEventType(params:type) {
// }