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
2ea80edf
Commit
2ea80edf
authored
Jul 02, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'aide_a_la_commande' into dev_cooperatic
parents
e609bddd
904551d7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
orders_helper.js
orders/static/js/orders_helper.js
+25
-4
No files found.
orders/static/js/orders_helper.js
View file @
2ea80edf
...
@@ -635,6 +635,7 @@ function generate_inventory() {
...
@@ -635,6 +635,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'
))
{
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
();
...
@@ -685,6 +686,8 @@ function order_pill_on_click() {
...
@@ -685,6 +686,8 @@ function order_pill_on_click() {
}
}
console
.
log
(
err
);
console
.
log
(
err
);
});
});
}
}
}
/**
/**
...
@@ -1494,6 +1497,9 @@ function update_main_screen(params) {
...
@@ -1494,6 +1497,9 @@ function update_main_screen(params) {
* Update DOM display on the order selection screen
* Update DOM display on the order selection screen
*/
*/
function
update_order_selection_screen
()
{
function
update_order_selection_screen
()
{
dbc
.
allDocs
({
include_docs
:
true
}).
then
(
function
(
result
)
{
// Remove listener before recreating them
// Remove listener before recreating them
$
(
".order_pill"
).
off
();
$
(
".order_pill"
).
off
();
...
@@ -1501,9 +1507,6 @@ function update_order_selection_screen() {
...
@@ -1501,9 +1507,6 @@ function update_order_selection_screen() {
existing_orders_container
.
empty
();
existing_orders_container
.
empty
();
$
(
'#new_order_name'
).
val
(
''
);
$
(
'#new_order_name'
).
val
(
''
);
dbc
.
allDocs
({
include_docs
:
true
}).
then
(
function
(
result
)
{
if
(
result
.
rows
.
length
===
0
)
{
if
(
result
.
rows
.
length
===
0
)
{
existing_orders_container
.
append
(
`<i>Aucune commande en cours...</i>`
);
existing_orders_container
.
append
(
`<i>Aucune commande en cours...</i>`
);
}
else
{
}
else
{
...
@@ -1576,7 +1579,8 @@ function init_pouchdb_sync() {
...
@@ -1576,7 +1579,8 @@ function init_pouchdb_sync() {
sync
=
PouchDB
.
sync
(
couchdb_dbname
,
couchdb_server
,
{
sync
=
PouchDB
.
sync
(
couchdb_dbname
,
couchdb_server
,
{
live
:
true
,
live
:
true
,
retry
:
true
,
retry
:
true
,
auto_compaction
:
true
auto_compaction
:
true
,
revs_limit
:
1
});
});
sync
.
on
(
'change'
,
function
(
info
)
{
sync
.
on
(
'change'
,
function
(
info
)
{
...
@@ -1620,6 +1624,7 @@ $(document).ready(function() {
...
@@ -1620,6 +1624,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'
))
{
let
val
=
$
(
"#coverage_days_input"
).
val
();
let
val
=
$
(
"#coverage_days_input"
).
val
();
val
=
parseInt
(
val
);
val
=
parseInt
(
val
);
...
@@ -1633,27 +1638,38 @@ $(document).ready(function() {
...
@@ -1633,27 +1638,38 @@ $(document).ready(function() {
$
(
"#coverage_days_input"
).
val
(
order_doc
.
coverage_days
);
$
(
"#coverage_days_input"
).
val
(
order_doc
.
coverage_days
);
alert
(
`Valeur non valide pour le nombre de jours de couverture !`
);
alert
(
`Valeur non valide pour le nombre de jours de couverture !`
);
}
}
}
});
});
$
(
"#supplier_form"
).
on
(
"submit"
,
function
(
e
)
{
$
(
"#supplier_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
if
(
is_time_to
(
'add_product'
))
{
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'
))
{
add_product
();
add_product
();
}
});
});
$
(
"#do_inventory"
).
on
(
"click"
,
function
()
{
$
(
"#do_inventory"
).
on
(
"click"
,
function
()
{
if
(
is_time_to
(
'generate_inventory'
))
{
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'
))
{
back
();
back
();
}
});
});
$
(
'#create_orders'
).
on
(
'click'
,
function
()
{
$
(
'#create_orders'
).
on
(
'click'
,
function
()
{
if
(
is_time_to
(
'create_orders'
))
{
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
();
...
@@ -1695,6 +1711,7 @@ $(document).ready(function() {
...
@@ -1695,6 +1711,7 @@ $(document).ready(function() {
$
(
this
).
val
(
''
);
$
(
this
).
val
(
''
);
}
}
});
});
}
return
0
;
return
0
;
});
});
...
@@ -1732,12 +1749,16 @@ $(document).ready(function() {
...
@@ -1732,12 +1749,16 @@ $(document).ready(function() {
$
(
"#new_order_form"
).
on
(
"submit"
,
function
(
e
)
{
$
(
"#new_order_form"
).
on
(
"submit"
,
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
if
(
is_time_to
(
'submit_new_order_form'
,
1000
))
{
create_cdb_order
();
create_cdb_order
();
}
});
});
// 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'
))
{
switch_screen
(
'order_selection'
,
'orders_created'
);
switch_screen
(
'order_selection'
,
'orders_created'
);
}
});
});
// Get suppliers
// Get suppliers
...
...
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