1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

Spam click on invalidity button is no longer possible

This commit is contained in:
Yohann D'ANELLO
2020-08-13 17:04:10 +02:00
parent c466715e8a
commit bb2704323a
6 changed files with 42 additions and 17 deletions

View File

@ -46,6 +46,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'django.forms',
'django_filters',
# API
'rest_framework',

View File

@ -349,8 +349,15 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
// When a validate button is clicked, we switch the validation status
function de_validate(id, validated) {
let validate_obj = $("#validate_" + id);
if (validate_obj.data("pending"))
// The button is already clicked
return;
let invalidity_reason = $("#invalidity_reason_" + id).val();
$("#validate_" + id).html("<strong style=\"font-size: 16pt;\">⟳</strong>");
validate_obj.html("<strong style=\"font-size: 16pt;\">⟳</strong>");
validate_obj.data("pending", true);
// Perform a PATCH request to the API in order to update the transaction
// If the user has insufficient rights, an error message will appear