This commit is contained in:
Moe Su
2017-06-07 18:13:12 +06:30
26 changed files with 841 additions and 394 deletions

View File

@@ -17,3 +17,4 @@
//= require turbolinks
//= require cable
//= require settings/processing_items
//= require bootstrap-datepicker

View File

@@ -15,3 +15,88 @@
//= 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 = "<tr>" +
"<td class='item-name'>" + parse_data.item_name + "</td>" +
"<td class='item-attr'>" + parse_data.qty + "</td>" +
"<td class='item-attr'>" + parse_data.qty*parse_data.price + "</td>" +
"</tr>";
$("#order-items-table").children("tbody").append(order_items_rows);
}
}
});
// End AJAX Call
$('.orders').removeClass('selected-item');
$(this).addClass('selected-item');
});
// Bill Request
$('#request_bills').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
window.location.href = '/origami/request_bills/'+ order_id
return false;
});
// Payment for Bill
$('#pay').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
window.location.href = '/origami/sale/'+ sale_id + "/payment"
return false;
});
});

View File

@@ -2,6 +2,7 @@
@import "bootstrap";
@import "font-awesome";
@import "theme";
@import "bootstrap-datepicker3";
/* Show it is fixed to the top */
// body {

View File

@@ -19,13 +19,45 @@
color:white;
cursor:pointer;
}
.cashier_number:hover{
background:#A9F5F2;
}
.long{
width:100%
}
.sold {
background-color: red;
}
.selected-item {
background-color: blue;
}
/* Reciept Style */
#order-charges-table td {
border-top: none !important;
}
.charges-name {
width: 80%;
text-align: left;
}
.item-name {
width: 60%;
text-align: left;
}
.item-attr {
width: 20%;
text-align: right;
}
/* Colors */
.purple {
background-color:#7a62d3;
}