Disable button on action

This commit is contained in:
Djery-Tom 2021-08-20 17:43:52 +01:00
parent 4facfe4f6c
commit 16b4d9738d
3 changed files with 27 additions and 5 deletions

View File

@ -391,6 +391,8 @@
const network = $(this).data('network');
const country = $(this).data('country');
const email = $(this).data('email');
let button = $(this)
button.prop("disabled",true);
$.ajax({
url: '<?php echo base_url('index.php/Hyperviseur_dash/resetWalletPassword')?>',
type: 'POST',
@ -420,7 +422,9 @@
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
},
complete: function (){
button.prop("disabled",false);
}
});
});
@ -430,11 +434,13 @@
const salt = $(this).data('salt');
const encrypted_password = $(this).data('encrypted_password');
let button = $(this);
if ($('#payCommissionForm')[0].checkValidity()) {
const montant = anElement.getNumber(); //parseFloat($('#montant').val());
const password = $('#password').val();
button.prop("disabled",true);
$.ajax({
url: '<?php echo base_url('index.php/Hyperviseur_dash/pay_commission_in_cash')?>',
type: 'POST',
@ -467,6 +473,9 @@
error: function (resultat, statut, error) {
console.log(resultat + " " + error);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
},
complete : function () {
button.prop("disabled",false);
}
});

View File

@ -301,6 +301,8 @@
<script>
$(document).on("click", "#cancelDemand", function () {
const id_demand = $(this).data('id-demand');
let button = $(this)
button.prop("disabled",true);
$.ajax({
url: '<?php echo base_url('index.php/Hyperviseur_dash/cancelCreditRequest')?>',
type: 'POST',
@ -322,10 +324,12 @@
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
}
},
error: function (resultat, statut, erreur) {
console.log(resultat + " " + erreur);
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
},
complete: function (){
button.prop("disabled",false);
}
});
});

View File

@ -335,6 +335,8 @@
})
$(document).on("click", "#cancel", function () {
let button = $(this);
button.prop("disabled",true);
const id_transaction = $(this).data('id-transaction');
$.ajax({
url : '<?php echo base_url('index.php/Gestion/cancelTransation')?>',
@ -357,15 +359,19 @@
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
},
complete: function (){
button.prop("disabled",false);
}
});
});
$('#delete').click(function(){
let button = $(this);
button.prop('disabled', true);
$.ajax({
url : '<?php echo base_url('index.php/Hyperviseur_dash/delete_wallet_transaction')?>',
type : 'POST',
@ -386,10 +392,13 @@
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
}
},
error : function(resultat, statut, erreur){
console.log(resultat+" "+erreur);
toastr.error("<?php echo $this->lang->line('error_message')?>" , "<?php echo $this->lang->line('request_error')?>");
},
complete: function (){
button.prop('disabled', false);
}
});
});