Order queue stations
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -23,6 +23,7 @@ gem 'coffee-rails', '~> 4.2'
|
||||
# gem 'therubyracer', platforms: :ruby
|
||||
gem 'simple_form'
|
||||
gem 'bootstrap', '~> 4.0.0.alpha3'
|
||||
gem 'tether-rails'
|
||||
gem "font-awesome-rails"
|
||||
gem 'rack-cors'
|
||||
|
||||
|
||||
@@ -192,6 +192,8 @@ GEM
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
tether-rails (1.4.0)
|
||||
rails (>= 3.1)
|
||||
thor (0.19.4)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.7)
|
||||
@@ -245,6 +247,7 @@ DEPENDENCIES
|
||||
spreadsheet
|
||||
spring
|
||||
spring-watcher-listen (~> 2.0.0)
|
||||
tether-rails
|
||||
to_xls-rails
|
||||
turbolinks (~> 5)
|
||||
tzinfo-data
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
// about supported directives.
|
||||
//
|
||||
//= require jquery
|
||||
//= require tether
|
||||
//= require bootstrap
|
||||
//= require jquery_ujs
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
//= require settings/processing_items
|
||||
|
||||
46
app/assets/javascripts/settings/processing_items.js
Normal file
46
app/assets/javascripts/settings/processing_items.js
Normal file
@@ -0,0 +1,46 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$(".processitems").click(function(event){
|
||||
event.preventDefault();
|
||||
console.log($(this).data("id"));
|
||||
var item = $(this).data("id");
|
||||
$(this).toggleClass("opi_selected");
|
||||
|
||||
});
|
||||
|
||||
$(".processingitems_all").click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
console.log($(this).data("id"));
|
||||
var group_id = $(this).data("id");
|
||||
var selector = "#" + group_id + " li div";
|
||||
console.log ($(selector));
|
||||
|
||||
$(selector).removeClass("opi_selected");
|
||||
$(selector).addClass("opi_selected");
|
||||
});
|
||||
|
||||
$(".processingitems_clr").click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
console.log($(this).data("id"));
|
||||
var group_id = $(this).data("id");
|
||||
var selector = "#" + group_id + " li div";
|
||||
console.log ($(selector));
|
||||
|
||||
$(selector).removeClass("opi_selected");
|
||||
});
|
||||
|
||||
//Process the menu item data before submitting
|
||||
$("form").submit(function(e){
|
||||
//e.preventDefault();
|
||||
var items = new Array();
|
||||
selected_div = $(".opi_selected");
|
||||
$.each( selected_div, function( key, value ) {
|
||||
console.log($(value).attr("data-id"));
|
||||
items.push($(value).attr("data-id"));
|
||||
});
|
||||
|
||||
$("#order_queue_station_processing_items").val(items);
|
||||
//$(this).submit();
|
||||
})
|
||||
})
|
||||
@@ -1,3 +1,4 @@
|
||||
@import "tether";
|
||||
@import "bootstrap";
|
||||
@import "font-awesome";
|
||||
@import "theme";
|
||||
@@ -7,3 +8,25 @@
|
||||
// min-height: 75rem;
|
||||
// padding-top: 4.5rem;
|
||||
// }
|
||||
|
||||
/*----- Order Processing Items -----*/
|
||||
.opi_ul {
|
||||
display:block;
|
||||
padding-left:0px;
|
||||
}
|
||||
.opi_ul li {
|
||||
display:list-item;
|
||||
list-style: none;
|
||||
margin-top:2px;
|
||||
}
|
||||
|
||||
.opi_selected {
|
||||
background-color:#BEA2C2 !important;
|
||||
}
|
||||
.opi_default {
|
||||
cursor: pointer;
|
||||
background-color: #E8ECF9;
|
||||
line-height: inherit;
|
||||
padding:5px;
|
||||
}
|
||||
/*----- Order Processing Items -----*/
|
||||
|
||||
74
app/controllers/settings/order_queue_stations_controller.rb
Normal file
74
app/controllers/settings/order_queue_stations_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Settings::OrderQueueStationsController < ApplicationController
|
||||
before_action :set_settings_order_queue_station, only: [:show, :edit,:new, :update, :destroy]
|
||||
|
||||
# GET /settings/order_queue_stations
|
||||
# GET /settings/order_queue_stations.json
|
||||
def index
|
||||
@settings_order_queue_stations = OrderQueueStation.all
|
||||
end
|
||||
|
||||
# GET /settings/order_queue_stations/1
|
||||
# GET /settings/order_queue_stations/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /settings/order_queue_stations/new
|
||||
def new
|
||||
@settings_order_queue_station = OrderQueueStation.new
|
||||
end
|
||||
|
||||
# GET /settings/order_queue_stations/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /settings/order_queue_stations
|
||||
# POST /settings/order_queue_stations.json
|
||||
def create
|
||||
@settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_order_queue_station.save
|
||||
format.html { redirect_to @settings_order_queue_station, notice: 'Order queue station was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_order_queue_station }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @settings_order_queue_station.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /settings/order_queue_stations/1
|
||||
# PATCH/PUT /settings/order_queue_stations/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @settings_order_queue_station.update(settings_order_queue_station_params)
|
||||
format.html { redirect_to settings_order_queue_station_path(@settings_order_queue_station), notice: 'Order queue station was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_order_queue_station }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @settings_order_queue_station.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /settings/order_queue_stations/1
|
||||
# DELETE /settings/order_queue_stations/1.json
|
||||
def destroy
|
||||
@settings_order_queue_station.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_order_queue_stations_url, notice: 'Order queue station was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_order_queue_station
|
||||
@settings_order_queue_station = OrderQueueStation.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_order_queue_station_params
|
||||
params.require(:order_queue_station).permit(:station_name, :is_active, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by)
|
||||
end
|
||||
end
|
||||
62
app/controllers/settings/processing_items_controller.rb
Normal file
62
app/controllers/settings/processing_items_controller.rb
Normal file
@@ -0,0 +1,62 @@
|
||||
class Settings::ProcessingItemsController < ApplicationController
|
||||
before_action :set_settings_order_queue_station, only: [:show, :edit, :new, :update, :destroy]
|
||||
|
||||
# GET /settings/order_queue_stations
|
||||
# GET /settings/order_queue_stations.json
|
||||
def index
|
||||
@settings_order_queue_stations = OrderQueueStation.all
|
||||
end
|
||||
|
||||
# GET /settings/order_queue_stations/1
|
||||
# GET /settings/order_queue_stations/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /settings/order_queue_stations/new
|
||||
def new
|
||||
#Load list of categories that has product assigned.
|
||||
@menu_categories = MenuCategory.where("id in (Select distinct menu_category_id from menu_items where menu_category_id is not null)")
|
||||
|
||||
end
|
||||
|
||||
# GET /settings/order_queue_stations/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /settings/order_queue_stations
|
||||
# POST /settings/order_queue_stations.json
|
||||
def create
|
||||
|
||||
end
|
||||
|
||||
# PATCH/PUT /settings/order_queue_stations/1
|
||||
# PATCH/PUT /settings/order_queue_stations/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @settings_order_queue_station.update(settings_order_queue_station_params)
|
||||
format.html { redirect_to order_queue_station_path(@settings_order_queue_station), notice: 'Order queue station was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_order_queue_station }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @settings_order_queue_station.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /settings/order_queue_stations/1
|
||||
# DELETE /settings/order_queue_stations/1.json
|
||||
def destroy
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_order_queue_station
|
||||
@settings_order_queue_station = OrderQueueStation.find(params[:order_queue_station_id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_order_queue_station_params
|
||||
params.require(:order_queue_station).permit(:station_name, :is_active, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by)
|
||||
end
|
||||
end
|
||||
2
app/helpers/settings/order_queue_stations_helper.rb
Normal file
2
app/helpers/settings/order_queue_stations_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Settings::OrderQueueStationsHelper
|
||||
end
|
||||
@@ -12,7 +12,8 @@
|
||||
<li><%= link_to "Menu Categories", settings_menu_categories_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Menu Item Attributes", settings_menu_item_attributes_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Menu Item Options",settings_menu_item_options_path, :tabindex =>"-1" %></li>
|
||||
|
||||
<hr>
|
||||
<li><%= link_to "Order Queue Stations",settings_order_queue_stations_path, :tabindex =>"-1" %></li>
|
||||
<hr>
|
||||
<li><%= link_to "Cashier Terminals ", settings_cashier_terminals_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="author" content=""/>
|
||||
<meta name="description" content="SMARTSALES RESTAURANTS"/>
|
||||
<meta name="author" content="code2LAB"/>
|
||||
|
||||
<title>SmartSales : Restaurant</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
@@ -13,14 +13,10 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Is active</th>
|
||||
<th>Is currently login</th>
|
||||
<th>Auto print receipt</th>
|
||||
<th>Active</th>
|
||||
<th>Login?</th>
|
||||
<th>Auto print</th>
|
||||
<th>Printer name</th>
|
||||
<th>Header</th>
|
||||
<th>Footer</th>
|
||||
<th>Font</th>
|
||||
<th>Font size</th>
|
||||
<th>Show tax</th>
|
||||
<th>Show cashier</th>
|
||||
<th>Show guest info</th>
|
||||
@@ -36,10 +32,6 @@
|
||||
<td><%= settings_cashier_terminal.is_currently_login %></td>
|
||||
<td><%= settings_cashier_terminal.auto_print_receipt %></td>
|
||||
<td><%= settings_cashier_terminal.printer_name %></td>
|
||||
<td><%= settings_cashier_terminal.header %></td>
|
||||
<td><%= settings_cashier_terminal.footer %></td>
|
||||
<td><%= settings_cashier_terminal.font %></td>
|
||||
<td><%= settings_cashier_terminal.font_size %></td>
|
||||
<td><%= settings_cashier_terminal.show_tax %></td>
|
||||
<td><%= settings_cashier_terminal.show_cashier %></td>
|
||||
<td><%= settings_cashier_terminal.show_guest_info %></td>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Menu Categories</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_menu_category_path,:class => 'btn btn-primary btn-sm' %>
|
||||
<!-- <%= link_to t('.new', :default => t("helpers.links.new")),new_settings_menu_category_path,:class => 'btn btn-primary btn-sm' %> -->
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -27,7 +27,7 @@
|
||||
<tbody>
|
||||
<% @settings_menu_categories.each do |settings_menu_category| %>
|
||||
<tr>
|
||||
<td><%= settings_menu_category.menu rescue '' %></td>
|
||||
<td><%= link_to settings_menu_category.menu.name, settings_menu_path(settings_menu_category.menu) %></td>
|
||||
<td><%= link_to settings_menu_category.name, settings_menu_category_path(settings_menu_category) %></td>
|
||||
|
||||
<td><%= settings_menu_category.alt_name rescue ''%></td>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= simple_form_for(@settings_menu_item) do |f| %>
|
||||
<%= simple_form_for([:setting, @settings_menu_item]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
|
||||
19
app/views/settings/order_queue_stations/_form.html.erb
Normal file
19
app/views/settings/order_queue_stations/_form.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<%= simple_form_for([:settings,@settings_order_queue_station]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :station_name %>
|
||||
<%= f.input :is_active %>
|
||||
<%= f.input :printer_name %>
|
||||
<%= f.input :font_size %>
|
||||
<%= f.input :print_copy %>
|
||||
<%= f.input :cut_per_item %>
|
||||
<%= f.input :use_alternate_name %>
|
||||
<%= f.input :processing_items, as: :hidden %>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! settings_order_queue_station, :id, :station_name, :is_active, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by, :created_at, :updated_at
|
||||
json.url settings_order_queue_station_url(settings_order_queue_station, format: :json)
|
||||
6
app/views/settings/order_queue_stations/edit.html.erb
Normal file
6
app/views/settings/order_queue_stations/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing Settings Order Queue Station</h1>
|
||||
|
||||
<%= render 'form', settings_order_queue_station: @settings_order_queue_station %>
|
||||
|
||||
<%= link_to 'Show', @settings_order_queue_station %> |
|
||||
<%= link_to 'Back', settings_order_queue_stations_path %>
|
||||
46
app/views/settings/order_queue_stations/index.html.erb
Normal file
46
app/views/settings/order_queue_stations/index.html.erb
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Order Queue Stations</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_order_queue_station_path,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Station name</th>
|
||||
<th>Is active</th>
|
||||
<th>Print copy</th>
|
||||
<th>Printer name</th>
|
||||
<th>Cut per item</th>
|
||||
<th>Use alternate name</th>
|
||||
<th>Created by</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @settings_order_queue_stations.each do |settings_order_queue_station| %>
|
||||
<tr>
|
||||
<td><%= link_to settings_order_queue_station.station_name, settings_order_queue_station_path(settings_order_queue_station) %></td>
|
||||
<td><%= settings_order_queue_station.is_active %></td>
|
||||
<td><%= settings_order_queue_station.print_copy %></td>
|
||||
<td><%= settings_order_queue_station.printer_name %></td>
|
||||
<td><%= settings_order_queue_station.cut_per_item %></td>
|
||||
<td><%= settings_order_queue_station.use_alternate_name %></td>
|
||||
<td><%= settings_order_queue_station.created_by %></td>
|
||||
<td><%= link_to 'Assign Processing Items', new_settings_order_queue_station_processing_item_path(settings_order_queue_station) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_order_queue_station_path(settings_order_queue_station) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
json.array! @settings_order_queue_stations, partial: 'settings_order_queue_stations/settings_order_queue_station', as: :settings_order_queue_station
|
||||
10
app/views/settings/order_queue_stations/new.html.erb
Normal file
10
app/views/settings/order_queue_stations/new.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_order_queue_stations_path %>">Order Queue Stations</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', settings_order_queue_station: @settings_order_queue_station %>
|
||||
</div>
|
||||
50
app/views/settings/order_queue_stations/show.html.erb
Normal file
50
app/views/settings/order_queue_stations/show.html.erb
Normal file
@@ -0,0 +1,50 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Station name:</strong>
|
||||
<%= @settings_order_queue_station.station_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Is active:</strong>
|
||||
<%= @settings_order_queue_station.is_active %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Processing items:</strong>
|
||||
<%= @settings_order_queue_station.processing_items %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Print copy:</strong>
|
||||
<%= @settings_order_queue_station.print_copy %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Printer name:</strong>
|
||||
<%= @settings_order_queue_station.printer_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Font size:</strong>
|
||||
<%= @settings_order_queue_station.font_size %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Cut per item:</strong>
|
||||
<%= @settings_order_queue_station.cut_per_item %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Use alternate name:</strong>
|
||||
<%= @settings_order_queue_station.use_alternate_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Created by:</strong>
|
||||
<%= @settings_order_queue_station.created_by %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_settings_order_queue_station_path(@settings_order_queue_station) %> | <%= link_to 'Destroy', settings_order_queue_station_path(@settings_order_queue_station), method: :delete, data: { confirm: 'Are you sure?' } %> |
|
||||
|
||||
<%= link_to 'Back', settings_order_queue_stations_path %>
|
||||
@@ -0,0 +1 @@
|
||||
json.partial! "settings_order_queue_stations/settings_order_queue_station", settings_order_queue_station: @settings_order_queue_station
|
||||
35
app/views/settings/processing_items/_form.html.erb
Normal file
35
app/views/settings/processing_items/_form.html.erb
Normal file
@@ -0,0 +1,35 @@
|
||||
<%= simple_form_for([:settings,@settings_order_queue_station]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
<%= f.input :processing_items, as: :hidden %>
|
||||
<strong>Select Menu Items</strong><br/><br/>
|
||||
<div class="row">
|
||||
<% @menu_categories.each do |category|%>
|
||||
|
||||
<div class="col-lg-3 col-md-3 col-sm-6">
|
||||
<div class="card" style="padding-left:5px">
|
||||
<div class="card-title">
|
||||
<h4><%= category.name %>
|
||||
<br/><br/>
|
||||
|
||||
<button type="button" data-id="menu_items_category_<%= category.id %>" class="btn btn-default processingitems_all" aria-label="Left Align">
|
||||
<i class="fa fa-list" aria-hidden="true"></i>
|
||||
</button>
|
||||
<button type="button" data-id="menu_items_category_<%= category.id %>" class="processingitems_clr btn btn-default" aria-label="Left Align">
|
||||
<i class="fa fa-minus-circle" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
<ul class="opi_ul" id="menu_items_category_<%= category.id %>">
|
||||
<% category.menu_items.each do |item| %>
|
||||
|
||||
<li><div class="processitems opi_default" data-id="<%= item.item_code %>"><%= item.name %></div></li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit, label: "Add Menu Items to Queue Station" %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! settings_order_queue_station, :id, :station_name, :is_active, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by, :created_at, :updated_at
|
||||
json.url settings_order_queue_station_url(settings_order_queue_station, format: :json)
|
||||
6
app/views/settings/processing_items/edit.html.erb
Normal file
6
app/views/settings/processing_items/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing Settings Order Queue Station</h1>
|
||||
|
||||
<%= render 'form', settings_order_queue_station: @settings_order_queue_station %>
|
||||
|
||||
<%= link_to 'Show', @settings_order_queue_station %> |
|
||||
<%= link_to 'Back', settings_order_queue_stations_path %>
|
||||
46
app/views/settings/processing_items/index.html.erb
Normal file
46
app/views/settings/processing_items/index.html.erb
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Order Queue Stations</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_order_queue_station_path,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Station name</th>
|
||||
<th>Is active</th>
|
||||
<th>Print copy</th>
|
||||
<th>Printer name</th>
|
||||
<th>Cut per item</th>
|
||||
<th>Use alternate name</th>
|
||||
<th>Created by</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @settings_order_queue_stations.each do |settings_order_queue_station| %>
|
||||
<tr>
|
||||
<td><%= link_to settings_order_queue_station.station_name, settings_order_queue_station_path(settings_order_queue_station) %></td>
|
||||
<td><%= settings_order_queue_station.is_active %></td>
|
||||
<td><%= settings_order_queue_station.print_copy %></td>
|
||||
<td><%= settings_order_queue_station.printer_name %></td>
|
||||
<td><%= settings_order_queue_station.cut_per_item %></td>
|
||||
<td><%= settings_order_queue_station.use_alternate_name %></td>
|
||||
<td><%= settings_order_queue_station.created_by %></td>
|
||||
<td><%= link_to 'Assign Processing Items', settings_order_queue_station_path(settings_order_queue_station) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_order_queue_station_path(settings_order_queue_station) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
1
app/views/settings/processing_items/index.json.jbuilder
Normal file
1
app/views/settings/processing_items/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @settings_order_queue_stations, partial: 'settings_order_queue_stations/settings_order_queue_station', as: :settings_order_queue_station
|
||||
10
app/views/settings/processing_items/new.html.erb
Normal file
10
app/views/settings/processing_items/new.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_order_queue_stations_path %>">Order Queue Stations</a></li>
|
||||
<li><%= @settings_order_queue_station.station_name %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', settings_order_queue_station: @settings_order_queue_station %>
|
||||
</div>
|
||||
50
app/views/settings/processing_items/show.html.erb
Normal file
50
app/views/settings/processing_items/show.html.erb
Normal file
@@ -0,0 +1,50 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Station name:</strong>
|
||||
<%= @settings_order_queue_station.station_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Is active:</strong>
|
||||
<%= @settings_order_queue_station.is_active %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Processing items:</strong>
|
||||
<%= @settings_order_queue_station.processing_items %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Print copy:</strong>
|
||||
<%= @settings_order_queue_station.print_copy %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Printer name:</strong>
|
||||
<%= @settings_order_queue_station.printer_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Font size:</strong>
|
||||
<%= @settings_order_queue_station.font_size %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Cut per item:</strong>
|
||||
<%= @settings_order_queue_station.cut_per_item %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Use alternate name:</strong>
|
||||
<%= @settings_order_queue_station.use_alternate_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Created by:</strong>
|
||||
<%= @settings_order_queue_station.created_by %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_settings_order_queue_station_path(@settings_order_queue_station) %> | <%= link_to 'Destroy', settings_order_queue_station_path(@settings_order_queue_station), method: :delete, data: { confirm: 'Are you sure?' } %> |
|
||||
|
||||
<%= link_to 'Back', settings_order_queue_stations_path %>
|
||||
1
app/views/settings/processing_items/show.json.jbuilder
Normal file
1
app/views/settings/processing_items/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "settings_order_queue_stations/settings_order_queue_station", settings_order_queue_station: @settings_order_queue_station
|
||||
@@ -125,6 +125,10 @@ Rails.application.routes.draw do
|
||||
resources :cashier_terminals
|
||||
#order_job_stations
|
||||
resources :order_job_stations
|
||||
#order_queue_stations
|
||||
resources :order_queue_stations do
|
||||
resources :processing_items, :only => [:new, :create]
|
||||
end
|
||||
#payment method settings
|
||||
resources :payment_method_settings
|
||||
#membership_settings
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateCashierTerminals < ActiveRecord::Migration[5.0]
|
||||
t.string :name, :null => false
|
||||
t.boolean :is_active, :null => false, :default => true
|
||||
t.boolean :is_currently_login, :null => false, :default => false
|
||||
t.string :auto_print_receipt, :null => false, :default => false
|
||||
t.boolean :auto_print_receipt, :null => false, :default => false
|
||||
t.string :printer_name
|
||||
t.json :header
|
||||
t.json :footer
|
||||
|
||||
@@ -18,3 +18,5 @@ rails generate scaffold_controller Setup/PaymentMethodSetting payment_method:str
|
||||
|
||||
rails generate scaffold Setup/TaxProfile name:string rate:decimal inclusive:boolean order_by:integer created_by:string --no-migration --skip-model
|
||||
rails generate scaffold_controller Setup/CashierTerminal name:string is_active:boolean is_currently_login:boolean auto_print_receipt:string printer_name:string header:json footer:json font:string font_size:string show_tax:boolean show_cashier:boolean show_guest_info:boolean --no-migration
|
||||
|
||||
rails generate scaffold_controller Settings/OrderQueueStation station_name:string is_active:boolean processing_items:json print_copy:boolean printer_name:string font_size:integer cut_per_item:boolean use_alternate_name:boolean created_by:string --no-migration
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
||||
# It demonstrates how one might use RSpec to specify the controller code that
|
||||
# was generated by Rails when you ran the scaffold generator.
|
||||
#
|
||||
# It assumes that the implementation code is generated by the rails scaffold
|
||||
# generator. If you are using any extension libraries to generate different
|
||||
# controller code, this generated spec may or may not pass.
|
||||
#
|
||||
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
||||
# of tools you can use to make these specs even more expressive, but we're
|
||||
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
||||
#
|
||||
# Compared to earlier versions of this generator, there is very limited use of
|
||||
# stubs and message expectations in this spec. Stubs are only used when there
|
||||
# is no simpler way to get a handle on the object needed for the example.
|
||||
# Message expectations are only used when there is no simpler way to specify
|
||||
# that an instance is receiving a specific message.
|
||||
#
|
||||
# Also compared to earlier versions of this generator, there are no longer any
|
||||
# expectations of assigns and templates rendered. These features have been
|
||||
# removed from Rails core in Rails 5, but can be added back in via the
|
||||
# `rails-controller-testing` gem.
|
||||
|
||||
RSpec.describe Settings::OrderQueueStationsController, type: :controller do
|
||||
|
||||
# This should return the minimal set of attributes required to create a valid
|
||||
# Settings::OrderQueueStation. As you add validations to Settings::OrderQueueStation, be sure to
|
||||
# adjust the attributes here as well.
|
||||
let(:valid_attributes) {
|
||||
skip("Add a hash of attributes valid for your model")
|
||||
}
|
||||
|
||||
let(:invalid_attributes) {
|
||||
skip("Add a hash of attributes invalid for your model")
|
||||
}
|
||||
|
||||
# This should return the minimal set of values that should be in the session
|
||||
# in order to pass any filters (e.g. authentication) defined in
|
||||
# Settings::OrderQueueStationsController. Be sure to keep this updated too.
|
||||
let(:valid_session) { {} }
|
||||
|
||||
describe "GET #index" do
|
||||
it "returns a success response" do
|
||||
order_queue_station = Settings::OrderQueueStation.create! valid_attributes
|
||||
get :index, params: {}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #show" do
|
||||
it "returns a success response" do
|
||||
order_queue_station = Settings::OrderQueueStation.create! valid_attributes
|
||||
get :show, params: {id: order_queue_station.to_param}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #new" do
|
||||
it "returns a success response" do
|
||||
get :new, params: {}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #edit" do
|
||||
it "returns a success response" do
|
||||
order_queue_station = Settings::OrderQueueStation.create! valid_attributes
|
||||
get :edit, params: {id: order_queue_station.to_param}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST #create" do
|
||||
context "with valid params" do
|
||||
it "creates a new Settings::OrderQueueStation" do
|
||||
expect {
|
||||
post :create, params: {settings_order_queue_station: valid_attributes}, session: valid_session
|
||||
}.to change(Settings::OrderQueueStation, :count).by(1)
|
||||
end
|
||||
|
||||
it "redirects to the created settings_order_queue_station" do
|
||||
post :create, params: {settings_order_queue_station: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(Settings::OrderQueueStation.last)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'new' template)" do
|
||||
post :create, params: {settings_order_queue_station: invalid_attributes}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "PUT #update" do
|
||||
context "with valid params" do
|
||||
let(:new_attributes) {
|
||||
skip("Add a hash of attributes valid for your model")
|
||||
}
|
||||
|
||||
it "updates the requested settings_order_queue_station" do
|
||||
order_queue_station = Settings::OrderQueueStation.create! valid_attributes
|
||||
put :update, params: {id: order_queue_station.to_param, settings_order_queue_station: new_attributes}, session: valid_session
|
||||
order_queue_station.reload
|
||||
skip("Add assertions for updated state")
|
||||
end
|
||||
|
||||
it "redirects to the settings_order_queue_station" do
|
||||
order_queue_station = Settings::OrderQueueStation.create! valid_attributes
|
||||
put :update, params: {id: order_queue_station.to_param, settings_order_queue_station: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(order_queue_station)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'edit' template)" do
|
||||
order_queue_station = Settings::OrderQueueStation.create! valid_attributes
|
||||
put :update, params: {id: order_queue_station.to_param, settings_order_queue_station: invalid_attributes}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE #destroy" do
|
||||
it "destroys the requested settings_order_queue_station" do
|
||||
order_queue_station = Settings::OrderQueueStation.create! valid_attributes
|
||||
expect {
|
||||
delete :destroy, params: {id: order_queue_station.to_param}, session: valid_session
|
||||
}.to change(Settings::OrderQueueStation, :count).by(-1)
|
||||
end
|
||||
|
||||
it "redirects to the settings_order_queue_stations list" do
|
||||
order_queue_station = Settings::OrderQueueStation.create! valid_attributes
|
||||
delete :destroy, params: {id: order_queue_station.to_param}, session: valid_session
|
||||
expect(response).to redirect_to(settings_order_queue_stations_url)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
15
spec/helpers/settings/order_queue_stations_helper_spec.rb
Normal file
15
spec/helpers/settings/order_queue_stations_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 Settings::OrderQueueStationsHelper. For example:
|
||||
#
|
||||
# describe Settings::OrderQueueStationsHelper 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 Settings::OrderQueueStationsHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
10
spec/requests/settings/settings_order_queue_stations_spec.rb
Normal file
10
spec/requests/settings/settings_order_queue_stations_spec.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "Settings::OrderQueueStations", type: :request do
|
||||
describe "GET /settings_order_queue_stations" do
|
||||
it "works! (now write some real specs)" do
|
||||
get settings_order_queue_stations_path
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
39
spec/routing/settings/order_queue_stations_routing_spec.rb
Normal file
39
spec/routing/settings/order_queue_stations_routing_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Settings::OrderQueueStationsController, type: :routing do
|
||||
describe "routing" do
|
||||
|
||||
it "routes to #index" do
|
||||
expect(:get => "/settings/order_queue_stations").to route_to("settings/order_queue_stations#index")
|
||||
end
|
||||
|
||||
it "routes to #new" do
|
||||
expect(:get => "/settings/order_queue_stations/new").to route_to("settings/order_queue_stations#new")
|
||||
end
|
||||
|
||||
it "routes to #show" do
|
||||
expect(:get => "/settings/order_queue_stations/1").to route_to("settings/order_queue_stations#show", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #edit" do
|
||||
expect(:get => "/settings/order_queue_stations/1/edit").to route_to("settings/order_queue_stations#edit", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #create" do
|
||||
expect(:post => "/settings/order_queue_stations").to route_to("settings/order_queue_stations#create")
|
||||
end
|
||||
|
||||
it "routes to #update via PUT" do
|
||||
expect(:put => "/settings/order_queue_stations/1").to route_to("settings/order_queue_stations#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #update via PATCH" do
|
||||
expect(:patch => "/settings/order_queue_stations/1").to route_to("settings/order_queue_stations#update", :id => "1")
|
||||
end
|
||||
|
||||
it "routes to #destroy" do
|
||||
expect(:delete => "/settings/order_queue_stations/1").to route_to("settings/order_queue_stations#destroy", :id => "1")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "settings/order_queue_stations/edit", type: :view do
|
||||
before(:each) do
|
||||
@settings_order_queue_station = assign(:settings_order_queue_station, Settings::OrderQueueStation.create!(
|
||||
:station_name => "MyString",
|
||||
:is_active => false,
|
||||
:processing_items => "",
|
||||
:print_copy => false,
|
||||
:printer_name => "MyString",
|
||||
:font_size => 1,
|
||||
:cut_per_item => false,
|
||||
:use_alternate_name => false,
|
||||
:created_by => "MyString"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders the edit settings_order_queue_station form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", settings_order_queue_station_path(@settings_order_queue_station), "post" do
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[station_name]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[is_active]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[processing_items]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[print_copy]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[printer_name]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[font_size]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[cut_per_item]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[use_alternate_name]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[created_by]"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,43 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "settings/order_queue_stations/index", type: :view do
|
||||
before(:each) do
|
||||
assign(:settings_order_queue_stations, [
|
||||
Settings::OrderQueueStation.create!(
|
||||
:station_name => "Station Name",
|
||||
:is_active => false,
|
||||
:processing_items => "",
|
||||
:print_copy => false,
|
||||
:printer_name => "Printer Name",
|
||||
:font_size => 2,
|
||||
:cut_per_item => false,
|
||||
:use_alternate_name => false,
|
||||
:created_by => "Created By"
|
||||
),
|
||||
Settings::OrderQueueStation.create!(
|
||||
:station_name => "Station Name",
|
||||
:is_active => false,
|
||||
:processing_items => "",
|
||||
:print_copy => false,
|
||||
:printer_name => "Printer Name",
|
||||
:font_size => 2,
|
||||
:cut_per_item => false,
|
||||
:use_alternate_name => false,
|
||||
:created_by => "Created By"
|
||||
)
|
||||
])
|
||||
end
|
||||
|
||||
it "renders a list of settings/order_queue_stations" do
|
||||
render
|
||||
assert_select "tr>td", :text => "Station Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => false.to_s, :count => 2
|
||||
assert_select "tr>td", :text => "".to_s, :count => 2
|
||||
assert_select "tr>td", :text => false.to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Printer Name".to_s, :count => 2
|
||||
assert_select "tr>td", :text => 2.to_s, :count => 2
|
||||
assert_select "tr>td", :text => false.to_s, :count => 2
|
||||
assert_select "tr>td", :text => false.to_s, :count => 2
|
||||
assert_select "tr>td", :text => "Created By".to_s, :count => 2
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "settings/order_queue_stations/new", type: :view do
|
||||
before(:each) do
|
||||
assign(:settings_order_queue_station, Settings::OrderQueueStation.new(
|
||||
:station_name => "MyString",
|
||||
:is_active => false,
|
||||
:processing_items => "",
|
||||
:print_copy => false,
|
||||
:printer_name => "MyString",
|
||||
:font_size => 1,
|
||||
:cut_per_item => false,
|
||||
:use_alternate_name => false,
|
||||
:created_by => "MyString"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders new settings_order_queue_station form" do
|
||||
render
|
||||
|
||||
assert_select "form[action=?][method=?]", settings_order_queue_stations_path, "post" do
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[station_name]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[is_active]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[processing_items]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[print_copy]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[printer_name]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[font_size]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[cut_per_item]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[use_alternate_name]"
|
||||
|
||||
assert_select "input[name=?]", "settings_order_queue_station[created_by]"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "settings/order_queue_stations/show", type: :view do
|
||||
before(:each) do
|
||||
@settings_order_queue_station = assign(:settings_order_queue_station, Settings::OrderQueueStation.create!(
|
||||
:station_name => "Station Name",
|
||||
:is_active => false,
|
||||
:processing_items => "",
|
||||
:print_copy => false,
|
||||
:printer_name => "Printer Name",
|
||||
:font_size => 2,
|
||||
:cut_per_item => false,
|
||||
:use_alternate_name => false,
|
||||
:created_by => "Created By"
|
||||
))
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
expect(rendered).to match(/Station Name/)
|
||||
expect(rendered).to match(/false/)
|
||||
expect(rendered).to match(//)
|
||||
expect(rendered).to match(/false/)
|
||||
expect(rendered).to match(/Printer Name/)
|
||||
expect(rendered).to match(/2/)
|
||||
expect(rendered).to match(/false/)
|
||||
expect(rendered).to match(/false/)
|
||||
expect(rendered).to match(/Created By/)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user