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

@section('title', 'Installation - Admin Account')

@section('content')
    <h2 class="h4 mb-3">Initial Admin Account</h2>
    <p class="text-muted mb-4">Create the first system administrator with Super Admin permissions.</p>

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

        <div class="row g-3 mb-4">
            <div class="col-12">
                <label for="admin_name" class="form-label">Full Name</label>
                <input type="text" name="admin_name" id="admin_name" class="form-control @error('admin_name') is-invalid @enderror"
                       value="{{ old('admin_name') }}" required>
                @error('admin_name')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="col-12">
                <label for="admin_email" class="form-label">Email Address</label>
                <input type="email" name="admin_email" id="admin_email" class="form-control @error('admin_email') is-invalid @enderror"
                       value="{{ old('admin_email') }}" required>
                @error('admin_email')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="col-12">
                <label for="admin_phone" class="form-label">WhatsApp / Mobile Number</label>
                <input type="tel" name="admin_phone" id="admin_phone" class="form-control @error('admin_phone') is-invalid @enderror"
                       value="{{ old('admin_phone', $state->adminPhone ?? '') }}" placeholder="9954770099" required>
                @error('admin_phone')<div class="invalid-feedback">{{ $message }}</div>@enderror
                <div class="form-text">Enter without country code if your WhatsApp API URL already includes it (e.g. <code>91{'{MOB}'}</code>).</div>
            </div>
            <div class="col-md-6">
                <label for="admin_password" class="form-label">Password</label>
                <input type="password" name="admin_password" id="admin_password" class="form-control @error('admin_password') is-invalid @enderror" required>
                @error('admin_password')<div class="invalid-feedback">{{ $message }}</div>@enderror
            </div>
            <div class="col-md-6">
                <label for="admin_password_confirmation" class="form-label">Confirm Password</label>
                <input type="password" name="admin_password_confirmation" id="admin_password_confirmation" class="form-control" required>
            </div>
        </div>

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