import React, { Suspense } from 'react'
import { Head, router, useForm } from '@inertiajs/react'
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'
import FormInput from '@/Components/FormInput'
import Checkbox from '@/Components/Checkbox'
import FormInputNumeric from '@/Components/FormInputNumeric'
import FormInputTime from '@/Components/FormInputTime'
import Button from '@/Components/Button'
import { extractValue } from './utils'
const TinyEditor = React.lazy(() => import('@/Components/TinyMCE'))
export default function General(props) {
const { setting } = props
const { data, setData, post, reset, processing, errors } = useForm({
OPEN_WEBSITE_NAME: extractValue(setting, 'OPEN_WEBSITE_NAME'),
SHARE_TEXT: extractValue(setting, 'SHARE_TEXT'),
ENABLE_CASH_DEPOSIT: extractValue(setting, 'ENABLE_CASH_DEPOSIT'),
ENABLE_MANUAL_TRANSFER: extractValue(setting, 'ENABLE_MANUAL_TRANSFER'),
MAX_MANUAL_TRANSFER_TIMEOUT: extractValue(
setting,
'MAX_MANUAL_TRANSFER_TIMEOUT'
),
MANUAL_TRANSFER_OPEN_HOUR: extractValue(
setting,
'MANUAL_TRANSFER_OPEN_HOUR'
),
MANUAL_TRANSFER_CLOSE_HOUR: extractValue(
setting,
'MANUAL_TRANSFER_CLOSE_HOUR'
),
MAX_POINT_EXPIRED: extractValue(setting, 'MAX_POINT_EXPIRED'),
})
const handleOnChange = (event) => {
setData(
event.target.name,
event.target.type === 'checkbox'
? event.target.checked
? 1
: 0
: event.target.value
)
}
const handleSubmit = () => {
post(route('setting.update'))
}
return (