merge with master

This commit is contained in:
Yan
2018-01-09 16:40:45 +06:30
91 changed files with 2666 additions and 744 deletions

View File

@@ -118,12 +118,13 @@
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
</button>
<%end%>
<%if current_login_employee.role != "waiter" %>
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
<button id="cash_out" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_out") %> </button>
<!-- Temporary Disabled -->
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
<%end%>
</div>
</div>
</div>

View File

@@ -1,4 +1,7 @@
<div class="container-fluid">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>
<div class="row clearfix">
<!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6">
@@ -140,7 +143,11 @@
</div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% if !@booking.reserved_by.nil? && %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
</div>
<% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
@@ -153,8 +160,7 @@
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span>
<br>
@@ -264,7 +270,7 @@
<table class="table" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
<td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td>
</tr>
<tr>
<% if @obj_sale != nil && @obj_sale.discount_type == 'member_discount' %>
@@ -291,7 +297,8 @@
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr">
<strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0 %></strong></td>
<strong id="order-round-adj"><%= @obj_sale.rounding_adjustment
%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
@@ -366,6 +373,7 @@
<%= t("views.btn.back") %>
</button>
<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>
<% if current_login_employee.role != "waiter" %>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% if @dining.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
@@ -389,6 +397,7 @@
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<!-- <button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button> -->
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
<% end %>
@@ -398,11 +407,52 @@
<% else %>
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
<% end %>
<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" 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 %>
</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>
&nbsp; &nbsp;
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
<script>
$(document).ready(function () {
/* start check first bill or not*/
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
// console.log(checkReceiptNoInFirstBillData(receipt_no));
if(checkReceiptNoInFirstBillData(receipt_no,"")){
$("#pay").show();
}else{
$("#pay").hide();
}
/* end check first bill or not*/
$('.invoicedetails').on('click', function () {
var dining_id = "<%= @dining.id %>";
@@ -491,7 +541,7 @@
window.location.href = '/origami/' + sale_id + '/other_charges'
}
else {
alert("Please select an table!");
swal ( "Oops" , "Please select an table!" , "warning" );
}
return false;
@@ -510,13 +560,12 @@
window.location.href = '/origami/' + sale_id + '/discount'
}
else {
alert("Please select an table!");
swal ( "Oops" , "Please select an table!" , "warning" );
}
return false;
});
});
// Print for first bill
// $("#first_bill").on('click', function () {
// var sale_id = $('#sale_id').val();
@@ -556,18 +605,19 @@
url: ajax_url,
// data: 'order_id='+ order_id,
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);
}
else {
location.reload();
else {
location.reload();
}
}
});
});
$('#move').on('click', function () {
var dining_id = "<%= @dining.id %>"
var dining_id = "<%= @dining.id %>";
window.location.href = '/origami/table/' + dining_id + "/movetable";
})
@@ -584,8 +634,16 @@
url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
success: function (result) {
alert("Invoice updated")
swal({
title: "Information!",
text: "Invoice updated",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.reload();
});
}
});
})
@@ -685,7 +743,7 @@
$.ajax({
type: 'POST',
data: {dining_id : dining_id},
data: {'dining_id' : dining_id},
datatype: 'JSON',
url: '/origami/check_in',
success: function(data) {