Init(Core): add to repo and add seeders
This commit is contained in:
38
resources/js/Components/CategoryForm.jsx
Normal file
38
resources/js/Components/CategoryForm.jsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import Input from '@/Components/Input'
|
||||
import TextArea from '@/Components/TextArea'
|
||||
import Button from '@/Components/Button'
|
||||
|
||||
import { useState } from 'react'
|
||||
|
||||
import { router } from '@inertiajs/react'
|
||||
|
||||
export default function CategoryForm({ onCancel, onSubmit }) {
|
||||
let [title, setTitle] = useState();
|
||||
let [description, setDescription] = useState();
|
||||
|
||||
let [step, setStep] = useState(1);
|
||||
|
||||
|
||||
function handleSubmit(){
|
||||
let data = {
|
||||
title: title,
|
||||
description: description,
|
||||
}
|
||||
router.post('/categories/store', data);
|
||||
onCancel();
|
||||
}
|
||||
if(step == 1){
|
||||
return (
|
||||
<div className="bg-white rounded-lg w-full max-w-lg h-fit p-8 space-y-4">
|
||||
<span className="pb-4 text-lg font-semibold">دسته بندی جدید</span>
|
||||
<Input label="عنوان" className="w-full ml-6" onChange={(e) => {setTitle(e.target.value)}} />
|
||||
<TextArea label="توضیحات (اختیاری)" className="" onChange={(e) => {setDescription(e.target.value)}}/>
|
||||
<div className="flex">
|
||||
<Button onClick={ onCancel } className="bg-white text-black border-gray-300 border-2 w-full transition hover:bg-zinc-100 ml-4 shadow-none">لغو</Button>
|
||||
<Button onClick={ e => setStep(2) } className="w-full text-white bg-zinc-800 transition hover:bg-zinc-700">ایجاد</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return("step2");
|
||||
}
|
||||
Reference in New Issue
Block a user