<?php
    if($create){
        $title = __('adminforms.ads.title_insert');
        $formpar = array('route' =>'admin.ad.store', 'autocomplete' => 'off');
    } else {
        $title = __('adminforms.ads.title_update');
        $formpar = array('route' => array('admin.ad.update', $ad->ad_id),'method' =>'PUT', 'autocomplete' => 'off');
    }

    $tr = [
       'ad id'     => __('adminforms.ads.ad_id'),
       'ad src'    => __('adminforms.ads.ad_src'),
       'ad title'  => __('adminforms.ads.ad_title'),
       'ad link'   => __('adminforms.ads.ad_link'),
       'ad all'    => __('adminforms.ads.ad_all'),
       'ad act'    => __('adminforms.ads.ad_act'),
       'ad pos id' => __('adminforms.ads.ad_pos_id'),
       'ad order'  => __('adminforms.ads.ad_order'),
    ];
?>

<?php $__env->startSection('title'); ?><?php echo e($title); ?><?php $__env->stopSection(); ?>
<?php $__env->startSection('header'); ?><?php echo e($title); ?><?php $__env->stopSection(); ?>
<?php $__env->startSection('header_desc'); ?> <?php $__env->stopSection(); ?>
<?php $__env->startSection('breadcumbs'); ?> <?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <!-- Main content -->
    <section class="content">



        <div class="row">

            <div class="col-xs-12">
                <?php if(session('error')): ?>
                    <div class="alert alert-danger alert-dismissible">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        <i class="icon fa fa-exclamation-triangle"></i> <strong>Info: </strong> &nbsp;  &nbsp;
                        <?php echo e(session('error')); ?>

                    </div>
                <?php endif; ?>
            </div>

            <?php echo Form::open($formpar); ?>


            <div class="col-xs-12">



                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-list-alt"></i> <?php echo e($title); ?></h3>
                    </div><!-- /. panel-heading -->

                    <div class="panel-body">
                        <div class="row">



                            <div class="col-xs-12 col-sm-6 col-md-3 pbb">
                                <?php $cgId = old('ad_pos_id', $ad->ad_pos_id); ?>
                                <?php echo e(Form::label('ad_pos_id', ucfirst(__('adminforms.ads.ad_pos_id').':'))); ?>

                                <?php echo e(Form::select('ad_pos_id', $adpositions, $cgId, ['placeholder' => __('adminforms.ads.selesct_position'), 'class' => 'form-control', 'id' => 'group-select'])); ?>

                                <small class="error"><?php echo e(strtr($errors->first('ad_pos_id'),$tr)); ?></small>
                            </div>

                            <div class="col-xs-12 col-sm-6 col-md-3 pbb">
                                <?php echo e(Form::label('ad_act', ucfirst(__('adminforms.ads.ad_act').':'))); ?><br>
                                <?php
                                    $cv = old('ad_act', $ad->ad_act);
                                    $actval = !is_null($cv) ? $cv : 1;
                                ?>
                                <label class="radio-inline"><input type="radio" name="ad_act" value="1" <?php echo e($actval== 1 ?'checked':''); ?> > <?php echo e(__('adminforms.common.true')); ?></label>
                                <label class="radio-inline"><input type="radio" name="ad_act" value="0" <?php echo e($actval== 0 ?'checked':''); ?> > <?php echo e(__('adminforms.common.false')); ?></label>
                                <small class="error"><?php echo e(strtr($errors->first('ad_act'),$tr)); ?></small>
                            </div>

                            <?php $__currentLoopData = config('app.languages'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lang): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                <?php

                                    $t_ad_title = '';
                                    $t_ad_src   = '';
                                    $t_ad_link  = '';


                                    if($ad->translation($lang)){
                                        $t_ad_title = $ad->translation($lang)->ad_title;
                                        $t_ad_src   = $ad->translation($lang)->ad_src;
                                        $t_ad_link  = $ad->translation($lang)->ad_link;
                                    }

                                ?>

                                <div class="col-xs-12"><label class="lang-intro" for=""><?php echo e(ucfirst(__('adminforms.common.'.$lang.'_version').':')); ?></label></div>

                                <div class="col-xs-12 col-sm-6 col-md-4 pbb">
                                    <?php echo e(Form::label($lang.'_'.'ad_title', ucfirst(__('adminforms.ads.ad_title').':'))); ?>

                                    <?php echo e(Form::text($lang.'_'.'ad_title', old($lang.'_'.'ad_title', $t_ad_title  ), ['class' =>'form-control'])); ?>

                                    <small class="error"><?php echo e(strtr($errors->first($lang.'_'.'ad_title'),$tr)); ?></small>
                                </div>

                                <div class="col-xs-12 col-sm-6 col-md-4 pbb">
                                    <?php echo e(Form::label($lang.'_'.'ad_src', ucfirst(__('adminforms.ads.ad_src').':'))); ?>

                                    <?php echo e(Form::text($lang.'_'.'ad_src', old($lang.'_'.'ad_src', $t_ad_src  ), ['class' =>'form-control','style' => 'cursor:pointer;' , 'onclick' => "openKCFinder('images',this,'images/banners')", ])); ?>

                                    <small class="error"><?php echo e(strtr($errors->first($lang.'_'.'ad_src'),$tr)); ?></small>
                                </div>


                                <div class="col-xs-12 col-sm-6 col-md-4 pbb">
                                    <?php echo e(Form::label($lang.'_'.'ad_link', ucfirst(__('adminforms.ads.ad_link').':'))); ?>

                                    <?php echo e(Form::text($lang.'_'.'ad_link', old($lang.'_'.'ad_link', $t_ad_link  ), ['class' =>'form-control'])); ?>

                                    <small class="error"><?php echo e(strtr($errors->first($lang.'_'.'ad_link'),$tr)); ?></small>
                                </div>

                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                            <br clear="all">
                            <hr>
                            <div class="col-xs-12">
                                <?php $btntext = ($create) ? __('adminforms.ads.btn_insert') : __('adminforms.ads.btn_update')?>
                                <?php echo e(Form::submit($btntext, ['class' =>'btn btn-success pull-right'])); ?>

                            </div>

                        </div> <!-- /.row -->
                    </div> <!-- /.panel-body -->
                </div> <!-- /.panel panel-default-->

            </div> <!-- /.col -->



            <?php echo Form::close(); ?>


        </div>
        <!-- /.row -->

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

<?php $__env->startPush('css'); ?>
<?php $__env->stopPush(); ?>


<?php $__env->startPush('scripts'); ?>
    <script src="<?php echo e(asset('assets/js/equalpbb.js')); ?>"></script>

    <!-- KCFinder -->
    <script type="text/javascript">
        function openKCFinder(type,field,dir) {
            //field = document.getElementById(field);//type : files / images / flash
            window.KCFinder = {  callBack: function(url) {  window.KCFinder = null;   field.value = url;}};
            window.open("/ckeditor/kcfinder/browse.php?type="+type+"&dir="+dir, "kcfinder_textbox","status=0, toolbar=0, location=0, menubar=0, directories=1,  " + "resizable=1, scrollbars=0, width=800, height=600");}
    </script>
    <!-- / KCFinder -->
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>