Skip to content

Commit

Permalink
Improve handling of transfer, confirmation and alert dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemhall committed May 24, 2024
1 parent c3c7387 commit 48b4d08
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions Koha/Plugin/Com/ByWaterSolutions/RFID/static_files/rfid.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,37 @@ function handle_one_at_a_time(
? form_submit
: barcode_input.closest("form").find(":submit");

const message = $("div.dialog.alert");
const modal = $("#circ-needsconfirmation-modal");

if (modal.length) {
if ($("#wrong-transfer-modal").length && !continue_processing) {
console.log("WRONG TRANSFER");
// Do nothing, the built in modal will reload the page when a button in it is clicked
} else if (message.length && !continue_processing) {
} else if (
$("#circ-needsconfirmation-modal").length &&
!continue_processing
) {
console.log("NEEDS CONFIMRATION");
const button = $("#circ-needsconfirmation-modal button.deny");
button.on("click", function () {
continue_processing = true;
initiate_rfid_scanning();
});
} else if ($("div.dialog.alert").length && !continue_processing) {
if (action != "renew") {
// renew has it's own "continue" button
console.log("THERE IS A MESSAGE");
console.log("NEEDS ALERT CONFIRMATION");
const message = $("div.dialog.alert");

//FIXME: Show this button only when necessary
const btn = `<button class="rfid-continue">Continue processing RFID tags</button>`;
message.append(btn);
message.on("click", "button.rfid-continue", function () {
console.log("CLICKED rfid-continue BUTTON");
$("button.rfid-continue").hide();
continue_processing = true;
handle_one_at_a_time();
handle_one_at_a_time(
action,
security_setting,
barcode_input,
form_submit,
submit_form_automatically,
);
});
}
} else if (barcode_input.length) {
Expand Down

0 comments on commit 48b4d08

Please sign in to comment.