fixed conflict

This commit is contained in:
Nweni
2017-12-27 16:45:15 +06:30
190 changed files with 5369 additions and 2417 deletions

View File

@@ -41,7 +41,11 @@
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
Zone <%= table.zone_id %> <br>
Table <%= table.name %> ( <%= table.seater %> Seat )
@@ -114,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">
@@ -37,22 +40,26 @@
<!--- Panel 1 - Table Orders -->
<div class="tab-pane dining active " id="tables" role="tabpanel">
<div class="card-columns">
<% @tables.each do |table| %>
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div>
</div>
</div>
<% else %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<% end %>
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
@@ -128,7 +135,11 @@
<div id="save_order_id" data-order="">
<% end %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% if @booking.checkout_by.nil? && !@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>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
@@ -145,8 +156,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>
@@ -212,7 +222,7 @@
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<%
# Can't check for discount
unless sale_item.price == 0
# unless sale_item.price == 0
count += 1
%>
<tr>
@@ -223,19 +233,18 @@
</tr>
<%
end
# end
end
end
if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil?
unless @order_items.nil? || @order_items.empty?
count = 0
@order_items.each do |order_item|
count += 1
sub_total = sub_total + (order_item.price * order_item.qty)
unless order_item.price == 0 %>
# unless order_item.price == 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
@@ -244,7 +253,7 @@
</tr>
<%
end
# end
end
end
end
@@ -257,7 +266,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' %>
@@ -284,7 +293,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>
@@ -298,7 +308,7 @@
<%
if @status_sale == 'sale'
unless @order_items.nil?
unless @order_items.nil? || @order_items.empty?
%>
Pending New Order
<table class="table table-striped">
@@ -359,6 +369,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' %>
@@ -374,14 +385,20 @@
<% end %>
<% if @status_sale == 'sale' %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit'>Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' active="<%= can? :edit, :sale_edit %>">Edit</button>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<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>
<%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%>
<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"> Void</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
<% end %>
<!-- Cashier Buttons -->
@@ -389,11 +406,51 @@
<% 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>
<% @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 %>";
@@ -482,7 +539,7 @@
window.location.href = '/origami/' + sale_id + '/other_charges'
}
else {
alert("Please select an table!");
swal ( "Oops" , "Please select an table!" , "warning" );
}
return false;
@@ -501,13 +558,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();
@@ -517,24 +573,68 @@
type: "GET",
url: ajax_url,
success: function (result) {
location.reload();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,"");
location.reload();
}
});
});
});
$(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
var sale_id = $('#sale_id').val();
type = $('.payment_method').val();
calculate_member_discount(sale_id,type);
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success: function (result) {
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
location.reload();
}
});
});
function calculate_member_discount(sale_id,type) {
var sub_total = $('#sub-total').text();
if (type == "Cash") {
is_card = false
}else{
is_card = true
}
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
async: false,
success:function(result){
}
});
}
// $('#pay').on('click', function () {
// var sale_id = $('#sale_id').val();
// var url = '/origami/sale/' + sale_id + "/rounding_adj";
// $.ajax({
// type: "POST",
// url: '/origami/sale/' + sale_id + "/rounding_adj",
// success: function (result) {
// window.location.href = '/origami/sale/' + sale_id + "/payment";
// }
// });
// });
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
var url = '/origami/sale/' + sale_id + "/rounding_adj";
$.ajax({
type: "POST",
url: '/origami/sale/' + sale_id + "/rounding_adj",
success: function (result) {
window.location.href = '/origami/sale/' + sale_id + "/payment";
}
});
window.location.href = '/origami/sale/' + sale_id + "/payment";
});
// Bill Request
@@ -546,18 +646,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";
})
@@ -574,8 +675,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();
});
}
});
})
@@ -617,7 +726,12 @@
$('#edit').on('click', function () {
var dining_id = "<%= @dining.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/edit";
if ($(this).attr('active')=== "true") {
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/edit";
}else{
swal("Opps","You are not authorized for void","warning")
}
});
$('#commissions').on('click', function () {
@@ -632,6 +746,7 @@
});
$('#void').on('click', function () {
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to Void?",
@@ -652,7 +767,10 @@
}
});
}
});
});
}else{
swal("Opps","You are not authorized for void","warning")
}
});
$('#add_order').on('click', function () {
@@ -666,7 +784,7 @@
$.ajax({
type: 'POST',
data: {dining_id : dining_id},
data: {'dining_id' : dining_id},
datatype: 'JSON',
url: '/origami/check_in',
success: function(data) {