import{u as x,j as e,H as h,L as p}from"./app-2gKhTNh_.js";import{A as b}from"./AdminKampusLayout-QLddaMo-.js";import{F as n,_ as g,a as f,b as j}from"./index-DQiLWVLj.js";import{S as o}from"./sweetalert2.esm.all-NNS-RXd7.js";import"./proxy-N6hiut4S.js";function F({auth:d,errors:a}){const{data:s,setData:t,post:l,processing:r}=x({name:"",description:"",is_active:!0}),m=i=>{i.preventDefault(),o.fire({title:"Konfirmasi Simpan",text:"Apakah Anda yakin data fitur sistem perkuliahan sudah benar dan ingin disimpan?",icon:"question",showCancelButton:!0,confirmButtonColor:"#4F46E5",cancelButtonColor:"#EF4444",confirmButtonText:"Ya, Simpan",cancelButtonText:"Batal"}).then(c=>{c.isConfirmed&&l(route("admin.kampus.sistem_perkuliahan.store"),{onSuccess:()=>{t({name:"",description:"",is_active:!0}),o.fire("Berhasil!","Fitur sistem perkuliahan baru telah berhasil ditambahkan.","success")},onError:u=>{console.error("Gagal menyimpan fitur sistem perkuliahan:",u),o.fire("Gagal!","Terjadi kesalahan saat menyimpan data. Periksa kembali input Anda.","error")}})})};return e.jsxs(b,{user:d.user,header:e.jsx("h2",{className:"font-semibold text-xl text-gray-800 leading-tight",children:"Tambah Fitur Sistem Perkuliahan Baru"}),children:[e.jsx(h,{title:"Tambah Fitur Sistem Perkuliahan"}),e.jsx("div",{className:"max-w-4xl mx-auto sm:px-6 lg:px-8 py-12",children:e.jsxs("div",{className:"bg-white overflow-hidden shadow-xl sm:rounded-xl p-8",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6 border-b pb-4",children:[e.jsxs("h3",{className:"text-xl font-bold text-gray-800 flex items-center",children:[e.jsx(n,{icon:g,className:"mr-3 text-indigo-600"}),"Formulir Fitur Sistem Perkuliahan Baru"]}),e.jsxs(p,{href:route("admin.kampus.sistem_perkuliahan.index"),className:"inline-flex items-center px-4 py-2 bg-gray-200 border border-transparent rounded-lg font-semibold text-xs text-gray-700 uppercase tracking-widest hover:bg-gray-300 transition duration-150",children:[e.jsx(n,{icon:f,className:"w-3 h-3 mr-2"}),"Kembali ke Daftar"]})]}),e.jsxs("form",{onSubmit:m,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:["Nama Fitur ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{id:"name",type:"text",value:s.name,onChange:i=>t("name",i.target.value),className:`mt-1 block w-full border ${a.name?"border-red-500":"border-gray-300"} rounded-lg shadow-sm p-3 focus:ring-indigo-500 focus:border-indigo-500 transition duration-150`,required:!0}),a.name&&e.jsx("p",{className:"mt-2 text-sm text-red-600",children:a.name})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700 mb-1",children:["Deskripsi ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("textarea",{id:"description",value:s.description,onChange:i=>t("description",i.target.value),rows:"3",className:`mt-1 block w-full border ${a.description?"border-red-500":"border-gray-300"} rounded-lg shadow-sm p-3 focus:ring-indigo-500 focus:border-indigo-500 transition duration-150`,required:!0}),a.description&&e.jsx("p",{className:"mt-2 text-sm text-red-600",children:a.description})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{id:"is_active",type:"checkbox",checked:s.is_active,onChange:i=>t("is_active",i.target.checked),className:"h-4 w-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500"}),e.jsx("label",{htmlFor:"is_active",className:"ml-2 block text-sm font-medium text-gray-700",children:"Aktif (Tampilkan di halaman publik)"}),a.is_active&&e.jsx("p",{className:"mt-2 text-sm text-red-600",children:a.is_active})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t mt-6",children:e.jsxs("button",{type:"submit",disabled:r,className:`inline-flex items-center px-6 py-3 border border-transparent rounded-lg font-semibold text-sm uppercase tracking-widest transition ease-in-out duration-150 shadow-md justify-center ${r?"bg-indigo-400 cursor-not-allowed":"bg-indigo-600 text-white hover:bg-indigo-700 active:bg-indigo-900 focus:outline-none focus:border-indigo-900 focus:ring ring-indigo-300"}`,children:[e.jsx(n,{icon:j,className:"w-4 h-4 mr-2"}),r?"Menyimpan...":"Simpan Fitur"]})})]})]})})]})}export{F as default};
