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

@push('style')

@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">ADD NEW Certificate
          </h4>
        </div>
        <div class="card-body">
          <form action="{{url('user/certificate/add')}}" method="POST" enctype="multipart/form-data">@csrf
            <div class="row">
              <div class="col-md-8 mb-4">
                <div class="form-group">
                  <label class="bmd-label-floating">Name</label>
                  <input type="text" name="name" class="form-control" required>
                </div>
              </div>
              <div class="col-md-8 mb-4">
                <div class="form-group">
                  <label class="bmd-label-floating">Image</label>
                  <input type="file" name="image" class="form-control" required>
                </div>
              </div>
              
            </div>
        
            <button type="submit" class="btn btn-info">Upload</button>
            <div class="clearfix"></div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
@endsection

@section('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) {
                    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) {
                    var obj = JSON.parse(response);
                    if(obj != '') {
                        $('[name="child_id"]').html(obj);
                    }
                }
            });
        }
        
        
        
        
</script>
@endsection