@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 d-flex gap-2">
                <div class="dropdown">
                    <button class="btn btn-primary fs-5 py-2 px-3 dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
                        aria-expanded="false">
                        <i class="bi bi-person-plus"></i>
                    </button>

                    <ul class="dropdown-menu">
                        <li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#createAgentModal">Добавить вручную</a></li>
                        <li><a class="dropdown-item" href="{{ route('company.invites.select') }}">Приглашения</a></li>
                    </ul>
                </div>
            </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