Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
ba58b323
Commit
ba58b323
authored
Jan 25, 2024
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent using scan in qty inputs
parent
5b6883fb
Pipeline
#3273
failed with stage
in 1 minute 4 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
reception_produits.js
reception/static/js/reception_produits.js
+15
-0
shelf_inventory.js
shelfs/static/js/shelf_inventory.js
+14
-0
No files found.
reception/static/js/reception_produits.js
View file @
ba58b323
...
...
@@ -40,6 +40,8 @@ var dbc = null,
sync
=
null
,
fingerprint
=
null
;
let
lastKeypressTime
=
0
;
/* UTILS */
function
back
()
{
...
...
@@ -2596,6 +2598,19 @@ function init_dom(partners_display_data) {
// Barcode reader
$
(
document
).
pos
();
$
(
document
).
on
(
'keydown'
,
'#edition_input'
,
function
(
event
)
{
const
keypressTime
=
event
.
timeStamp
;
const
timeDifference
=
keypressTime
-
lastKeypressTime
;
lastKeypressTime
=
keypressTime
;
// Assuming a scanner would input faster than 50ms between keystrokes
if
(
timeDifference
<
50
)
{
// Looks like scanner input, ignore or handle differently
event
.
preventDefault
();
// You can display a message or handle the input differently
alert
(
"Vous ne pouvez pas scanner pour saisir une quantité."
);
}
});
$
(
document
).
on
(
'scan.pos.barcode'
,
function
(
event
)
{
//access `event.code` - barcode data
var
barcode
=
event
.
code
;
...
...
shelfs/static/js/shelf_inventory.js
View file @
ba58b323
...
...
@@ -35,6 +35,7 @@ var shelf = null,
all_shelfs
=
null
,
// Use get_all_shelfs to access it's value
debounce_timeout
=
null
;
let
lastKeypressTime
=
0
;
/* UTILS */
...
...
@@ -1241,6 +1242,19 @@ function init() {
});
$
(
document
).
pos
();
$
(
document
).
on
(
'keydown'
,
'#edition_input'
,
function
(
event
)
{
const
keypressTime
=
event
.
timeStamp
;
const
timeDifference
=
keypressTime
-
lastKeypressTime
;
lastKeypressTime
=
keypressTime
;
// Assuming a scanner would input faster than 50ms between keystrokes
if
(
timeDifference
<
50
)
{
// Looks like scanner input, ignore or handle differently
event
.
preventDefault
();
// You can display a message or handle the input differently
alert
(
"Vous ne pouvez pas scanner pour saisir une quantité."
);
}
});
$
(
document
).
on
(
'scan.pos.barcode'
,
function
(
event
)
{
//access `event.code` - barcode data
var
barcode
=
event
.
code
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment