Current File : //home/tradevaly/public_html/resources/views/user/pages/submitfeatured.blade.php
@extends('user.ayaan.master')

@push('style')
 <link href="{{ asset('/assets/libs/select2/select2.min.css') }}" rel="stylesheet" type="text/css" />

@endpush

@section('content')
<div class="container-fluid">
  <div class="row">
    <div class="col-md-12">
      <div class="card">
        <div class="card-header card-header-icon card-header-info">
          <h4 class="card-title">Submit For Homepage Featured
          </h4>
        </div>
        <div class="card-body">
          <form action="{{route('user.featured.submit', $product->id)}}" method="POST" enctype="multipart/form-data">@csrf
            
              
            <div class="row">  
               <div class="col-md-6 mb-3 mb-5">
                <div class="form-group">
                  <h3 class="mb-3">Notes</h3>
                  <textarea id="elm1" name="notes" aria-hidden="true"></textarea>
                </div>
              </div>
            </div>
            
            <button type="submit" class="btn btn-info pull-right mt-3">Upload</button>
            <div class="clearfix"></div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
@endsection

@section('script')
<script src="{{ asset('/assets/libs/select2/select2.min.js') }}"></script>

    <!-- dropzone plugin -->
    <script src="{{ asset('/assets/libs/dropzone/dropzone.min.js') }}"></script>
    <script src="{{ asset('assets/libs/tinymce/tinymce.min.js') }}"></script>
    <!-- init js -->
    <script src="{{ asset('/assets/js/pages/ecommerce-select2.init.js') }}"></script>
    <script src="{{ asset('assets/js/pages/form-editor.init.js') }}"></script>
<script>
$(function() {
$('#example').select2({
         multiple: true,
         maximumSelectionSize: 1
    });
});
</script>
<script>
       $(document).ready(function() {
  if (window.File && window.FileList && window.FileReader) {
    $("#files5").on("change", function(e) {
      var files = e.target.files,
        filesLength = files.length;
      
        var f = files[0]
        var fileReader = new FileReader();
        fileReader.onload = (function(e) {
          var file = e.target;
          $("<span class=\"pip\">" +
            "<img class=\"imageThumb\" src=\"" + e.target.result + "\" title=\"" + file.name + "\"/>" +
            "<br/><span class=\"remove\">Remove image</span>" +
            "</span>").insertAfter("#files5");
          $(".remove").click(function(){
            $(this).parent(".pip").remove();
          });
          
          // Old code here
          /*$("<img></img>", {
            class: "imageThumb",
            src: e.target.result,
            title: file.name + " | Click to remove"
          }).insertAfter("#files").click(function(){$(this).remove();});*/
          
        });
        fileReader.readAsDataURL(f);
      
      console.log(files);
    });
  } else {
    alert("Your browser doesn't support to File API")
  }
});
    </script>



<script>
       $(document).ready(function() {
  if (window.File && window.FileList && window.FileReader) {
    $("#files2").on("change", function(e) {
      var files = e.target.files,
        filesLength = files.length;
      
        var f = files[0]
        var fileReader = new FileReader();
        fileReader.onload = (function(e) {
          var file = e.target;
          $("<span class=\"pip\">" +
            "<img class=\"imageThumb\" src=\"" + e.target.result + "\" title=\"" + file.name + "\"/>" +
            "<br/><span class=\"remove\">Remove image</span>" +
            "</span>").insertAfter("#files2");
          $(".remove").click(function(){
            $(this).parent(".pip").remove();
          });
          
          // Old code here
          /*$("<img></img>", {
            class: "imageThumb",
            src: e.target.result,
            title: file.name + " | Click to remove"
          }).insertAfter("#files").click(function(){$(this).remove();});*/
          
        });
        fileReader.readAsDataURL(f);
      
      console.log(files);
    });
  } else {
    alert("Your browser doesn't support to File API")
  }
});
    </script>

<script>
       $(document).ready(function() {
  if (window.File && window.FileList && window.FileReader) {
    $("#files3").on("change", function(e) {
      var files = e.target.files,
        filesLength = files.length;
      
        var f = files[0]
        var fileReader = new FileReader();
        fileReader.onload = (function(e) {
          var file = e.target;
          $("<span class=\"pip\">" +
            "<img class=\"imageThumb\" src=\"" + e.target.result + "\" title=\"" + file.name + "\"/>" +
            "<br/><span class=\"remove\">Remove image</span>" +
            "</span>").insertAfter("#files3");
          $(".remove").click(function(){
            $(this).parent(".pip").remove();
          });
          
          // Old code here
          /*$("<img></img>", {
            class: "imageThumb",
            src: e.target.result,
            title: file.name + " | Click to remove"
          }).insertAfter("#files").click(function(){$(this).remove();});*/
          
        });
        fileReader.readAsDataURL(f);
      
      console.log(files);
    });
  } else {
    alert("Your browser doesn't support to File API")
  }
});
    </script>
    
    
    
    <script>
       $(document).ready(function() {
  if (window.File && window.FileList && window.FileReader) {
    $("#files4").on("change", function(e) {
      var files = e.target.files,
        filesLength = files.length;
      
        var f = files[0]
        var fileReader = new FileReader();
        fileReader.onload = (function(e) {
          var file = e.target;
          $("<span class=\"pip\">" +
            "<img class=\"imageThumb\" src=\"" + e.target.result + "\" title=\"" + file.name + "\"/>" +
            "<br/><span class=\"remove\">Remove image</span>" +
            "</span>").insertAfter("#files4");
          $(".remove").click(function(){
            $(this).parent(".pip").remove();
          });
          
          // Old code here
          /*$("<img></img>", {
            class: "imageThumb",
            src: e.target.result,
            title: file.name + " | Click to remove"
          }).insertAfter("#files").click(function(){$(this).remove();});*/
          
        });
        fileReader.readAsDataURL(f);
      
      console.log(files);
    });
  } else {
    alert("Your browser doesn't support to File API")
  }
});
    </script>
<script>
$(document).ready(function() {
      $(".btn-success").click(function(){ 
          var lsthmtl = $(".clone").html();
          $(".increment").after(lsthmtl);
      });
       $("body").on("click",".btn-danger",function(){ 
          $(this).parents("#cloning").remove();
      });
    });
    
    
    
    
    
    
    $(document).on('change', '[name=category_id]', function() {
            var child_id = $(this).val();
            get_cat(child_id);
        });
        
        
        function get_cat(child_id) {
            $('[name="sub_id"]').html("");
            $.ajax({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                url: "{{ route('ajax.cat')}}",
                type: 'POST',
                data: {
                    sub_id  : child_id
                },
                success: function (response) {
                    $(".select2").select2();
                    var obj = JSON.parse(response);
                    if(obj != '') {
                        $('[name="sub_id"]').html(obj);
                    }
                }
            });
        }
        
        
        
        
        
        
        
        $(document).on('change', '[name=sub_id]', function() {
            var child_id = $(this).val();
            get_child(child_id);
        });
        
        
        function get_child(child_id) {
            $('[name="child_id"]').html("");
            $.ajax({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                url: "{{ route('ajax.subcat')}}",
                type: 'POST',
                data: {
                    sub_id  : child_id
                },
                success: function (response) {
                    $(".select2").select2();
                    var obj = JSON.parse(response);
                    if(obj != '') {
                        $('[name="child_id"]').html(obj);
                    }
                }
            });
        }
        
        
        
        
</script>
@endsection