jQuery.fn.ForceNumericOnly = function() { return this.each(function() { $(this).keydown(function(e) { var key = e.charCode || e.keyCode || 0; // allow backspace, tab, delete, enter, arrows, numbers and keypad numbers ONLY // home, end, period, and numpad decimal return ( key == 8 || key == 9 || key == 13 || key == 46 || key == 110 || //key == 190 || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105)); }); }); }; $("#RegMobile").ForceNumericOnly(); $('#verifyOrder').submit(function(e){ e.preventDefault(); $.ajax({ url: "ajax/verifyOrder.php", type: 'POST', data:$("#verifyOrder").serialize(), dataType: 'html', success: function (data){ var data = $.parseJSON(data); if(data.status==1) { $(".alert-success").show(); $(".alert-success").text(data.SuccessMsg); setTimeout(function(){ location.reload(); }, 3000); } } }); }); $('#uploadTracking').submit(function(e){ e.preventDefault(); $.ajax({ url: "ajax/uploadTracking.php", type: 'POST', data:$("#uploadTracking").serialize(), dataType: 'html', success: function (data){ var data = $.parseJSON(data); if(data.status==1) { $(".alert-success").show(); $(".alert-success").text(data.SuccessMsg); setTimeout(function(){ location.reload();}, 3000); } } }); }); $(".newOrder").click(function(){ $("#newOrder").show(); }); $(".orderApproved").click(function(){ var invoiceNo = []; $.each($("input[name='newinvoice_no[]']:checked"), function(){ invoiceNo.push($(this).val()); }); var invoice = invoiceNo.join(","); $("#processOrderId").val(invoice); }); $("#saveDelivery").submit(function(e) { e.preventDefault(); // avoid to execute the actual submit of the form. var form = $(this); var url = form.attr('action'); $.ajax({ type: "POST", url: url, data: form.serialize(), // serializes the form's elements. success: function(data) { var data = $.parseJSON(data); if(data.status==1) { setTimeout(function(){location.reload();}, 1000); } else { alert(data.SuccessMsg); $('#deliveryProcess').modal('hide'); } } }); }); $(".approvedOrder").click(function(){ $("#approvedOrder").show(); }); $(".orderPacked").click(function(){ $.blockUI({ message: '<h4><img src="images/busy.gif" /> Please Wait...</h4>' }); var invoiceNo = []; $.each($("input[name='approvedinvoice_no[]']:checked"), function(){ invoiceNo.push($(this).val()); }); var invoice = invoiceNo.join(","); var dataString = "order_id="+invoice; $.ajax ({ type: "POST", url: "ajax/orderPacked.php", data: dataString, success: function(data) { var obj = $.parseJSON(data); if(obj.status==1) { setTimeout(function(){$.unblockUI();location.reload();}, 1000); } } }); }); $(".packedOrder").click(function(){ $("#packedOrder").show(); }); $(".orderDispatch").click(function(){ $.blockUI({ message: '<h4><img src="images/busy.gif" /> Please Wait...</h4>' }); var invoiceNo = []; $.each($("input[name='packedinvoice_no[]']:checked"), function(){ invoiceNo.push($(this).val()); }); var invoice = invoiceNo.join(","); var dataString = "order_id="+invoice; $.ajax ({ type: "POST", url: "ajax/orderDispatch.php", data: dataString, success: function(data) { var obj = $.parseJSON(data); if(obj.status==1) { setTimeout(function(){$.unblockUI();location.reload();}, 1000); } } }); }); $(".dispatchOrder").click(function(){ $("#dispatchOrder").show(); }); $(".orderPicked").click(function(){ $.blockUI({ message: '<h4><img src="images/busy.gif" /> Please Wait...</h4>' }); var invoiceNo = []; $.each($("input[name='dispatchinvoice_no[]']:checked"), function(){ invoiceNo.push($(this).val()); }); var invoice = invoiceNo.join(","); var dataString = "order_id="+invoice; $.ajax ({ type: "POST", url: "ajax/orderPicked.php", data: dataString, success: function(data) { var obj = $.parseJSON(data); if(obj.status==1) { setTimeout(function(){$.unblockUI();location.reload();}, 1000); } } }); }); $(".deliveredOrder").click(function(){ $("#deliveredOrder").show(); }); $(".orderDelivered").click(function(){ $.blockUI({ message: '<h4><img src="images/busy.gif" /> Please Wait...</h4>' }); var invoiceNo = []; $.each($("input[name='deliveredinvoice_no[]']:checked"), function(){ invoiceNo.push($(this).val()); }); var invoice = invoiceNo.join(","); var dataString = "order_id="+invoice; $.ajax ({ type: "POST", url: "ajax/orderDelivered.php", data: dataString, success: function(data) { var obj = $.parseJSON(data); if(obj.status==1) { setTimeout(function(){$.unblockUI();location.reload();}, 1000); } } }); }); function deleteOrderConfirmation() { var x = confirm("Are you sure you want to delete?"); if (x) return true; else return false; }