<?php $__env->startSection('content'); ?>
<div class="side-title">
    <h3><?php echo e($head ?? ''); ?></h3>
</div>

<div class="border-item">
    <form class="form-row" method="post" action="<?php echo e($action); ?>" enctype="multipart/form-data">
        
        <?php if($cobon ?? ''  && $cobon->id): ?>
            <?php echo method_field('PUT'); ?>
        <?php endif; ?>
        <?php echo csrf_field(); ?>
<input type="hidden" id="cobon_id" name="cobon_id" value="<?php if($cobon ?? ''  && $cobon->id): ?><?php echo e($cobon->id); ?><?php endif; ?>">
       

        <?php $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="form-group col-lg-6">
            <label><?php echo e(meta('title', $language->local) ?? __('cobons.title')); ?> <?php echo e(count($languages) > 1 ? "({$language->name})" : ''); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('title_'.$language->local) ? 'is-invalid' : ''); ?>" name="title_<?php echo e($language->local); ?>" placeholder="<?php echo e(meta('title', $language->local) ?? __('cobons.title')); ?>" value='<?php echo e(old("title_{$language->local}", $cobon[$language->local]->title ?? "")); ?>'/>
        </div>

     

        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <div class="form-group col-lg-6">
            <label><?php echo e(meta('discount_type', getCurrentLocale()) ?? __('cobons.discount_type')); ?></label>
            <select class="form-control <?php echo e($errors->has('discount_type') ? 'is-invalid' : ''); ?>" name="discount_type">
                <option <?php if($cobon ?? ''  && $cobon->id): ?> <?php if($cobon->discount_type == '1'): ?> selected <?php endif; ?> <?php endif; ?> value="1"><?php echo e(__('cobons.value')); ?></option>
                <option <?php if($cobon ?? ''  && $cobon->id): ?> <?php if($cobon->discount_type == '2'): ?> selected <?php endif; ?> <?php endif; ?>  value="2"><?php echo e(__('cobons.percentage')); ?></option>
            </select>
        </div>
        <div class="form-group col-lg-6">
            <label><?php echo e(meta('discount_amount', getCurrentLocale()) ?? __('cobons.discount_amount')); ?></label>
            <input type="number" step="2" class="form-control  <?php echo e($errors->has('discount_amount') ? 'is-invalid' : ''); ?>" name="discount_amount" placeholder="<?php echo e(meta('discount_amount', getCurrentLocale()) ?? __('cobons.discount_amount')); ?>" value='<?php echo e(old("discount_amount", $cobon->discount_amount ?? "")); ?>'/>
        </div>
        
          <div class="form-group col-lg-6">
            <label><?php echo e(meta('start_date', getCurrentLocale()) ?? __('cobons.start_date')); ?></label>
          <input type="text" placeholder="<?php echo e(meta('start_date', getCurrentLocale()) ?? __('cobons.start_date')); ?>" name="start_date" value='<?php echo e(old("start_date", $cobon->start_date ?? "")); ?>' class="date_from form-control <?php echo e($errors->has('start_date') ? 'is-invalid' : ''); ?>">
        </div>
          <div class="form-group col-lg-6">
            <label><?php echo e(meta('end_date', getCurrentLocale()) ?? __('cobons.end_date')); ?></label>
          <input type="text" placeholder="<?php echo e(meta('end_date', getCurrentLocale()) ?? __('cobons.end_date')); ?>" name="end_date" value='<?php echo e(old("end_date", $cobon->end_date ?? "")); ?>' class="date_from form-control <?php echo e($errors->has('end_date') ? 'is-invalid' : ''); ?>">

        </div>
        <div class="form-group col-lg-12">
            <label><?php echo e(meta('type', getCurrentLocale()) ?? __('cobons.type')); ?></label>
            <select class="form-control <?php echo e($errors->has('type') ? 'is-invalid' : ''); ?>" name="type" id="type">
                <option disabled="" selected=""><?php echo e(__('cobons.select')); ?></option>
                <option <?php if($cobon ?? ''  && $cobon->id): ?> <?php if($cobon->type == '1'): ?> selected <?php endif; ?> <?php endif; ?>  value="1"><?php echo e(__('cobons.products')); ?></option>
                <option <?php if($cobon ?? ''  && $cobon->id): ?> <?php if($cobon->type == '2'): ?> selected <?php endif; ?> <?php endif; ?>  value="2"><?php echo e(__('cobons.categories')); ?></option>
            </select>
        </div>

        <div class="form-group col-lg-12" >
            <div class="row" id="data">
                 <?php if($cobon ?? ''  && $cobon->id): ?>
                <?php if($cobon->type == '1'): ?>

                <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                 <div class="col-lg-3">
            <input type="checkbox" <?php if(cobonitem($cobon->id,$row->id)): ?> checked <?php endif; ?> name="item_id[]" value="<?php echo e($row->id); ?>"> <?php echo e(productname($row->id)); ?>          
        </div>
 <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php else: ?>

                 <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <div class="col-lg-3">
            <input type="checkbox" name="item_id[]" <?php if(cobonitem($cobon->id,$row->id)): ?> checked <?php endif; ?> value="<?php echo e($row->id); ?>"> <?php echo e(categoryname($row->id)); ?>          
        </div>
 <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php endif; ?>
                 <?php endif; ?>
            </div>
        </div>
      
        <div class="text-center mt-5 col-12">
            <button class="butn"><span><?php echo e(__('dashboard.save')); ?></span></button>
        </div>
    </form>
</div>

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

<?php $__env->startSection('inner_js'); ?>
    <!-- Editor JS files -->

        <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
    <script>
        let route_prefix = "<?php echo e(url(config('lfm.prefix'))); ?>",
            url = "<?php echo e(url('/')); ?>/",
            url_type = <?php echo json_encode(url(getCurrentLocale().'/admin/type/')); ?>,
            currentLanguage = "<?php echo e(getCurrentLocale()); ?>",
            imagePath = "<?php echo e(asset('')); ?>";
    </script>
    <script src="<?php echo e(asset('assets/admin/js/editor.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/js/lfm.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/js/articles.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/js/cobons.js')); ?>"></script>
<?php $__env->stopSection(); ?>




<?php echo $__env->make('admin.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/omaralyomhost/public_html/commerce/resources/views/admin/cobons/form.blade.php ENDPATH**/ ?>