Pull from master

This commit is contained in:
San Wai Lwin
2018-06-11 13:18:18 +06:30
parent 019db9f5d1
commit 97f4a9df11
6 changed files with 163 additions and 29 deletions

View File

@@ -10,12 +10,13 @@ App.order = App.cable.subscriptions.create('BillChannel', {
if(data.from == "" || hostname == data.from) if(data.from == "" || hostname == data.from)
{ {
if($('.table_'+data.table.id).hasClass('blue')){ if($('.table_'+data.table.id).hasClass('blue')){
$('.table_'+data.table.id).removeClass('blue'); $('.table_'+data.table.id).removeClass('blue');
$('.table_'+data.table.id).addClass('red'); $('.table_'+data.table.id).removeClass('green');
}else{ $('.table_'+data.table.id).addClass('red');
$('.table_'+data.table.id).removeClass('orange'); }else{
$('.table_'+data.table.id).addClass('red'); $('.table_'+data.table.id).removeClass('orange');
} $('.table_'+data.table.id).addClass('red');
}
$('.new_text_'+data.table.id).removeClass('hide'); $('.new_text_'+data.table.id).removeClass('hide');
$('.new_text_'+data.table.id).text('billed'); $('.new_text_'+data.table.id).text('billed');
} }

View File

@@ -37,7 +37,10 @@ class Origami::SalesController < BaseOrigamiController
# create sale item # create sale item
saleobj = Sale.find(sale_id) saleobj = Sale.find(sale_id)
order.order_items.each do |orer_item| order.order_items.each do |orer_item|
saleobj.add_item (orer_item) saleobj.add_item (orer_item)
if !orer_item.set_menu_items.nil?
saleobj.add_sub_item(orer_item.set_menu_items)
end
end end
# Re-compute for add # Re-compute for add

View File

@@ -383,6 +383,7 @@
<% <%
count = 0 count = 0
@order_items.each do |order_item| @order_items.each do |order_item|
set_item_prices = 0
count += 1 count += 1
%> %>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'> <tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
@@ -398,7 +399,9 @@
<% end %> <% end %>
<% if !order_item.set_menu_items.nil? <% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance| %> JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
<br><span class="font-13"> <br><span class="font-13">
<%= item_instance["item_instance_name"] %> <%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %> <% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
@@ -410,10 +413,11 @@
<% end %> <% end %>
</span> </span>
<% end <% end
sub_total += set_item_prices
end %> end %>
</td> </td>
<td class='item-attr'><%= order_item.qty %></td> <td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td> <td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr> </tr>
<% <%
end end

View File

@@ -203,15 +203,43 @@
unless @order_items.nil? || @order_items.empty? unless @order_items.nil? || @order_items.empty?
count = 0 count = 0
@order_items.each do |order_item | @order_items.each do |order_item |
set_item_prices = 0
count += 1 count += 1
sub_total = sub_total + (order_item.price * order_item.qty) sub_total = sub_total + (order_item.price * order_item.qty)
#unless order_item.price <= 0 %> #unless order_item.price <= 0 %>
<tr> <tr>
<td><%= count %></td> <td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td> <td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td> <td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td> <td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr> </tr>
<% <%
#end #end
@@ -231,12 +259,40 @@ if @status_sale == 'sale'
<table class="table table-striped"> <table class="table table-striped">
<% <%
@order_items.each do |order_item | @order_items.each do |order_item |
set_item_prices = 0
%> %>
<tr> <tr>
<td class='item-name'><%= order_item.item_name %></td> <td class='item-name'>
<td class='item-attr'><%= order_item.qty %></td> <%= order_item.item_name %>
<td class='item-attr'><%= order_item.qty*order_item.price %></td> <% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr> </tr>
<% <%
@@ -327,18 +383,28 @@ end
change_to = $('#change_table_value').val(); change_to = $('#change_table_value').val();
change_from = "<%= @dining.id %>"; change_from = "<%= @dining.id %>";
if (change_to == ""){ if (change_to == ""){
alert("Please Select Room") swal({
title: "Alert!!",
text: 'Please Select Table !',
type: 'warning',
});
}else{ }else{
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_moving_path %>", url: "<%= origami_moving_path %>",
data: "change_from="+ change_from + "&change_to=" + change_to, data: "change_from="+ change_from + "&change_to=" + change_to,
success:function(result){ success:function(result){
alert("Moving Success") // alert("Moving Success")
if (result.get_type == 'Table'){ swal({
window.location.href = '/origami/table/' + change_to; title: "Information!",
}else{ text: 'Moving Success',
window.location.href = '/origami/room/' + change_to; type: 'success',
} }, function (){
if (result.get_type == 'Table'){
window.location.href = '/origami/table/' + change_to;
}else{
window.location.href = '/origami/room/' + change_to;
}
});
} }
}); });
} }

View File

@@ -204,15 +204,43 @@
unless @order_items.nil? || @order_items.empty? unless @order_items.nil? || @order_items.empty?
count = 0 count = 0
@order_items.each do |order_item | @order_items.each do |order_item |
set_item_prices = 0
count += 1 count += 1
sub_total = sub_total + (order_item.price * order_item.qty) sub_total = sub_total + (order_item.price * order_item.qty)
#unless order_item.price <= 0 %> #unless order_item.price <= 0 %>
<tr> <tr>
<td><%= count %></td> <td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td> <td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td> <td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td> <td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr> </tr>
<% <%
#end #end
@@ -232,12 +260,40 @@ if @status_sale == 'sale'
<table class="table table-striped"> <table class="table table-striped">
<% <%
@order_items.each do |order_item | @order_items.each do |order_item |
set_item_prices = 0
%> %>
<tr> <tr>
<td class='item-name'><%= order_item.item_name %></td> <td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td> <td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td> <td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr> </tr>
<% <%

View File

@@ -367,6 +367,7 @@
<% <%
count = 0 count = 0
@order_items.each do |order_item | @order_items.each do |order_item |
set_item_prices = 0
count += 1 count += 1
%> %>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'> <tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
@@ -382,7 +383,9 @@
<% end %> <% end %>
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]' <% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
JSON.parse(order_item.set_menu_items).each do |item_instance| %> JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
<br><span class="font-13"> <br><span class="font-13">
<%= item_instance["item_instance_name"] %> <%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %> <% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
@@ -394,10 +397,11 @@
<% end %> <% end %>
</span> </span>
<% end <% end
sub_total += set_item_prices
end %> end %>
</td> </td>
<td class='item-attr'><%= order_item.qty %></td> <td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td> <td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr> </tr>
<% <%