frontend working

This commit is contained in:
Qwann 2017-03-17 19:17:36 +01:00
parent d0938dfae7
commit fcc2ab8810
2 changed files with 8 additions and 4 deletions

View file

@ -646,7 +646,7 @@ $(document).ready(function() {
});
$after.after(article_html);
// Pour l'autocomplétion
articlesList.push([article['name'],article['id'],article['category_id'],article['price'], article['stock']]);
articlesList.push([article['name'],article['id'],article['category_id'],article['price'], article['stock'],article['category__has_addcost']]);
}
function getArticles() {
@ -830,8 +830,11 @@ $(document).ready(function() {
while (i<articlesList.length && id != articlesList[i][1]) i++;
article_data = articlesList[i];
var amount_euro = - article_data[3] * nb ;
if (settings['addcost_for'] && settings['addcost_amount'] && account_data['trigramme'] != settings['addcost_for'])
amount_euro -= settings['addcost_amount'] * nb;
if (settings['addcost_for']
&& settings['addcost_amount']
&& account_data['trigramme'] != settings['addcost_for']
&& article_data['5'])
amount_euro -= settings['addcost_amount'] * nb;
var reduc_divisor = 1;
if (account_data['is_cof'])
reduc_divisor = 1 + settings['subvention_cof'] / 100;

View file

@ -1393,7 +1393,8 @@ def history_json(request):
def kpsul_articles_data(request):
articles = (
Article.objects
.values('id', 'name', 'price', 'stock', 'category_id', 'category__name')
.values('id', 'name', 'price', 'stock', 'category_id',
'category__name', 'category__has_addcost')
.filter(is_sold=True))
return JsonResponse({ 'articles': list(articles) })