<?php $__env->startSection('title', 'Páginas'); ?>

<?php $__env->startSection('content'); ?>
    <!-- Page Header -->
    <div class="page-header">
        <div class="row align-items-end">
            <div class="col-sm mb-2 mb-sm-0">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb breadcrumb-no-gutter">
                        <li class="breadcrumb-item"><a class="breadcrumb-link" href="javascript:;">Contenido</a></li>
                        <li class="breadcrumb-item active" aria-current="page"><?php echo $__env->yieldContent('title'); ?></li>
                    </ol>
                </nav>

                <h1 class="page-header-title"><?php echo $__env->yieldContent('title'); ?></h1>
            </div>

            <div class="col-sm-auto">
                <a class="btn btn-primary" href="<?php echo e(route('backend.pages.create')); ?>">
                    <i class="tio-file-add-outlined mr-1"></i> Crear página
                </a>
            </div>
        </div>
        <!-- End Row -->
    </div>
    <!-- End Page Header -->

    <!-- Card -->
    <div class="card">
        <!-- Header -->
        <div class="card-header">
            <div class="row justify-content-between align-items-center flex-grow-1">
                <div class="col-sm-6 col-md-4 mb-3 mb-sm-0">
                <?php echo Form::open([
                    'method' => 'get'
                ]); ?>

                <!-- Search -->
                    <div class="input-group input-group-merge input-group-flush">
                        <div class="input-group-prepend">
                            <div class="input-group-text">
                                <i class="tio-search"></i>
                            </div>
                        </div>
                        <?php echo Form::text('q', request()->q, ['class' => 'form-control', 'placeholder' => 'Buscar páginas']); ?>

                    </div>
                    <!-- End Search -->
                    <?php echo Form::close(); ?>

                </div>
            </div>
            <!-- End Row -->
        </div>
        <!-- End Header -->

        <!-- Table -->
        <table class="table table-lg table-borderless table-thead-bordered table-nowrap table-align-middle card-table">
            <thead class="thead-light">
            <tr>
                <th>Nombre</th>
                <th>URL</th>
                <th>Plantilla</th>
                <th>Estado</th>
                <th>Acciones</th>
            </tr>
            </thead>
            <tbody class="sortable" data-href="<?php echo e(route('backend.posts.order')); ?>">
            <?php $__empty_1 = true; $__currentLoopData = $pages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $page): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <tr id="post_<?php echo e($page->post->id); ?>">
                    <td>
                        <a class="d-flex align-items-center" href="<?php echo e(route('backend.pages.edit', $page->id)); ?>"><?php echo e($page->post->title); ?></a>
                    </td>
                    <td>
                        <a class="d-flex align-items-center" href="<?php echo e(url($page->post->slug)); ?>" target="_blank"><?php echo e($page->post->slug); ?></a>
                    <td>
                        <?php echo e($page->template_name); ?>

                    </td>
                    <td>
                        <span class="legend-indicator <?php echo e($page->post->active ? 'bg-success' : 'bg-danger'); ?>"></span><?php echo e($page->post->active ? 'Visible' : 'Oculto'); ?>

                    </td>
                    <td>
                        <div class="btn-group" role="group">
                            <a class="btn btn-sm btn-white" href="<?php echo e(route('backend.pages.edit', $page->id)); ?>">
                                <i class="tio-edit"></i> Editar
                            </a>

                            <!-- Unfold -->
                            <div class="hs-unfold btn-group">
                                <a class="js-hs-unfold-invoker btn btn-icon btn-sm btn-white dropdown-toggle dropdown-toggle-empty" href="javascript:;"
                                   data-hs-unfold-options='{
                     "target": "#productsEditDropdown_<?php echo e($page->id); ?>",
                     "type": "css-animation",
                     "smartPositionOffEl": "#datatable"
                   }'></a>

                                <div id="productsEditDropdown_<?php echo e($page->id); ?>" class="hs-unfold-content dropdown-unfold dropdown-menu dropdown-menu-right mt-1">
                                    <a class="dropdown-item modal-toggle-delete" href="#" data-href="<?php echo e(route('backend.pages.destroy', $page->id)); ?>" data-title="<?php echo e($page->post->title); ?>">
                                        <i class="tio-delete-outlined dropdown-item-icon"></i> Eliminar
                                    </a>
                                </div>
                            </div>
                            <!-- End Unfold -->

                            <a class="btn btn-sm handle">
                                <i class="tio-move-page" style="color: inherit;"></i>
                            </a>
                        </div>
                    </td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <tr>
                    <td colspan="5" class="text-center"><b>No hay resultados</b></td>
                </tr>
            <?php endif; ?>
            </tbody>
        </table>
        <!-- End Table -->
    </div>
    <!-- End Card -->
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
    <!-- Modal -->
    <div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <?php echo Form::open([
                    'method' => 'delete'
                ]); ?>

                <div class="modal-header">
                    <h5 class="modal-title" id="deleteModalLabel">Eliminar página</h5>
                    <button type="button" class="btn btn-xs btn-icon btn-ghost-secondary" data-dismiss="modal" aria-label="Close">
                        <i class="tio-clear tio-lg"></i>
                    </button>
                </div>
                <div class="modal-body">
                    <span></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-white" data-dismiss="modal">Cancelar</button>
                    <button class="btn btn-danger" type="submit">Eliminar</button>
                </div>
                <?php echo Form::close(); ?>

            </div>
        </div>
    </div>
    <!-- End Modal -->
    <script>
      $(function() {
        $('.modal-toggle-delete').on('click', function() {
          $('#deleteModal form').attr('action', $(this).attr('data-href'));
          $('#deleteModal .modal-body span').text($(this).attr('data-title'));
          $('#deleteModal').modal('show');
          return false;
        });
      });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.backend', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/bgreen/test.bgreen.com.py/resources/views/backend/pages/index.blade.php ENDPATH**/ ?>