  <div class="col-12">
 <div class="row pricing-list-item border-item mb-4">
            <?php $__currentLoopData = languages(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="form-group col-lg-5">
            <label><?php echo e(__('packages.file')); ?> <?php echo e($language->local); ?></label>
            <input type="text" class="form-control" name="file[<?php echo e($num); ?>][name_<?php echo e($language->local); ?>]" id="file_<?php echo e($num); ?>_name_<?php echo e($language->local); ?>" placeholder="<?php echo e(__('packages.file')); ?> <?php echo e($language->local); ?>" />
            
        </div>
        
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
       
        <div class="form-group col-lg-2" style="font-size: 30px;margin-top:35px;">
    	<i class="fas fa-times-circle" onclick="remove(this)"></i></div>
    	<!--------------- new --------------->
            <div class="col-lg-12">
                <div class="form-group">
                    <div class="box" style="display:block">
                        <div class="js--image-preview"></div>
                        <div class="upload-options">
                            <label>
                            <input type="file" name="file[<?php echo e($num); ?>][image]" class="image-upload" />
                          </label>
                        </div>
                    </div>
                </div>
            </div>
    	</div>
    	</div>
    	
    	  	
        <!--------------- new script for edit image -------------->
        <script>
        function initImageUpload(box) {
            let uploadField = box.querySelector('.image-upload');

            uploadField.addEventListener('change', getFile);

            function getFile(e) {
                let file = e.currentTarget.files[0];
                checkType(file);
            }

            function previewImage(file) {
                let name = file.name;
                let arr = name.split(".");
                let thumb = box.querySelector('.js--image-preview'),
                    reader = new FileReader();
                if(arr[1] == 'pdf'){
                   
                   reader.onload = function() {
                    thumb.style.backgroundImage = 'url(https://nawalgym.omar.alyomhost.net/public/assets/web/pdf.png)';
                   }
                }
                else{
                reader.onload = function() {
                    thumb.style.backgroundImage = 'url(' + reader.result + ')';
                }
                }
                reader.readAsDataURL(file);
                thumb.className += ' js--no-default';
            }

            function checkType(file) {
                // let imageType = /image.*/;
                // if (!file.type.match(imageType)) {
                //     throw 'Datei ist kein Bild';
                // } else if (!file) {
                //     throw 'Kein Bild gew채hlt';
                // } else {
                    previewImage(file);
                // }
            }

        }

        // initialize box-scope
        var boxes = document.querySelectorAll('.box');

        for (let i = 0; i < boxes.length; i++) {
            let box = boxes[i];
            initDropEffect(box);
            initImageUpload(box);
        }



        /// drop-effect
        function initDropEffect(box) {
            let area, drop, areaWidth, areaHeight, maxDistance, dropWidth, dropHeight, x, y;

            // get clickable area for drop effect
            area = box.querySelector('.js--image-preview');
            area.addEventListener('click', fireRipple);

            function fireRipple(e) {
                area = e.currentTarget
                    // create drop
                if (!drop) {
                    drop = document.createElement('span');
                    drop.className = 'drop';
                    this.appendChild(drop);
                }
                // reset animate class
                drop.className = 'drop';

                // calculate dimensions of area (longest side)
                areaWidth = getComputedStyle(this, null).getPropertyValue("width");
                areaHeight = getComputedStyle(this, null).getPropertyValue("height");
                maxDistance = Math.max(parseInt(areaWidth, 10), parseInt(areaHeight, 10));

                // set drop dimensions to fill area
                drop.style.width = maxDistance + 'px';
                drop.style.height = maxDistance + 'px';

                // calculate dimensions of drop
                dropWidth = getComputedStyle(this, null).getPropertyValue("width");
                dropHeight = getComputedStyle(this, null).getPropertyValue("height");

                // calculate relative coordinates of click
                // logic: click coordinates relative to page - parent's position relative to page - half of self height/width to make it controllable from the center
                x = e.pageX - this.offsetLeft - (parseInt(dropWidth, 10) / 2);
                y = e.pageY - this.offsetTop - (parseInt(dropHeight, 10) / 2) - 30;

                // position drop and animate
                drop.style.top = y + 'px';
                drop.style.left = x + 'px';
                drop.className += ' animate';
                e.stopPropagation();

            }
        }
    </script>
    	
    <script>
        $(".form-group").delegate( ".edit_btn", "click", function() {
            $(this).parentsUntil(".form-group").siblings(".box").toggleClass("d-block");
        })
    </script><?php /**PATH /home/omaralyomhost/public_html/nawalgym/resources/views/admin/ajax/files.blade.php ENDPATH**/ ?>