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
931e437c
Commit
931e437c
authored
Jul 02, 2021
by
Damien Moulard
Committed by
Alexis Aoun
Jul 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix wrong total value displayed
parent
31c8bda3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
+25
-10
orders_helper.js
orders/static/js/orders_helper.js
+24
-9
helper.html
templates/orders/helper.html
+1
-1
No files found.
orders/static/js/orders_helper.js
View file @
931e437c
...
@@ -484,7 +484,7 @@ function _compute_total_values_by_supplier() {
...
@@ -484,7 +484,7 @@ function _compute_total_values_by_supplier() {
for
(
let
supinfo
of
p
.
suppliersinfo
)
{
for
(
let
supinfo
of
p
.
suppliersinfo
)
{
let
supplier_index
=
selected_suppliers
.
findIndex
(
s
=>
s
.
id
==
supinfo
.
supplier_id
);
let
supplier_index
=
selected_suppliers
.
findIndex
(
s
=>
s
.
id
==
supinfo
.
supplier_id
);
let
product_supplier_value
=
(
'qty'
in
supinfo
)
?
supinfo
.
qty
*
supinfo
.
price
:
0
;
let
product_supplier_value
=
(
'qty'
in
supinfo
)
?
supinfo
.
qty
*
supinfo
.
p
ackage_qty
*
supinfo
.
p
rice
:
0
;
selected_suppliers
[
supplier_index
].
total_value
+=
product_supplier_value
;
selected_suppliers
[
supplier_index
].
total_value
+=
product_supplier_value
;
}
}
}
}
...
@@ -588,6 +588,7 @@ function generate_inventory() {
...
@@ -588,6 +588,7 @@ function generate_inventory() {
openModal
(
openModal
(
modal_create_inventory
.
html
(),
modal_create_inventory
.
html
(),
()
=>
{
()
=>
{
if
(
is_time_to
(
'validate_generate_inventory'
))
{
$
(
'#do_inventory'
).
empty
().
append
(
`<i class="fas fa-spinner fa-spin"></i>`
);
$
(
'#do_inventory'
).
empty
().
append
(
`<i class="fas fa-spinner fa-spin"></i>`
);
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
...
@@ -624,6 +625,7 @@ function generate_inventory() {
...
@@ -624,6 +625,7 @@ function generate_inventory() {
alert
(
"Erreur lors de la création de l'inventaire. Réessayez plus tard."
);
alert
(
"Erreur lors de la création de l'inventaire. Réessayez plus tard."
);
}
}
});
});
}
},
},
'Valider'
'Valider'
);
);
...
@@ -637,7 +639,7 @@ function generate_inventory() {
...
@@ -637,7 +639,7 @@ function generate_inventory() {
* Event fct: on click on an order button
* Event fct: on click on an order button
*/
*/
function
order_pill_on_click
()
{
function
order_pill_on_click
()
{
if
(
is_time_to
(
'order_pill_on_click'
))
{
if
(
is_time_to
(
'order_pill_on_click'
,
1000
))
{
clicked_order_pill
=
$
(
this
);
clicked_order_pill
=
$
(
this
);
let
order_name_container
=
clicked_order_pill
.
find
(
'.pill_order_name'
);
let
order_name_container
=
clicked_order_pill
.
find
(
'.pill_order_name'
);
let
doc_id
=
$
(
order_name_container
).
text
();
let
doc_id
=
$
(
order_name_container
).
text
();
...
@@ -665,7 +667,9 @@ function order_pill_on_click() {
...
@@ -665,7 +667,9 @@ function order_pill_on_click() {
openModal
(
openModal
(
modal_order_access
.
html
(),
modal_order_access
.
html
(),
()
=>
{
()
=>
{
if
(
is_time_to
(
'validate_access_order'
))
{
goto_main_screen
(
doc
);
goto_main_screen
(
doc
);
}
},
},
'Valider'
'Valider'
);
);
...
@@ -810,6 +814,9 @@ function create_orders() {
...
@@ -810,6 +814,9 @@ function create_orders() {
}
}
}
}
console
.
log
(
orders_data
);
// TODO
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
"/orders/create_orders"
,
url
:
"/orders/create_orders"
,
...
@@ -978,7 +985,9 @@ function display_suppliers() {
...
@@ -978,7 +985,9 @@ function display_suppliers() {
openModal
(
openModal
(
modal_remove_supplier
.
html
(),
modal_remove_supplier
.
html
(),
()
=>
{
()
=>
{
if
(
is_time_to
(
'validate_remove_supplier'
))
{
remove_supplier
(
supplier_id
);
remove_supplier
(
supplier_id
);
}
},
},
'Valider'
'Valider'
);
);
...
@@ -1320,7 +1329,9 @@ function display_products(params) {
...
@@ -1320,7 +1329,9 @@ function display_products(params) {
openModal
(
openModal
(
modal_attach_product_to_supplier
.
html
(),
modal_attach_product_to_supplier
.
html
(),
()
=>
{
()
=>
{
if
(
is_time_to
(
'validate_save_supplier_product_association'
))
{
save_supplier_product_association
(
product
,
supplier
,
this
);
save_supplier_product_association
(
product
,
supplier
,
this
);
}
},
},
'Valider'
,
'Valider'
,
false
false
...
@@ -1407,7 +1418,9 @@ function display_products(params) {
...
@@ -1407,7 +1418,9 @@ function display_products(params) {
openModal
(
openModal
(
modal_product_npa
.
html
(),
modal_product_npa
.
html
(),
()
=>
{
()
=>
{
if
(
is_time_to
(
'validate_set_product_npa'
))
{
set_product_npa
(
p_id
,
npa
);
set_product_npa
(
p_id
,
npa
);
}
},
},
'Valider'
,
'Valider'
,
false
,
false
,
...
@@ -1624,7 +1637,7 @@ $(document).ready(function() {
...
@@ -1624,7 +1637,7 @@ $(document).ready(function() {
// Main screen
// Main screen
$
(
"#coverage_form"
).
on
(
"submit"
,
function
(
e
)
{
$
(
"#coverage_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
if
(
is_time_to
(
'submit_coverage_form'
))
{
if
(
is_time_to
(
'submit_coverage_form'
,
1000
))
{
let
val
=
$
(
"#coverage_days_input"
).
val
();
let
val
=
$
(
"#coverage_days_input"
).
val
();
val
=
parseInt
(
val
);
val
=
parseInt
(
val
);
...
@@ -1644,32 +1657,32 @@ $(document).ready(function() {
...
@@ -1644,32 +1657,32 @@ $(document).ready(function() {
$
(
"#supplier_form"
).
on
(
"submit"
,
function
(
e
)
{
$
(
"#supplier_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
if
(
is_time_to
(
'add_product'
))
{
if
(
is_time_to
(
'add_product'
,
1000
))
{
add_supplier
();
add_supplier
();
}
}
});
});
$
(
"#product_form"
).
on
(
"submit"
,
function
(
e
)
{
$
(
"#product_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
if
(
is_time_to
(
'add_product'
))
{
if
(
is_time_to
(
'add_product'
,
1000
))
{
add_product
();
add_product
();
}
}
});
});
$
(
"#do_inventory"
).
on
(
"click"
,
function
()
{
$
(
"#do_inventory"
).
on
(
"click"
,
function
()
{
if
(
is_time_to
(
'generate_inventory'
))
{
if
(
is_time_to
(
'generate_inventory'
,
1000
))
{
generate_inventory
();
generate_inventory
();
}
}
});
});
$
(
'#back_to_order_selection_from_main'
).
on
(
'click'
,
function
()
{
$
(
'#back_to_order_selection_from_main'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'back_to_order_selection_from_main'
))
{
if
(
is_time_to
(
'back_to_order_selection_from_main'
,
1000
))
{
back
();
back
();
}
}
});
});
$
(
'#create_orders'
).
on
(
'click'
,
function
()
{
$
(
'#create_orders'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'create_orders'
))
{
if
(
is_time_to
(
'create_orders'
,
1000
))
{
let
modal_create_order
=
$
(
'#templates #modal_create_order'
);
let
modal_create_order
=
$
(
'#templates #modal_create_order'
);
modal_create_order
.
find
(
'.suppliers_date_planned_area'
).
empty
();
modal_create_order
.
find
(
'.suppliers_date_planned_area'
).
empty
();
...
@@ -1686,7 +1699,9 @@ $(document).ready(function() {
...
@@ -1686,7 +1699,9 @@ $(document).ready(function() {
openModal
(
openModal
(
modal_create_order
.
html
(),
modal_create_order
.
html
(),
()
=>
{
()
=>
{
if
(
is_time_to
(
'validate_create_orders'
))
{
create_orders
();
create_orders
();
}
},
},
'Valider'
,
'Valider'
,
false
false
...
@@ -1756,7 +1771,7 @@ $(document).ready(function() {
...
@@ -1756,7 +1771,7 @@ $(document).ready(function() {
// Orders created screen
// Orders created screen
$
(
'#back_to_order_selection_from_orders_created'
).
on
(
'click'
,
function
()
{
$
(
'#back_to_order_selection_from_orders_created'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'back_to_order_selection_from_orders_created'
))
{
if
(
is_time_to
(
'back_to_order_selection_from_orders_created'
,
1000
))
{
switch_screen
(
'order_selection'
,
'orders_created'
);
switch_screen
(
'order_selection'
,
'orders_created'
);
}
}
});
});
...
...
templates/orders/helper.html
View file @
931e437c
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
<p
id=
"order_data_container"
>
<p
id=
"order_data_container"
>
Commande :
<span
class=
"order_name_container"
></span>
Commande :
<span
class=
"order_name_container"
></span>
<span
id=
"order_data_separator"
>
|
</span>
<span
id=
"order_data_separator"
>
|
</span>
Total :
<span
id=
"order_total_value"
>
0
</span>
€
Total
HT
:
<span
id=
"order_total_value"
>
0
</span>
€
</p>
</p>
</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