Finish adapting ArticleManager and Autocomplete
This commit is contained in:
parent
91f14deda1
commit
9ab2a11432
1 changed files with 8 additions and 7 deletions
|
@ -373,11 +373,11 @@ class ArticleManager {
|
||||||
constructor(env) {
|
constructor(env) {
|
||||||
this._env = env; // Global K-Psul Manager
|
this._env = env; // Global K-Psul Manager
|
||||||
|
|
||||||
this._$container = $('#articles_data tbody');
|
this._$container = $('#articles_data');
|
||||||
this._$input = $('#article_autocomplete');
|
this._$input = $('#article_autocomplete');
|
||||||
this._$nb = $('#article_number');
|
this._$nb = $('#article_number');
|
||||||
this.templates = {'category': '<tr class="category"><td class="name" colspan="3"></td></tr>',
|
this.templates = {'category': '<div class="category"><span class="name"></span></div>',
|
||||||
'article' : '<tr class="article"><td class="name"></td><td class="price"></td><td class="stock"></td></tr>'}
|
'article' : '<div class="article"><span class="name"></span><span class="price"></span><span class="stock"></span></div>'}
|
||||||
|
|
||||||
this.selected = new Article() ;
|
this.selected = new Article() ;
|
||||||
this.list = new ArticleList() ;
|
this.list = new ArticleList() ;
|
||||||
|
@ -410,7 +410,7 @@ class ArticleManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_data() {
|
reset_data() {
|
||||||
this._$container.find('tr').remove();
|
this._$container.html('');
|
||||||
this.list.clear();
|
this.list.clear();
|
||||||
this.list.fromAPI({}, this.display_list.bind(this), $.noop) ;
|
this.list.fromAPI({}, this.display_list.bind(this), $.noop) ;
|
||||||
}
|
}
|
||||||
|
@ -450,10 +450,11 @@ class ArticleManager {
|
||||||
});
|
});
|
||||||
|
|
||||||
this._$container.on('click', '.article', function() {
|
this._$container.on('click', '.article', function() {
|
||||||
var id = $(this).attr('data-article-id') ;
|
var id = $(this).parent().attr('id').split('-')[1];
|
||||||
var article = that.list.find(Article, { 'id': intCheck(id) });
|
console.log(id);
|
||||||
|
var article = that.list.find('article', id);
|
||||||
if (article)
|
if (article)
|
||||||
that.validate(article);
|
that.validate(article.content);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._$nb.on('keydown', function(e) {
|
this._$nb.on('keydown', function(e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue