<?php $__env->startSection('title', $section->exists ? 'Editando '.$section->post->title : 'Crear nueva sección'); ?>

<?php $__env->startSection('content'); ?>
    <!-- Page Header -->
    <div class="page-header">
        <div class="row align-items-center">
            <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"><a class="breadcrumb-link" href="<?php echo e(route('backend.sections.index')); ?>">Secciones</a></li>
                        <?php if($section->page): ?>
                            <li class="breadcrumb-item"><a class="breadcrumb-link" href="<?php echo e(route('backend.pages.edit', $section->page->id)); ?>"><?php echo e($section->page->post->title); ?></a></li>
                        <?php endif; ?>
                        <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>
        <!-- End Row -->
    </div>
    <!-- End Page Header -->

    <?php echo Form::model($section, [
        'method' => $section->exists ? 'put' : 'post',
        'route' => $section->exists ? ['backend.sections.update', $section->id] : 'backend.sections.store',
        'files' => true
    ]); ?>

    <div class="row">
        <div class="col-lg-8">

            <!-- Card -->
            <div class="card mb-3 mb-lg-5">
                <!-- Header -->
                <div class="card-header">
                    <h4 class="card-header-title">Información de sección</h4>
                </div>
                <!-- End Header -->

                <!-- Body -->
                <div class="card-body">
                    <!-- Form Group -->
                    <div class="form-group">
                        <label for="sectionNameLabel" class="input-label">Nombre</label>
                        <?php echo Form::text('post[title]', null, ['class' => 'form-control', 'id' => 'sectionNameLabel']); ?>

                    </div>
                    <!-- End Form Group -->

                

                
                
                
                
                
                

                <!-- Form Group -->
                    <div class="form-group">
                        <label for="textLabel" class="input-label">Texto</label>

                        <?php echo Form::textarea('post[excerpt]', null, ['class' => 'form-control', 'id' => 'textLabel', 'rows' => 5]); ?>

                    </div>
                    <!-- End Form Group -->

                <!-- Form Group -->
                    <div class="form-group">
                        <label for="contentLabel" class="input-label">Contenido</label>

                        <?php echo Form::textarea('post[content]', null, ['class' => 'form-control ckeditor', 'id' => 'contentLabel', 'rows' => 5]); ?>

                    </div>
                    <!-- End Form Group -->

                    <!-- Form Group -->
                    <div class="form-group">
                        <label for="urlLabel" class="input-label">Enlace</label>

                        <?php echo Form::text('url', null, ['class' => 'form-control', 'id' => 'urlLabel']); ?>

                    </div>
                    <!-- End Form Group -->
                </div>
                <!-- Body -->
            </div>
            <!-- End Card -->
        </div>

        <div class="col-lg-4">
            <!-- Card -->
            <div class="card mb-3 mb-lg-5">
                <!-- Header -->
                <div class="card-header">
                    <h4 class="card-header-title">Visibilidad</h4>
                </div>
                <!-- End Header -->

                <!-- Body -->
                <div class="card-body">
                    <!-- Form Group -->
                    <div class="form-group">
                        <label for="selectorLabel" class="input-label">Plantilla</label>

                        <!-- Select -->
                    <?php echo Form::select('selector', ['' => 'Ninguna'] + $selectors, $section->selector, ['class' => 'js-select2-custom custom-select', 'size' => '1', 'style' => 'opacity: 0;', 'id' => 'selectorLabel', 'data-hs-select2-options' => '{
                        "minimumResultsForSearch": "Infinity"
                      }']); ?>

                    <!-- End Select -->
                    </div>
                    <!-- Form Group -->
                    <div class="form-group">
                        <label for="categoryLabel" class="input-label">Páginas</label>

                        <!-- Select -->
                    <?php echo Form::select('page_id',  ['' => 'Ninguna'] + $pages, $section->page_id, ['class' => 'js-select2-custom custom-select', 'size' => '1', 'style' => 'opacity: 0;', 'id' => 'categoryLabel', 'data-hs-select2-options' => '{
                        "minimumResultsForSearch": "Infinity"
                      }']); ?>

                    <!-- End Select -->
                    </div>
                    <!-- Form Group -->

                    <!-- Toggle Switch -->
                    <label class="row toggle-switch" for="activeSwitch1">
                          <span class="col-8 col-sm-9 toggle-switch-content ml-0">
                            <span class="text-dark">Activo</span>
                          </span>
                        <span class="col-4 col-sm-3">
                            <?php echo Form::hidden('post[active]', 0); ?>

                            <?php echo Form::checkbox('post[active]', 1, $section->exists ? $section->post->active : 1, ['class' => 'toggle-switch-input', 'id' => 'activeSwitch1']); ?>

                            <span class="toggle-switch-label ml-auto">
                              <span class="toggle-switch-indicator"></span>
                            </span>
                          </span>
                    </label>
                    <!-- End Toggle Switch -->
                </div>
                <!-- Body -->
            </div>
            <!-- End Card -->

            <div class="card">
                <div class="card-body d-sm-flex align-items-sm-center">
                    <button type="submit" class="btn btn-primary btn-block"><?php echo e($section->exists ? 'Actualizar' : 'Crear'); ?> sección</button>
                </div>
            </div>
        </div>
        <?php if($section->exists): ?>
        <div class="col-12">
            <?php echo $__env->make('backend.partials.images', ['model' => $section], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        </div>
        <?php endif; ?>
    </div>
    <!-- End Row -->
    <?php echo Form::close(); ?>

<?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 imagen</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>
    <script>
      $(function() {
        // INITIALIZATION OF ADD INPUT FILED
        // =======================================================
        $('.js-add-field').each(function () {
          new HSAddField($(this), {
            addedField: function() {
              $('.js-add-field .js-select2-custom-dynamic').each(function () {
                var select2dynamic = $.HSCore.components.HSSelect2.init($(this));
              });
            }
          }).init();
        });


        // INITIALIZATION OF TAGIFY
        // =======================================================
        $('.js-tagify').each(function () {
          var tagify = $.HSCore.components.HSTagify.init($(this), {
            originalInputValueFormat: valuesArr => valuesArr.map(item => item.value).join(',')
          });
        });


        // INITIALIZATION OF DROPZONE FILE ATTACH MODULE
        // =======================================================
        $('.js-dropzone').each(function () {
          var dropzone = $.HSCore.components.HSDropzone.init('#' + $(this).attr('id'));
        });
      });
    </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/sections/form.blade.php ENDPATH**/ ?>