import React from 'react' import { usePage, useForm } from '@inertiajs/react' import { isEmpty } from 'lodash' import Button from '@/Components/Button' import FormInputNumeric from '@/Components/FormInputNumeric' export default function Paylater() { const { props: { customer, levels }, } = usePage() const { data, setData, post, processing, errors } = useForm({ level: customer?.level.key, paylater_limit: +customer?.paylater?.limit, }) const handleOnChange = (event) => { setData( event.target.name, event.target.type === 'checkbox' ? event.target.checked ? 1 : 0 : event.target.value ) } const handleSubmit = () => { post(route('customer.update_level', customer)) } if (isEmpty(customer)) { return } return (
{errors.level}
)}