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
88bbcc8e
Commit
88bbcc8e
authored
Jul 05, 2021
by
Alexis Aoun
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
controle de l'input et fix des warnings de lint
parent
ae99c34c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
25 deletions
+28
-25
reception_produits.js
reception/static/js/reception_produits.js
+27
-24
reception_produits.html
templates/reception/reception_produits.html
+1
-1
No files found.
reception/static/js/reception_produits.js
View file @
88bbcc8e
...
...
@@ -69,6 +69,7 @@ function select_product_from_bc(barcode) {
try
{
if
(
editing_product
==
null
)
{
var
scannedProduct
=
barcodes
.
get_corresponding_odoo_product
(
barcode
);
priceToWeightIsCorrect
=
true
;
if
(
scannedProduct
==
null
)
{
...
...
@@ -76,7 +77,7 @@ function select_product_from_bc(barcode) {
return
-
1
;
}
var
foundProduct
=
{
data
:
null
,
place
:
null
};
$
.
each
(
list_to_process
,
function
(
i
,
e
)
{
...
...
@@ -94,27 +95,25 @@ function select_product_from_bc(barcode) {
}
});
}
if
(
foundProduct
.
data
!==
null
){
if
(
scannedProduct
.
rule
===
'weight'
){
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
}
else
if
(
scannedProduct
.
rule
===
'price_to_weight'
){
if
(
foundProduct
.
data
!==
null
)
{
if
(
scannedProduct
.
rule
===
'weight'
)
{
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
}
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
));
setupPopUpBtnStyle
(
scannedProduct
);
}
if
(
scannedProduct
.
rule
!==
'price_to_weight'
)
{
if
(
scannedProduct
.
rule
===
'weight'
)
{
if
(
scannedProduct
.
rule
!==
'price_to_weight'
)
{
if
(
scannedProduct
.
rule
===
'weight'
)
{
editProductInfo
(
foundProduct
.
data
,
foundProduct
.
data
.
product_qty
);
}
else
{
}
else
{
setLineEdition
(
foundProduct
.
data
);
}
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
foundProduct
.
data
);
}
}
...
...
@@ -174,39 +173,43 @@ function update_distant_orders() {
});
}
function
price_to_weight_confirmed_callback
(
foundProduct
,
scannedProduct
){
return
function
price_to_weight_confirmed
(){
if
(
priceToWeightIsCorrect
)
{
function
price_to_weight_confirmed_callback
(
foundProduct
,
scannedProduct
)
{
return
function
price_to_weight_confirmed
()
{
if
(
priceToWeightIsCorrect
)
{
foundProduct
.
data
.
product_qty
=
scannedProduct
.
qty
;
}
else
{
}
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
));
var
tmp
=
Number
((
scannedProduct
.
value
/
document
.
getElementById
(
"new_price_to_weight"
).
value
).
toFixed
(
3
));
if
(
isFinite
(
tmp
))
{
foundProduct
.
data
.
product_qty
=
tmp
;
}
}
if
(
foundProduct
.
data
!==
null
)
{
if
(
foundProduct
.
data
!==
null
&&
isFinite
(
tmp
)
)
{
editProductInfo
(
foundProduct
.
data
,
foundProduct
.
data
.
product_qty
);
if
(
foundProduct
.
place
===
'to_process'
)
{
let
row
=
table_to_process
.
row
(
$
(
'#'
+
foundProduct
.
data
.
product_id
[
0
]));
remove_from_toProcess
(
row
,
foundProduct
.
data
);
}
resetPopUpButtons
();
}
}
}
;
}
function
price_to_weight_is_wrong
(){
function
price_to_weight_is_wrong
()
{
document
.
getElementById
(
"new_price_to_weight"
).
style
.
display
=
""
;
document
.
getElementsByClassName
(
"btn--success"
)[
0
].
style
.
display
=
"none"
;
document
.
querySelector
(
'#modal_closebtn_bottom'
).
innerHTML
=
'OK'
;
priceToWeightIsCorrect
=
false
;
}
function
setupPopUpBtnStyle
(
p
){
function
setupPopUpBtnStyle
(
p
)
{
//On inverse en quelque sorte les boutons succes et d'annulation en mettant "Oui" sur le btn d'annulation
// et "Non" sur le bouton de reussite.
//Cela nous permet de reecrire moins de code puisque si la reponse est Oui on ne veut
//rien modifier et sortir du pop up, ce qui correspond au comportement du bouton annulation
// et "Non" sur le bouton de reussite.
//Cela nous permet de reecrire moins de code puisque si la reponse est Oui on ne veut
//rien modifier et sortir du pop up, ce qui correspond au comportement du bouton annulation
//(ou aussi appeler cancel button)
document
.
querySelector
(
'#modal_closebtn_bottom'
).
innerHTML
=
'Oui'
;
...
...
templates/reception/reception_produits.html
View file @
88bbcc8e
...
...
@@ -181,7 +181,7 @@
<h3>
Confirmation du prix
</h3>
<p>
Est ce que le prix au kilo du produit
<b><span
id=
"product_to_verify"
></span></b>
est bien
<b><span
id=
"price_to_verify"
></span></b>
euros/Kg ?
</p>
<
textarea
name=
"Prix au Kilo"
id=
"new_price_to_weight"
cols=
"3"
rows=
"1"
></textarea
>
<
input
type=
"number"
min=
"0.00001"
name=
"Prix au Kilo"
id=
"new_price_to_weight"
>
</div>
</div>
<br/>
...
...
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