@extends('layouts.app')

@section('content')
    <div>
        <form class="d-flex mb-3" method="GET" action="{{ route('company.agents.table') }}">
            <div class="p-2 border rounded-3 border-1 bg-white">
                <input type="radio" class="btn-check" name="status" value="all" id="option5" autocomplete="off"
                    onclick="this.form.submit()" {{ $status == 'all' || !$status ? 'checked' : '' }}>
                <label class="btn p-2 fs-5" for="option5">Все</label>

                <input type="radio" class="btn-check" name="status" value="{{ $statuses::ACTIVE }}" id="option6"
                    autocomplete="off" onclick="this.form.submit()" {{ $status == $statuses::ACTIVE ? 'checked' : '' }}>
                <label class="btn p-2 fs-5" for="option6">Активные</label>

                <input type="radio" class="btn-check" name="status" value="{{ $statuses::DISMISSED }}" id="option7"
                    autocomplete="off" onclick="this.form.submit()" {{ $status == $statuses::DISMISSED ? 'checked' : '' }}>
                <label class="btn p-2 fs-5" for="option7">Уволенные</label>
            </div>

            <div class="ms-auto p-2">
                <button type="button" class="btn btn-primary py-2 px-3 fs-5" data-bs-toggle="modal"
                    data-bs-target="#createAgentModal">
                    <i class="bi bi-person-plus"></i>
                </button>
            </div>
        </form>
        @if (!$status || $status == 'all' || $status == $statuses::ACTIVE)
            <h4 class="fw-bold mt-5 mb-3">Активные</h4>
            <div class="fs-5 bg-light   mb-2">
                @livewire('agentsTable', ['status' => $statuses::ACTIVE])
            </div>
        @endif

        @if (!$status || $status == 'all' || $status == $statuses::DISMISSED)
            <h4 class="fw-bold mt-5 mb-3">Уволенные</h4>
            <div class="fs-5 bg-light   mb-2">
                @livewire('agentsTable', ['status' => $statuses::DISMISSED])
            </div>
        @endif
    </div>
    @livewire('company.agent.create', ['containerId' => 'createAgentModal'])
@endsection
