@extends('install.layout')

@section('title', trans('installer.database_title'))
@section('content')
    <h3>@lang('installer.database_title')</h3>
    <p>@lang('installer.database_intro')</p>

    <div class="row" style="margin-top: 30px;">
        <div class="col-md-6 mr-md-auto ml-md-auto">
            @if (!is_null($database_error))
                <div class="alert alert-danger">
                    <p><strong>Database error:</strong> {{ $database_error }}</p>
                </div>
            @endif

            <form action="{{ route('install.database') }}" method="post">
                {{ csrf_field() }}
                <div class="form-group">
                    <label for="mysql-server">Server:</label>
                    <input type="text" class="form-control" id="mysql-server" name="mysql-server" value="{{ old('mysql-server', config('database.connections.mysql.host')) }}" />
                </div>

                <div class="form-group">
                    <label for="mysql-port">Port number:</label>
                    <input type="number" class="form-control" id="mysql-port" name="mysql-port" value="{{ old('mysql-port', config('database.connections.mysql.port')) }}" />
                </div>

                <div class="form-group">
                    <label for="mysql-username">Username:</label>
                    <input type="text" class="form-control" id="mysql-username" name="mysql-username" value="{{ old('mysql-username', config('database.connections.mysql.username')) }}" />
                </div>

                <div class="form-group">
                    <label for="mysql-password">Password:</label>
                    <input type="password" class="form-control" id="mysql-password" name="mysql-password" value="{{ old('mysql-password', config('database.connections.mysql.password')) }}" />
                </div>

                <div class="form-group">
                    <label for="mysql-database">Database:</label>
                    <input type="text" class="form-control" id="mysql-database" name="mysql-database" value="{{ old('mysql-database', config('database.connections.mysql.database')) }}" />
                </div>

                <div class="form-group text-right">
                    <button type="submit" class="btn btn-success">Save &amp; Install</button>
                </div>
            </form>
        </div>
    </div>
@endsection