merge with addorder
This commit is contained in:
BIN
app/assets/images/logo.png
Normal file
BIN
app/assets/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
3
app/assets/javascripts/origami/addorders.coffee
Normal file
3
app/assets/javascripts/origami/addorders.coffee
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
@@ -268,4 +268,3 @@ tr.discount-item-row:hover {
|
|||||||
-moz-opacity: 1; /* mozilla */
|
-moz-opacity: 1; /* mozilla */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
app/assets/stylesheets/origami/addorders.scss
Normal file
3
app/assets/stylesheets/origami/addorders.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the origami/addorders controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
class Api::Restaurant::MenuController < Api::ApiController
|
class Api::Restaurant::MenuCategoriesController < Api::ApiController
|
||||||
|
skip_before_action :authenticate
|
||||||
#Description
|
#Description
|
||||||
# Pull the default menu details and also other available (active) menus
|
# Pull the default menu details and also other available (active) menus
|
||||||
# Input Params - order_id
|
# Input Params - order_id
|
||||||
def index
|
def index
|
||||||
@menus = Menu.all
|
@menus = MenuCategory.all
|
||||||
@current_menu = Menu.current_menu
|
@current_menu = MenuCategory.current_menu
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -21,10 +21,10 @@ class Api::Restaurant::MenuController < Api::ApiController
|
|||||||
def menu_detail (menu_id)
|
def menu_detail (menu_id)
|
||||||
if (menu_id)
|
if (menu_id)
|
||||||
#Pull this menu
|
#Pull this menu
|
||||||
menu = Menu.find_by_id(menu_id)
|
menu = MenuCategory.find_by_id(menu_id)
|
||||||
return menu
|
return menu
|
||||||
else
|
else
|
||||||
Menu.current_menu
|
MenuCategory.current_menu
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Api::Restaurant::MenuController < Api::ApiController
|
class Api::Restaurant::MenuController < Api::ApiController
|
||||||
|
skip_before_action :authenticate
|
||||||
#Description
|
#Description
|
||||||
# Pull the default menu details and also other available (active) menus
|
# Pull the default menu details and also other available (active) menus
|
||||||
# Input Params - order_id
|
# Input Params - order_id
|
||||||
|
|||||||
22
app/controllers/origami/addorders_controller.rb
Normal file
22
app/controllers/origami/addorders_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
class Origami::AddordersController < BaseOrigamiController
|
||||||
|
before_action :set_dining, only: [:show]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@tables = Table.all.active.order('zone_id asc').group("zone_id")
|
||||||
|
@rooms = Room.all.active.order('zone_id asc').group("zone_id")
|
||||||
|
@all_table = Table.all.active.order('status desc')
|
||||||
|
@all_room = Room.all.active.order('status desc')
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@menu = MenuCategory.all
|
||||||
|
@table_id = params[:id]
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_dining
|
||||||
|
@dining = DiningFacility.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
2
app/helpers/origami/addorders_helper.rb
Normal file
2
app/helpers/origami/addorders_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Origami::AddordersHelper
|
||||||
|
end
|
||||||
@@ -38,9 +38,10 @@ json.options item.item_options
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#Child Menu items
|
#Child Menu items
|
||||||
# if (item.children) then
|
# if (item.children) then
|
||||||
# json.set_items item.children.each do |item|
|
# json.set_items item.children.each do |item|
|
||||||
# json.partial! 'api/restaurant/menu/menu_item', item: item
|
# json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
43
app/views/api/restaurant/menu_categories/show.json.jbuilder
Normal file
43
app/views/api/restaurant/menu_categories/show.json.jbuilder
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
if @menu.menu_items
|
||||||
|
json.menu_items @menu.menu_items do |item|
|
||||||
|
#Menu Item Information
|
||||||
|
json.item_code item.item_code
|
||||||
|
json.name item.name
|
||||||
|
json.alt_name item.alt_name
|
||||||
|
json.type item.type
|
||||||
|
json.min_qty item.min_qty
|
||||||
|
# json.min_selectable_item item.min_selectable_item
|
||||||
|
# json.max_selectable_item item.max_selectable_item
|
||||||
|
|
||||||
|
#Item instance
|
||||||
|
if item.menu_item_instances.count == 1 then
|
||||||
|
|
||||||
|
item_instance = item.menu_item_instances[0]
|
||||||
|
json.price item_instance.price
|
||||||
|
json.is_available item_instance.is_available
|
||||||
|
json.is_on_promotion item_instance.is_on_promotion
|
||||||
|
json.promotion_price item_instance.promotion_price
|
||||||
|
json.item_attributes item_instance.item_attributes
|
||||||
|
|
||||||
|
elsif item.menu_item_instances.count > 1 then
|
||||||
|
|
||||||
|
json.item_instances item.menu_item_instances do |is|
|
||||||
|
json.item_instance_item_code is.item_instance_code
|
||||||
|
json.item_instance_name is.item_instance_name
|
||||||
|
json.price is.price
|
||||||
|
json.is_available is.is_available
|
||||||
|
json.is_on_promotion is.is_on_promotion
|
||||||
|
json.promotion_price is.promotion_price
|
||||||
|
json.item_attributes is.item_attributes
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
#Child Menu items
|
||||||
|
if (item.menu_item_sets) then
|
||||||
|
json.set_items item.menu_item_sets.each do |item|
|
||||||
|
json.partial! 'api/restaurant/menu/menu_item', item: item
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
108
app/views/origami/addorders/index.html.erb
Normal file
108
app/views/origami/addorders/index.html.erb
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||||
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="tab" href="#table" role="tab">Tables</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="tab" href="#room" role="tab">Rooms</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content" style="max-height:650px; overflow:auto">
|
||||||
|
|
||||||
|
<div class="tab-pane active" id="table" role="tabpanel" style="max-height:; overflow:auto">
|
||||||
|
<% @tables.each do |zone| %>
|
||||||
|
<h3>Zone : <%=zone.zone.name%></h3>
|
||||||
|
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||||
|
|
||||||
|
<% @all_table.each do |table| %>
|
||||||
|
<% if zone.zone_id == table.zone_id %>
|
||||||
|
<div class="card click_table <%= table.status=="available" ? "available" : "occupied"%>" data-id = "<%= table.id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<p class="hidden table-status"><%= table.status %></p>
|
||||||
|
<p style="text-align: center"><%= table.name %></p>
|
||||||
|
<p style="text-align: center">Seat : <%= table.seater %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %> <% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane" id="room" role="tabpanel" style="max-height:; overflow:auto">
|
||||||
|
<% @rooms.each do |zone| %>
|
||||||
|
<h3>Zone : <%=zone.zone.name%></h3>
|
||||||
|
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||||
|
|
||||||
|
<% @all_room.each do |room| %>
|
||||||
|
<% if zone.zone_id == room.zone_id %>
|
||||||
|
<div class="card click_table <%= room.status=="available" ? "available" : "occupied"%>" data-id = "<%= room.id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<p class="hidden table-status"><%= room.status %></p>
|
||||||
|
<p style="text-align: center"><%= room.name %></p>
|
||||||
|
<p style="text-align: center">Seat : <%= room.seater %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %> <% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).on('click',".click_table",function(){
|
||||||
|
|
||||||
|
var dining_id = $(this).attr('data-id');
|
||||||
|
var status = $(this).find(".table-status").text();
|
||||||
|
|
||||||
|
if (status == "available") {
|
||||||
|
$.confirm({
|
||||||
|
title: 'Confirmation !',
|
||||||
|
content: 'Are you sure to assign this table',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: 'Ok',
|
||||||
|
btnClass: 'btn-green',
|
||||||
|
action: function(){
|
||||||
|
window.location.href = '/origami/addorders/'+dining_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.confirm({
|
||||||
|
title: 'Alert!',
|
||||||
|
content: 'You cannot assign this table',
|
||||||
|
buttons: {
|
||||||
|
confirm: {
|
||||||
|
text: 'Ok',
|
||||||
|
btnClass: 'btn-red',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count:5;
|
||||||
|
-moz-column-count:5;
|
||||||
|
column-count:5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.occupied{
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
.available{
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: #009900;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
323
app/views/origami/addorders/show.html.erb
Normal file
323
app/views/origami/addorders/show.html.erb
Normal file
@@ -0,0 +1,323 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
|
<ul class="nav nav-tabs flex-column" role="tablist" >
|
||||||
|
<% @menu.each do |menu| %>
|
||||||
|
<li class="nav-item menu_category" data-ref="<%= api_restaurant_menu_category_path menu.id%>">
|
||||||
|
<p class="hidden menu-id"><%= menu.id %></p>
|
||||||
|
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%></a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7 col-lg-7 col-sm-7">
|
||||||
|
<div class="card-columns menu_items_list" style="column-gap: 10px;">
|
||||||
|
<!-- append data -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 col-lg-3 col-sm-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<div>
|
||||||
|
<strong id="order-title">ORDER DETAILS </strong> | Table <%=@table_id%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-block">
|
||||||
|
<div class="card-text" style="max-height:550px; overflow:auto"">
|
||||||
|
<table class="table table-striped summary-items">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th class="item-qty">QTY</th>
|
||||||
|
<th class="item-attr">Price</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<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="sub_total">0.00</strong></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<button type="button" id="remove" class="btn btn-default" data-dismiss="modal" style="float:right;margin-right:30px;">Remove Item</button>
|
||||||
|
<h4 class="modal-title"></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-offset-6 col-md-offset-6 col-sm-offset-6 col-sm-6 col-md-6 col-lg-6">
|
||||||
|
<span id="item_err_msg"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-md-6" style="width: 14.499999995%">
|
||||||
|
<label for="ex1">Qty</label>
|
||||||
|
<input type="hidden" id="modal_product_name">
|
||||||
|
<input type="hidden" id="modal_product_sku">
|
||||||
|
<input type="hidden" class="current_textbox">
|
||||||
|
<div id="modal_qty" class="form-control" ></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label for="ex1" style='width:50%;'>Price</label><span class="minus btn btn-default btn-xs" style='width:50%;'>-</span>
|
||||||
|
<div id="modal_price" class="form-control" ></div>
|
||||||
|
<input type="button" class="btn btn-primary btn-lg btn-block" id="clear" value="Clear">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary">Save changes</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
|
||||||
|
//click menu sidebar menu category
|
||||||
|
$(".menu_category").on("click", function(){
|
||||||
|
var menu_id = $(this).find(".menu-id").text();
|
||||||
|
var url = $(this).attr('data-ref');
|
||||||
|
show_menu_item_list(url);
|
||||||
|
});
|
||||||
|
//End menu category Click
|
||||||
|
|
||||||
|
//show menu item list when click menu category
|
||||||
|
function show_menu_item_list(url_item){
|
||||||
|
var menu_list = $('.menu_items_list');
|
||||||
|
menu_list.empty();
|
||||||
|
|
||||||
|
//Start Ajax
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url_item,
|
||||||
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
var menu_items_list = $('.menu_items_list');
|
||||||
|
menu_items_list.empty();
|
||||||
|
menu_items = data.menu_items;
|
||||||
|
console.log(data);
|
||||||
|
for(var field in menu_items) {
|
||||||
|
if (menu_items[field].item_instances){
|
||||||
|
var price = parseFloat(menu_items[field].item_instances[1].price).toFixed(2);
|
||||||
|
var is_available = menu_items[field].item_instances[1].is_available
|
||||||
|
var is_on_promotion = menu_items[field].item_instances[1].is_on_promotion
|
||||||
|
var item_attributes = menu_items[field].item_instances[1].item_attributes
|
||||||
|
var item_instance_code = menu_items[field].item_instances[1].item_instance_item_code
|
||||||
|
var item_instance_name = menu_items[field].item_instances[1].item_instance_name
|
||||||
|
var promotion_price = menu_items[field].item_instances[1].promotion_price
|
||||||
|
}else{
|
||||||
|
var price = parseFloat(menu_items[field].price).toFixed(2);
|
||||||
|
var is_available = menu_items[field].is_available
|
||||||
|
var is_on_promotion = menu_items[field].is_on_promotion
|
||||||
|
var item_attributes = menu_items[field].item_attributes
|
||||||
|
var item_instance_code = menu_items[field].item_instance_item_code
|
||||||
|
var item_instance_name = menu_items[field].item_instance_name
|
||||||
|
var promotion_price = menu_items[field].promotion_price
|
||||||
|
}
|
||||||
|
|
||||||
|
row = '<div class="card">'
|
||||||
|
+'<div class="card-head" style="line-height:14px;">'
|
||||||
|
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
|
||||||
|
+'<div class="col-md-3 add_icon"'
|
||||||
|
+'data-id="'+ menu_items[field].name +'"'
|
||||||
|
+'data-item-code="'+ menu_items[field].item_code +'"'
|
||||||
|
+'data-name="'+ menu_items[field].name +'"'
|
||||||
|
+'data-price="'+ price +'"'
|
||||||
|
+'data-available="'+ is_available +'"'
|
||||||
|
+'data-promotion="'+ is_on_promotion +'"'
|
||||||
|
+'data-attributes="'+ item_attributes +'"'
|
||||||
|
+'data-instance-code="'+ item_instance_code +'"'
|
||||||
|
+'data-instance="'+ item_instance_name +'"'
|
||||||
|
+'data-promotion-price="'+ promotion_price +'"'
|
||||||
|
+'>'
|
||||||
|
+'<i class="fa fa-plus "'
|
||||||
|
+ 'style="margin-top:4px;">'
|
||||||
|
+'</i></div>'
|
||||||
|
+'</div>'
|
||||||
|
|
||||||
|
+'<div class="card-block">'
|
||||||
|
+'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>'
|
||||||
|
+'</div>'
|
||||||
|
|
||||||
|
+'<div class="card-footer">'
|
||||||
|
+'<small>'+ price +'</small>'
|
||||||
|
+'</div>';
|
||||||
|
$('.menu_items_list').append(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//end Ajax
|
||||||
|
}
|
||||||
|
//end show detail function
|
||||||
|
|
||||||
|
// click plus icon for add
|
||||||
|
$(document).on('click', '.add_icon', function(event){
|
||||||
|
var item_data = $(this);
|
||||||
|
show_item_detail(item_data);
|
||||||
|
calculate_sub_total();
|
||||||
|
}); //End Add Icon Click
|
||||||
|
|
||||||
|
function show_item_detail(data){
|
||||||
|
qty = 1;
|
||||||
|
append = 0;
|
||||||
|
price = data.attr('data-price');
|
||||||
|
instance_code = data.attr('data-instance');
|
||||||
|
|
||||||
|
if (instance_code == "undefined"){
|
||||||
|
instance = '';
|
||||||
|
}else{
|
||||||
|
instance = "("+data.attr('data-instance')+")";
|
||||||
|
}
|
||||||
|
|
||||||
|
var rowCount = $('.summary-items tbody tr').length+1;
|
||||||
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
|
||||||
|
$(item_row).each(function(i){
|
||||||
|
if ($(item_row[i]).attr('data-code') == data.attr('data-item-code')) {
|
||||||
|
qty = parseInt($(item_row[i]).children('#item_qty').text()) +1;
|
||||||
|
$(item_row[i]).children('#item_qty').text(qty);
|
||||||
|
$(item_row[i]).children('#item_price').text(price*qty);
|
||||||
|
append = 1;
|
||||||
|
}else{
|
||||||
|
qty = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (append===0) {
|
||||||
|
row ="<tr data-price ='"+price+ "'data-toggle='modal' data-target='#myModal' 'data-instance ='"+instance+ "'data-code='"+data.attr('data-item-code')+"'>"
|
||||||
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
|
+'<td class="item-cell-name" >' + data.attr('data-name')+ ' ' + instance + '</td>'
|
||||||
|
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||||
|
+'<td class="item-cell-price" id="item_price">'
|
||||||
|
+ parseFloat(price).toFixed(2)
|
||||||
|
+'</td>'
|
||||||
|
+'</tr>';
|
||||||
|
$(".summary-items tbody").append(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculate_sub_total(){
|
||||||
|
var total_price = 0;
|
||||||
|
var taxable_amount = 0;
|
||||||
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
|
||||||
|
$(item_row).each(function(i){
|
||||||
|
// var taxable = $(item_row[i]).attr('data-taxable');
|
||||||
|
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
|
||||||
|
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
|
||||||
|
// if(taxable == 'true'){
|
||||||
|
// taxable_amount += qty*unit_price;
|
||||||
|
// }
|
||||||
|
total_price += qty*unit_price;
|
||||||
|
});
|
||||||
|
var fixed_total_price = parseFloat(total_price).toFixed(2);
|
||||||
|
var fixed_taxable_amount = parseFloat(taxable_amount).toFixed(2);
|
||||||
|
$('#sub_total').empty();
|
||||||
|
$('#sub_total').append(fixed_total_price);
|
||||||
|
// $('#sub_total').attr('taxable_amount',fixed_taxable_amount);
|
||||||
|
// $('#show_sub').text(fixed_total_price);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
.card-head{
|
||||||
|
height: 40px;
|
||||||
|
background-color: #54A5AF;
|
||||||
|
padding:5px;
|
||||||
|
color :#fff;
|
||||||
|
}
|
||||||
|
.card-block {
|
||||||
|
padding: 0.3rem !important;
|
||||||
|
}
|
||||||
|
@media (min-width: 34em) {
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count: 2;
|
||||||
|
-moz-column-count: 2;
|
||||||
|
column-count: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 48em) {
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count: 3;
|
||||||
|
-moz-column-count: 3;
|
||||||
|
column-count: 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 62em) {
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count: 4;
|
||||||
|
-moz-column-count: 4;
|
||||||
|
column-count: 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 75em) {
|
||||||
|
.card-columns {
|
||||||
|
-webkit-column-count: 4;
|
||||||
|
-moz-column-count: 4;
|
||||||
|
column-count: 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-tabs .nav-item {
|
||||||
|
border-bottom: 1px solid #fff;
|
||||||
|
border-left: 1px solid #54A5AF;
|
||||||
|
border-right: 1px solid #54A5AF;
|
||||||
|
}
|
||||||
|
.nav > li > a{
|
||||||
|
color:#54A5AF;
|
||||||
|
}
|
||||||
|
.nav-tabs {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
}
|
||||||
|
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
|
||||||
|
background-color: #fff;
|
||||||
|
border-left: 6px solid #111;
|
||||||
|
color:#54A5AF;
|
||||||
|
font-weight: bold;
|
||||||
|
border-color: #fff #fff #fff #54A5AF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-dialog {
|
||||||
|
left:auto;
|
||||||
|
right: auto;
|
||||||
|
width: 600px;
|
||||||
|
padding-top: 100px;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@@ -305,31 +305,28 @@
|
|||||||
<!-- 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>
|
||||||
|
<button type="button" id="add_order" class="btn btn-primary btn-block" >Add Order</button>
|
||||||
<% if @dining.bookings.length >= 1 %>
|
<% if @dining.bookings.length >= 1 %>
|
||||||
|
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
<!-- <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" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
|
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
|
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
|
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
||||||
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
|
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||||
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
|
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
<% else %>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
|
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
||||||
<% else %>
|
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
||||||
<!-- <button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> -->
|
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
|
||||||
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
|
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
||||||
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
|
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
<% end %>
|
||||||
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
|
||||||
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
|
||||||
<% end %>
|
|
||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
|
|
||||||
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
|
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
|
||||||
@@ -580,4 +577,9 @@ function show_customer_details(customer_id){
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#add_order').on('click',function(){
|
||||||
|
var dining_id = "<%= @dining.id %>"
|
||||||
|
window.location.href = '/origami/addorders/'+ dining_id;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Rails.application.routes.draw do
|
|||||||
namespace :restaurant do
|
namespace :restaurant do
|
||||||
get 'zones' => "zones#index"
|
get 'zones' => "zones#index"
|
||||||
resources :menu, only:[:index, :show]
|
resources :menu, only:[:index, :show]
|
||||||
resources :menu_categories, only: [:index]
|
resources :menu_categories, only: [:index, :show]
|
||||||
resources :menu_items, only: [:index, :show]
|
resources :menu_items, only: [:index, :show]
|
||||||
resources :menu_item_attributes, only: [:index]
|
resources :menu_item_attributes, only: [:index]
|
||||||
resources :menu_item_options, only: [:index]
|
resources :menu_item_options, only: [:index]
|
||||||
@@ -165,7 +165,10 @@ Rails.application.routes.draw do
|
|||||||
get '/:sale_id/customers', to: "customers#add_customer"
|
get '/:sale_id/customers', to: "customers#add_customer"
|
||||||
get '/:customer_id/get_customer' => 'home#get_customer',:as => "show_customer_details"
|
get '/:customer_id/get_customer' => 'home#get_customer',:as => "show_customer_details"
|
||||||
post '/:sale_id/update_sale' , to: "customers#update_sale_by_customer" # update customer id in sale table
|
post '/:sale_id/update_sale' , to: "customers#update_sale_by_customer" # update customer id in sale table
|
||||||
|
|
||||||
post '/:sale_id/get_customer' => "customers#get_customer"
|
post '/:sale_id/get_customer' => "customers#get_customer"
|
||||||
|
|
||||||
|
resources :addorders
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Waiter/Ordering Station ------------#
|
#--------- Waiter/Ordering Station ------------#
|
||||||
|
|||||||
BIN
public/image/logo.png
Normal file
BIN
public/image/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
5
spec/controllers/origami/addorders_controller_spec.rb
Normal file
5
spec/controllers/origami/addorders_controller_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Origami::AddordersController, type: :controller do
|
||||||
|
|
||||||
|
end
|
||||||
15
spec/helpers/origami/addorders_helper_spec.rb
Normal file
15
spec/helpers/origami/addorders_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
# Specs in this file have access to a helper object that includes
|
||||||
|
# the Origami::AddordersHelper. For example:
|
||||||
|
#
|
||||||
|
# describe Origami::AddordersHelper do
|
||||||
|
# describe "string concat" do
|
||||||
|
# it "concats two strings with spaces" do
|
||||||
|
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
RSpec.describe Origami::AddordersHelper, type: :helper do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user