diff --git a/resources/js/Layouts/MainLayout.jsx b/resources/js/Layouts/MainLayout.jsx new file mode 100644 index 0000000..88db98d --- /dev/null +++ b/resources/js/Layouts/MainLayout.jsx @@ -0,0 +1,81 @@ +import { Link, usePage } from '@inertiajs/react'; +import { useState } from 'react'; + +export default function MainLayout({ children }) { + const [sidebarOpen, setSidebarOpen] = useState(true); + const { url } = usePage(); + + const menus = [ + { name: 'Dashboard', href: '/', icon: '🏠' }, + { name: 'Buku', href: '/buku', icon: '📚' }, + { name: 'Kategori', href: '/kategori', icon: '🏷️' }, + { name: 'Anggota', href: '/anggota', icon: '👥' }, + { name: 'Peminjaman', href: '/peminjaman', icon: '📋' }, + ]; + + return ( +
+ {/* Sidebar */} + + + {/* Main Content */} +
+ {/* Header */} +
+

Sistem Perpustakaanku

+ 📅 {new Date().toLocaleDateString('id-ID', { + weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' + })} +
+ + {/* Flash Message */} + + + {/* Content */} +
+ {children} +
+
+
+ ); +} + +function FlashMessage() { + const { flash } = usePage().props; + if (!flash?.success) return null; + + return ( +
+ + {flash.success} +
+ ); +} \ No newline at end of file diff --git a/resources/js/Pages/Anggota/Create.jsx b/resources/js/Pages/Anggota/Create.jsx new file mode 100644 index 0000000..315dcc1 --- /dev/null +++ b/resources/js/Pages/Anggota/Create.jsx @@ -0,0 +1,158 @@ +import MainLayout from "@/Layouts/MainLayout"; +import { Head, useForm, Link } from "@inertiajs/react"; + +export default function AnggotaCreate() { + const { data, setData, post, processing, errors } = useForm({ + nama: "", + email: "", + no_telepon: "", + alamat: "", + tanggal_bergabung: "", + status: "aktif", + }); + + const handleSubmit = (e) => { + e.preventDefault(); + post("/anggota"); + }; + + return ( + + + +
+
+ + ← Kembali + + / + Tambah Anggota +
+ +
+

+ 👥 Tambah Anggota Baru +

+ +
+ + + setData("nama", e.target.value) + } + className="w-full border rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-400 focus:outline-none" + placeholder="Masukkan nama lengkap" + /> + + + + + setData("email", e.target.value) + } + className="w-full border rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-400 focus:outline-none" + placeholder="contoh@email.com" + /> + + +
+ + + setData("no_telepon", e.target.value) + } + className="w-full border rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-400 focus:outline-none" + placeholder="08xxxxxxxxxx" + /> + + + + + setData( + "tanggal_bergabung", + e.target.value, + ) + } + className="w-full border rounded-lg px-3 py-2 focus:ring-2 focus:ring-indigo-400 focus:outline-none" + /> + +
+ + +