forked from DGNum/gestioCOF
Merge branch 'qwann/k-fet/home' of git.eleves.ens.fr:cof-geek/gestioCOF into qwann/k-fet/home
This commit is contained in:
commit
b0b2210e93
15 changed files with 511 additions and 557 deletions
|
@ -14,14 +14,12 @@
|
|||
<script type="text/javascript" src="{% static 'kfet/js/Chart.bundle.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'kfet/js/statistic.js' %}"></script>
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var stat_last = $("#stat_last");
|
||||
var stat_balance = $("#stat_balance");
|
||||
var stat_last_url = "{% url 'kfet.account.stat.last' trigramme=account.trigramme %}";
|
||||
var stat_balance_url = "{% url 'kfet.account.stat.balance' trigramme=account.trigramme %}";
|
||||
STAT.get_thing(stat_last_url, stat_last, "Stat non trouvées :(");
|
||||
STAT.get_thing(stat_balance_url, stat_balance, "Stat non trouvées :(");
|
||||
});
|
||||
jQuery(document).ready(function() {
|
||||
var stat_last = new StatsGroup("{% url 'kfet.account.stat.last' trigramme=account.trigramme %}",
|
||||
$("#stat_last"));
|
||||
var stat_balance = new StatsGroup("{% url 'kfet.account.stat.balance' trigramme=account.trigramme %}",
|
||||
$("#stat_balance"));
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
<!doctype html>
|
||||
{% load dictionary_extras %}
|
||||
|
||||
<body>
|
||||
<canvas id="{{ chart_id }}" height="100"></canvas>
|
||||
{% comment %}
|
||||
<ul>
|
||||
{% for change in changes %}
|
||||
<li>
|
||||
{{ change | get_item:'label'}}
|
||||
| {{ change | get_item:'at'}}
|
||||
| ({{ change | get_item:'amount'}})
|
||||
| balance {{ change | get_item:'balance'}}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endcomment %}
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var ctx1 = $({{ chart_id }});
|
||||
var myChart = new Chart(ctx1, {
|
||||
type: 'line',
|
||||
data: {
|
||||
datasets: [{
|
||||
label: 'Balance',
|
||||
borderColor: 'rgb(255, 99, 132)',
|
||||
backgroundColor: 'rgba(255, 99, 132, 0.5)',
|
||||
data: [
|
||||
{% for change in changes %}
|
||||
{
|
||||
x: new Date("{{ change | get_item:'at'}}"),
|
||||
y: {{ change | get_item:'balance'| stringformat:"f" }},
|
||||
label: "{{change|get_item:'label'}}"
|
||||
}{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
fill: true,
|
||||
steppedLine: true,
|
||||
lineTension: 0,
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
},
|
||||
hover: {
|
||||
mode: 'nearest',
|
||||
intersect: false,
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
type: "time",
|
||||
display: true,
|
||||
scaleLabel: {
|
||||
display: false,
|
||||
labelString: 'Date'
|
||||
},
|
||||
time: {
|
||||
tooltipFormat: 'll HH:mm',
|
||||
min: new Date("{{ min_date }}"),
|
||||
max: new Date("{{ max_date }}"),
|
||||
displayFormats: {
|
||||
'millisecond': 'SSS [ms]',
|
||||
'second': 'mm:ss a',
|
||||
'minute': 'DD MMM',
|
||||
'hour': 'ddd h[h]',
|
||||
'day': 'DD MMM',
|
||||
'week': 'DD MMM',
|
||||
'month': 'MMM',
|
||||
'quarter': 'MMM',
|
||||
'year': 'YYYY',
|
||||
}
|
||||
}
|
||||
|
||||
}],
|
||||
yAxes: [{
|
||||
display: true,
|
||||
scaleLabel: {
|
||||
display: false,
|
||||
labelString: 'value'
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
|
@ -1,52 +0,0 @@
|
|||
<!doctype html>
|
||||
|
||||
<body>
|
||||
<canvas id="{{ chart_id }}" height="100" ></canvas>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var ctx1 = $({{ chart_id }});
|
||||
var myChart = new Chart(ctx1, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [
|
||||
{% for k,label in labels.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ label }}"
|
||||
{% else %}
|
||||
"{{ label }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
datasets: [{
|
||||
label: 'Nb items achetés',
|
||||
borderColor: 'rgb(255, 99, 132)',
|
||||
backgroundColor: 'rgb(255, 99, 132)',
|
||||
data: [
|
||||
{% for k,nb in nb_ventes.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ nb }}"
|
||||
{% else %}
|
||||
"{{ nb }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
fill: false,
|
||||
lineTension: 0,
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
},
|
||||
hover: {
|
||||
mode: 'nearest',
|
||||
intersect: false,
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
|
@ -1,82 +0,0 @@
|
|||
<!doctype html>
|
||||
|
||||
<body>
|
||||
<canvas id="{{ chart_id }}" height="100" ></canvas>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var ctx1 = $({{ chart_id }});
|
||||
var myChart = new Chart(ctx1, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [
|
||||
{% for k,label in labels.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ label }}"
|
||||
{% else %}
|
||||
"{{ label }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
datasets: [{
|
||||
label: 'Toutes consommations',
|
||||
borderColor: 'rgb(255, 99, 132)',
|
||||
backgroundColor: 'rgb(255, 99, 132)',
|
||||
data: [
|
||||
{% for k,nb in nb_ventes.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ nb }}"
|
||||
{% else %}
|
||||
"{{ nb }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
fill: false,
|
||||
lineTension: 0,
|
||||
} , {
|
||||
label: 'LIQ',
|
||||
borderColor: 'rgb(54, 162, 235)',
|
||||
backgroundColor: 'rgb(54, 162, 235)',
|
||||
data: [
|
||||
{% for k,nb in nb_liq.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ nb }}"
|
||||
{% else %}
|
||||
"{{ nb }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
fill: false,
|
||||
lineTension: 0,
|
||||
} , {
|
||||
label: 'Comptes K-Fêt',
|
||||
borderColor: 'rgb(255, 205, 86)',
|
||||
backgroundColor: 'rgb(255, 205, 86)',
|
||||
data: [
|
||||
{% for k,nb in nb_accounts.items %}
|
||||
{% if forloop.last %}
|
||||
"{{ nb }}"
|
||||
{% else %}
|
||||
"{{ nb }}",
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
fill: false,
|
||||
lineTension: 0,
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
},
|
||||
hover: {
|
||||
mode: 'nearest',
|
||||
intersect: false,
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
|
@ -123,6 +123,7 @@
|
|||
<div id="article_selection">
|
||||
<input type="text" id="article_autocomplete" autocomplete="off">
|
||||
<input type="number" id="article_number" step="1" min="1">
|
||||
<span type="stock" id="article_stock"></span>
|
||||
<input type="hidden" id="article_id" value="">
|
||||
</div>
|
||||
<div id="articles_data">
|
||||
|
@ -221,7 +222,7 @@ $(document).ready(function() {
|
|||
function displayAccountData() {
|
||||
var balance = account_data['trigramme'] != 'LIQ' ? account_data['balance'] : '';
|
||||
if (balance != '')
|
||||
balance = amountToUKF(account_data['balance'], account_data['is_cof']);
|
||||
balance = amountToUKF(account_data['balance'], account_data['is_cof'], true);
|
||||
var is_cof = account_data['trigramme'] ? account_data['is_cof'] : '';
|
||||
if (is_cof !== '')
|
||||
is_cof = is_cof ? '<b>COF</b>' : '<b>Non-COF</b>';
|
||||
|
@ -616,7 +617,10 @@ $(document).ready(function() {
|
|||
for (var elem in article) {
|
||||
article_html.find('.'+elem).text(article[elem])
|
||||
}
|
||||
article_html.find('.price').text(amountToUKF(article['price'], false));
|
||||
if (-5 <= article['stock'] && article['stock'] <= 5) {
|
||||
article_html.addClass('low-stock');
|
||||
}
|
||||
article_html.find('.price').text(amountToUKF(article['price'], false, false)+' UKF');
|
||||
var category_html = articles_container
|
||||
.find('#data-category-'+article['category_id']);
|
||||
if (category_html.length == 0) {
|
||||
|
@ -642,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']]);
|
||||
articlesList.push([article['name'],article['id'],article['category_id'],article['price'], article['stock']]);
|
||||
}
|
||||
|
||||
function getArticles() {
|
||||
|
@ -670,8 +674,9 @@ $(document).ready(function() {
|
|||
var articleSelect = $('#article_autocomplete');
|
||||
var articleId = $('#article_id');
|
||||
var articleNb = $('#article_number');
|
||||
// 8:Backspace|9:Tab|13:Enter|46:DEL|112-117:F1-6|119-123:F8-F12
|
||||
var normalKeys = /^(8|9|13|46|112|113|114|115|116|117|119|120|121|122|123)$/;
|
||||
var articleStock = $('#article_stock');
|
||||
// 8:Backspace|9:Tab|13:Enter|38-40:Arrows|46:DEL|112-117:F1-6|119-123:F8-F12
|
||||
var normalKeys = /^(8|9|13|37|38|39|40|46|112|113|114|115|116|117|119|120|121|122|123)$/;
|
||||
var articlesList = [];
|
||||
|
||||
function deleteNonMatching(array, str) {
|
||||
|
@ -727,6 +732,7 @@ $(document).ready(function() {
|
|||
if (commit) {
|
||||
articleId.val(articlesMatch[0][1]);
|
||||
articleSelect.val(articlesMatch[0][0]);
|
||||
articleStock.text('/'+articlesMatch[0][4]);
|
||||
displayMatchedArticles(articlesList);
|
||||
return true;
|
||||
}
|
||||
|
@ -773,10 +779,15 @@ $(document).ready(function() {
|
|||
return $article.find('.name').text();
|
||||
}
|
||||
|
||||
function getArticleStock($article) {
|
||||
return $article.find('.stock').text();
|
||||
}
|
||||
|
||||
// Sélection des articles à la souris/tactile
|
||||
articles_container.on('click', '.article', function() {
|
||||
articleId.val(getArticleId($(this)));
|
||||
articleSelect.val(getArticleName($(this)));
|
||||
articleStock.text('/'+getArticleStock($(this)));
|
||||
displayMatchedArticles(articlesList);
|
||||
goToArticleNb();
|
||||
});
|
||||
|
@ -790,6 +801,7 @@ $(document).ready(function() {
|
|||
addPurchase(articleId.val(), articleNb.val());
|
||||
articleSelect.val('');
|
||||
articleNb.val('');
|
||||
articleStock.text('');
|
||||
articleSelect.focus();
|
||||
displayMatchedArticles(articlesList);
|
||||
return false;
|
||||
|
@ -809,7 +821,7 @@ $(document).ready(function() {
|
|||
// Basket
|
||||
// -----
|
||||
|
||||
var item_basket_default_html = '<tr><td class="amount"></td><td class="number"></td><td class="name"></td></tr>';
|
||||
var item_basket_default_html = '<tr><td class="amount"></td><td class="number"></td><td ><span class="lowstock glyphicon glyphicon-alert"></span></td><td class="name"></td></tr>';
|
||||
var basket_container = $('#basket table');
|
||||
var arrowKeys = /^(37|38|39|40)$/;
|
||||
|
||||
|
@ -827,16 +839,39 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
function addPurchase(id, nb) {
|
||||
var amount_euro = amountEuroPurchase(id, nb).toFixed(2);
|
||||
var index = addPurchaseToFormset(article_data[1], nb, amount_euro);
|
||||
article_basket_html = $(item_basket_default_html);
|
||||
article_basket_html
|
||||
.attr('data-opeindex', index)
|
||||
.find('.number').text(nb).end()
|
||||
.find('.name').text(article_data[0]).end()
|
||||
.find('.amount').text(amountToUKF(amount_euro, account_data['is_cof']));
|
||||
basket_container.prepend(article_basket_html);
|
||||
updateBasketRel();
|
||||
var existing = false;
|
||||
formset_container.find('[data-opeindex]').each(function () {
|
||||
var opeindex = $(this).attr('data-opeindex');
|
||||
var article_id = $(this).find('#id_form-'+opeindex+'-article').val();
|
||||
if (article_id == id) {
|
||||
existing = true ;
|
||||
addExistingPurchase(opeindex, nb);
|
||||
}
|
||||
});
|
||||
if (!existing) {
|
||||
var amount_euro = amountEuroPurchase(id, nb).toFixed(2);
|
||||
var index = addPurchaseToFormset(article_data[1], nb, amount_euro);
|
||||
article_basket_html = $(item_basket_default_html);
|
||||
article_basket_html
|
||||
.attr('data-opeindex', index)
|
||||
.find('.number').text('('+nb+'/'+article_data[4]+')').end()
|
||||
.find('.name').text(article_data[0]).end()
|
||||
.find('.amount').text(amountToUKF(amount_euro, account_data['is_cof']), false);
|
||||
basket_container.prepend(article_basket_html);
|
||||
if (is_low_stock(id, nb))
|
||||
article_basket_html.find('.lowstock')
|
||||
.show();
|
||||
updateBasketRel();
|
||||
}
|
||||
}
|
||||
|
||||
function is_low_stock(id, nb) {
|
||||
var i = 0 ;
|
||||
while (i<articlesList.length && id != articlesList[i][1]) i++;
|
||||
article_data = articlesList[i];
|
||||
|
||||
stock = article_data[4] ;
|
||||
return (-5 <= stock - nb && stock - nb <= 5);
|
||||
}
|
||||
|
||||
function addDeposit(amount, is_checkout=1) {
|
||||
|
@ -848,7 +883,7 @@ $(document).ready(function() {
|
|||
.attr('data-opeindex', index)
|
||||
.find('.number').text(amount+"€").end()
|
||||
.find('.name').text(text).end()
|
||||
.find('.amount').text(amountToUKF(amount, account_data['is_cof']));
|
||||
.find('.amount').text(amountToUKF(amount, account_data['is_cof'], false));
|
||||
basket_container.prepend(deposit_basket_html);
|
||||
updateBasketRel();
|
||||
}
|
||||
|
@ -861,7 +896,7 @@ $(document).ready(function() {
|
|||
.attr('data-opeindex', index)
|
||||
.find('.number').text(amount+"€").end()
|
||||
.find('.name').text('Retrait').end()
|
||||
.find('.amount').text(amountToUKF(amount, account_data['is_cof']));
|
||||
.find('.amount').text(amountToUKF(amount, account_data['is_cof'], false));
|
||||
basket_container.prepend(withdraw_basket_html);
|
||||
updateBasketRel();
|
||||
}
|
||||
|
@ -871,11 +906,25 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$(document).on('keydown', function (e) {
|
||||
if (e.keyCode == 46) {
|
||||
// DEL (Suppr)
|
||||
basket_container.find('.ui-selected').each(function () {
|
||||
deleteFromBasket($(this).data('opeindex'));
|
||||
});
|
||||
switch(e.which) {
|
||||
case 46:
|
||||
// DEL (Suppr)
|
||||
basket_container.find('.ui-selected').each(function () {
|
||||
deleteFromBasket($(this).data('opeindex'));
|
||||
});
|
||||
break;
|
||||
case 38:
|
||||
// Arrow up
|
||||
basket_container.find('.ui-selected').each(function () {
|
||||
addExistingPurchase($(this).data('opeindex'), 1);
|
||||
});
|
||||
break;
|
||||
case 40:
|
||||
// Arrow down
|
||||
basket_container.find('.ui-selected').each(function () {
|
||||
addExistingPurchase($(this).data('opeindex'), -1);
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -903,7 +952,7 @@ $(document).ready(function() {
|
|||
var amount = $(this).find('#id_form-'+opeindex+'-amount');
|
||||
if (!deleted && type == "purchase")
|
||||
amount.val(amountEuroPurchase(article_id, article_nb));
|
||||
basket_container.find('[data-opeindex='+opeindex+'] .amount').text(amountToUKF(amount.val(), account_data['is_cof']));
|
||||
basket_container.find('[data-opeindex='+opeindex+'] .amount').text(amountToUKF(amount.val(), account_data['is_cof'], false));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -922,9 +971,9 @@ $(document).ready(function() {
|
|||
basketrel_html += '<div>Sur 20€: '+ (20-amount).toFixed(2) +' €</div>';
|
||||
} else if (account_data['trigramme'] != '' && !isBasketEmpty()) {
|
||||
var amount = getAmountBasket();
|
||||
var amountUKF = amountToUKF(amount, account_data['is_cof']);
|
||||
var amountUKF = amountToUKF(amount, account_data['is_cof'], false);
|
||||
var newBalance = account_data['balance'] + amount;
|
||||
var newBalanceUKF = amountToUKF(newBalance, account_data['is_cof']);
|
||||
var newBalanceUKF = amountToUKF(newBalance, account_data['is_cof'], true);
|
||||
basketrel_html += '<div>Total: '+amountUKF+'</div>';
|
||||
basketrel_html += '<div>Nouveau solde: '+newBalanceUKF+'</div>';
|
||||
if (newBalance < 0)
|
||||
|
@ -939,6 +988,46 @@ $(document).ready(function() {
|
|||
updateBasketRel();
|
||||
}
|
||||
|
||||
function addExistingPurchase(opeindex, nb) {
|
||||
var type = formset_container.find("#id_form-"+opeindex+"-type").val();
|
||||
var id = formset_container.find("#id_form-"+opeindex+"-article").val();
|
||||
var nb_before = formset_container.find("#id_form-"+opeindex+"-article_nb").val();
|
||||
var nb_after = parseInt(nb_before) + parseInt(nb);
|
||||
var amountEuro_after = amountEuroPurchase(id, nb_after);
|
||||
var amountUKF_after = amountToUKF(amountEuro_after, account_data['is_cof']);
|
||||
|
||||
if (type == 'purchase') {
|
||||
if (nb_after == 0) {
|
||||
deleteFromBasket(opeindex);
|
||||
} else if (nb_after > 0 && nb_after <= 25) {
|
||||
if (nb_before > 0) {
|
||||
var article_html = basket_container.find('[data-opeindex='+opeindex+']');
|
||||
article_html.find('.amount').text(amountUKF_after).end()
|
||||
.find('.number').text('('+nb_after+'/'+article_data[4]+')').end() ;
|
||||
|
||||
} else {
|
||||
article_html = $(item_basket_default_html);
|
||||
article_html
|
||||
.attr('data-opeindex', opeindex)
|
||||
.find('.number').text('('+nb_after+'/'+article_data[4]+')').end()
|
||||
.find('.name').text(article_data[0]).end()
|
||||
.find('.amount').text(amountUKF_after);
|
||||
basket_container.prepend(article_basket_html);
|
||||
|
||||
}
|
||||
|
||||
if (is_low_stock(id, nb_after))
|
||||
article_html.find('.lowstock')
|
||||
.show();
|
||||
else
|
||||
article_html.find('.lowstock')
|
||||
.hide();
|
||||
updateExistingFormset(opeindex, nb_after, amountEuro_after);
|
||||
updateBasketRel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resetBasket() {
|
||||
basket_container.find('tr').remove();
|
||||
mngmt_total_forms = 1;
|
||||
|
@ -948,6 +1037,7 @@ $(document).ready(function() {
|
|||
articleId.val(0);
|
||||
articleSelect.val('');
|
||||
articleNb.val('');
|
||||
articleStock.text('');
|
||||
displayMatchedArticles(articlesList);
|
||||
}
|
||||
|
||||
|
@ -959,7 +1049,7 @@ $(document).ready(function() {
|
|||
var title = is_checkout ? 'Montant de la charge' : "Montant de l'édition";
|
||||
$.confirm({
|
||||
title: title,
|
||||
content: '<input type="number" step="0.01" min="0.01" on autofocus placeholder="€">',
|
||||
content: '<input type="number" lang="en" step="0.01" min="0.01" on autofocus placeholder="€">',
|
||||
backgroundDismiss: true,
|
||||
animation:'top',
|
||||
closeAnimation:'bottom',
|
||||
|
@ -986,7 +1076,7 @@ $(document).ready(function() {
|
|||
function askWithdraw() {
|
||||
$.confirm({
|
||||
title: 'Montant du retrait',
|
||||
content: '<input type="number" step="0.01" min="0.01" on autofocus placeholder="€">',
|
||||
content: '<input type="number" lang="en" step="0.01" min="0.01" on autofocus placeholder="€">',
|
||||
backgroundDismiss: true,
|
||||
animation:'top',
|
||||
closeAnimation:'bottom',
|
||||
|
@ -1072,7 +1162,14 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
function deleteFromFormset(opeindex) {
|
||||
formset_container.find('#id_form-'+opeindex+'-DELETE').prop('checked', true);
|
||||
updateExistingFormset(opeindex, 0, '0.00');
|
||||
}
|
||||
|
||||
function updateExistingFormset(opeindex, nb, amount) {
|
||||
formset_container
|
||||
.find('#id_form-'+opeindex+'-amount').val((parseFloat(amount)).toFixed(2)).end()
|
||||
.find('#id_form-'+opeindex+'-article_nb').val(nb).end()
|
||||
.find('#id_form-'+opeindex+'-DELETE').prop('checked', !nb);
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -1164,7 +1261,7 @@ $(document).ready(function() {
|
|||
function askAddcost(errors = '') {
|
||||
$.confirm({
|
||||
title: 'Majoration',
|
||||
content: errors + '<input type="text" placeholder="Trigramme" autocomplete="off" name="trigramme" spellcheck="false" style="text-transform:uppercase" autofocus><input type="number" step="0.01" min="0.01" placeholder="€" name="amount">',
|
||||
content: errors + '<input type="text" placeholder="Trigramme" autocomplete="off" name="trigramme" spellcheck="false" style="text-transform:uppercase" autofocus><input type="number" lang="en" step="0.01" min="0.01" placeholder="€" name="amount">',
|
||||
backgroundDismiss: true,
|
||||
animation:'top',
|
||||
closeAnimation:'bottom',
|
||||
|
@ -1251,7 +1348,9 @@ $(document).ready(function() {
|
|||
}
|
||||
for (var i=0; i<data['articles'].length; i++) {
|
||||
article = data['articles'][i];
|
||||
articles_container.find('[data-article='+article['id']+'] .stock')
|
||||
articles_container.find('#data-article-'+article['id'])
|
||||
.addClass('low-stock');
|
||||
articles_container.find('#data-article-'+article['id']+' .stock')
|
||||
.text(article['stock']);
|
||||
}
|
||||
if (data['addcost']) {
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
<!doctype html>
|
||||
{% load staticfiles %}
|
||||
{% load dictionary_extras %}
|
||||
<body>
|
||||
<div class="btn-group btn-group-justified" role="group" aria-label="select-period">
|
||||
{% for k,stat in stats.items %}
|
||||
<div class="btn-group" role="group">
|
||||
<button id="{{ stat | get_item:'btn' }}" type="button" class="btn btn-primary {{ id_prefix }}-btn {%if k == default_stat%} focus{%endif%}">{{ stat | get_item:'label' }}</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div><!-- /boutons -->
|
||||
<div id="{{ content_id}}">
|
||||
</div>
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
// VARIABLES
|
||||
{{id_prefix}}_content_id = $("#{{content_id}}");
|
||||
{{id_prefix}}_btns = $(".{{id_prefix}}-btn");
|
||||
{% for k,stat in stats.items %}
|
||||
{% if k == default_stat %}
|
||||
{{id_prefix}}_default_url = "{{ stat | get_item:'url' }}";
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
// INIT
|
||||
STAT.get_thing({{id_prefix}}_default_url, {{id_prefix}}_content_id, "Ouppss ?");
|
||||
{% for k,stat in stats.items %}
|
||||
$("#{{stat|get_item:'btn'}}").on('click', function() {
|
||||
STAT.get_thing("{{stat|get_item:'url'}}", {{id_prefix}}_content_id, "Ouuups ?");
|
||||
{{id_prefix}}_btns.removeClass("focus");
|
||||
$("#{{stat|get_item:'btn'}}").addClass("focus");
|
||||
});
|
||||
{% endfor %}
|
||||
});
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue