lib/rawbotz/public/rawbotz.js in rawbotz-0.1.2 vs lib/rawbotz/public/rawbotz.js in rawbotz-0.1.3

- old
+ new

@@ -31,11 +31,14 @@ }; // For Non-Remote Order Forms: add a pack $("button.plus-pack").click(function(e) { e.preventDefault(); - inputField = $(this).siblings("input"); + + input_id = $(this).data("reference_input_id"); + inputField = $('#' + input_id); + current = parseInt(inputField.val()); if (isNaN(current)) { current = 0; } packsize = parseInt($(this).data("packsize")); @@ -47,11 +50,13 @@ }); // For Non-Remote Order Forms: subtract a pack $("button.minus-pack").click(function(e) { e.preventDefault(); - inputField = $(this).siblings("input"); + + input_id = $(this).data("reference_input_id"); + inputField = $("#" + input_id); current = parseInt(inputField.val()); if (isNaN(current)) { current = 0; } packsize = parseInt($(this).data("packsize")); @@ -90,7 +95,16 @@ }); // move up and autoopen $('#modal-plot').load(url); $('#modal-plot').dialog("open"); }); + + // Fill order item input with last value + $("button.reorder").click(function(e) { + e.preventDefault(); + var order_item_id = $(e.target).data('order_item_id'); + var num_wished = $(e.target).data('num_wished'); + $("#item_" + order_item_id).val(num_wished); + }); + });