Commit 737ac81e by Damien Moulard

add listener for keyboard digits for tav secret code

parent 4e8f1b57
......@@ -511,25 +511,6 @@ $(function() {
$("#code-visual").text("*".repeat(code.length));
});
$("#code-digits-container").addEventListener('keydown', function (e) {
// Get existing input
let code = $("#formEncaissement_payment_code").val();
if ((e.key >= 48 && e.key <= 57)) {
// Add button value
code += e.key - 48;
} else if (e.key >= 96 && e.key <= 105) {
// Add button value
code += e.key - 96;
} else if (e.key == 8) {
// Remove last char of code
code = code.slice(0, -1);
}
$("#formEncaissement_payment_code").val(code);
// Visual payment code representation
$("#code-visual").text("*".repeat(code.length));
});
$(".payment-code-correction-button").off("click");
$(".payment-code-correction-button").on("click", function() {
// Get existing input
......@@ -541,6 +522,18 @@ $(function() {
$("#code-visual").text("*".repeat(code.length));
});
if ($("form[name='formEncaissement'] #code-digits-container").length > 0) {
document.addEventListener('keydown', function (e) {
if (!isNaN(parseInt(e.key))) {
$(`form[name='formEncaissement'] button.payment-code-button[data-value="${e.key}"]`)[0].click();
} else if (e.key === "Backspace") {
$("form[name='formEncaissement'] .payment-code-correction-button")[0].click();
} else if (e.key === "Enter") {
$("form[name='formEncaissement'] #formEncaissement_save")[0].click();
}
});
}
$("#formEncaisserCotisationAdherent_destinataire").on("change", function() {
const cotisationMontants = JSON.parse($("#formEncaisserCotisationAdherent_cotisationMontants").val());
let cotisationmontant = cotisationMontants[this.value];
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,7 +3,7 @@
"app": {
"js": [
"/build/runtime.6ad5c9da.js",
"/build/app.1a688d7d.js"
"/build/app.a8f5cd0d.js"
],
"css": [
"/build/app.9c351632.css"
......
{
"build/app.css": "/build/app.9c351632.css",
"build/app.js": "/build/app.1a688d7d.js",
"build/app.js": "/build/app.a8f5cd0d.js",
"build/admin.css": "/build/admin.5dc0eea7.css",
"build/admin.js": "/build/admin.cee4d78d.js",
"build/runtime.js": "/build/runtime.6ad5c9da.js",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment