$(document).ready(function(){

    $('.bankdetail_editbtn').click(function(){
      var bank_id=$(this).data('id');

      $.ajaxSetup({
        headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
      });  
      $.ajax({
        
        url:url_getbankdetail,
        type:"POST",
        data:{bank_id:bank_id},
     
           success:function(data){
            $('#editbankd_aliasname').val(data.bank_aliasname);
            $('#editbankd_bankname').val(data.bank_name);
            $('#editbankd_branchname').val(data.bank_branch);
            $('#editbankd_ifsc').val(data.bank_ifsc);
            $('#editbankd_branchcode').val(data.branch_code);
            $('#editbankd_id').val(data.id);

            $("#bankdetail_edit").modal('show');
            
           }
          });

    });

    $('.editbankd_submit').click(function(){ 
      
      var bank_id=$('#editbankd_id').val();
      var bank_aliasname=$('#editbankd_aliasname').val();
      var bank_name=$('#editbankd_bankname').val();
      var bank_branchname=$('#editbankd_branchname').val();
      var bank_ifsc=$('#editbankd_ifsc').val();
      var bank_branchcode=$('#editbankd_branchcode').val();

      console.log(bank_id);
      console.log(bank_aliasname);
      console.log(bank_name);
      console.log(bank_branchname);
      console.log(bank_ifsc);
      console.log(bank_branchcode);
         
      $.ajaxSetup({
  
        headers: {
  
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  
        }
  
      });  
      
      
      $.ajax({
  
           url:url_bankdetailupdate,
    
          type:"POST",
    
            data:{
              
              bank_id:bank_id,
              bank_aliasname:bank_aliasname,
              bank_name:bank_name,
              bank_branchname:bank_branchname,
              bank_ifsc:bank_ifsc,
              bank_branchcode:bank_branchcode,
           },
     
           success:function(data){

            $("#bankdetail_edit").modal('hide');
  
            var success="";
  
            success=success+
          
            '<p style="text-align:center;"><b>Bank Detail Updated Successfully!!!</b></p>';
           
            $('#bankdetail_success').append(success);
            $('#bankdetail_success').removeClass("hide");
  
            setTimeout(function(){
              location.reload();
            }, 200);
            
           }
          });
  
    });
  
});