changed in server master

This commit is contained in:
superuser
2017-06-22 11:38:42 +06:30
82 changed files with 2217 additions and 513 deletions

View File

@@ -18,3 +18,5 @@
//= require cable
//= require jquery-ui
//= require bootstrap-datepicker
//= require bootstrap/modal

View File

@@ -18,46 +18,71 @@
//= require cable
$(document).ready(function(){
// auto refresh every 10 seconds
// setTimeout(function(){
// window.location.reload(1);
// }, 10000);
$('.queue_station').on('click',function(){
var orderZone=$(this).children().children().children('.order-zone').text();
var orderItem=$(this).children().children().children('.order-item').text();
var orderQty=$(this).children().children().children('.order-qty').text();
var orderBy=$(this).children().children().children().children('.order-by').text();
var orderAt=$(this).children().children().children().children('.order-at').text();
var orderCustomer=$(this).children().children('.order-customer').text();
var orderZone=$(this).children().children().children('.order-zone').text().trim();
// var orderItem=$(this).children().children().children('.order-item').text();
//var assigned_item_id = $(this).children().find(".assigned-order-item").text();
var orderQty = $(this).children().children().children('.order-qty').text();
var orderBy = $(this).children().children().children().children('.order-by').text();
var orderAt = $(this).children().children().children().children('.order-at').text();
var orderCustomer = $(this).children().children('.order-customer').text();
var order_status = $(this).children().children('.order-status').text();
$('#order-title').text("ORDER DETAILS - " + orderZone);
$('#order-by').text(orderBy);
$('#order-at').text(orderAt);
$('#order-customer').text(orderCustomer);
$('#order-from').text(orderZone);
// clear order items
$("#oqs-order-details-table").children("tbody").empty();
$('#order-items').text(orderItem);
$('#order-qty').text(orderQty);
// Call get_order_items() for Order Items by dining
$.ajax({
type: 'GET',
url: '/oqs/' + orderZone,
data: { 'status' : order_status },
success: function(res){
for (i = 0; i < res.length; i++) {
var data = JSON.stringify(res[i]);
var parse_data = JSON.parse(data);
var order_item_row = "<tr>" +
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + "</td>" +
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
"</tr>";
$("#oqs-order-details-table").children("tbody").append(order_item_row);
}
}
})
// $('#order-items').text(orderItem);
// $('#order-qty').text(orderQty);
$('.queue_station').removeClass('selected-item');
$(this).addClass('selected-item');
});
// complete for queue item
$('.order-complete').on('click',function(e){
$('.order-complete').on('click',function(e){
//e.preventDefault();
var _self = $(this); // To know in ajax return
var assigned_item_id=$(this).attr('id').substr(15);
var _self = $(this); // To know in ajax return
var assigned_item_id=$(this).attr('id').substr(15);
var params = { 'id':assigned_item_id };
// Call update_delivery_status() for changed delivery and move to delivery
$.ajax({
type: 'POST',
url: '/oqs/update_delivery',
data: params,
dataType: 'json',
success: function(data){
for (i = 0; i < data.length; i++) {
success: function(data){
for (i = 0; i < data.length; i++) {
var queue_station = $('#assigned_queue_' + data[i]).parent().parent(".queue_station");
var station = queue_station.parent().parent().attr('id');
@@ -66,7 +91,7 @@ $(document).ready(function(){
// Remove a queue card from current station
queue_station.children('.card-footer').remove();
// Add removed queue card from station to completed
$("#completed").children('.card-columns').append(queue_station);
@@ -74,33 +99,37 @@ $(document).ready(function(){
var station_count=parseInt($("#"+station+"_count").text()) - 1;
$("#"+station+"_count").text(station_count);
}
// update queue item count in completed station
// update queue item count in completed station
$("#completed_count").text(parseInt($("#completed_count").text()) + data.length);
alert("updated!");
// Page reload
location.reload();
}
});
});
});
// Print Order Item
$('#print_order_item').on('click',function(){
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'id':assigned_item_id };
$.ajax({
type: 'GET',
url: '/oqs/print/print/'+assigned_item_id,
url: '/oqs/print/print/'+assigned_item_id,
success: function(data){ }
});
});
// Print Order Summary
$('#print_order_summary').on('click',function(){
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'id':assigned_item_id };
var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'table_name':table_name };
$.ajax({
type: 'GET',
url: '/oqs/print/print_order_summary/'+assigned_item_id,
url: '/oqs/print/print_order_summary/'+assigned_item_id,
data: params,
success: function(data){ }
});
});

View File

@@ -55,7 +55,7 @@ $(document).ready(function(){
var cashier="";
var receipt_date="";
var sub_total=0;
var sub_total=0.0;
var discount_amount=0;
var tax_amount=0;
var grand_total_amount=0;
@@ -69,11 +69,11 @@ $(document).ready(function(){
type: "POST",
url: "/origami/" + unique_id,
data: { 'booking_id' : unique_id },
success:function(result){
success:function(result){
for (i = 0; i < result.length; i++) {
var data = JSON.stringify(result[i]);
var parse_data = JSON.parse(data);
var show_date = "";
var show_date = "";
// Receipt Header
receipt_no = result[i].receipt_no;
@@ -81,36 +81,37 @@ $(document).ready(function(){
if(result[i].receipt_date != null){
receipt_date = new Date(result[i].receipt_date);
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
}
$("#receipt_no").text(receipt_no);
$("#cashier").text(cashier == null ? "" : cashier);
$("#receipt_date").text(show_date);
}
//Receipt Charges
sub_total += (parse_data.qty*parse_data.price);
sub_total += parseFloat(parse_data.price);
discount_amount = parse_data.discount_amount == null? '0.0' : 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);
grand_total_amount = parse_data.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>" +
"<td class='item-attr'>" + parse_data.price + "</td>" +
"</tr>";
$("#order-items-table").children("tbody").append(order_items_rows);
}
// Cashier Info
$("#receipt_no").text(receipt_no);
$("#cashier").text(cashier == null ? "" : cashier);
$("#receipt_date").text(show_date);
// Payment Info
$("#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);
}
});
// End AJAX Call
@@ -121,7 +122,7 @@ $(document).ready(function(){
// Bill Request
$('#request_bills').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
if(order_id!=""){
window.location.href = '/origami/' + order_id + '/request_bills'
}
@@ -133,7 +134,8 @@ $(document).ready(function(){
// Discount for Payment
$('#discount').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
var order_id=$(".selected-item").find(".orders-id").text().substr(0,16);
if(order_id!=""){
window.location.href = '/origami/' + order_id + '/discount'
}
@@ -148,7 +150,7 @@ $(document).ready(function(){
$("#pay-discount").on('click', function(e){
e.preventDefault();
var sale_id = $('#sale-id').text();
var sale_item_id = $('.selected-item').attr('id');
var sale_item_id = $('.selected-item').attr('id').substr(0,16);
var sub_total = $('#order-sub-total').text();
var grand_total = $('#order-grand-total').text();
var discount_type = $('#discount-type').val();
@@ -178,7 +180,7 @@ $(document).ready(function(){
// Payment for Bill
$('#pay-bill').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
var sale_id=$(".selected-item").find(".orders-id").text().substr(0,16);
if(sale_id!=""){
window.location.href = '/origami/sale/'+ sale_id + "/payment"
}
@@ -190,7 +192,7 @@ $(document).ready(function(){
});
$('#customer').click(function() {
var sale = $(".selected-item").find(".orders-id").text();
var sale = $(".selected-item").find(".orders-id").text().substr(0,16);
if (sale.substring(0, 3)=="SAL") {
var sale_id = sale
}else{
@@ -202,7 +204,7 @@ $(document).ready(function(){
});
$('#re-print').click(function() {
var sale_id = $(".selected-item").find(".orders-id").text();
var sale_id = $(".selected-item").find(".orders-id").text().substr(0,16);
window.location.href = '/origami/'+ sale_id + "/reprint"

View File

@@ -40,7 +40,7 @@ $(document).on('turbolinks:load', function() {
items.push($(value).attr("data-id"));
});
$("#order_queue_station_processing_items").val(items);
$("#order_queue_station_processing_items").val(JSON.stringify(items));
//$(this).submit();
})
})

View File

@@ -3,6 +3,7 @@
@import "theme";
@import "jquery-ui";
@import "bootstrap-datepicker3";
@import "bootstrap/modal";
/* Show it is fixed to the top */
// body {
@@ -10,4 +11,15 @@
// padding-top: 4.5rem;
// }
.selected-item {
color: #fff !important;
background-color: #ccc !important;
}
.assign {
color: #fff !important;
background-color: red;
}
.assign .text-muted{
color: #fff !important;
}