$(document).ready(function(){
 
  $('.bankdetail_trashbtn').on('click',function(){

    var bank_id=$(this).data('id');

    var conformation=confirm("Are Sure !!!");

    if(conformation==true)
    {
        deletetempbankd(bank_id);
    } 

  });  


  $(document).on('click', '.trashbtnDelete_bankd', function () {

    var bank_id=$(this).data('id');

    deletepermbankd(bank_id);


  });  

});


function  deletetempbankd(bank_id)
{
  $.ajaxSetup({

    headers: {

        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
 
    } 

  });


  $.ajax({ 
  
    url:url_movetotrashbankDetail,

    method:"POST",

    data:{bank_id:bank_id},

    success:function(result)

    {
      var success="";

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

 });
}

function deletepermbankd(bank_id)
{

  $.ajaxSetup({

    headers: {

        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

    } 

  });


  $.ajax({ 
  
    url:url_deletebankDetail,

    method:"POST",

    data:{bank_id:bank_id},

    success:function(result)

    {
      $("#bankdetail_trashed").modal('hide');
      
      var success="";

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

 });

}