import React from 'react' import { Head, router, useForm } from '@inertiajs/react' import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout' import FormInput from '@/Components/FormInput' import Button from '@/Components/Button' import TextArea from '@/Components/TextArea' import FormFile from '@/Components/FormFile' import Checkbox from '@/Components/Checkbox' import { extractValue } from './utils' export default function General(props) { const { setting, midtrans_notification_url } = props const { data, setData, post, reset, processing, errors } = useForm({ AFFILATE_ENABLED: extractValue(setting, 'AFFILATE_ENABLED'), AFFILATE_COIN_AMOUNT: extractValue(setting, 'AFFILATE_COIN_AMOUNT'), MIDTRANS_SERVER_KEY: extractValue(setting, 'MIDTRANS_SERVER_KEY'), MIDTRANS_CLIENT_KEY: extractValue(setting, 'MIDTRANS_CLIENT_KEY'), MIDTRANS_MERCHANT_ID: extractValue(setting, 'MIDTRANS_MERCHANT_ID'), MIDTRANS_LOGO: extractValue(setting, 'MIDTRANS_LOGO'), MIDTRANS_ENABLED: extractValue(setting, 'MIDTRANS_ENABLED'), midtrans_logo_file: null, }) 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'), { onSuccess: () => { setTimeout(() => router.get(route(route().current())), 3000) }, }) } return (
Setting
Affilate
Midtrans Payment
setData( 'midtrans_logo_file', e.target.files[0] ) } error={errors.midtrans_logo_file} preview={ site logo } />
) }