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
5a7df93d
Commit
5a7df93d
authored
Jul 08, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REC: adding products, differenciate unit & kg products for qty precision
parent
672c5269
Pipeline
#2310
passed with stage
in 1 minute 24 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
10 deletions
+52
-10
reception_style.css
reception/static/css/reception_style.css
+19
-1
reception_produits.js
reception/static/js/reception_produits.js
+29
-8
reception_produits.html
templates/reception/reception_produits.html
+4
-1
No files found.
reception/static/css/reception_style.css
View file @
5a7df93d
...
...
@@ -277,12 +277,30 @@ tr.odd td.row_product_no_qty {
}
.add_product_line_item
{
width
:
45%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
.input_uom_container
{
display
:
flex
;
flex-direction
:
row
;
justify-content
:
center
;
align-items
:
center
;
}
.product_uom
{
margin-left
:
10px
;
}
.add_product_line
.product_name
{
width
:
60%
;
}
.add_product_line
.product_qty
{
width
:
30%
;
}
.product_qty_input_alert
{
color
:
#d9534f
;
font-size
:
1.4rem
;
...
...
reception/static/js/reception_produits.js
View file @
5a7df93d
...
...
@@ -1979,10 +1979,10 @@ function add_products_action() {
for
(
let
qty_input
of
qty_inputs
)
{
if
(
$
(
qty_input
).
val
()
===
""
)
{
has_empty_qty_input
=
true
;
$
(
qty_input
).
siblings
(
".product_qty_input_alert"
)
$
(
qty_input
).
closest
(
".product_qty"
).
find
(
".product_qty_input_alert"
)
.
show
();
}
else
{
$
(
qty_input
).
siblings
(
".product_qty_input_alert"
)
$
(
qty_input
).
closest
(
".product_qty"
).
find
(
".product_qty_input_alert"
)
.
hide
();
}
}
...
...
@@ -2017,16 +2017,23 @@ function create_orders() {
for
(
let
p
of
products_to_add
)
{
// Get product qty from input
let
product_qty
=
0
;
let
product_uom
=
""
;
let
add_products_lines
=
$
(
"#modal .add_product_line"
);
for
(
let
i
=
0
;
i
<
add_products_lines
.
length
;
i
++
)
{
let
line
=
add_products_lines
[
i
];
if
(
$
(
line
).
find
(
".product_name"
)
.
text
()
===
p
.
name
)
{
product_qty
=
parseFloat
(
$
(
line
).
find
(
".product_qty_input"
)
.
val
());
if
(
$
(
line
).
find
(
".product_name"
).
text
()
===
p
.
name
)
{
product_uom
=
$
(
line
).
find
(
".product_uom"
).
text
();
if
(
product_uom
.
includes
(
"kg"
))
{
product_qty
=
parseFloat
(
$
(
line
).
find
(
".product_qty_input"
)
.
val
());
}
else
{
product_qty
=
parseInt
(
$
(
line
).
find
(
".product_qty_input"
)
.
val
(),
10
);
}
break
;
}
}
...
...
@@ -2034,11 +2041,24 @@ function create_orders() {
let
p_supplierinfo
=
p
.
suppliersinfo
[
0
];
// product is ordered at its first supplier
const
supplier_id
=
p_supplierinfo
.
supplier_id
;
let
item_qty_package
=
0
;
let
package_qty
=
p_supplierinfo
.
package_qty
;
if
(
product_qty
<
package_qty
)
{
package_qty
=
product_qty
;
}
if
(
product_uom
.
includes
(
"kg"
)
)
{
item_qty_package
=
Math
.
round
((
product_qty
/
package_qty
)
*
1
e2
)
/
1
e2
;
}
else
{
item_qty_package
=
Math
.
round
(
product_qty
/
package_qty
)
}
orders_data
.
suppliers_data
[
supplier_id
].
lines
.
push
({
'package_qty'
:
p
_supplierinfo
.
p
ackage_qty
,
'package_qty'
:
package_qty
,
'product_id'
:
p
.
id
,
'name'
:
p
.
name
,
'product_qty_package'
:
(
product_qty
/
p_supplierinfo
.
package_qty
).
toFixed
(
2
)
,
'product_qty_package'
:
item_qty_package
,
'product_qty'
:
product_qty
,
'product_uom'
:
p
.
uom_id
[
0
],
'price_unit'
:
p_supplierinfo
.
price
,
...
...
@@ -2243,6 +2263,7 @@ function set_products_autocomplete() {
let
add_product_template
=
$
(
"#add_product_line_template"
);
add_product_template
.
find
(
".product_name"
).
text
(
product_name
);
add_product_template
.
find
(
".product_uom"
).
text
(
product
.
uom_id
[
1
]);
$
(
"#modal .products_lines"
).
append
(
add_product_template
.
html
());
if
(
products_to_add
.
length
===
1
)
{
...
...
templates/reception/reception_produits.html
View file @
5a7df93d
...
...
@@ -219,7 +219,10 @@
<div
class=
"add_product_line"
>
<div
class=
"product_name add_product_line_item"
></div>
<div
class=
"product_qty add_product_line_item"
>
<input
type=
"number"
autocomplete=
"off"
class=
"product_qty_input input_small"
placeholder=
"Quantité"
>
<div
class=
"input_uom_container"
>
<input
type=
"number"
autocomplete=
"off"
class=
"product_qty_input input_small"
placeholder=
"Quantité"
>
<div
class=
"product_uom"
></div>
</div>
<i
class=
"product_qty_input_alert"
>
Vous devez renseigner une quantité
</i>
</div>
<div
class=
"remove_line"
>
...
...
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