<div>
<div class="pd-20 card-box mb-30">
    <div class="row mb-20">
       <div class="col-md-4">
        <label for="search"><b class="text-secondary">Search</b>:</label>
        <input wire:model.live="search" type="text" id="search" class="form-control" placeholder="Seach posts">
       </div>
       <?php if(Auth::user()->type == "superAdmin"): ?>
       <div class="col-md-2">
        <label for="author"><b class="text-secondary">Author</b>:</label>
        <select wire:model.live="author" id="author" class="custom-select form-control">
        <option value="">No selected</option>
        <?php $__currentLoopData = App\Models\User::whereHas('posts')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <option value="<?php echo e($user->id); ?>"><?php echo e($user->name); ?></option>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
       </div>
       <?php endif; ?>
       <div class="col-md-2">
        <label for="category"><b class="text-secondary">Category</b>:</label>
        <select wire:model.live="category" id="category" class="custom-select form-control">
        <option value="">No selected</option>
        <?php echo $categories_html; ?>

        </select>
       </div>
       <div class="col-md-2">
        <label for="visibility"><b class="text-secondary">Visibility</b>:</label>
        <select wire:model.live="visibility"  id="visibility" class="custom-select form-control">
        <option value="">No selected</option>
        <option value="public">Public</option>
        <option value="private">Private</option>
        </select>
       </div>
       <div class="col-md-2">
        <label for="sort"><b class="text-secondary">Sort By</b>:</label>
        <select wire:model.live="sortBy" id="sort" class="custom-select form-control">
        <option value="asc">ASC</option>
        <option value="desc">DESC</option>
        </select>
       </div>
    </div>
    <div class="table-responsive">
        <table class="table table-striped table-auto table-sm">
            <thead class="bg-secondary text-white">
                <th scope="col">#ID</th>
                <th scope="col">Image</th>
                <th scope="col">Title</th>
                <th scope="col">Author</th>
                <th scope="col">Category</th>
                <th scope="col">Visibility</th>
                <th scope="col">Action</th>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
               
                <tr>
                    <td scope="row"><?php echo e($item->id); ?></td>
                    <td>
                        <a href="">
                            <img src="/images/posts/resized/resized_<?php echo e($item->featured_image); ?>" width="100" alt="">
                        </a>
                    </td>
                    <td><?php echo e($item->title); ?></td>
                    <td> <?php echo e($item->author->name); ?> </td>
                    <td> <?php echo e($item->post_category->name); ?></td>
                    <td>
                        <?php if( $item->visibility == 1 ): ?>
                        <span class="badge badge-pill badge-success"> <i class="icon-copy ti-world">
                        </i>Public</span>
                        <?php else: ?> 
                        <span class="badge badge-pill badge-warning"> <i class="icon-copy ti-lock">
                        </i>Public</span>
                        <?php endif; ?>
                    </td>
                    <td>
                        <div class="table-action">
                        <a href="<?php echo e(route('admin.edit_post', ['id'=>$item->id])); ?>" data-color="#265ed7" style="color:rgb(38, 94, 215)">
                            <i class="icon-copy dw dw-edit2"></i>
                        </a>
                        <a href="javascript:;" wire:click="deletePost(<?php echo e($item->id); ?>)" data-color="#e95959" style="color:rgb(233, 89, 89)">
                            <i class="icon-copy dw dw-delete-3"></i>
                        </a>
                        </div>
                    </td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <tr>
                    <td colspan="7">
                        <span class="text-danger">No post(s) found!</span>
                    </td>
                </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
    <div class="block mt-1">
        <?php echo e($posts->links('livewire::simple-bootstrap')); ?>

    </div>
</div>
</div>
<?php /**PATH C:\xampp\htdocs\larablog\resources\views\livewire\admin\posts.blade.php ENDPATH**/ ?>