Commit 76ae0847 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: Avoid to disable all buttons if current button is already disabled

parent 4cfb3990
......@@ -534,7 +534,7 @@
})
.onEvent("click", function (evt) {
// Only handle click on BUTTON element
// Only handle click on BUTTON and IMG element
if (evt.target.tagName !== 'BUTTON' && evt.target.tagName !== 'IMG') {
return;
}
......@@ -544,9 +544,13 @@
// Disable any button. It must be managed by this gadget
evt.preventDefault();
gadget.element.querySelectorAll('button').forEach(function (elt) {
elt.disabled = true;
});
// If user clicks on same image twice,
// we don't need to disable everything again if parent is already disabled
if (evt.target.tagName === 'IMG' && !evt.target.parentElement.disabled) {
gadget.element.querySelectorAll('button').forEach(function (elt) {
elt.disabled = true;
});
}
if (evt.target.className.indexOf("take-picture-btn") !== -1) {
return gadget.changeState({
......
......@@ -244,7 +244,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>981.58568.65411.58828</string> </value>
<value> <string>981.59234.29833.17954</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1581903960.55</float>
<float>1581944351.11</float>
<string>UTC</string>
</tuple>
</state>
......
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