update origami for room

This commit is contained in:
Aung Myo
2017-07-03 12:20:03 +06:30
parent 6c3c863fce
commit 92712787e1
4 changed files with 37 additions and 23 deletions

View File

@@ -115,7 +115,7 @@ class Crm::CustomersController < BaseCrmController
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json' 'Accept' => 'application/json'
}, },
:timeout => 100 :timeout => 10
) )
rescue HTTParty::Error rescue HTTParty::Error
@@ -209,8 +209,6 @@ end
}, },
:timeout => 10 :timeout => 10
) )
puts "hhhhhhhhh"
puts response.to_json
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = { status: false }

View File

@@ -55,6 +55,10 @@ class Origami::PaymentsController < BaseOrigamiController
shop_details = Shop.find(1) shop_details = Shop.find(1)
# get member information # get member information
member_info = Customer.get_member_account(customer) member_info = Customer.get_member_account(customer)
puts "transaction"
puts rebate_amount.to_json
puts "member_info"
puts member_info.to_json
# get printer info # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) print_settings=PrintSetting.find_by_unique_code(unique_code)

View File

@@ -6,6 +6,7 @@ class Origami::RoomsController < BaseOrigamiController
@complete = Sale.all @complete = Sale.all
@orders = Order.all.order('date desc') @orders = Order.all.order('date desc')
@room = DiningFacility.find(params[:room_id]) @room = DiningFacility.find(params[:room_id])
@sale_array = Array.new
@room.bookings.each do |booking| @room.bookings.each do |booking|
if booking.sale_id.nil? if booking.sale_id.nil?
@order_items = Array.new @order_items = Array.new
@@ -23,12 +24,16 @@ class Origami::RoomsController < BaseOrigamiController
sale = Sale.find(booking.sale_id) sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed" if sale.sale_status != "completed"
@sale_array.push(sale)
@status = 'sale' @status = 'sale'
@obj = sale @obj = sale
@customer = sale.customer @customer = sale.customer
end end
end end
end end
puts "hhhhhhhhhh"
puts @status
puts @obj.to_json
end end

View File

@@ -69,16 +69,23 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @rooms.each do |room| %> <% @rooms.each do |room| %>
<% if room.status == 'occupied' %> <% if room.status == 'occupied' %>
<div class="card rooms red text-white" data-id="<%= room.id %>">
<div class="card-block"> <% if room.get_booking.nil? %>
<%= room.name %> <div class="card rooms red text-white" data-id="<%= room.id %>">
<% if room.get_booking.nil? %> <div class="card-block">
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span> <%= room.name %>
<% else %> <span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span> <div style="font-size:12px;"></div>
<% end %> </div>
</div> </div>
</div> <% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
</div>
</div>
<% end %>
<% else %> <% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>"> <div class="card rooms green text-white" data-id="<%= room.id %>">
<div class="card-block"> <div class="card-block">
@@ -114,7 +121,7 @@
<div class="card-header"> <div class="card-header">
<% if @status == 'order' %> <% if @status == 'order' %>
<div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @room.name rescue "" %></div> <div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @room.name rescue "" %></div>
<% elsif @status_sale == 'sale' %> <% elsif @status == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @room.name rescue "" %></div> <div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @room.name rescue "" %></div>
<% end %> <% end %>
@@ -218,7 +225,7 @@
</div> </div>
<br> <br>
<% <%
if @status_sale == 'sale' if @status == 'sale'
unless @order_items.nil? unless @order_items.nil?
%> %>
Pending New Order Pending New Order
@@ -272,10 +279,10 @@
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons --> <!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button> <button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<% if @dining.bookings.length >= 1 %> <% if @room.bookings.length >= 1 %>
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button> <button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status == 'order' && @status != 'sale' %>
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> --> <!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button> <button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button> <button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
@@ -332,7 +339,7 @@ $(document).ready(function(){
// }) // })
$('.invoicedetails').on('click',function(){ $('.invoicedetails').on('click',function(){
var dining_id = "<%= @dining.id %>"; var dining_id = "<%= @room.id %>";
var sale_id = this.id; var sale_id = this.id;
window.location.href = '/origami/table/'+ dining_id + "/table_invoice/"+sale_id; window.location.href = '/origami/table/'+ dining_id + "/table_invoice/"+sale_id;
}) })
@@ -431,7 +438,7 @@ $("#first_bill").on('click', function(){
$('#pay').on('click',function() { $('#pay').on('click',function() {
var sale_id = $('#sale_id').val(); var sale_id = $('#sale_id').val();
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ; var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
alert(url)
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj", url: '/origami/sale/'+ sale_id + "/rounding_adj",
@@ -466,8 +473,8 @@ $('#back').on('click',function(){
}) })
$('#add_invoice').on('click',function(){ $('#add_invoice').on('click',function(){
var dining_id = "<%= @dining.id %>" var dining_id = "<%= @room.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>" var sale_id = "<%= @obj.sale_id rescue "" %>"
var ajax_url = "/origami/sale/append_order"; var ajax_url = "/origami/sale/append_order";
$.ajax({ $.ajax({
type: "POST", type: "POST",
@@ -549,8 +556,8 @@ $('#add_invoice').on('click',function(){
} }
$('#edit').on('click',function(){ $('#edit').on('click',function(){
var dining_id = "<%= @dining.id %>" var dining_id = "<%= @room.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>" var sale_id = "<%= @obj.sale_id rescue "" %>"
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit"; window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
}); });