diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb
index 8c1144e5..3f65a8ad 100755
--- a/app/views/origami/sale_edit/edit.html.erb
+++ b/app/views/origami/sale_edit/edit.html.erb
@@ -59,7 +59,8 @@
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' && sale_item.remark != 'foc' %>
-
+
+
|
@@ -166,21 +167,27 @@ var cashier_type = "<%= @cashier_type %>";
var sale_item_id = $(this).attr('data-id');
var qty = $('#' + sale_item_id + "_qty").val();
var price = $('#' + sale_item_id + "_price").val();
- console.log(qty + "|" + price)
- var ajax_url = "/origami/item_edit";
- $.ajax({
- type: "POST",
- url: ajax_url,
- data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
- success: function (result) {
- swal({
- title: "Information!",
- text: "Qty and Price was successfully Updated",
- }, function () {
- location.reload();
- });
- }
- });
+ console.log(qty + "|" + price);
+ if(qty > 0){
+ $('#' + sale_item_id + "_qtyErr").html("");
+ var ajax_url = "/origami/item_edit";
+ $.ajax({
+ type: "POST",
+ url: ajax_url,
+ data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
+ success: function (result) {
+ swal({
+ title: "Information!",
+ text: "Qty and Price was successfully Updated",
+ }, function () {
+ location.reload();
+ });
+ }
+ });
+ }else{
+ $('#' + sale_item_id + "_qtyErr").html("can't be blank");
+ }
+
});
$('.void').on('click', function () {
@@ -311,4 +318,20 @@ var cashier_type = "<%= @cashier_type %>";
return false;
}
});
+
+ //check for isNumber
+ function isNumberKey(evt) {
+ var charCode = (evt.which) ? evt.which : event.keyCode;
+ if (charCode > 31 && (charCode < 48 || charCode > 57)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ function checkQuantity(obj_value,sale_item_id) {
+ if(obj_value == '0'){
+ $("#"+sale_item_id+"_qty").val('1');
+ }
+ }
|