<form id="form-staff-permission">
    <table class="table table-bordered table-striped">
        <input type="hidden" name="id" value="{{ $user->id }}"/>
        <tbody>
        <tr>
            <td> Xem thống kê</td>
            <td>
                <div class="mt-checkbox-inline">
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-statistic"
                               @if($user->hasPermissionTo('view-statistic')) checked @endif> Xem
                        <span></span>
                    </label>
                </div>
            </td>
        </tr>
        <tr>
            <td> Quản lý nhà trọ</td>
            <td>
                <div class="mt-checkbox-inline">
                    <label class="mt-checkbox">
                        <input type="checkbox" class="check-all"> Tất cả
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-hostel"
                               @if($user->hasPermissionTo('add-hostel')) checked @endif> Thêm
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-hostel"
                               @if($user->hasPermissionTo('edit-hostel')) checked @endif> Sửa
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-hostel"
                               @if($user->hasPermissionTo('delete-hostel')) checked @endif> Xóa
                        <span></span>
                    </label>
                </div>
            </td>
        </tr>
        <tr>
            <td> Quản lý phòng</td>
            <td>
                <div class="mt-checkbox-inline">
                    <label class="mt-checkbox">
                        <input type="checkbox" class="check-all"> Tất cả
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-room"
                               @if($user->hasPermissionTo('add-room')) checked @endif> Thêm
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-room"
                               @if($user->hasPermissionTo('edit-room')) checked @endif> Sửa
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-room"
                               @if($user->hasPermissionTo('delete-room')) checked @endif> Xóa
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="process-report-break"
                               @if($user->hasPermissionTo('process-report-break')) checked @endif> Xử lý sự cố
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-report-break"
                               @if($user->hasPermissionTo('add-report-break')) checked @endif> Tạo sự cố
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-report-break"
                               @if($user->hasPermissionTo('view-report-break')) checked @endif> Xem sự cố
                        <span></span>
                    </label>


                </div>
            </td>
        </tr>
        <tr>
            <td> Quản lý tài sản</td>
            <td>
                <div class="mt-checkbox-inline">
                    <label class="mt-checkbox">
                        <input type="checkbox" class="check-all"> Tất cả
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-item"
                               @if($user->hasPermissionTo('view-item')) checked @endif> Xem tài sản
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-item"
                               @if($user->hasPermissionTo('add-item')) checked @endif> Thêm tài sản
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-room-type"
                               @if($user->hasPermissionTo('edit-item')) checked @endif> Sửa tài sản
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-item"
                               @if($user->hasPermissionTo('delete-item')) checked @endif> Xóa tài sản
                        <span></span>
                    </label>


                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-item-type"
                               @if($user->hasPermissionTo('view-item-type')) checked @endif> Xem loại tài sản
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-item-type"
                               @if($user->hasPermissionTo('add-item-type')) checked @endif> Thêm loại tài sản
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-item-type"
                               @if($user->hasPermissionTo('edit-item-type')) checked @endif> Sửa loại tài sản
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-item-type"
                               @if($user->hasPermissionTo('delete-item-type')) checked @endif> Xóa loại tài sản
                        <span></span>
                    </label>

                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-warehouse"
                               @if($user->hasPermissionTo('view-warehouse')) checked @endif> Xem kho
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-warehouse"
                               @if($user->hasPermissionTo('edit-warehouse')) checked @endif> Sửa kho
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-warehouse"
                               @if($user->hasPermissionTo('delete-warehouse')) checked @endif> Xóa kho
                        <span></span>
                    </label>


                </div>
            </td>
        </tr>
        <tr>
            <td> Cấu hình bảng giá</td>
            <td>
                <div class="mt-checkbox-inline">
                    <label class="mt-checkbox">
                        <input type="checkbox" class="check-all"> Tất cả
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-hostel-fee"
                               @if($user->hasPermissionTo('add-hostel-fee')) checked @endif> Thêm
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-hostel-fee"
                               @if($user->hasPermissionTo('edit-hostel-fee')) checked @endif> Sửa
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-hostel-fee"
                               @if($user->hasPermissionTo('delete-hostel-fee')) checked @endif> Xóa
                        <span></span>
                    </label>
                </div>
            </td>
        </tr>
        <tr>
            <td> Quản lý khách thuê</td>
            <td>

                <div class="mt-checkbox-inline">
                    <label class="mt-checkbox">
                        <input type="checkbox" class="check-all"> Tất cả
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-contract"
                               @if($user->hasPermissionTo('view-contract')) checked @endif> Xem hợp đồng
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-contract"
                               @if($user->hasPermissionTo('add-contract')) checked @endif> Tạo hợp đồng
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-contract"
                               @if($user->hasPermissionTo('edit-contract')) checked @endif> Sửa hợp đồng
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-contract"
                               @if($user->hasPermissionTo('delete-contract')) checked @endif> Xóa hợp đồng
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="attach-file"
                               @if($user->hasPermissionTo('attach-file')) checked @endif> Đính kèm file
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="extend-contract"
                               @if($user->hasPermissionTo('extend-contract')) checked @endif> Gia hạn hợp đồng
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="end-contract"
                               @if($user->hasPermissionTo('end-contract')) checked @endif> Thanh lý hợp đồng
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="change-room"
                               @if($user->hasPermissionTo('change-room')) checked @endif> Đổi phòng / giường hợp đồng
                        <span></span>
                    </label>
                    <br>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-reserve"
                               @if($user->hasPermissionTo('add-reserve')) checked @endif> Thêm giữ chỗ
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-renter"
                               @if($user->hasPermissionTo('view-renter')) checked @endif> Xem khách thuê
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-renter"
                               @if($user->hasPermissionTo('add-renter')) checked @endif> Thêm người phụ thuộc
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="update-renter"
                               @if($user->hasPermissionTo('update-renter')) checked @endif> Cập nhật người phụ thuộc
                        <span></span>
                    </label><br>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-renter"
                               @if($user->hasPermissionTo('delete-renter')) checked @endif> Xóa người phụ thuộc
                        <span></span>
                    </label>

                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-bike"
                               @if($user->hasPermissionTo('view-bike')) checked @endif> Xem phương tiện
                        <span></span>
                    </label>

                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-bike"
                               @if($user->hasPermissionTo('add-bike')) checked @endif> Thêm phương tiện
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-bike"
                               @if($user->hasPermissionTo('edit-bike')) checked @endif> Sửa phương tiện
                        <span></span>
                    </label>

                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-bike"
                               @if($user->hasPermissionTo('delete-bike')) checked @endif> Xóa phương tiện
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-renter-password"
                               @if($user->hasPermissionTo('edit-renter-password')) checked @endif> Đổi mật khẩu khách thuê
                        <span></span>
                    </label>
                </div>
            </td>
        </tr>
        <tr>
            <td> Quản lý thu chi, thanh toán</td>
            <td>
                <div class="mt-checkbox-inline">
                    <label class="mt-checkbox">
                        <input type="checkbox" class="check-all"> Tất cả
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-stat"
                               @if($user->hasPermissionTo('view-stat')) checked @endif> Xem TKKD
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-payment-history"
                               @if($user->hasPermissionTo('view-payment-history')) checked @endif> Xem lịch sử thanh toán
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-voucher"
                               @if($user->hasPermissionTo('add-voucher')) checked @endif> Tạo hóa đơn dịch vụ
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-money-info"
                               @if($user->hasPermissionTo('edit-money-info')) checked @endif> Sửa hóa đơn
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-money-info"
                               @if($user->hasPermissionTo('view-money-info')) checked @endif> Xem hóa đơn
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="create-room-money-info"
                               @if($user->hasPermissionTo('create-room-money-info')) checked @endif> Sinh hóa đơn tiền
                        nhà
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-collect"
                               @if($user->hasPermissionTo('add-collect')) checked @endif> Thêm phiếu thu
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-collect"
                               @if($user->hasPermissionTo('edit-collect')) checked @endif> Sửa phiếu thu
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-collect"
                               @if($user->hasPermissionTo('delete-collect')) checked @endif> Xóa phiếu thu
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-payment"
                               @if($user->hasPermissionTo('add-payment')) checked @endif> Thêm thanh toán
                        <span></span>
                    </label><br>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-collect-spend"
                               @if($user->hasPermissionTo('view-collect-spend')) checked @endif> Xem thu chi
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-spend"
                               @if($user->hasPermissionTo('add-spend')) checked @endif> Thêm phiếu chi
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-spend"
                               @if($user->hasPermissionTo('edit-spend')) checked @endif> Sửa phiếu chi
                        <span></span>
                    </label> <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-spend"
                               @if($user->hasPermissionTo('delete-spend')) checked @endif> Xóa phiếu chi
                        <span></span>
                    </label>

                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-deposit"
                               @if($user->hasPermissionTo('delete-deposit')) checked @endif> Xóa cọc giữ chỗ
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-deposit"
                               @if($user->hasPermissionTo('edit-deposit')) checked @endif> Sửa cọc giữ chỗ
                        <span></span>
                    </label>


                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-ew"
                               @if($user->hasPermissionTo('view-ew')) checked @endif> Xem điện nước
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="add-ew"
                               @if($user->hasPermissionTo('add-ew')) checked @endif> Chốt điện nước
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="edit-ew"
                               @if($user->hasPermissionTo('edit-ew')) checked @endif> Sửa điện nước
                        <span></span>
                    </label>
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="delete-ew"
                               @if($user->hasPermissionTo('delete-ew')) checked @endif> Xóa điện nước
                        <span></span>
                    </label>
                </div>
            </td>
        </tr>
        <tr>
            <td> Báo cáo</td>
            <td>
                <div class="mt-checkbox-inline">
                    <label class="mt-checkbox">
                        <input type="checkbox" name="permissions[]" value="view-report"
                               @if($user->hasPermissionTo('view-report')) checked @endif> Xem báo cáo
                        <span></span>
                    </label>

                </div>
            </td>
        </tr>


        <tr>
            <td> Phân quyền theo nhà trọ</td>
            <td>
                @php $hostels = \App\Models\Hostel::where('owner_id', auth('backend')->user()->id)->get();
                    $hostelArrs = $user->staffHostelArr->pluck('hostel_id')->toArray();
                @endphp

                <div class="mt-checkbox-inline">
                    @foreach($hostels as $hostel)
                        <label class="mt-checkbox">
                            <input type="checkbox" class="check-hostel" name="hostels[]" value="{{ $hostel->id }}"

                                   @if(!empty($hostelArrs))
                                   @if(in_array($hostel->id, $hostelArrs))checked
                                    @endif
                                    @endif


                            > {{ $hostel->name }}
                            <span></span>
                        </label>
                    @endforeach
                    <label class="mt-checkbox">
                        <input type="checkbox" class="check-hostel check-all" id="all" name="hostels[]" value="-1"
                               @if(!empty($hostelArrs))
                               @if(in_array($hostel->id, $hostelArrs))checked
                                @endif
                                @endif> Tất cả
                        <span></span>
                    </label>
                </div>
            </td>
        </tr>
        </tbody>
    </table>
    <!--end profile-settings-->
</form>