Edit File: 33fd503af48438c016b943f60787b9a231cbfe80.php
<?php $__env->startSection('css'); ?> <link rel="stylesheet" type="text/css" href="<?php echo e(asset('admin/app-assets/css-rtl/plugins/forms/validation/form-validation.css')); ?>"> <link rel="stylesheet" type="text/css" href="<?php echo e(asset('admin/app-assets/vendors/css/extensions/sweetalert2.min.css')); ?>"> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <?php $__env->stopSection(); ?> <?php $__env->startSection('content'); ?> <section id="multiple-column-form"> <div class="row match-height"> <div class="col-12"> <div class="card"> <div class="card-header"> <h4 class="card-title"><?php echo e(awtTrans('اضافه سمات للمنتج رقم ') . $product->id); ?></h4> </div> <div class="card-content"> <div class="card-body"> <div class="row align-items-center"> <div class="col-12"> <div class="form-group"> <label for="first-name-column"><?php echo e(awtTrans('اختر سمة جديدة لاضافتها للمنتج')); ?></label> <select class="form-control select_feature" name="feature_id"> <option value><?php echo e(awtTrans('اختر سمة')); ?></option> <?php $__currentLoopData = $features; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $feature): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option data-feature="<?php echo e($feature); ?>" data-properities="<?php echo e($feature->properities); ?>" value="<?php echo e($feature->id); ?>"><?php echo e($feature->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> </div> <form action="<?php echo e(route('admin.stores.products.features.update' , ['id' => $product->id])); ?>" class="form-horizontal store w-100 novalidate" > <div class="form-body"> <div class="row append_features w-100"> <?php if($product->productfeatures()->count()>0): ?> <?php $__currentLoopData = $product->productfeatures; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $feature): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <div class="col-md-12 col-12 feature_parent"> <div class="form-group"> <input type="hidden" name="feature_id[]" value="<?php echo e($feature->feature->id); ?>" > <label class="text-danger d-flex justify-content-between"> <span><?php echo e(awtTrans('اختر خصائص لسمة ')); ?> (<?php echo e($feature->feature->name); ?>)</span> <i data-id="<?php echo e($feature->id); ?>" class="delete-feature feather icon-trash"></i> </label> <div class="controls"> <select class="select2 form-control feature_<?php echo e($feature->feature->id); ?>" name="proparties[<?php echo e($feature->feature->id); ?>][]" multiple="multiple" required > <option value><?php echo e(awtTrans('اختر السمات')); ?></option> <?php $__currentLoopData = $feature->feature->properities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $properity): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option <?php echo e(in_array( $properity->id , $feature->productfeatureproperities()->pluck('properity_id')->toArray() ) ? 'selected' : ''); ?> value="<?php echo e($properity->id); ?>"><?php echo e($properity->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?> </div> <div class="row"> <div class="col-12 d-flex justify-content-center mt-3"> <button type="submit" class="btn btn-primary mr-1 mb-1 submit_button"><?php echo e(awtTrans('تحديث السمات')); ?></button> </div> </div> </div> </form> </div> </div> </div> </div> </div> </section> <?php $__env->stopSection(); ?> <?php $__env->startSection('js'); ?> <script src="<?php echo e(asset('admin/app-assets/vendors/js/forms/validation/jqBootstrapValidation.js')); ?>"></script> <script src="<?php echo e(asset('admin/app-assets/js/scripts/forms/validation/form-validation.js')); ?>"></script> <script src="<?php echo e(asset('admin/app-assets/vendors/js/extensions/sweetalert2.all.min.js')); ?>"></script> <script src="<?php echo e(asset('admin/app-assets/js/scripts/extensions/sweet-alerts.js')); ?>"></script> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <script> $('.select2').select2() $(document).on('change' , '.select_feature', function (e) { e.preventDefault() var feature = $('.select_feature option:selected').data('feature') var properities = $('.select_feature option:selected').data('properities') if ($('.feature_'+feature.id).length > 0) { toastr.error('<?php echo e(awtTrans('تم اضافة السمة سابقا')); ?>') }else{ var options = '' ; $.each(properities , function( index, value ) { options += `<option value="${value.id}">${value.name.ar}</option>` }); $('.append_features').append(` <div class="col-md-12 col-12 feature_parent"> <div class="form-group"> <input type="hidden" name="feature_id[]" value="${feature.id}" > <label class="text-danger d-flex justify-content-between"> <span><?php echo e(awtTrans('اختر خصائص لسمة ')); ?> (${feature.name.ar})</span> <i class="delete-feature feather icon-trash"></i> </label> <div class="controls"> <select class="select2 form-control feature_${feature.id}" name="proparties[${feature.id}][]" multiple="multiple" required > <option value><?php echo e(awtTrans('اختر السمات')); ?></option> ${options} </select> </div> </div> </div> `) $('.select2').select2() } }); $(document).on('click' , '.delete-feature', function (e) { e.preventDefault() if ($(this).data('id')) { $.ajax({ type: "post", url: "<?php echo e(url('admin/stores/products/delete')); ?>", data: {id: $(this).data('id')}, dataType: "json", success: (response) => { $(this).parents('.feature_parent').remove() } }); }else{ $(this).parents('.feature_parent').remove() } }); </script> <script> $(document).ready(function() { $(document).on('submit', '.store', function(e) { e.preventDefault(); var url = $(this).attr('action') $.ajax({ url: url, method: 'post', data: new FormData($(this)[0]), dataType: 'json', processData: false, contentType: false, success: function(response) { if(response.key == 'fail'){ toastr.error(response.msg) }else{ toastr.success('<?php echo e(awtTrans("تم التحديث بنجاح . الرجاء اضافة المجموعات")); ?>') setTimeout(function(){ window.location.replace(response.url) }, 1000); } } }); }); }); </script> <?php $__env->stopSection(); ?> <?php echo $__env->make('admin.layout.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/wwineerc/public_html/resources/views/admin/products/features.blade.php ENDPATH**/ ?>
Back to File Manager