

<?php $__env->startSection('title', __('backend.meta-tags')); ?>

<?php $__env->startSection('content'); ?>
<!-- MAIN CONTENT -->
<div class="container-fluid">
  <div class="row">
    <div class="col-xs-12 col-sm-6">
    	<div class="panel panel-primary">
        <header class="panel-heading">
          <?php 
            foreach ($pagename as $key => $value) {
              $get = $value->locales()->where('locale',config('app.locale'))->first();
              $pages[$value->id] = isset($get)?$get->page_name:title_case($value->key);
            }
           ?>
          <div class="row">
            <h2 class="col-xs-12"><?php echo app('translator')->getFromJson('backend.select-page'); ?> </h2>
            <span class="col-xs-12 col-sm-4">
              <?php 
                if(Session::has('pname_id')){
                  $default = Session::get('pname_id');
                }else{
                  $default = null;
                }
               ?>
              <?php echo Form::select('select_page',$pages,$default,['class'=>'form-control']); ?>

            </span>
          </div>
        </header>
        <div class="panel-body">
          <?php if(Session::has('message')): ?>
            <div class="alert <?php echo e(Session::get('alert-class')); ?> alert-dismissible" role="alert">
              <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <p><?php echo e(Session::get('message')); ?></p>
            </div>
          <?php endif; ?>
          <div id="formLoader">
          </div>

        </div>
      </div>
    </div>
  </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.4/css/select2.min.css" rel="stylesheet" />
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.4/js/select2.min.js"></script>
<script type="text/javascript">
  $(document).ready(function(){
    $('select[name="select_page"]').select2();

    $('select[name="select_page"]').on('change',function(){
      var $id = $(this).val();
      $.ajax({
        type: "GET",
        url: "<?php echo e(route('meta_per_page')); ?>/"+$id,
        success: function(response){
          $("#formLoader").html(response);

          $('select[multiple=""]').select2({
            tags: true,
          });
        }
      })
    });

    $('select[name="select_page"]').trigger('change');
  });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.masterBackend', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>