
<?php $__env->startSection('title', __('cms::lang.cms')); ?>

<?php $__env->startSection('content'); ?>

<?php echo $__env->make('cms::layouts.nav', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<!-- Content Header (Page header) -->
<section class="content-header">
    <h1 class="tw-text-xl md:tw-text-3xl tw-font-bold tw-text-black">
        <?php if($post_type == 'page'): ?>
            <?php echo app('translator')->get('cms::lang.page'); ?>
        <?php elseif($post_type == 'testimonial'): ?>
            <?php echo app('translator')->get('cms::lang.testimonial'); ?>
        <?php elseif($post_type == 'blog'): ?>
            <?php echo app('translator')->get('cms::lang.blog'); ?>
        <?php endif; ?>
    </h1>
</section>

<!-- Main content -->
<section class="content">
    
    <?php $__env->startComponent('components.widget', ['class' => 'box-primary']); ?>
        <?php $__env->slot('tool'); ?>
        <div class="box-tools">
            <a type="button" class="tw-dw-btn tw-bg-gradient-to-r tw-from-indigo-600 tw-to-blue-500 tw-font-bold tw-text-white tw-border-none tw-rounded-full pull-righ" 
                href="<?php echo e(action([\Modules\Cms\Http\Controllers\CmsPageController::class, 'create'], ['type' => $post_type]), false); ?>">
                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
                    stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                    class="icon icon-tabler icons-tabler-outline icon-tabler-plus">
                    <path stroke="none" d="M0 0h24v24H0z" fill="none" />
                    <path d="M12 5l0 14" />
                    <path d="M5 12l14 0" />
                </svg> <?php echo app('translator')->get( 'messages.add' ); ?>
            </a>
            </div>
        <?php $__env->endSlot(); ?>
        <div class="row">
            <?php $__empty_1 = true; $__currentLoopData = $pages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $page): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <div class="col-md-4 page-box">
                    <?php $__env->startComponent('components.widget', ['class' => 'box box-solid', 'title' => $page->title]); ?>
                        <?php $__env->slot('tool'); ?>
                            <div class="box-tools" style="display: flex;">
                                <a class="tw-dw-btn tw-dw-btn-outline tw-dw-btn-xs tw-dw-btn-primary "
                                    href="<?php echo e(action([\Modules\Cms\Http\Controllers\CmsPageController::class, 'edit'], [$page->id, 'type' => $post_type]), false); ?>">
                                    <i class="fa fa-edit"></i>
                                </a>
                                &nbsp;
                                <?php if(empty($page->layout)): ?>
                                    <button data-href="<?php echo e(action([\Modules\Cms\Http\Controllers\CmsPageController::class, 'destroy'], [$page->id, 'type' => $post_type]), false); ?>" class="tw-dw-btn tw-dw-btn-outline tw-dw-btn-xs tw-dw-btn-error delete_page">
                                        <i class="glyphicon glyphicon-trash"></i>
                                    </button>
                                <?php endif; ?>
                            </div>
                        <?php $__env->endSlot(); ?>
                        <p>
                            <b><?php echo app('translator')->get('cms::lang.priority'); ?>: </b> <?php echo e($page->priority, false); ?>

                        </p>
                        <p class="text-muted">
                            <?php echo app('translator')->get('lang_v1.added_on'); ?>: <?php echo e(\Carbon::createFromTimestamp(strtotime($page->created_at))->format(session('business.date_format') . ' ' . 'H:i'), false); ?>

                        </p>
                        <?php if(!empty($page->layout)): ?>
                            <p class="text-muted">
                                <?php echo app('translator')->get('cms::lang.layout'); ?>: <?php echo app('translator')->get('cms::lang.'.$page->layout); ?>
                            </p>
                        <?php endif; ?>
                        <?php if($page->is_enabled == 0): ?>
                           <span class="label bg-gray"><?php echo app('translator')->get('cms::lang.disabled'); ?></span>
                        <?php endif; ?>
                    <?php echo $__env->renderComponent(); ?>
                </div>
                <?php if($loop->iteration%3 == 0): ?>
                    <div class="clearfix"></div>
                <?php endif; ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <div class="col-md-12">
                    <div class="callout callout-info">
                        <h3>
                            <i class="fas fa-exclamation-circle"></i>
                            <?php echo app('translator')->get('cms::lang.not_found_please_add_one'); ?>
                        </h3>
                    </div>
                </div>
            <?php endif; ?>
        </div>
    <?php echo $__env->renderComponent(); ?>
</section>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('javascript'); ?>
<script type="text/javascript">
    $(document).ready(function(){
        $(document).on('click', 'button.delete_page', function() {
            var page_box = $(this).closest('.page-box');
            swal({
                title: LANG.sure,
                icon: 'warning',
                buttons: true,
                dangerMode: true,
            }).then(willDelete => {
                if (willDelete) {
                    var href = $(this).data('href');
                    var data = $(this).serialize();
                    $.ajax({
                        method: 'DELETE',
                        url: href,
                        dataType: 'json',
                        data: data,
                        success: function(result) {
                            if (result.success == true) {
                                toastr.success(result.msg);
                                page_box.remove();
                            } else {
                                toastr.error(result.msg);
                            }
                        },
                    });
                }
            });
        });
    })
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/gyannewsoftware/public_html/pos11_UltimatePOS65/Modules/Cms/Providers/../Resources/views/page/index.blade.php ENDPATH**/ ?>