@extends('eliteadmin::layouts.installer')

@section('title', 'Installation - Company')

@section('content')
    <h2 class="h4 mb-3">Company Configuration</h2>
    <p class="text-muted mb-4">Configure your company details and regional settings.</p>

    <form action="{{ route('installer.company.store') }}" method="POST">
        @csrf

        <div class="row g-3 mb-4">
            <div class="col-md-6">
                <label for="company_name" class="form-label">Company Name</label>
                <input type="text" name="company_name" id="company_name" class="form-control @error('company_name') is-invalid @enderror"
                       value="{{ old('company_name', $state->companyName) }}" required>
                @error('company_name')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="col-md-6">
                <label for="company_email" class="form-label">Company Email</label>
                <input type="email" name="company_email" id="company_email" class="form-control @error('company_email') is-invalid @enderror"
                       value="{{ old('company_email', $state->companyEmail) }}" required>
                @error('company_email')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="col-md-6">
                <label for="company_phone" class="form-label">Company Phone</label>
                <input type="tel" name="company_phone" id="company_phone" class="form-control @error('company_phone') is-invalid @enderror"
                       value="{{ old('company_phone', $state->companyPhone) }}">
                @error('company_phone')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="col-md-6">
                <label for="timezone" class="form-label">Default Timezone</label>
                <select name="timezone" id="timezone" class="form-select @error('timezone') is-invalid @enderror">
                    <option value="UTC" @selected(old('timezone', $state->timezone ?? 'UTC') === 'UTC')>UTC</option>
                    <option value="America/New_York" @selected(old('timezone', $state->timezone) === 'America/New_York')>America/New_York</option>
                    <option value="Europe/London" @selected(old('timezone', $state->timezone) === 'Europe/London')>Europe/London</option>
                    <option value="Asia/Kolkata" @selected(old('timezone', $state->timezone) === 'Asia/Kolkata')>Asia/Kolkata</option>
                </select>
                @error('timezone')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="col-md-6">
                <label for="locale" class="form-label">Default Language</label>
                <select name="locale" id="locale" class="form-select @error('locale') is-invalid @enderror">
                    <option value="en" @selected(old('locale', $state->locale ?? 'en') === 'en')>English</option>
                    <option value="fr" @selected(old('locale', $state->locale) === 'fr')>French</option>
                    <option value="de" @selected(old('locale', $state->locale) === 'de')>German</option>
                </select>
                @error('locale')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
        </div>

        <div class="d-flex flex-column flex-sm-row gap-2 justify-content-between">
            <a href="{{ route('installer.mail') }}" class="btn btn-outline-secondary">Back</a>
            <button type="submit" class="btn btn-primary">Continue</button>
        </div>
    </form>
@endsection
