forked from DGNum/gestioCOF
Add websocket support to ArticleManager
This commit is contained in:
parent
565a054323
commit
fc3e86aea6
2 changed files with 6 additions and 7 deletions
|
@ -415,9 +415,10 @@ class ArticleManager {
|
||||||
this.list.fromAPI({}, this.display_list.bind(this), $.noop) ;
|
this.list.fromAPI({}, this.display_list.bind(this), $.noop) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: filter articles before ?
|
||||||
update_data(data) {
|
update_data(data) {
|
||||||
for (let article_dict of data) {
|
for (let article_dict of data.articles) {
|
||||||
article = this.list.find('article', article_dict['id']);
|
var article = this.list.find('article', article_dict['id']);
|
||||||
|
|
||||||
// For now, article additions are disregarded
|
// For now, article additions are disregarded
|
||||||
if (article) {
|
if (article) {
|
||||||
|
|
|
@ -799,11 +799,9 @@ $(document).ready(function() {
|
||||||
displayCheckoutData();
|
displayCheckoutData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var i=0; i<data['articles'].length; i++) {
|
|
||||||
var article = data['articles'][i];
|
kpsul.article_manager.update_data(data);
|
||||||
articles_container.find('#data-article-'+article['id']+' .stock')
|
|
||||||
.text(article['stock']);
|
|
||||||
}
|
|
||||||
if (data['addcost']) {
|
if (data['addcost']) {
|
||||||
Config.set('addcost_for', data['addcost']['for']);
|
Config.set('addcost_for', data['addcost']['for']);
|
||||||
Config.set('addcost_amount', data['addcost']['amount']);
|
Config.set('addcost_amount', data['addcost']['amount']);
|
||||||
|
|
Loading…
Reference in a new issue