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
e6c44c7a
Commit
e6c44c7a
authored
Jul 01, 2021
by
Damien Moulard
Committed by
Alexis Aoun
Jul 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pouchdb actions continuity
parent
9f638578
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
16 deletions
+26
-16
orders_helper.js
orders/static/js/orders_helper.js
+26
-15
helper.html
templates/orders/helper.html
+0
-1
No files found.
orders/static/js/orders_helper.js
View file @
e6c44c7a
...
...
@@ -178,7 +178,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
)
{
...
...
@@ -701,14 +701,20 @@ function update_cdb_order() {
fingerprint
:
fingerprint
};
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
();
}
});
});
}
/**
...
...
@@ -814,10 +820,10 @@ function create_orders() {
// Clear data
order_doc
.
_deleted
=
true
;
update_cdb_order
();
reset_data
();
update_cdb_order
().
then
(()
=>
{
update_order_selection_screen
();
})
reset_data
();
switch_screen
(
'orders_created'
);
closeModal
();
},
...
...
@@ -1457,7 +1463,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
());
...
...
@@ -1517,13 +1522,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
,
...
...
@@ -1543,13 +1545,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
)
{
...
...
@@ -1559,6 +1560,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 @
e6c44c7a
...
...
@@ -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