<div id="window_newsIndex" class="page-window">
    <input type="hidden" class="prev_window"/>
  <div class="row">
      <div class="col-lg-12">
          <section class="panel">
            <header class="panel-heading">
              <div class="panel-actions">
                <a href="#" class="panel-action panel-action-toggle" data-panel-toggle></a>
                <a href="#" class="panel-action panel-action-dismiss" data-panel-dismiss></a>
              </div>

              <h2 class="panel-title"><?php echo e(trans('resource.news.title')); ?></h2>
            </header>
            <div class="panel-body">
              <form action="" id="news_action_form" class="form-horizontal form-bordered">
                <input type="hidden" name="id" value="<?php echo e((count($vw_news) > 0) ? $vw_news->id : ''); ?>"/>
                  <?php $__currentLoopData = $langs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?>
                    <div class="form-group">
                      <label class="col-md-3 control-label"><?php echo e(trans('resource.news.ntitle')); ?> <?php echo e($item->lang_name); ?></label>
                      <div class="col-md-6">
                        <input class="form-control" type="text" value="<?php echo e((count($source->get($item->lang_key)) > 0) ? $source->get($item->lang_key)->title : ''); ?>" name="title[<?php echo e($item->lang_key); ?>]">
                      </div>
                    </div>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getFirstLoop(); ?>
                  <div class="form-group">
                    <label class="col-md-3 control-label"><?php echo e(trans('resource.upload.thumbnail')); ?></label>
                    <div class="col-md-6">
                      <div class="input-group">
												<input class="form-control" id="thumbnail" name="thumbnail" value="<?php echo e((count($vw_news) > 0) ? $vw_news->thumbnail : ''); ?>" type="text">
												<div class="spinner-buttons input-group-btn">
  													<span class="btn btn-default" id="lfm" data-input="thumbnail" data-preview="holder">
  														   <i class="fa fa-file-picture-o"></i>
  													</span>
												</div>
											</div>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-3 control-label">Category</label>
                    <div class="col-md-6">
                      <select id="category" name="category" style="width:100%">
                        <?php $__currentLoopData = $category; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?>
                          <?php if(count($newscat) > 0): ?>
                                <?php if($newscat->cat_id == $item->ca_id): ?>
                                    <option selected="selected" value="<?php echo e($item->ca_id); ?>"><?php echo e($item->source); ?></option>
                                <?php else: ?>
                                    <option value="<?php echo e($item->ca_id); ?>"><?php echo e($item->source); ?></option>
                                <?php endif; ?>
                          <?php else: ?>
                              <option value="<?php echo e($item->ca_id); ?>"><?php echo e($item->source); ?></option>
                          <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getFirstLoop(); ?>
                      </select>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-md-3 control-label"><?php echo e(trans('resource.news.publish')); ?></label>
                    <div class="col-md-6">
                      <div class="checkbox check-default checkbox-circle">
                          <?php if(count($vw_news) > 0): ?>
                            <?php if($vw_news->slide == 1): ?>
                                <input id="checkbox7" style="margin-left: 0;" name="slide" value="1" checked="checked" type="checkbox">
                            <?php else: ?>
                              <input id="checkbox7" style="margin-left: 0;" name="slide" value="1" type="checkbox">
                            <?php endif; ?>
                          <?php else: ?>
                              <input id="checkbox7" style="margin-left: 0;" name="slide" value="1" type="checkbox">
                          <?php endif; ?>
                      </div>
                    </div>
                  </div>
                <?php $__currentLoopData = $langs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?>
                  <div class="form-group">
                    <div class="col-md-12">
                        
                        
                        <?php echo e(trans('resource.news.content')); ?> <span class="semi-bold"><?php echo e($item->lang_name); ?>

                        <textarea id="content_<?php echo e($item->lang_key); ?>" name="content[<?php echo e($item->lang_key); ?>]" class="form-control summernote"></textarea>
                    </div>
                  </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getFirstLoop(); ?>
                <div class="form-group usticky" style="background: #fff;">
                  <div class="col-md-12">
                    <div style="float: right;">
                      <button type="button" class="btn btn-primary" onclick="unews.save();"><?php echo e(trans('resource.buttons.save')); ?></button>
                      <button type="button" class="btn" onclick="uPage.close('window_newsIndex')"><?php echo e(trans('resource.buttons.close')); ?></button>
                    </div>
                  </div>
                </div>
              </form>
              <usource style="display: none;">
                <?php $__currentLoopData = $langs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?>
                    <item name='<?php echo $item->lang_key; ?>'><?php echo (count($source->get($item->lang_key)) > 0) ? $source->get($item->lang_key)->source : ''; ?></item>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getFirstLoop(); ?>
              </usource>
            </div>
          </section>
      </div>
  </div>

<script type="text/javascript">
    $(document).ready(function(){

      $("#category").select2();


    $('.summernote').ckeditor({
      height: 400,
      filebrowserImageBrowseUrl: route_prefix + '?type=Images',
      filebrowserImageUploadUrl: route_prefix + '/upload?type=Images&_token=<?php echo e(csrf_token()); ?>',
      filebrowserBrowseUrl: route_prefix + '?type=Files',
      filebrowserUploadUrl: route_prefix + '/upload?type=Files&_token=<?php echo e(csrf_token()); ?>',
      language: 'mn'
    });

    $("usource").find("item").each(function(){
      CKEDITOR.instances["content_"+ $(this).attr('name')].setData($(this).html());
      // $("#content_"+ $(this).attr('name')).summernote("code", $(this).html());
    });

    var selectedContext = "";

    $('#lfm').filemanager('image', {prefix: route_prefix});
  });
</script>
</div>
