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
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 @
e6c44c7a
...
@@ -178,7 +178,7 @@ function compute_products_coverage_qties() {
...
@@ -178,7 +178,7 @@ function compute_products_coverage_qties() {
* Update order products data in case they have changed.
* Update order products data in case they have changed.
*/
*/
function
check_products_data
()
{
function
check_products_data
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
suppliers_id
=
selected_suppliers
.
map
(
s
=>
s
.
id
);
const
suppliers_id
=
selected_suppliers
.
map
(
s
=>
s
.
id
);
if
(
suppliers_id
.
length
>
0
)
{
if
(
suppliers_id
.
length
>
0
)
{
...
@@ -701,13 +701,19 @@ function update_cdb_order() {
...
@@ -701,13 +701,19 @@ function update_cdb_order() {
fingerprint
:
fingerprint
fingerprint
:
fingerprint
};
};
dbc
.
put
(
order_doc
,
function
callback
(
err
,
result
)
{
return
new
Promise
((
resolve
)
=>
{
if
(
!
err
&&
result
!==
undefined
)
{
dbc
.
put
(
order_doc
,
function
callback
(
err
,
result
)
{
order_doc
.
_rev
=
result
.
rev
;
if
(
!
err
&&
result
!==
undefined
)
{
}
else
{
order_doc
.
_rev
=
result
.
rev
;
alert
(
"Erreur lors de la sauvegarde de la commande... Si l'erreur persiste contactez un administrateur svp."
);
console
.
log
(
err
);
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() {
...
@@ -814,10 +820,10 @@ function create_orders() {
// Clear data
// Clear data
order_doc
.
_deleted
=
true
;
order_doc
.
_deleted
=
true
;
update_cdb_order
();
update_cdb_order
().
then
(()
=>
{
update_order_selection_screen
();
})
reset_data
();
reset_data
();
update_order_selection_screen
();
switch_screen
(
'orders_created'
);
switch_screen
(
'orders_created'
);
closeModal
();
closeModal
();
},
},
...
@@ -1457,7 +1463,6 @@ function update_order_selection_screen() {
...
@@ -1457,7 +1463,6 @@ function update_order_selection_screen() {
}
else
{
}
else
{
for
(
let
row
of
result
.
rows
)
{
for
(
let
row
of
result
.
rows
)
{
let
template
=
$
(
"#templates #order_pill_template"
);
let
template
=
$
(
"#templates #order_pill_template"
);
template
.
find
(
".pill_order_name"
).
text
(
row
.
id
);
template
.
find
(
".pill_order_name"
).
text
(
row
.
id
);
existing_orders_container
.
append
(
template
.
html
());
existing_orders_container
.
append
(
template
.
html
());
...
@@ -1517,13 +1522,10 @@ function switch_screen(direction = 'main_screen', from = 'main_screen') {
...
@@ -1517,13 +1522,10 @@ function switch_screen(direction = 'main_screen', from = 'main_screen') {
}
}
$
(
document
).
ready
(
function
()
{
/**
fingerprint
=
new
Fingerprint
({
canvas
:
true
}).
get
();
* Init the PouchDB local database & sync
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
*/
function
init_pouchdb_sync
()
{
openModal
();
// Init CouchDB
dbc
=
new
PouchDB
(
couchdb_dbname
);
dbc
=
new
PouchDB
(
couchdb_dbname
);
sync
=
PouchDB
.
sync
(
couchdb_dbname
,
couchdb_server
,
{
sync
=
PouchDB
.
sync
(
couchdb_dbname
,
couchdb_server
,
{
live
:
true
,
live
:
true
,
...
@@ -1543,13 +1545,12 @@ $(document).ready(function() {
...
@@ -1543,13 +1545,12 @@ $(document).ready(function() {
className
:
"error"
className
:
"error"
}
}
);
);
update_order_selection_screen
();
back
();
back
();
break
;
break
;
}
else
if
(
doc
.
_deleted
===
true
)
{
update_order_selection_screen
();
}
}
}
}
update_order_selection_screen
();
}
}
}).
on
(
'error'
,
function
(
err
)
{
}).
on
(
'error'
,
function
(
err
)
{
if
(
err
.
status
===
409
)
{
if
(
err
.
status
===
409
)
{
...
@@ -1559,6 +1560,16 @@ $(document).ready(function() {
...
@@ -1559,6 +1560,16 @@ $(document).ready(function() {
console
.
log
(
'erreur sync'
);
console
.
log
(
'erreur sync'
);
console
.
log
(
err
);
console
.
log
(
err
);
});
});
}
$
(
document
).
ready
(
function
()
{
fingerprint
=
new
Fingerprint
({
canvas
:
true
}).
get
();
$
.
ajaxSetup
({
headers
:
{
"X-CSRFToken"
:
getCookie
(
'csrftoken'
)
}
});
openModal
();
init_pouchdb_sync
();
// Main screen
// Main screen
$
(
"#coverage_form"
).
on
(
"submit"
,
function
(
e
)
{
$
(
"#coverage_form"
).
on
(
"submit"
,
function
(
e
)
{
...
...
templates/orders/helper.html
View file @
e6c44c7a
...
@@ -206,7 +206,6 @@
...
@@ -206,7 +206,6 @@
<div
id=
"modal_create_order"
>
<div
id=
"modal_create_order"
>
<h3>
Dernière étape...
</h3>
<h3>
Dernière étape...
</h3>
<br/>
<br/>
<p>
<p>
Vous vous apprêtez à générer les commandes à partir des données rentrées dans le tableau.
Vous vous apprêtez à générer les commandes à partir des données rentrées dans le tableau.
</p>
</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