import InputError from '@/components/input-error'; import LoadingButton from '@/components/loading-button'; import TagInput from '@/components/tag-input'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Textarea } from '@/components/ui/textarea'; import { onHandleChange } from '@/lib/inertia'; import { StudentDashboardProps } from '@/types/page'; import { useForm, usePage } from '@inertiajs/react'; import { useState } from 'react'; const BecomeInstructor = () => { const { auth, instructor, translate } = usePage().props; const { button, input, frontend } = translate; const [isEditing, setIsEditing] = useState(instructor ? false : true); // Parse the options and answers if they're strings const initialOptions = instructor?.skills ? (typeof instructor.skills === 'string' ? JSON.parse(instructor.skills) : instructor.skills) : []; const { data, setData, post, processing, errors } = useForm({ user_id: auth.user.id, skills: initialOptions, designation: instructor?.designation || '', biography: instructor?.biography || '', resume: null, }); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); if (instructor) { post(route('become-instructor.update', instructor.id)); } else { post(route('become-instructor.store')); } }; return ( {!isEditing ? (
{instructor.status === 'rejected' ? ( <>

{frontend.application_rejected}

) : ( <>

{frontend.application_under_review}

)}
) : (
onHandleChange(e, setData)} placeholder={input.designation_placeholder} />
onHandleChange(e, setData)} />
setData('skills', values)} />