Fixes form reset
This commit is contained in:
1 parent
135fe821e1
commit
822fc058c8
1 file changed
+24
-23
+24
-23
@@ -1,26 +1,27 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
/* Customer selection */
|
function enable_all_customers() {
|
||||||
$("li.customer").click( function() {
|
$("li.customer").each(function(i) {
|
||||||
/* Enable all buttons */
|
$(this).removeClass("selected");
|
||||||
$("li.customer").each(function(i) {
|
});
|
||||||
$(this).removeClass("selected");
|
}
|
||||||
});
|
/* Customer selection */
|
||||||
/* Disable the customer button just clicked */
|
$("li.customer").click( function() {
|
||||||
$(this).addClass("selected");
|
enable_all_customers();
|
||||||
/* Update the form */
|
/* Disable the customer button just clicked */
|
||||||
$("input[name=customer]").val($(this).children("span.name").text());
|
$(this).addClass("selected");
|
||||||
});
|
/* Update the field */
|
||||||
/* Product amount controls */
|
$("input[name=customer]").val($(this).children("span.name").text());
|
||||||
$("li.product").click( function() {
|
});
|
||||||
var form_field = $(this).children("input[type=text]");
|
/* Product amount controls */
|
||||||
var qty = Number(form_field.val()) + 1;
|
$("li.product").click( function() {
|
||||||
form_field.val(qty);
|
var form_field = $(this).children("input[type=text]");
|
||||||
});
|
var qty = Number(form_field.val()) + 1;
|
||||||
/* Also reset the hidden customer fields */
|
form_field.val(qty);
|
||||||
$("input[type=reset]").click( function() {
|
});
|
||||||
$("input[name=customer]").val("");
|
/* Form reset */
|
||||||
});
|
$("input[type=reset]").click( function() {
|
||||||
|
$("input[name=customer]").val("");
|
||||||
/* TODO: keyboard shortcuts */
|
enable_all_customers();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user