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,59 +32,71 @@ 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?
# 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)
# if !order.order_items.empty? # if !order.order_items.empty?
# if !@order_items_count.key?(booking.dining_facility_id) # if !@order_items_count.key?(booking.dining_facility_id)
# @order_items_count.store(booking.dining_facility_id, order.order_items.count) # @order_items_count.store(booking.dining_facility_id, order.order_items.count)
# else # else
# @order_items_count[booking.dining_facility_id] += order.order_items.count # @order_items_count[booking.dining_facility_id] += order.order_items.count
# end # end
# end # end
# end # end
# end # end
# else # else
# if !booking.sale_id.nil? # if !booking.sale_id.nil?
# sale = Sale.find(booking.sale_id) # sale = Sale.find(booking.sale_id)
# if sale.sale_status !='completed' # if sale.sale_status !='completed'
# if !@order_items_count.key?(booking.dining_facility_id) # if !@order_items_count.key?(booking.dining_facility_id)
# @order_items_count.store(booking.dining_facility_id, sale.sale_items.count) # @order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
# else # else
# @order_items_count[booking.dining_facility_id] = sale.sale_items.count # @order_items_count[booking.dining_facility_id] = sale.sale_items.count
# end # end
# end # end
# 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
booking.booking_orders.each do |booking_order| if booking.booking_orders.empty?
order = Order.find(booking_order.order_id) @booking = booking
@customer = order.customer else
if (order.status == "new") booking.booking_orders.each do |booking_order|
@obj_order = order order = Order.find(booking_order.order_id)
if (order.status == "new")
@date = order.created_at @obj_order = order
@booking = booking @customer = order.customer
order.order_items.each do |item| @date = order.created_at
@order_items.push(item) @booking = booking
# assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id) order.order_items.each do |item|
# if !assigned_order_items.nil? @order_items.push(item)
# @assigned_order_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id}) # assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
# end # if !assigned_order_items.nil?
# @assigned_order_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id})
# 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 end
@status_order = 'order' @status_order = 'order'
else else
sale = Sale.find(booking.sale_id) sale = Sale.find(booking.sale_id)
@@ -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

