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
ae99c34c
Commit
ae99c34c
authored
Jul 02, 2021
by
Alexis Aoun
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor et renommage de variable
parent
476540af
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
reception_produits.js
reception/static/js/reception_produits.js
+23
-19
No files found.
reception/static/js/reception_produits.js
View file @
ae99c34c
...
@@ -95,20 +95,23 @@ function select_product_from_bc(barcode) {
...
@@ -95,20 +95,23 @@ function select_product_from_bc(barcode) {
});
});
}
}
if
(
scannedProduct
.
rule
==
'weight'
)
if
(
foundProduct
.
data
!==
null
){
if
(
scannedProduct
.
rule
===
'weight'
){
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
}
else
if
(
scannedProduct
.
rule
==
'price_to_weight'
){
else
if
(
scannedProduct
.
rule
=
==
'price_to_weight'
){
openModal
(
$
(
'#templates #modal_confirm_price_to_weight'
).
html
(),
price_to_weight_is_wrong
,
'Non'
,
false
,
true
,
price_to_weight_confirmed_callback
(
foundProduct
,
scannedProduct
));
openModal
(
$
(
'#templates #modal_confirm_price_to_weight'
).
html
(),
price_to_weight_is_wrong
,
'Non'
,
false
,
true
,
price_to_weight_confirmed_callback
(
foundProduct
,
scannedProduct
));
setupPopUpBtnStyle
(
scannedProduct
);
setupPopUpBtnStyle
(
scannedProduct
);
}
}
if
(
scannedProduct
.
rule
!==
'price_to_weight'
){
if
(
foundProduct
.
data
!==
null
&&
!
(
scannedProduct
.
rule
==
'price_to_weight'
)){
if
(
scannedProduct
.
rule
===
'weight'
){
if
(
scannedProduct
.
rule
==
'weight'
)
editProductInfo
(
foundProduct
.
data
,
foundProduct
.
data
.
product_qty
);
editProductInfo
(
foundProduct
.
data
,
foundProduct
.
data
.
product_qty
);
else
}
else
{
setLineEdition
(
foundProduct
.
data
);
setLineEdition
(
foundProduct
.
data
);
}
if
(
foundProduct
.
place
===
'to_process'
)
{
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
...
@@ -116,6 +119,7 @@ function select_product_from_bc(barcode) {
...
@@ -116,6 +119,7 @@ function select_product_from_bc(barcode) {
}
}
}
}
}
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
err
=
{
msg
:
e
.
name
+
' : '
+
e
.
message
,
ctx
:
'select_product_from_bc'
};
err
=
{
msg
:
e
.
name
+
' : '
+
e
.
message
,
ctx
:
'select_product_from_bc'
};
console
.
error
(
err
);
console
.
error
(
err
);
...
@@ -170,21 +174,21 @@ function update_distant_orders() {
...
@@ -170,21 +174,21 @@ function update_distant_orders() {
});
});
}
}
//TODO not the cleanest way to manage the callback, needs improvement
function
price_to_weight_confirmed_callback
(
foundProduct
,
scannedProduct
){
//TODO too much repeating code, needs refactor
function
price_to_weight_confirmed_callback
(
found
,
p
){
return
function
price_to_weight_confirmed
(){
return
function
price_to_weight_confirmed
(){
if
(
priceToWeightIsCorrect
)
if
(
priceToWeightIsCorrect
){
found
.
data
.
product_qty
=
p
.
qty
;
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
else
}
found
.
data
.
product_qty
=
Number
((
p
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
).
toFixed
(
3
));
else
{
//TODO il n'y a aucun controle sur l'input à corriger
foundProduct
.
data
.
product_qty
=
Number
((
scannedProduct
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
).
toFixed
(
3
));
}
if
(
found
.
data
!==
null
)
{
if
(
found
Product
.
data
!==
null
)
{
editProductInfo
(
found
.
data
,
found
.
data
.
product_qty
);
editProductInfo
(
found
Product
.
data
,
foundProduct
.
data
.
product_qty
);
if
(
found
.
place
===
'to_process'
)
{
if
(
found
Product
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
found
.
data
.
product_id
[
0
]));
let
row
=
table_to_process
.
row
(
$
(
'#'
+
found
Product
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
found
.
data
);
remove_from_toProcess
(
row
,
found
Product
.
data
);
}
}
resetPopUpButtons
();
resetPopUpButtons
();
}
}
...
...
Damien Moulard
@DamienM
mentioned in commit
1835290c
Jan 17, 2022
mentioned in commit
1835290c
mentioned in commit 1835290c2a6ff23629dd84d8d34ae2c61cb8406d
Toggle commit list
Damien Moulard
@DamienM
mentioned in merge request
!105 (merged)
Jan 17, 2022
mentioned in merge request
!105 (merged)
mentioned in merge request !105
Toggle commit list
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