<?php $__env->startSection('content'); ?>

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

<div class="border-item">
    <form class="form-row" id="form" method="post" action="<?php echo e($action); ?>" enctype="multipart/form-data">
        <?php if($service ?? ''  && $service->id): ?>
            <?php echo method_field('PUT'); ?>
        <?php endif; ?>
        <?php echo csrf_field(); ?>
 <?php if($service ?? ''  && $service->id): ?>
  <?php 
            $error_name ='service_name';
            $error_description ='service_description';

              ?>
  <div class="form-group col-lg-6">
            <label><?php echo e(meta('name', getCurrentLocale()) ?? __('services.name')); ?> </label>
           
            <input type="text" class="form-control <?php echo e($errors->has($error_name) ? 'is-invalid' : ''); ?>" name="service[name]" placeholder="<?php echo e(meta('name', getCurrentLocale()) ??__('services.name')); ?>" id="<?php echo e($error_name); ?>" value='<?php echo e(old("$error_name", $service->name ?? "")); ?>'/>
            <input type="hidden" name="service[language_id]" value="<?php echo e($service->language_id); ?>">
        </div>

        <div class="form-group col-lg-6">
            <label><?php echo e(meta('description', getCurrentLocale()) ?? __('services.description')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has($error_description) ? 'is-invalid' : ''); ?>" id="<?php echo e($error_description); ?>" name="service[description]" placeholder="<?php echo e(meta('description', getCurrentLocale()) ??__('services.description')); ?>" value='<?php echo e(old("$error_description", $service->description ?? "")); ?>'/>
        </div>
       
 <?php else: ?>
 <?php $__currentLoopData = $language; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lang): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="form-group col-lg-6">
            <label><?php echo e(meta('name', getCurrentLocale()) ?? __('services.name')); ?> </label>
            <?php 
            $error_name ='service_'.$lang->local.'_name';
            $error_description ='service_'.$lang->local.'_description';
              ?>
            <input type="text" class="form-control <?php echo e($errors->has($error_name) ? 'is-invalid' : ''); ?>" name="service[<?php echo e($lang->local); ?>][name]" placeholder="<?php echo e(meta('name', getCurrentLocale()) ??__('services.name')); ?>" id="<?php echo e($error_name); ?>" value='<?php echo e(old("$error_name", $service->name ?? "")); ?>'/>
            <input type="hidden" name="service[<?php echo e($lang->local); ?>][language_id]" value="<?php echo e($lang->id); ?>">
        </div>

        <div class="form-group col-lg-6">
            <label><?php echo e(meta('description', getCurrentLocale()) ?? __('services.description')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has($error_description) ? 'is-invalid' : ''); ?>" id="<?php echo e($error_description); ?>" name="service[<?php echo e($lang->local); ?>][description]" placeholder="<?php echo e(meta('description', getCurrentLocale()) ??__('services.description')); ?>" value='<?php echo e(old("$error_description", $service->description ?? "")); ?>'/>
        </div>


    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    <?php endif; ?>
     <div class="form-group col-lg-12">
            <label><?php echo e(meta('img', getCurrentLocale()) ?? __('services.img')); ?> </label>
            <input type="file" class="form-control" name="img" id="img" />
            
        </div>

     <a style="cursor: pointer;float:right;"<?php if($service ?? ''  && $service->id): ?>  data-id="<?php echo e(($forms->count())); ?>" onclick="editform(this)" <?php else: ?>    data-id="0" onclick="addform(this)" <?php endif; ?> class="btn_1 gray"><i class="fa fa-fw fa-plus-circle"></i><?php echo e(__('services.add_form')); ?></a>
<table id="pricing-list-container" style="width:100%;" >
                            <tbody id="body">
                                 <?php if($service ?? ''  && $service->id): ?>
                          <?php $__currentLoopData = $forms; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                           <tr class="pricing-list-item" id="data0" >
                  <td>
                   <div class="row" id="data">
                    
                       <div class="col-md-5" >
                                                    <div class="form-group">
                                                        <input type="text" class="form-control" name="form[<?php echo e($key); ?>][question]" id="form_<?php echo e($key); ?>_question" placeholder='<?php echo e(__("questions.form")); ?>' value="<?php echo e($row->question); ?>">
                                                    </div>
                                                </div>
                                                 <div class="col-md-1">
                     <a style="font-size:25px;margin-top:5px;cursor: pointer;" row-id="<?php echo e($row->id); ?>" onclick="deleteform(this)"><i  class="fas fa-times-circle" ></i></a>
                                            </div>
                    
                   </div>
                       </td>
         </tr>
                          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>    
                          <?php endif; ?> 
                            </tbody>
                             
                                </table>


      
        
        

        <div class="text-center mt-5 col-12">
            <button class="butn" <?php if($service ?? ''  && $service->id): ?> onclick="update()" <?php else: ?> onclick="store()" <?php endif; ?>><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('/')); ?>/",
            imagePath = "<?php echo e(asset('')); ?>";
            url_editform = <?php echo json_encode(url(getCurrentLocale().'/admin/editform')); ?>

            url_addform = <?php echo json_encode(url(getCurrentLocale().'/admin/addform')); ?>

            url_deleteform = <?php echo json_encode(url(getCurrentLocale().'/admin/deleteform')); ?>

    </script>

    <script src="<?php echo e(asset('assets/admin/js/addform.js')); ?>"></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>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\lamis\resources\views/admin/services/form.blade.php ENDPATH**/ ?>