

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

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

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

       

       <div class="form-group col-lg-6">
                <label><?php echo e(meta('specialties', getCurrentLocale()) ?? __('systemphysics.specialties')); ?> </label>
               <select class="form-control <?php echo e($errors->has('specialty_id') ? 'is-invalid' : ''); ?>" name="specialty_id">
                   <option selected disabled ><?php echo e(__('systemphysics.select')); ?></option>
                    <?php $__currentLoopData = $specialties; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option  <?php if($systemphysic ?? ''  && $systemphysic->id): ?> <?php if($systemphysic->specialty_id == $row->id): ?> selected <?php endif; ?> <?php endif; ?> value="<?php echo e($row->id); ?>"><?php echo e($row->name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
               </select>
                </div>
       
  
                
                <div class="row col-12 pricing-list-item border-item mb-4" <?php if(!($systemphysic ?? ''  && $systemphysic->id)): ?> style="display:none" <?php endif; ?> id="physics">
                <?php if($systemphysic ?? ''  && $systemphysic->id): ?>
                    <?php $__currentLoopData = $codes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data=>$row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="row col-12 pricing-list-item border-item mb-4">
          <div class="form-group col-lg-6">
            <label>الكود </label>
            <input type="text" class="form-control" name="physical[<?php echo e($data); ?>][name]" placeholder="الكود" value="<?php echo e($row->name); ?>" />
        </div>

       
          <div class="form-group col-lg-6" style="font-size: 30px;margin-top:35px;">
    	<i class="fas fa-times-circle" onclick="remove(this)"></i></div>
        
          <div class="form-group col-lg-12">
             <label>التمارين </label>
               
                     <div class="row">
                     
                    <?php $__currentLoopData = $physics; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rows): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        
                       
                    <div class="col-3">
                    <input type="checkbox" <?php if(codephysics($row->id,$rows->id)): ?> checked <?php endif; ?> name="physical[<?php echo e($data); ?>][physics][]" value="<?php echo e($rows->id); ?>"> <?php echo e($rows->name); ?>

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

        
       </div>
                            </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php endif; ?>
                </div>
<div class="col-lg-12">
       <a style="cursor: pointer;" <?php if($systemphysic ?? ''  && $systemphysic->id): ?> data-id="<?php echo e(count($codes)); ?>" <?php else: ?> data-id="0" <?php endif; ?> onclick="addphysic(this)" class="btn_1 gray "><i class="fa fa-fw fa-plus-circle"></i>اضافة كود رياضي</a>
                   
</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'); ?>
<script>
 function remove(elem){
            $(elem).closest('.row').remove();
        }
    function addphysic(elem){
        $("#physics").css("display", "block");
        var num = $(elem).attr('data-id');
        
        var newrow = parseInt(num)+1; 
        $(elem).attr('data-id', newrow);
        
         $.ajax({
          url : urls+'/'+num,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#physics').append(data);
          }
        })
    }
</script>
    <!-- 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('/')); ?>/",
            urls = "<?php echo e(url('/')); ?>/admin/addphysic",
            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>
<?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/green_apple/resources/views/admin/systemphysics/form.blade.php ENDPATH**/ ?>