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
0
Merge Requests
0
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
Alexis AOUN
third-party
Commits
b4ff007d
Commit
b4ff007d
authored
Jul 02, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display total values on top of the screen
parent
904551d7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
44 deletions
+40
-44
oders_helper_style.css
orders/static/css/oders_helper_style.css
+20
-24
orders_helper.js
orders/static/js/orders_helper.js
+8
-7
models.py
products/models.py
+2
-2
helper.html
templates/orders/helper.html
+10
-11
No files found.
orders/static/css/oders_helper_style.css
View file @
b4ff007d
...
@@ -14,13 +14,13 @@
...
@@ -14,13 +14,13 @@
.pill
{
.pill
{
border-radius
:
30px
;
border-radius
:
30px
;
min-width
:
200px
;
min-width
:
200px
;
min-height
:
35
px
;
min-height
:
40
px
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
padding
:
8px
15px
8px
15
px
;
padding
:
10px
20px
10px
20
px
;
margin
:
0
10px
5px
0
;
margin
:
0
10px
5px
10px
;
}
}
.disabled
{
.disabled
{
...
@@ -84,6 +84,14 @@
...
@@ -84,6 +84,14 @@
/* -- Order data */
/* -- Order data */
#order_data_container
{
#order_data_container
{
font-size
:
1.8rem
;
}
#order_data_separator
{
margin
:
0
10px
0
10px
;
}
#order_forms_container
{
margin-top
:
30px
;
margin-top
:
30px
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-evenly
;
justify-content
:
space-evenly
;
...
@@ -157,14 +165,7 @@
...
@@ -157,14 +165,7 @@
/* -- Footer */
/* -- Footer */
#main_content_footer
{
#main_content_footer
{
margin
:
10px
0
35px
0
;
margin
:
20px
0
40px
0
;
}
#footer_orders_recap
{
width
:
100%
;
display
:
flex
;
justify-content
:
space-evenly
;
margin-bottom
:
15px
;
}
}
#footer_actions
{
#footer_actions
{
...
@@ -173,28 +174,23 @@
...
@@ -173,28 +174,23 @@
justify-content
:
space-between
;
justify-content
:
space-between
;
}
}
#suppliers_total_values
{
display
:
flex
;
}
.supplier_total_item
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
/* -- Suppliers list */
/* -- Suppliers list */
#suppliers_container
{
#suppliers_container
{
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
margin
:
2
0px
0
20px
0
;
margin
:
3
0px
0
20px
0
;
}
}
.supplier_pill
{
.supplier_pill
{
background-color
:
#e7e9ed
;
background-color
:
#e7e9ed
c5
;
border
:
1px
solid
black
;
}
.supplier_total_value_container
{
font-size
:
1.5rem
;
font-style
:
italic
;
}
}
.remove_supplier_icon
{
.remove_supplier_icon
{
...
...
orders/static/js/orders_helper.js
View file @
b4ff007d
...
@@ -214,9 +214,12 @@ function check_products_data() {
...
@@ -214,9 +214,12 @@ function check_products_data() {
// Update suppliers info
// Update suppliers info
for
(
let
psi_index
in
products
[
p_index
].
suppliersinfo
)
{
for
(
let
psi_index
in
products
[
p_index
].
suppliersinfo
)
{
const
updated_psi
=
updated_suppliersinfo
.
find
(
psi
=>
psi
.
supplier_id
==
products
[
p_index
].
suppliersinfo
[
psi_index
].
supplier_id
);
const
updated_psi
=
updated_suppliersinfo
.
find
(
psi
=>
psi
.
supplier_id
==
products
[
p_index
].
suppliersinfo
[
psi_index
].
supplier_id
);
if
(
updated_psi
!==
undefined
)
{
products
[
p_index
].
suppliersinfo
[
psi_index
].
package_qty
=
updated_psi
.
package_qty
;
products
[
p_index
].
suppliersinfo
[
psi_index
].
package_qty
=
updated_psi
.
package_qty
;
products
[
p_index
].
suppliersinfo
[
psi_index
].
price
=
updated_psi
.
price
;
products
[
p_index
].
suppliersinfo
[
psi_index
].
price
=
updated_psi
.
price
;
}
}
}
}
}
$
(
'.notifyjs-wrapper'
).
trigger
(
'notify-hide'
);
$
(
'.notifyjs-wrapper'
).
trigger
(
'notify-hide'
);
...
@@ -958,6 +961,7 @@ function display_suppliers() {
...
@@ -958,6 +961,7 @@ function display_suppliers() {
let
template
=
$
(
"#templates #supplier_pill_template"
);
let
template
=
$
(
"#templates #supplier_pill_template"
);
template
.
find
(
".pill_supplier_name"
).
text
(
supplier
.
display_name
);
template
.
find
(
".pill_supplier_name"
).
text
(
supplier
.
display_name
);
template
.
find
(
".supplier_pill"
).
attr
(
'id'
,
`pill_supplier_
${
supplier
.
id
}
`
);
template
.
find
(
".remove_supplier_icon"
).
attr
(
'id'
,
`remove_supplier_
${
supplier
.
id
}
`
);
template
.
find
(
".remove_supplier_icon"
).
attr
(
'id'
,
`remove_supplier_
${
supplier
.
id
}
`
);
supplier_container
.
append
(
template
.
html
());
supplier_container
.
append
(
template
.
html
());
...
@@ -1441,17 +1445,14 @@ function unselect_all_rows() {
...
@@ -1441,17 +1445,14 @@ function unselect_all_rows() {
function
display_total_values
()
{
function
display_total_values
()
{
_compute_total_values_by_supplier
();
_compute_total_values_by_supplier
();
$
(
'#suppliers_total_values_container'
).
empty
();
let
total_values_content
=
'<ul>'
;
let
order_total_value
=
0
;
let
order_total_value
=
0
;
for
(
let
supplier
of
selected_suppliers
)
{
for
(
let
supplier
of
selected_suppliers
)
{
total_values_content
+=
`<li>
${
supplier
.
display_name
}
:
${
supplier
.
total_value
}
€</li>`
;
$
(
`#pill_supplier_
${
supplier
.
id
}
`
).
find
(
'.supplier_total_value'
).
text
(
supplier
.
total_value
)
;
order_total_value
+=
supplier
.
total_value
;
order_total_value
+=
supplier
.
total_value
;
}
}
total_values_content
+=
'</ul>'
;
$
(
'#suppliers_total_values_container'
).
append
(
total_values_content
);
order_total_value
=
parseFloat
(
order_total_value
).
toFixed
(
2
);
$
(
'#order_total_value'
).
text
(
`
${
order_total_value
}
€`
);
$
(
'#order_total_value'
).
text
(
order_total_value
);
}
}
/**
/**
...
...
products/models.py
View file @
b4ff007d
...
@@ -503,8 +503,8 @@ class CagetteProducts(models.Model):
...
@@ -503,8 +503,8 @@ class CagetteProducts(models.Model):
sales_average_params
=
{
sales_average_params
=
{
'ids'
:
ptids
,
'ids'
:
ptids
,
'from'
:
'2019-04-10'
,
#
'from': '2019-04-10',
'to'
:
'2019-08-10'
,
#
'to': '2019-08-10',
}
}
sales
=
CagetteProducts
.
get_template_products_sales_average
(
sales_average_params
)
sales
=
CagetteProducts
.
get_template_products_sales_average
(
sales_average_params
)
...
...
templates/orders/helper.html
View file @
b4ff007d
...
@@ -41,10 +41,14 @@
...
@@ -41,10 +41,14 @@
<div
class=
"header txtcenter"
>
<div
class=
"header txtcenter"
>
<h1>
Aide à la commande
</h1>
<h1>
Aide à la commande
</h1>
<i>
Commande :
<span
class=
"order_name_container"
></span></i>
<p
id=
"order_data_container"
>
Commande :
<span
class=
"order_name_container"
></span>
<span
id=
"order_data_separator"
>
|
</span>
Total :
<span
id=
"order_total_value"
>
0
</span>
€
</p>
</div>
</div>
<div
class=
"txtcenter"
id=
"order_
data
_container"
>
<div
class=
"txtcenter"
id=
"order_
forms
_container"
>
<form
action=
"javascript:;"
id=
"coverage_form"
>
<form
action=
"javascript:;"
id=
"coverage_form"
>
<input
type=
"number"
name=
"coverage_days"
id=
"coverage_days_input"
placeholder=
"Nb jours de couverture"
min=
"1"
>
<input
type=
"number"
name=
"coverage_days"
id=
"coverage_days_input"
placeholder=
"Nb jours de couverture"
min=
"1"
>
<button
type=
"submit"
class=
'btn--primary'
>
Calculer les besoins
</button>
<button
type=
"submit"
class=
'btn--primary'
>
Calculer les besoins
</button>
...
@@ -55,7 +59,7 @@
...
@@ -55,7 +59,7 @@
</form>
</form>
</div>
</div>
<div
class=
"txtcenter"
id=
"suppliers_container"
></div>
<div
id=
"suppliers_container"
></div>
<div
class=
"main"
style=
"display:none;"
>
<div
class=
"main"
style=
"display:none;"
>
<div
class=
"table_area"
>
<div
class=
"table_area"
>
...
@@ -64,14 +68,6 @@
...
@@ -64,14 +68,6 @@
</div>
</div>
<div
id=
"main_content_footer"
style=
"display:none;"
>
<div
id=
"main_content_footer"
style=
"display:none;"
>
<div
id=
"footer_orders_recap"
>
<div
id=
"suppliers_total_values"
>
<h4>
Total /fournisseur :
</h4><div
id=
"suppliers_total_values_container"
></div>
</div>
<div
id=
"order_total_value_container"
>
<h4>
Total :
<span
id=
"order_total_value"
></span></h4>
</div>
</div>
<div
id=
"footer_actions"
>
<div
id=
"footer_actions"
>
<div
class=
"add_product_container"
>
<div
class=
"add_product_container"
>
<div
id=
"product_form_container"
>
<div
id=
"product_form_container"
>
...
@@ -121,6 +117,9 @@
...
@@ -121,6 +117,9 @@
<span
class=
"pill_supplier_name"
></span>
<span
class=
"pill_supplier_name"
></span>
<i
class=
"fas fa-times remove_supplier_icon"
></i>
<i
class=
"fas fa-times remove_supplier_icon"
></i>
</div>
</div>
<div
class=
"supplier_total_value_container"
>
Total:
<span
class=
"supplier_total_value"
>
0
</span>
€
</div>
</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