@extends('admin.layouts.app')

@section('content')
<div class="container-fluid">
    <h2>게시판 관리 - 권한</h2>
    <hr/>
    @include('admin.messages')
    @if($boardID)
        @include('admin.board.board.navTabs')
    @endif

    <form name="f_admin_write" id="fAdminWrite" method="post" action="{{ $actionURL }}" enctype="multipart/form-data">
        @csrf
        <input type="hidden" name="board_id" value="{{ $boardID }}" />
        <div class="row mb-3">
            <label for="accessPostList" class="col-sm-2 col-form-label">목록</label>
            <div class="col-sm-8">
                <div class="row g-2">
                    <div class="col-auto">
                        <select name="access_post_list" id="accessPostList" class="form-select w-auto select-auth-value">
                            @foreach($authorityType as $k => $v)
                                <option value="{{ $k }}" @if(($boardMetaData->access_post_list ?? old('access_post_list')) == $k) selected @endif>{{ $v }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[access_post_list]" id="grpAccessPostList" class="form-check-input" value="1" />
                    <label for="grpAccessPostList" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[access_post_list]" id="allAccessPostList" class="form-check-input" value="1" />
                    <label for="allAccessPostList" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="accessPostView" class="col-sm-2 col-form-label">글 열람</label>
            <div class="col-sm-8">
                <div class="row g-2">
                    <div class="col-auto">
                        <select name="access_post_view" id="accessPostView" class="form-select w-auto select-auth-value">
                            @foreach($authorityType as $k => $v)
                                <option value="{{ $k }}" @if(($boardMetaData->access_post_view ?? old('access_post_view')) == $k) selected @endif>{{ $v }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[access_post_view]" id="grpAccessPostView" class="form-check-input" value="1" />
                    <label for="grpAccessPostView" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[access_post_view]" id="allAccessPostView" class="form-check-input" value="1" />
                    <label for="allAccessPostView" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="accessPostWrite" class="col-sm-2 col-form-label">글 작성</label>
            <div class="col-sm-8">
                <div class="row g-2">
                    <div class="col-auto">
                        <select name="access_post_write" id="accessPostWrite" class="form-select w-auto select-auth-value">
                            @foreach($authorityType as $k => $v)
                                <option value="{{ $k }}" @if(($boardMetaData->access_post_write ?? old('access_post_write')) == $k) selected @endif>{{ $v }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[access_post_write]" id="grpAccessPostWrite" class="form-check-input" value="1" />
                    <label for="grpAccessPostWrite" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[access_post_write]" id="allAccessPostWrite" class="form-check-input" value="1" />
                    <label for="allAccessPostWrite" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="accessCommentList" class="col-sm-2 col-form-label">댓글 목록</label>
            <div class="col-sm-8">
                <div class="row g-2">
                    <div class="col-auto">
                        <select name="access_comment_list" id="accessCommentList" class="form-select w-auto select-auth-value">
                            @foreach($authorityType as $k => $v)
                                <option value="{{ $k }}" @if(($boardMetaData->access_comment_list ?? old('access_comment_list')) == $k) selected @endif>{{ $v }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[access_comment_list]" id="grpAccessCommentList" class="form-check-input" value="1" />
                    <label for="grpAccessCommentList" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[access_comment_list]" id="allAccessCommentList" class="form-check-input" value="1" />
                    <label for="allAccessCommentList" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="accessCommentWrite" class="col-sm-2 col-form-label">댓글 작성</label>
            <div class="col-sm-8">
                <div class="row g-2">
                    <div class="col-auto">
                        <select name="access_comment_write" id="accessCommentWrite" class="form-select w-auto select-auth-value">
                            @foreach($authorityType as $k => $v)
                                <option value="{{ $k }}" @if(($boardMetaData->access_comment_write ?? old('access_comment_write')) == $k) selected @endif>{{ $v }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[access_comment_write]" id="grpAccessCommentWrite" class="form-check-input" value="1" />
                    <label for="grpAccessCommentWrite" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[access_comment_write]" id="allAccessCommentWrite" class="form-check-input" value="1" />
                    <label for="allAccessCommentWrite" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="accessImageUpload" class="col-sm-2 col-form-label">이미지 첨부</label>
            <div class="col-sm-8">
                <div class="row g-2">
                    <div class="col-auto">
                        <select name="access_image_upload" id="accessImageUpload" class="form-select w-auto select-auth-value">
                            @foreach($authorityType as $k => $v)
                                <option value="{{ $k }}" @if(($boardMetaData->access_image_upload ?? old('access_image_upload')) == $k) selected @endif>{{ $v }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[access_image_upload]" id="grpAccessImageUpload" class="form-check-input" value="1" />
                    <label for="grpAccessImageUpload" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[access_image_upload]" id="allAccessImageUpload" class="form-check-input" value="1" />
                    <label for="allAccessImageUpload" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="accessFileDownload" class="col-sm-2 col-form-label">파일 다운로드</label>
            <div class="col-sm-8">
                <div class="row g-2">
                    <div class="col-auto">
                        <select name="access_file_download" id="accessFileDownload" class="form-select w-auto select-auth-value">
                            @foreach($authorityType as $k => $v)
                                <option value="{{ $k }}" @if(($boardMetaData->access_file_download ?? old('access_file_download')) == $k) selected @endif}>{{ $v }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="form-check-inline">
                    <input type="checkbox" name="grp[access_file_download]" id="grpAccessFileDownload" class="form-check-input" value="1" />
                    <label for="grpAccessFileDownload" class="form-check-label">
                        그룹적용
                    </label>
                </div>
                <div class="form-check-inline">
                    <input type="checkbox" name="all[access_file_download]" id="allAccessFileDownload" class="form-check-input" value="1" />
                    <label for="allAccessFileDownload" class="form-check-label">
                        전체적용
                    </label>
                </div>
            </div>
        </div>
        <hr/>
        <div class="text-end">
            <button type="submit" class="btn btn-success">저장하기</button>
            <button type="button" class="btn btn-light btn-write-cancel" value="{{ route('admin.board.board.list.index') }}">취소하기</button>
        </div>
    </form>
</div>
@endsection
