Merge branch 'ui_ux_changes' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes

This commit is contained in:
phyusin
2018-06-08 16:50:57 +06:30
3 changed files with 287 additions and 254 deletions

View File

@@ -32,9 +32,9 @@ class Origami::RoomsController < BaseOrigamiController
@membership = MembershipSetting::MembershipSetting @membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all
bookings = Booking.all # bookings = Booking.all
if !bookings.today.nil? # if !bookings.today.nil?
@order_items_count = Hash.new # @order_items_count = Hash.new
# bookings.each do |booking| # bookings.each do |booking|
# if booking.sale_id.nil? && booking.booking_status != 'moved' # if booking.sale_id.nil? && booking.booking_status != 'moved'
# if !booking.booking_orders.empty? # if !booking.booking_orders.empty?
@@ -62,18 +62,20 @@ class Origami::RoomsController < BaseOrigamiController
# end # end
# end # end
# end # end
end # end
@room.bookings.active.each do |booking| @room.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved' if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new @order_items = Array.new
# @assigned_order_items = Array.new # @assigned_order_items = Array.new
if booking.booking_orders.empty?
@booking = booking
else
booking.booking_orders.each do |booking_order| booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id) order = Order.find(booking_order.order_id)
@customer = order.customer
if (order.status == "new") if (order.status == "new")
@obj_order = order @obj_order = order
@customer = order.customer
@date = order.created_at @date = order.created_at
@booking = booking @booking = booking
order.order_items.each do |item| order.order_items.each do |item|
@@ -83,6 +85,16 @@ class Origami::RoomsController < BaseOrigamiController
# @assigned_order_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id}) # @assigned_order_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id})
# end # end
end end
@account_arr = Array.new
if @customer.tax_profiles
accounts = @customer.tax_profiles
@account_arr =[]
accounts.each do |acc|
account = TaxProfile.find(acc)
@account_arr.push(account)
end
end
end
end end
end end
@status_order = 'order' @status_order = 'order'
@@ -98,6 +110,12 @@ class Origami::RoomsController < BaseOrigamiController
@status_sale = 'sale' @status_sale = 'sale'
@obj_sale = sale @obj_sale = sale
@customer = sale.customer @customer = sale.customer
accounts = @customer.tax_profiles
@account_arr =[]
accounts.each do |acc|
account = TaxProfile.find(acc)
@account_arr.push(account)
end
end end
end end
end end

View File

@@ -181,7 +181,8 @@
<% end %> <% end %>
</div> </div>
<% elsif @status_sale == 'sale' %> <% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %> <div>
<strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if !@booking.reserved_by.nil? && %> <% 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> <span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %> <% else %>
@@ -347,7 +348,7 @@
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td> <td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
</tr> </tr>
<% if @status_sale == "sale" && @status_order == 'order' %> <% if @status_sale == "sale" %>
<tr> <tr>
<td class="charges-name"><strong>Tax: <td class="charges-name"><strong>Tax:
(<% @i = 0 (<% @i = 0
@@ -362,17 +363,14 @@
</tr> </tr>
<tr> <tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td> <td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"> <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>
<tr> <tr>
<td class="charges-name"><strong>Grand Total:</strong></td> <td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0 %></strong> <td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
</td>
</tr> </tr>
<% end %> <% end %>
<!-- <tr class="rebate_amount"></tr> --> <tr class="rebate_amount"></tr>
</table> </table>
</div> </div>

View File

@@ -334,7 +334,15 @@
</tr> </tr>
<% if @status_sale == "sale" %> <% if @status_sale == "sale" %>
<tr> <tr>
<td class="charges-name"><strong>Tax:</strong></td> <td class="charges-name"><strong>Tax:
(<% @i = 0
@account_arr.each do |ct| %>
<%=ct.name%>
<% if @account_arr.count != @i+1%>
+ <% @i =+1 %>
<%end%>
<%end %>)
</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td> <td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
</tr> </tr>
<tr> <tr>
@@ -430,7 +438,7 @@
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i> Back</button> <button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i> Back</button>
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button> <button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button> <button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
<% if @room.bookings.length >= 1 %> <% if @room.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> --> <!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> -->
<!-- <button type="button" id="customer" class="btn bg-blue btn-block" disabled>Customer</button> --> <!-- <button type="button" id="customer" class="btn bg-blue btn-block" disabled>Customer</button> -->
@@ -473,16 +481,11 @@
<% end %> <% end %>
<% end %> <% end %>
<% if current_login_employee.role != "waiter" %> <% 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 %> <%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> <button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
<%else%> <%else%>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button> <button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<%end%> <%end%>
<!-- <%end%>-->
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button> <button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<% end %> <% end %>
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> --> <!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
@@ -789,8 +792,20 @@ $(document).ready(function(){
// Print for first bill // Print for first bill
$("#first_bill").on('click', function(){ $("#first_bill").on('click', function(){
swal({
title: "Alert",
text: "Are you sure want to print First Bill?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, print it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill"; var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
@@ -805,6 +820,8 @@ $("#first_bill").on('click', function(){
location.reload(); location.reload();
} }
}); });
}
});
}); });
$(".choose_payment").on('click', function () { $(".choose_payment").on('click', function () {