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
261
Issues
261
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
Paul
third-party
Commits
1e31fc73
Commit
1e31fc73
authored
Jul 01, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pouchdb actions continuity
parent
2fa5307f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
23 deletions
+33
-23
orders_helper.js
orders/static/js/orders_helper.js
+33
-22
helper.html
templates/orders/helper.html
+0
-1
No files found.
orders/static/js/orders_helper.js
View file @
1e31fc73
...
...
@@ -179,7 +179,7 @@ function compute_products_coverage_qties() {
* Update order products data in case they have changed.
*/
function
check_products_data
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
suppliers_id
=
selected_suppliers
.
map
(
s
=>
s
.
id
);
if
(
suppliers_id
.
length
>
0
)
{
...
...
@@ -702,13 +702,19 @@ function update_cdb_order() {
fingerprint
:
fingerprint
};
dbc
.
put
(
order_doc
,
function
callback
(
err
,
result
)
{
if
(
!
err
&&
result
!==
undefined
)
{
order_doc
.
_rev
=
result
.
rev
;
}
else
{
alert
(
"Erreur lors de la sauvegarde de la commande... Si l'erreur persiste contactez un administrateur svp."
);
console
.
log
(
err
);
}
return
new
Promise
((
resolve
)
=>
{
dbc
.
put
(
order_doc
,
function
callback
(
err
,
result
)
{
if
(
!
err
&&
result
!==
undefined
)
{
order_doc
.
_rev
=
result
.
rev
;
resolve
();
}
else
{
alert
(
"Erreur lors de la sauvegarde de la commande... Si l'erreur persiste contactez un administrateur svp."
);
console
.
log
(
err
);
resolve
();
}
});
});
}
...
...
@@ -815,10 +821,10 @@ function create_orders() {
// Clear data
order_doc
.
_deleted
=
true
;
update_cdb_order
();
update_cdb_order
().
then
(()
=>
{
update_order_selection_screen
();
})
reset_data
();
update_order_selection_screen
();
switch_screen
(
'orders_created'
);
closeModal
();
},
...
...
@@ -1458,7 +1464,6 @@ function update_order_selection_screen() {
}
else
{
for
(
let
row
of
result
.
rows
)
{
let
template
=
$
(
"#templates #order_pill_template"
);
template
.
find
(
".pill_order_name"
).
text
(
row
.
id
);
existing_orders_container
.
append
(
template
.
html
());
...
...
@@ -1518,13 +1523,10 @@ function switch_screen(direction = 'main_screen', from = 'main_screen') {
}
$
(
document
).
ready
(
function
()
{
fingerprint
=
new
Fingerprint
({
canvas
:
true
}).
get
();
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
openModal
();
// Init CouchDB
/**
* Init the PouchDB local database & sync
*/
function
init_pouchdb_sync
()
{
dbc
=
new
PouchDB
(
couchdb_dbname
);
sync
=
PouchDB
.
sync
(
couchdb_dbname
,
couchdb_server
,
{
live
:
true
,
...
...
@@ -1544,13 +1546,12 @@ $(document).ready(function() {
className
:
"error"
}
);
update_order_selection_screen
();
back
();
break
;
}
else
if
(
doc
.
_deleted
===
true
)
{
update_order_selection_screen
();
}
}
update_order_selection_screen
();
}
}).
on
(
'error'
,
function
(
err
)
{
if
(
err
.
status
===
409
)
{
...
...
@@ -1560,6 +1561,16 @@ $(document).ready(function() {
console
.
log
(
'erreur sync'
);
console
.
log
(
err
);
});
}
$
(
document
).
ready
(
function
()
{
fingerprint
=
new
Fingerprint
({
canvas
:
true
}).
get
();
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
openModal
();
init_pouchdb_sync
();
// Main screen
$
(
"#coverage_form"
).
on
(
"submit"
,
function
(
e
)
{
...
...
templates/orders/helper.html
View file @
1e31fc73
...
...
@@ -206,7 +206,6 @@
<div
id=
"modal_create_order"
>
<h3>
Dernière étape...
</h3>
<br/>
<p>
Vous vous apprêtez à générer les commandes à partir des données rentrées dans le tableau.
</p>
...
...
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