update add order
This commit is contained in:
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/
|
||||
@@ -211,3 +211,4 @@ tr.discount-item-row:hover {
|
||||
margin-left:-40px !important;
|
||||
margin-top:-40px !important;
|
||||
}
|
||||
|
||||
|
||||
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/
|
||||
21
app/controllers/origami/addorders_controller.rb
Normal file
21
app/controllers/origami/addorders_controller.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
||||
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
|
||||
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>
|
||||
30
app/views/origami/addorders/show.html.erb
Normal file
30
app/views/origami/addorders/show.html.erb
Normal file
@@ -0,0 +1,30 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<div class="ta" style="max-height:550px; overflow:auto">
|
||||
<ul class="nav nav-tabs md-pills pills-primary flex-column" role="tablist">
|
||||
<% @menu.each do |menu| %>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#panel21" role="tab"> <%= menu.name%></a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
<div class="tab-content" style="max-height:650px; overflow:auto">
|
||||
|
||||
<div class="tab-pane active" id="table" role="tabpanel" style="max-height:; overflow:auto">
|
||||
</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>
|
||||
|
||||
</script>
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
|
||||
<button type="button" id="add_order" 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="discount" class="btn btn-primary btn-block" disabled>Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
|
||||
@@ -312,7 +312,7 @@
|
||||
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
|
||||
<% else %>
|
||||
<!-- <button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> -->
|
||||
<button type="button" id="add_order" class="btn btn-primary btn-block">Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
||||
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
|
||||
@@ -555,4 +555,8 @@ function show_customer_details(customer_id){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#add_order').on('click',function(){
|
||||
window.location.href = '/origami/addorders';
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -156,6 +156,8 @@ Rails.application.routes.draw do
|
||||
get '/:sale_id/customers', to: "customers#add_customer"
|
||||
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
|
||||
|
||||
resources :addorders
|
||||
end
|
||||
|
||||
#--------- Waiter/Ordering Station ------------#
|
||||
|
||||
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