<?php
    if($create){
        $title = __('adminforms.positions.title_insert');
        $formpar = array('route' => 'admin.position.store');
    } else {
        $title = __('adminforms.positions.title_update');
        $formpar = array('route' => array('admin.position.update', $position->pos_id), 'method' => 'PUT');
    }

    $tr = [
        'pos id'        => __('adminforms.positions.pos_id'),
        'pos name'      => __('adminforms.positions.pos_name'),
        'pos sticker'   => __('adminforms.positions.pos_sticker'),
        'pos mainnav'   => __('adminforms.positions.pos_mainnav'),
        'pos title'     => __('adminforms.positions.pos_title'),
        'pos metadesc'  => __('adminforms.positions.pos_metadesc'),
        'pos keyw'      => __('adminforms.positions.pos_keyw'),
        'slug'             => __('adminforms.common.slug'),

    ];
?>

<?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; ?>



                        <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div><?php echo e($error); ?></div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>



            </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-ellipsis-h"></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-4 pbb">
                                <?php echo e(Form::label('pos_mainnav', ucfirst(__('adminforms.positions.pos_mainnav').':'))); ?><br>
                                <?php
                                    $cv = old('pos_mainnav', $position->pos_mainnav);
                                    $actval = !is_null($cv) ? $cv : 1;
                                ?>
                                <label class="radio-inline"><input type="radio" name="pos_mainnav" value="1" <?php echo e($actval== 1 ? 'checked': ''); ?> > <?php echo e(__('adminforms.common.true')); ?></label>
                                <label class="radio-inline"><input type="radio" name="pos_mainnav" value="0" <?php echo e($actval== 0 ? 'checked': ''); ?> > <?php echo e(__('adminforms.common.false')); ?></label>
                                <small class="error"><?php echo e(strtr($errors->first('pos_mainnav'),$tr)); ?></small>
                            </div>

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

                                <?php

                                    $t_pos_name     = '';
                                    $t_pos_title    = '';
                                    $t_pos_metadesc = '';
                                    $t_pos_keyw     = '';
                                    $t_pos_sticker  = '';
                                    $t_slug         = '';

                                    $translation = $position->translation($lang);
                                    if($translation){
                                        $t_pos_name     = $translation->pos_name;
                                        $t_pos_title    = $translation->pos_title;
                                        $t_pos_metadesc = $translation->pos_metadesc;
                                        $t_pos_keyw     = $translation->pos_keyw;
                                        $t_pos_sticker  = $translation->pos_sticker;
                                    }

                                    $route = $position->route($lang);
                                    if($route){
                                        $t_slug             = $route->slug;
                                    }

                                ?>

                                <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.'_'.'pos_name', ucfirst(__('adminforms.positions.pos_name').':'))); ?>

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

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

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

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

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

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

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

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

                                <br clear="all">
                                <div class="col-xs-12">
                                    <hr>
                                </div>

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

                                    <?php echo e(Form::textarea ($lang.'_'.'pos_title', old($lang.'_'.'pos_title', $t_pos_title), ['class' => 'form-control', 'rows' => 3])); ?>

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


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

                                    <?php echo e(Form::textarea ($lang.'_'.'pos_metadesc', old($lang.'_'.'pos_metadesc', $t_pos_metadesc), ['class' => 'form-control', 'rows' => 3])); ?>

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


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

                                    <?php echo e(Form::textarea ($lang.'_'.'pos_keyw', old($lang.'_'.'pos_keyw', $t_pos_keyw), ['class' => 'form-control', 'rows' => 3])); ?>

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

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

                            <br clear="all">
                            <hr>
                            <div class="col-xs-12">
                                <?php $btntext = ($create) ? __('adminforms.positions.btn_insert') : __('adminforms.positions.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>
    <script src="<?php echo e(asset('ckeditor/ckeditor.js')); ?>"></script>
    <script>
        // omogucavanje na mobilnim uredjajima
        //CKEDITOR.env.isCompatible = true;
    </script>
    <script src="<?php echo e(asset('ckeditor/ckeditor_autogrow.js')); ?>"></script>
    <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>
    <script>
        $(document).ready(function(){
            <?php $__currentLoopData = config('app.languages'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lang): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            $('#<?php echo e($lang); ?>name').keyup(function () {
                var cval = $.trim($(this).val());
                var cslug = cval.replace(/\s/g, '-').toLowerCase();
                $('#<?php echo e($lang); ?>slug').val(cslug);
            });
            $('#<?php echo e($lang); ?>name').blur(function () {
                var cval = $.trim($(this).val());
                var cslug = cval.replace(/\s/g, '-').toLowerCase();
                $('#<?php echo e($lang); ?>slug').val(cslug);
            });
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        });
    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>