// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. JavaScript code in this file should be added after the last require_* statement. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require bootstrap //= require jquery_ujs //= require turbolinks //= require cable $(document).ready(function(){ $(".orders").on('click', function(){ var zone_name=$(this).find(".orders-table").text(); var receipt_no=$(this).find(".orders-receipt-no").text(); var unique_id=$(this).find(".orders-id").text(); var cashier=""; var receipt_date=""; var sub_total=0; var discount_amount=0; var tax_amount=0; var grand_total_amount=0; $("#order-title").text("ORDER DETAILS - " + zone_name); // clear order items $("#order-items-table").children("tbody").empty(); // AJAX call for order $.ajax({ type: "GET", url: "origami/" + unique_id, data: { 'id' : unique_id }, success:function(result){ for (i = 0; i < result.length; i++) { var data = JSON.stringify(result[i]); var parse_data = JSON.parse(data); // Receipt Header receipt_no = result[i].receipt_no; cashier = result[i].cashier_name; receipt_date = result[i].receipt_date; $("#receipt_no").text(receipt_no); $("#cashier").text(cashier==null?"":cashier); $("#receipt_date").text(receipt_date); //Receipt Charges sub_total += (parse_data.qty*parse_data.price); discount_amount = parse_data.discount_amount; tax_amount = parse_data.tax_amount; grand_total_amount = parse_data.grand_total_amount; $("#order-sub-total").text(sub_total); $("#order-food").text(''); $("#order-beverage").text(''); $("#order-discount").text(discount_amount); $("#order-Tax").text(tax_amount); $("#order-grand-total").text(grand_total_amount); // Ordered Items var order_items_rows = "