import React, { useEffect, Suspense } from 'react' import { isEmpty } from 'lodash' import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout' import FormInput from '@/Components/FormInput' import Button from '@/Components/Button' import { Head, useForm, usePage } from '@inertiajs/react' import FormFile from '@/Components/FormFile' import FormInputWith from '@/Components/FormInputWith' import TextArea from '@/Components/TextArea' const Profile = () => { const { props: { customer, statuses }, } = usePage() const { data, setData, post, processing, errors } = useForm({ username: '', password: '', name: '', fullname: '', address: '', phone: '', image: '', image_url: '', status: 0, }) const handleOnChange = (event) => { setData( event.target.name, event.target.type === 'checkbox' ? event.target.checked ? 1 : 0 : event.target.value ) } const handleSubmit = () => { if (isEmpty(customer) === false) { post(route('customer.update', customer)) return } post(route('customer.store')) } useEffect(() => { if (isEmpty(customer) === false) { setData({ username: customer.username, password: customer.password, name: customer.name, fullname: customer.fullname, address: customer.address, phone: customer.phone, image_url: customer.image_url, status: customer.status, }) } }, [customer]) return (
{errors.level}
)}