<form name="f_admin_search" id="fAdminSearch" method="get" action="{{ $params->actionURL }}">
    <input type="hidden" name="page" value="{{ $params->page }}" />
    <div class="row g-2">
        <div class="col-auto">
            <select name="field" id="field" class="form-select">
                <option value="users.id" @if($params->field == 'users.id') selected @endif>회원 PK</option>
                <option value="users.sid" @if($params->field == 'users.sid') selected @endif>회원 ID</option>
                <option value="users.name" @if($params->field == 'users.name') selected @endif>회원 이름</option>
                <option value="users.nickname" @if($params->field == 'users.nickname') selected @endif>회원 닉네임</option>
                <option value="users.email" @if($params->field == 'users.email') selected @endif>회원 이메일</option>
            </select>
        </div>
        <div class="col-auto">
            <div class="input-group">
                <input type="text" name="keyword" id="keyword" class="form-control" value="{{ $params->keyword }}" placeholder="검색어를 입력하세요." />
                <button type="submit" class="btn btn-dark">검색</button>
            </div>
        </div>
    </div>
</form>
<br/>

<div class="row mb-2">
    <div class="col align-self-center">
        <label>전체 : {{ $userData->total }} / {{ $userData->rows }}</label>
    </div>
    <div class="col text-end">
        <button type="button" class="btn btn-outline-dark btn-list-selected disabled btn-add-all-receiver">선택추가</button>
    </div>
</div>

<div class="table-responsive">
    <table class="table table-hover table-bordered table-nowrap">
        <thead>
            <tr>
                <th><input type="checkbox" name="chk_all" id="chkAll" class="form-check-input" value="1"/></th>
                <th>PK</th>
                <th>ID</th>
                <th>이메일</th>
                <th>이름</th>
                <th>닉네임</th>
                <th>연락처</th>
                <th>비고</th>
            </tr>
        </thead>
        <tbody>
        @if($userData->rows > 0)
            @foreach($userData->list as $row)
            <tr>
                <td>
                    <input type="checkbox" name="chk[]" id="chk_{{ $row->id }}" class="form-check-input list-check-box" data-target="#dataSet_{{ $row->id }}" value="{{ $row->id }}"/>
                    <input type="hidden" id="#dataSet_{{ $row->id }}"
                           data-id="{{ $row->id }}"
                           data-name="{{ $row->name }}"
                           data-nickname="{{ $row->nickname }}"
                           data-phone="{{ $row->phone }}" />
                </td>
                <td>{{ $row->id }}</td>
                <td>{{ $row->sid }}</td>
                <td>{{ $row->name ?? '-' }}</td>
                <td>{{ $row->nickname ?? '-' }}</td>
                <td>{{ $row->email}}</td>
                <td>{{ $row->phone ?: '-' }}</td>
                <td>
                    <button type="button" class="btn btn-sm btn-secondary btn-add-receiver" data-target="#dataSet_{{ $row->id }}">추가</button>
                </td>
            </tr>
            @endforeach
        @else
            <tr>
                <td colspan="8">
                    No data.
                </td>
            </tr>
        @endif
        </tbody>
    </table>

    <div class="pagination">
        {{ $userData->list->withQueryString()->links() }}
    </div>
</div>

