<div>
    <div class="modal fade" id="{{ $containerId }}" tabindex="-1" aria-labelledby="createCompanyAdminModalLabel"
        aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <form class="modal-content" action="{{ route('company.admin.store') }}" method="post">
                <div class="modal-header">
                    <h1 class="modal-title fs-5" id="exampleModalLabel">Новый администратор</h1>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                @if($availableCompanies->count() == 0)
                    <div class="modal-body">
                        Нет доступных агентств для продолжения работы
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">ОК</button>
                    </div>
                @else
                    <div class="modal-body">
                        @csrf
                        @if($availableCompanies->count() > 1)
                            <div class="mb-3">
                                <label for="companyId" class="form-label">Агентство</label>
                                <select wire:model="companyId" class="form-select  @error('companyId') is-invalid @enderror"
                                    id="companyId" name="company_id" aria-label="Агентство">
                                    <option selected></option>
                                    @foreach ($availableCompanies as $company)
                                        <option value="{{ $company['id'] }}">
                                            {{ $company['name'] }}
                                        </option>
                                    @endforeach
                                </select>
                            </div>
                        @elseif($availableCompanies->count() == 1)
                            <input type="hidden" class="form-control" id="company_id" name="company_id"
                                value="{{ $companyId }}">
                        @endif
                        <div class="mb-3">
                            <label for="adminName" class="form-label">Полное имя (ФИО)</label>
                            <input type="text" class="form-control" id="adminName" name="name">
                        </div>

                        <div class="mb-3">
                            <label for="adminEmail" class="form-label">Электронная почта</label>
                            <input type="text" class="form-control" id="adminEmail" name="email">
                        </div>

                        <div class="mb-3">
                            <label for="adminPhone" class="form-label">Телефон</label>
                            <input type="tel" class="form-control" id="adminPhone" name="phone">
                        </div>

                        <div class="mb-3 form-check form-switch">
                            <input class="form-check-input" type="checkbox" role="switch" id="sendEmailSwitch"
                                name="sendToEmail" checked>
                            <label class="form-check-label" for="sendEmailSwitch">Отправить учетные данные на электронную
                                почту</label>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Отмена</button>
                        <input type="submit" class="btn btn-primary" value="Добавить">
                    </div>
                @endif
            </form>
        </div>
    </div>
</div>