import InputError from '@/components/input-error'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { cn } from '@/lib/utils'; import { SharedData } from '@/types/global'; import { Link, router, useForm } from '@inertiajs/react'; import React, { ChangeEvent, ReactNode } from 'react'; import Layout from './Partials/Layout'; import Message from './Partials/Message'; import StepNavigator from './Partials/StepNavigator'; interface Props extends SharedData { DB_HOST: string; DB_PORT: string; DB_DATABASE: string; DB_USERNAME: string; DB_PASSWORD: string; DB_CONNECTION: string; DB_CONNECTION_STATUS: string; } const Step3 = (props: Props) => { const { DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD, DB_CONNECTION, DB_CONNECTION_STATUS, flash } = props; const { data, errors, post, setData } = useForm({ db_connection: DB_CONNECTION || 'mysql', db_host: DB_HOST || '', db_port: DB_PORT || '', db_database: DB_DATABASE || '', db_username: DB_USERNAME || '', db_password: DB_PASSWORD || '', }); const dbConnectionStatus = Boolean(parseInt(DB_CONNECTION_STATUS)); const onHandleChange = (event: ChangeEvent) => { const target = event.target as HTMLInputElement; setData({ ...data, [target.name]: target.value, }); }; const testDBConnection = async (e: React.FormEvent) => { e.preventDefault(); router.post(route('check-database'), data); }; const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); post(route('install.store-step3')); }; return (
{dbConnectionStatus && ( )}
); }; Step3.layout = (page: ReactNode) => ; export default Step3;