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
e84119f3
Commit
e84119f3
authored
Jul 27, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display total packages by supplier
parent
2e70b732
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
4 deletions
+19
-4
oders_helper_style.css
orders/static/css/oders_helper_style.css
+2
-1
orders_helper.js
orders/static/js/orders_helper.js
+9
-1
helper.html
templates/orders/helper.html
+8
-2
No files found.
orders/static/css/oders_helper_style.css
View file @
e84119f3
...
...
@@ -279,8 +279,9 @@
font-weight
:
bold
;
}
.supplier_
total_value_container
{
.supplier_
data
{
font-size
:
1.5rem
;
display
:
flex
;
}
.remove_supplier_icon
{
...
...
orders/static/js/orders_helper.js
View file @
e84119f3
...
...
@@ -324,6 +324,7 @@ function add_supplier() {
openModal
();
supplier
.
total_value
=
0
;
supplier
.
total_packages
=
0
;
selected_suppliers
.
push
(
supplier
);
// Fetch supplier products
...
...
@@ -583,15 +584,19 @@ function _compute_total_values_by_supplier() {
// Reinit
for
(
let
s
of
selected_suppliers
)
{
s
.
total_value
=
0
;
s
.
total_packages
=
0
;
}
for
(
let
p
of
products
)
{
for
(
let
supinfo
of
p
.
suppliersinfo
)
{
let
supplier_index
=
selected_suppliers
.
findIndex
(
s
=>
s
.
id
==
supinfo
.
supplier_id
);
// Value
let
product_supplier_value
=
(
'qty'
in
supinfo
)
?
supinfo
.
qty
*
supinfo
.
package_qty
*
supinfo
.
price
:
0
;
selected_suppliers
[
supplier_index
].
total_value
+=
product_supplier_value
;
// Packages
selected_suppliers
[
supplier_index
].
total_packages
+=
(
'qty'
in
supinfo
)
?
supinfo
.
qty
:
0
;
}
}
}
...
...
@@ -1668,6 +1673,9 @@ function display_total_values() {
$
(
`#pill_supplier_
${
supplier
.
id
}
`
).
find
(
'.supplier_total_value'
)
.
text
(
parseFloat
(
supplier
.
total_value
).
toFixed
(
2
));
order_total_value
+=
supplier
.
total_value
;
$
(
`#pill_supplier_
${
supplier
.
id
}
`
).
find
(
'.supplier_total_packages'
)
.
text
(
+
parseFloat
(
supplier
.
total_packages
).
toFixed
(
2
));
}
order_total_value
=
parseFloat
(
order_total_value
).
toFixed
(
2
);
...
...
templates/orders/helper.html
View file @
e84119f3
...
...
@@ -153,8 +153,14 @@
<span
class=
"pill_supplier_name"
></span>
<i
class=
"fas fa-times remove_supplier_icon"
></i>
</div>
<div
class=
"supplier_total_value_container"
>
Total:
<span
class=
"supplier_total_value"
>
0
</span>
€
<div
class=
"supplier_data"
>
<div
class=
"supplier_total_value_container"
>
Total :
<span
class=
"supplier_total_value"
>
0
</span>
€
</div>
|
<div
class=
"supplier_total_packages_container"
>
Nb colis :
<span
class=
"supplier_total_packages"
>
0
</span>
</div>
</div>
</div>
</div>
...
...
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