3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-10-31 23:22:50 +00:00
coope/staticfiles/stocks.js

16 lines
582 B
JavaScript
Raw Normal View History

2019-08-27 21:21:15 +00:00
$(document).ready(function(){
$(".update-stock").click(function(){
var pk = $(this).attr('data-pk');
var current_value = $(this).attr('data-stock');
var ok = false;
while(!ok){
var new_stock = prompt("Nouveau stock ? (entier attendu)", current_value);
ok = new_stock == null || !(isNaN(parseInt(new_stock)));
}
if(new_stock != null){
$.get("/gestion/updateStock/" + pk, {"stock": new_stock}, function(data){
$("#stock-"+pk).html(new_stock);
});
}
});
});