mirror of
https://github.com/nanoy42/coope
synced 2024-11-28 23:52:27 +00:00
16 lines
582 B
JavaScript
16 lines
582 B
JavaScript
|
$(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);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
});
|