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

    $tr = [
        'brand name'      => __('adminforms.brands.brand_name'),
        'brand title'     => __('adminforms.brands.brand_title'),
        'brand_metadesc'  => __('adminforms.brands.brand_metadesc'),
        'brand keyw'      => __('adminforms.brands.brand_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; ?>
            </div>

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


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



                <div class="panel panel-default">
                    

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

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

                                <?php echo e(Form::text('brand_name', old('brand_name', $brand->brand_name ), ['class' => 'form-control', 'id' => 'name'])); ?>

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


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

                                <?php

                                    $t_slug             = '';

                                    $route = $brand->route($lang);

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

                                ?>


                                <div class="col-xs-12 col-sm-6 col-md-4 pbb">
                                    <?php echo e(Form::label($lang.'_'.'slug', $lang.' '.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>


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

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

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

                                <?php echo e(Form::textarea ('brand_title', old('brand_title', $brand->brand_title), ['class' => 'form-control', 'rows' => 3])); ?>

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


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

                                <?php echo e(Form::textarea ('brand_metadesc', old('brand_metadesc', $brand->brand_metadesc), ['class' => 'form-control', 'rows' => 3])); ?>

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


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

                                <?php echo e(Form::textarea ('brand_keyw', old('brand_keyw', $brand->brand_keyw), ['class' => 'form-control', 'rows' => 3])); ?>

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

                            <br clear="all">
                            <hr>
                            <div class="col-xs-12">
                                <?php $btntext = ($create) ? __('adminforms.brands.btn_insert') : __('adminforms.brands.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>
        $(document).ready(function(){

            $('#name').keyup(function () {
                var cval = $.trim($(this).val());
                var cslug = cval.replace(/\s/g, '-').toLowerCase();
                <?php $__currentLoopData = config('app.languages'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lang): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                $('#<?php echo e($lang); ?>slug').val(cslug);
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            });
            $('#name').blur(function () {
                var cval = $.trim($(this).val());
                var cslug = cval.replace(/\s/g, '-').toLowerCase();
                <?php $__currentLoopData = config('app.languages'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lang): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                $('#<?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(); ?>