merge with master
This commit is contained in:
@@ -134,7 +134,7 @@
|
||||
<div class="tab-pane dining" id="orders" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id="<%= order.order_id %>">
|
||||
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%
|
||||
order_status = ""
|
||||
@@ -292,9 +292,26 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
@@ -371,9 +388,26 @@
|
||||
<td><%= count %>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
@@ -424,7 +458,7 @@
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
<a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a>
|
||||
<!-- <a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a> -->
|
||||
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||
<% if @dining.status != "available" %>
|
||||
@@ -454,6 +488,11 @@
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||
<% end %>
|
||||
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
||||
<% end %>
|
||||
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
|
||||
@@ -464,15 +503,13 @@
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<!-- first bill not used in cloud -->
|
||||
<% if ENV["SERVER_MODE"] == "cloud" %>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<% else %>
|
||||
|
||||
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||
<%else%>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
<% end %>
|
||||
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -488,30 +525,31 @@
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
|
||||
<option value="Cash">Cash</option>
|
||||
<option value="Credit">Credit</option>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option>
|
||||
<%end %>
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment Method</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- <select class="form-control show-tick payment_method" multiple="true" id="payment_method" > -->
|
||||
<!-- <option value="Cash">Cash</option> -->
|
||||
<button class='btn waves-effect payment_btn green' data-type='Credit' data-value='Credit'>Credit</button>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<!-- <option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option> -->
|
||||
<button class='btn btn-lg waves-effect payment_btn green' data-type='<%= pay.payment_method %>' data-value='<%= pay.payment_method %>'><%= pay.payment_method %></button>
|
||||
<%end %>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
<!-- </select> -->
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -540,6 +578,30 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')"><strong>Spoile</strong></button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>CLOSE</strong></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "cashier";
|
||||
$(document).ready(function () {
|
||||
@@ -681,6 +743,7 @@
|
||||
$("#first_bill").on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
var server_mode =
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -689,18 +752,41 @@
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
|
||||
// console.log(result);
|
||||
// code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// click select option icon for add
|
||||
$(document).on('click', '.payment_btn', function(event){
|
||||
active = $(this).hasClass('selected-payment');
|
||||
value = $(this).data('value');
|
||||
type = $(this).data('type');
|
||||
group = $(this).data('group');
|
||||
payments = $(".payment_btn");
|
||||
|
||||
if (active) {
|
||||
$(this).removeClass('selected-payment');
|
||||
}else{
|
||||
$(this).addClass('selected-payment');
|
||||
}
|
||||
}); //End selecct attribute buttom
|
||||
|
||||
$(".choose_payment").on('click', function () {
|
||||
$( "#loading_wrapper").show();
|
||||
alert(parseInt(jQuery.inArray("PAYMAL", type)));
|
||||
|
||||
var sale_id = $('#sale_id').val();
|
||||
type = $('.payment_method').val();
|
||||
// type = $('.payment_method').val();
|
||||
type = get_selected_attributes('selected-payment');
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
|
||||
calculate_member_discount(sale_id,"Card");
|
||||
@@ -718,7 +804,11 @@
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,type);
|
||||
location.reload();
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -768,7 +858,7 @@
|
||||
//split bill process
|
||||
$('#split_bills').click(function(){
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/split_bills";
|
||||
window.location.href = '/origami/table/' + dining_id + "/" + cashier_type +"/split_bills";
|
||||
});
|
||||
|
||||
$('#move').on('click', function () {
|
||||
@@ -872,15 +962,19 @@
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
var remark = $("#remark").val();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
success: function (result) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -938,4 +1032,46 @@
|
||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
||||
}
|
||||
});
|
||||
|
||||
// Get Selected Class
|
||||
function get_selected_attributes(selected_class) {
|
||||
var item_row = $('.'+selected_class);
|
||||
var attribute_arr = [];
|
||||
$(item_row).each(function(i){
|
||||
value = $(item_row[i]).attr('data-value');
|
||||
str = value;
|
||||
attribute_arr.push(str);
|
||||
});
|
||||
return attribute_arr;
|
||||
}
|
||||
|
||||
function waste_and_spoilage(remark) {
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to " + remark +" ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, " +remark+ " it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var url = "/origami/sale/" + sale_id + '/cashier/waste_and_spoilage';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function (result) {
|
||||
console.log(result)
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user