@extends('layouts.install')
@section('title', __('messages.database'))
@section('content')
<div class="card"><div class="card-body">
    @if(session('existing_tables'))
        <div class="alert alert-warning">{{ __('messages.existing_tables_warning') }}</div>
    @endif
    <form method="post" action="{{ route('install.database.test') }}">
        @csrf
        <div class="mb-3"><label class="form-label">{{ __('messages.type') }}</label>
            <select name="connection" class="form-select"><option value="mysql">MySQL</option></select>
        </div>
        <div class="mb-3"><label class="form-label">{{ __('messages.host') }}</label><input class="form-control" name="host" value="{{ old('host','127.0.0.1') }}" required></div>
        <div class="mb-3"><label class="form-label">{{ __('messages.port') }}</label><input class="form-control" name="port" value="{{ old('port','3306') }}" required></div>
        <div class="mb-3"><label class="form-label">{{ __('messages.database_name') }}</label><input class="form-control" name="database" value="{{ old('database') }}" required></div>
        <div class="mb-3"><label class="form-label">{{ __('messages.username') }}</label><input class="form-control" name="username" value="{{ old('username','root') }}"></div>
        <div class="mb-3"><label class="form-label">{{ __('messages.password') }}</label><input class="form-control" type="password" name="password" value="{{ old('password') }}"></div>
        @if(session('existing_tables'))
            <div class="form-check mb-3">
                <input class="form-check-input" type="checkbox" name="confirm_existing" value="1" id="ce">
                <label class="form-check-label" for="ce">{{ __('messages.confirm_existing') }}</label>
            </div>
        @endif
        <button class="btn btn-success">{{ __('messages.test_connection') }}</button>
    </form>
</div></div>
@endsection
