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, day_deadline: +customer?.paylater?.day_deadline, }) 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}
)}