import React, { useEffect } from 'react' import { isEmpty } from 'lodash' import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout' import FormInput from '@/Components/FormInput' import Button from '@/Components/Button' import { Head, useForm } from '@inertiajs/react' import FormInputWith from '@/Components/FormInputWith' import LocationSelectionInput from '../Location/SelectionInput' import TextArea from '@/Components/TextArea' export default function Import(props) { const { data, setData, post, processing, errors } = useForm({ script: '', discount: 0, display_price: 0, expired: '', expired_unit: 'Hari', location_id: null, }) const handleOnChange = (event) => { setData( event.target.name, event.target.type === 'checkbox' ? event.target.checked ? 1 : 0 : event.target.value ) } const handleSubmit = () => { post(route('voucher.import')) } return (
Voucher
setData('location_id', id)} error={errors.location_id} />
%
} name="discount" value={data.discount} onChange={handleOnChange} error={errors.discount} formClassName={'pr-10'} label="Discount" max={100} min={0} />