@@ -1,131 +1,131 @@
<div class="container-fluid"> <div class="container-fluid">
<div id="loading_wrapper" style="display:none;"> <div id="loading_wrapper" style="display:none;">
<div id="loading"></div> <div id="loading"></div>
</div> </div>
<div class="row clearfix"> <div class="row clearfix">
<!-- Column One --> <!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist"> <ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a> <a class="nav-link" data-toggle="tab" href="#completed" role="tab"><%= t :competed %></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab"><%= t :tables %></a> <a class="nav-link active" data-toggle="tab" href="#tables" role="tab"><%= t :tables %></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab"><%= t :rooms %></a> <a class="nav-link" data-toggle="tab" href="#rooms" role="tab"><%= t :rooms %></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#orders" role="tab"><%= t :orders %></a> <a class="nav-link" data-toggle="tab" href="#orders" role="tab"><%= t :orders %></a>
</li> </li>
</ul> </ul>
<!-- Nav tabs - End --> <!-- Nav tabs - End -->
<div id="custom-slimscroll"> <div id="custom-slimscroll">
<div class="tab-content m-t-10"> <div class="tab-content m-t-10">
<!--- Panel 0 - Completed Orders --> <!--- Panel 0 - Completed Orders -->
<div class="tab-pane dining" id="completed" role="tabpanel"> <div class="tab-pane dining" id="completed" role="tabpanel">
<div class="card-columns"> <div class="card-columns">
<% @complete.each do |sale| %> <% @complete.each do |sale| %>
<div class="card sales red text-white" data-id="<%= sale.sale_id %>"> <div class="card sales red text-white" data-id="<%= sale.sale_id %>">
<div class="card-block"> <div class="card-block">
<%= sale.receipt_no %> <%= sale.receipt_no %>
<span class="float-right font-12"><%= sale.sale_status %></span> <span class="float-right font-12"><%= sale.sale_status %></span>
</div>
</div>
<% end %>
</div>
</div>
<!--- Panel 1 - Table Orders -->
<div class="tab-pane dining active " id="tables" role="tabpanel">
<div class="card-columns">
<% @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 %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div>
</div> </div>
</div> </div>
<% end %> <% else %>
</div> <% if table.get_checkout_booking.nil? %>
</div> <div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<!--- Panel 1 - Table Orders -->
<div class="tab-pane dining active " id="tables" role="tabpanel">
<div class="card-columns">
<% @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 %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div>
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue 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 %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
<% end %>
<% else %> <% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
</div>
</div>
<% end %> <% end %>
<div class="card-block">
<%= table.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
</div>
</div>
<% end %> <% end %>
</div> <% end %>
</div> </div>
</div>
<!--- Panel 2 - Room Orders --> <!--- Panel 2 - Room Orders -->
<div class="tab-pane dining" id="rooms" role="tabpanel"> <div class="tab-pane dining" id="rooms" role="tabpanel">
<div class="card-columns"> <div class="card-columns">
<% @rooms.each do |room| %> <% @rooms.each do |room| %>
<% if room.status == 'occupied' %> <% if room.status == 'occupied' %>
<% if room.get_booking.nil? %> <% if room.get_booking.nil? %>
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<!-- <% if !@order_items_count.nil? %> <!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %> <% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>) (Orders : <%= @order_items_count[room.id] %>)
<% end %> <% end %>
<% end %> --> <% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span> <span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
</div> </div>
</div> </div>
<% else %> <% else %>
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<!-- <% if !@order_items_count.nil? %> <!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %> <% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>) (Orders : <%= @order_items_count[room.id] %>)
<% end %> <% end %>
<% end %> --> <% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> new</span> <span class="float-right font-12 new_text_<%= room.id %>"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<span class="float-right font-12 new_text_<%= room.id %> hide">
</div>
</div> </div>
</div>
<% end %> <% end %>
<% else %>
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<span class="float-right font-12 new_text_<%= room.id %> hide">
</div>
</div>
<% end %>
<% end %> <% end %>
</div> </div>
</div> </div>
@@ -134,26 +134,26 @@
<div class="tab-pane dining" id="orders" role="tabpanel"> <div class="tab-pane dining" id="orders" role="tabpanel">
<div class="card-columns"> <div class="card-columns">
<% @orders.each do |order| %> <% @orders.each do |order| %>
<div class="card orders <%=(order.status=="new") ? 'blue' : '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"> <div class="card-block">
<% <%
order_status = "" order_status = ""
sale_order = SaleOrder.find_by_order_id(order) sale_order = SaleOrder.find_by_order_id(order)
if sale_order if sale_order
unless sale_order.sale_id.nil? unless sale_order.sale_id.nil?
sale = Sale.find(sale_order.sale_id) sale = Sale.find(sale_order.sale_id)
order_status = sale.sale_status order_status = sale.sale_status
if order_status == 'new' if order_status == 'new'
order_status = order.status order_status = order.status
end
end end
else
order_status = order.status
end end
%> else
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %> order_status = order.status
</div> end
%>
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
</div> </div>
</div>
<% end %> <% end %>
</div> </div>
</div> </div>
@@ -168,26 +168,27 @@
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %> <% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"> <div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %> <% else %>
<div id="save_order_id" data-order=""> <div id="save_order_id" data-order="">
<% end %> <% end %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %> <strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> <% 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> <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 %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span> <span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% 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>
<% if !@booking.reserved_by.nil? && %> <strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span> <% if !@booking.reserved_by.nil? && %>
<% else %> <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">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span> <% else %>
<% end %> <span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
</div> <% end %>
</div>
<% else %> <% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %> <strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %> <% end %>
@@ -331,48 +332,45 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<table class="table" id="order-charges-table" border="0"> <table class="table" id="order-charges-table" border="0">
<tr> <tr>
<td class="charges-name"><strong>Sub Total:</strong></td> <td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td> <td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td>
</tr> </tr>
<tr> <tr>
<% if @obj_sale != nil && @obj_sale.discount_type == 'member_discount' %> <%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td> <td class="charges-name"><strong>Member Discount:</strong></td>
<% else %> <%else%>
<td class="charges-name"><strong>Discount:</strong></td> <td class="charges-name"><strong>Discount:</strong></td>
<% end %> <%end%>
<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
@account_arr.each do |ct| %> @account_arr.each do |ct| %>
<%=ct.name%> <%=ct.name%>
<% if @account_arr.count != @i+1%> <% if @account_arr.count != @i+1%>
+ <% @i =+1 %> + <% @i =+1 %>
<%end%> <%end%>
<%end %>) <%end %>)
</strong></td> </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>
<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 </tr>
%></strong></td> <tr>
</tr> <td class="charges-name"><strong>Grand Total:</strong></td>
<tr> <td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
<td class="charges-name"><strong>Grand Total:</strong></td> </tr>
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0 %></strong> <% end %>
</td> <tr class="rebate_amount"></tr>
</tr>
<% end %>
<!-- <tr class="rebate_amount"></tr> -->
</table> </table>
</div> </div>

View File

@@ -1,7 +1,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div id="loading_wrapper" style="display:none;"> <div id="loading_wrapper" style="display:none;">
<div id="loading"></div> <div id="loading"></div>
</div> </div>
<div class="row"> <div class="row">
<!-- Column One --> <!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
@@ -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,23 +792,37 @@ $(document).ready(function(){
// Print for first bill // Print for first bill
$("#first_bill").on('click', function(){ $("#first_bill").on('click', function(){
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill"; swal({
$.ajax({ title: "Alert",
type: "GET", 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 ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url, url: ajax_url,
success:function(result){ success:function(result){
receipt_no = ($("#receipt_no").html()).trim(); receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!="")) if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,""); createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade // For Server Print - from jade
if ($("#server_mode").val() == "cloud") { if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
location.reload();
} }
location.reload(); });
} }
}); });
}); });
$(".choose_payment").on('click', function () { $(".choose_payment").on('click', function () {
$( "#loading_wrapper").show(); $( "#loading_wrapper").show();