forked from DGNum/gestioCOF
Clean JS ajout article et ordre des articles
This commit is contained in:
parent
e154316eae
commit
1f61f79606
1 changed files with 4 additions and 6 deletions
|
@ -526,16 +526,14 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
if (!added) articles_container.append(category_html);
|
if (!added) articles_container.append(category_html);
|
||||||
}
|
}
|
||||||
var added = false;
|
var $after = articles_container.find('#data-category-'+article['category_id']);
|
||||||
articles_container
|
articles_container
|
||||||
.find('.article.data-category-'+article['category_id']).each(function() {
|
.find('.article.data-category-'+article['category_id']).each(function() {
|
||||||
if (article['name'].toLowerCase < $('.name', this).text().toLowerCase()) {
|
if (article['name'].toLowerCase < $('.name', this).text().toLowerCase())
|
||||||
$(this).before(article_html);
|
|
||||||
added = true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
$after = $(this);
|
||||||
});
|
});
|
||||||
if (!added) articles_container.find('#data-category-'+article['category_id']).after(article_html);
|
$after.after(article_html);
|
||||||
// Pour l'autocomplétion
|
// Pour l'autocomplétion
|
||||||
articlesList.push([article['name'],article['id'],article['category_id'],article['price']]);
|
articlesList.push([article['name'],article['id'],article['category_id'],article['price']]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue