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
2
Merge Requests
2
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
cooperatic-foodcoops
third-party
Commits
1f07d3a4
Commit
1f07d3a4
authored
Jul 21, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix error creating an order after an order is finished
parent
4b9e24a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
27 deletions
+33
-27
orders_helper.js
orders/static/js/orders_helper.js
+33
-27
No files found.
orders/static/js/orders_helper.js
View file @
1f07d3a4
...
@@ -868,11 +868,12 @@ function create_orders() {
...
@@ -868,11 +868,12 @@ function create_orders() {
// Clear data
// Clear data
order_doc
.
_deleted
=
true
;
order_doc
.
_deleted
=
true
;
update_cdb_order
().
then
(()
=>
{
update_cdb_order
().
then
(()
=>
{
update_order_selection_screen
();
update_order_selection_screen
().
then
(()
=>
{
reset_data
();
switch_screen
(
'orders_created'
);
closeModal
();
});
});
});
reset_data
();
switch_screen
(
'orders_created'
);
closeModal
();
},
},
error
:
function
(
data
)
{
error
:
function
(
data
)
{
let
msg
=
"erreur serveur lors de la création des product orders"
;
let
msg
=
"erreur serveur lors de la création des product orders"
;
...
@@ -1548,35 +1549,40 @@ function update_main_screen(params) {
...
@@ -1548,35 +1549,40 @@ 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
({
return
new
Promise
((
resolve
)
=>
{
include_docs
:
true
dbc
.
allDocs
({
}).
then
(
function
(
result
)
{
include_docs
:
true
// Remove listener before recreating them
})
$
(
".order_pill"
).
off
();
.
then
(
function
(
result
)
{
// Remove listener before recreating them
let
existing_orders_container
=
$
(
"#existing_orders"
);
$
(
".order_pill"
).
off
();
existing_orders_container
.
empty
();
let
existing_orders_container
=
$
(
"#existing_orders"
);
$
(
'#new_order_name'
).
val
(
''
);
existing_orders_container
.
empty
();
if
(
result
.
rows
.
length
===
0
)
{
$
(
'#new_order_name'
).
val
(
''
);
existing_orders_container
.
append
(
`<i>Aucune commande en cours...</i>`
);
}
else
{
if
(
result
.
rows
.
length
===
0
)
{
for
(
let
row
of
result
.
rows
)
{
existing_orders_container
.
append
(
`<i>Aucune commande en cours...</i>`
);
let
template
=
$
(
"#templates #order_pill_template"
);
}
else
{
for
(
let
row
of
result
.
rows
)
{
template
.
find
(
".pill_order_name"
).
text
(
row
.
id
);
let
template
=
$
(
"#templates #order_pill_template"
);
existing_orders_container
.
append
(
template
.
html
());
template
.
find
(
".pill_order_name"
).
text
(
row
.
id
);
existing_orders_container
.
append
(
template
.
html
());
}
$
(
".order_pill"
).
on
(
"click"
,
order_pill_on_click
);
}
}
$
(
".order_pill"
).
on
(
"click"
,
order_pill_on_click
);
resolve
();
}
})
})
.
catch
(
function
(
err
)
{
.
catch
(
function
(
err
)
{
alert
(
'Erreur lors de la synchronisation des commandes. Vous pouvez créer une nouvelle commande.'
);
alert
(
'Erreur lors de la synchronisation des commandes. Vous pouvez créer une nouvelle commande.'
);
console
.
log
(
err
);
console
.
log
(
err
);
});
});
});
}
}
/**
/**
...
...
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