merge with settings_backend

This commit is contained in:
Yan
2017-06-18 12:30:06 +06:30
26 changed files with 610 additions and 57 deletions

View File

@@ -71,6 +71,11 @@ class Settings::OrderQueueStationsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_order_queue_station_params
# <<<<<<< HEAD
params.require(:order_queue_station).permit(:station_name, :is_active, :auto_print, :processing_items, :print_copy, :printer_name, :font_size, :cut_per_item, :use_alternate_name, :created_by)
# =======
# Don't Know { zone_ids: [] }
# 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,{ zone_ids: [] })
# >>>>>>> b093a993ba002c92659bbb34338c55c031c11d87
end
end

View File

@@ -0,0 +1,81 @@
class Settings::RoomsController < ApplicationController
before_action :set_settings_room, only: [:show, :edit, :update, :destroy]
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create]
# GET /settings/rooms
# GET /settings/rooms.json
def index
@settings_rooms = @zone.rooms
end
# GET /settings/rooms/1
# GET /settings/rooms/1.json
def show
@room = Room.find(params[:id])
end
# GET /settings/rooms/new
def new
@settings_room = Room.new
end
# GET /settings/rooms/1/edit
def edit
end
# POST /settings/rooms
# POST /settings/rooms.json
def create
@settings_room = Room.new(settings_room_params)
@settings_room.type = DiningFacility::ROOM_TYPE
@settings_room.zone_id = params[:zone_id]
respond_to do |format|
if @settings_room.save
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully created.' }
format.json { render :show, status: :created, location: @settings_room }
else
puts "abc"
format.html { render :new }
format.json { render json: @settings_room.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /settings/rooms/1
# PATCH/PUT /settings/rooms/1.json
def update
respond_to do |format|
if @settings_room.update(settings_room_params)
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_room }
else
format.html { render :edit }
format.json { render json: @settings_room.errors, status: :unprocessable_entity }
end
end
end
# DELETE /settings/rooms/1
# DELETE /settings/rooms/1.json
def destroy
@settings_room.destroy
respond_to do |format|
format.html { redirect_to settings_zones_path, notice: 'Room was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_settings_room
@settings_room = Room.find(params[:id])
end
def set_settings_zone
@zone = Zone.find(params[:zone_id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_room_params
params.require(:room).permit(:name, :status, :seater, :order_by,:is_active ,:id, :zone_id, :created_by)
end
end

View File

@@ -0,0 +1,81 @@
class Settings::TablesController < ApplicationController
before_action :set_settings_table, only: [:show, :edit, :update, :destroy]
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create]
# GET /settings/tables
# GET /settings/tables.json
def index
@settings_tables = @zone.tables
end
# GET /settings/tables/1
# GET /settings/tables/1.json
def show
@table = Table.find(params[:id])
end
# GET /settings/tables/new
def new
@settings_table = Table.new
end
# GET /settings/tables/1/edit
def edit
end
# POST /settings/tables
# POST /settings/tables.json
def create
@settings_table = Table.new(settings_table_params)
@settings_table.type = DiningFacility::TABLE_TYPE
@settings_table.zone_id = params[:zone_id]
respond_to do |format|
if @settings_table.save
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully created.' }
format.json { render :show, status: :created, location: @settings_table }
else
puts "abc"
format.html { render :new }
format.json { render json: @settings_table.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /settings/tables/1
# PATCH/PUT /settings/tables/1.json
def update
respond_to do |format|
if @settings_table.update(settings_table_params)
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_table }
else
format.html { render :edit }
format.json { render json: @settings_table.errors, status: :unprocessable_entity }
end
end
end
# DELETE /settings/tables/1
# DELETE /settings/tables/1.json
def destroy
@settings_table.destroy
respond_to do |format|
format.html { redirect_to settings_zones_path, notice: 'Table was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_settings_table
@settings_table = Table.find(params[:id])
end
def set_settings_zone
@zone = Zone.find(params[:zone_id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_table_params
params.require(:table).permit(:name, :status, :seater, :order_by,:is_active ,:id, :zone_id, :created_by)
end
end

View File

@@ -10,6 +10,8 @@ class Settings::ZonesController < ApplicationController
# GET /settings/zones/1
# GET /settings/zones/1.json
def show
@settings_tables = @settings_zone.tables
@settings_rooms = @settings_zone.rooms
end
# GET /settings/zones/new
@@ -28,7 +30,7 @@ class Settings::ZonesController < ApplicationController
respond_to do |format|
if @settings_zone.save
format.html { redirect_to @settings_zone, notice: 'Zone was successfully created.' }
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully created.' }
format.json { render :show, status: :created, location: @settings_zone }
else
format.html { render :new }
@@ -42,7 +44,7 @@ class Settings::ZonesController < ApplicationController
def update
respond_to do |format|
if @settings_zone.update(settings_zone_params)
format.html { redirect_to @settings_zone, notice: 'Zone was successfully updated.' }
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_zone }
else
format.html { render :edit }
@@ -56,7 +58,7 @@ class Settings::ZonesController < ApplicationController
def destroy
@settings_zone.destroy
respond_to do |format|
format.html { redirect_to settings_zones_url, notice: 'Zone was successfully destroyed.' }
format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' }
format.json { head :no_content }
end
end
@@ -69,6 +71,6 @@ class Settings::ZonesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def settings_zone_params
params.require(:settings_zone).permit(:name, :is_active, :created_by)
params.require(:zone).permit(:name, :is_active, :created_by)
end
end

View File

@@ -6,6 +6,9 @@ class Employee < ApplicationRecord
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
def self.collection
Employee.select("id, name").map { |e| [e.name, e.id] }
end
def self.login(emp_id, password)
user = Employee.find_by_emp_id(emp_id)

View File

@@ -5,6 +5,8 @@
class OrderQueueStation < ApplicationRecord
has_many :assigned_order_items
has_many :order_items
has_many :order_queue_process_by_zones
has_many :zones, through: :order_queue_process_by_zones
scope :active, -> {where(is_active: true)}
@@ -22,7 +24,7 @@ class OrderQueueStation < ApplicationRecord
#Loop through the processing items
pq_items.each do |pq_item|
#Processing through the looping items
order_items.each do |order_item|
order_items.each do |order_item|
if (pq_item == order_item.item_code)
if oqs.id == oqpbz.order_queue_station_id
#Same Order_items can appear in two location.

View File

@@ -2,7 +2,12 @@ class Zone < ApplicationRecord
# model association
has_many :tables, dependent: :destroy
has_many :rooms, dependent: :destroy
has_many :order_queue_stations
# validations
validates_presence_of :name, :created_by
def self.collection
Zone.select("id, name").map { |e| [e.name, e.id] }
end
end

View File

@@ -14,6 +14,7 @@
<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>
<li><%= link_to "Zones", settings_zones_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>

View File

@@ -1,3 +1,8 @@
<style type="text/css">
div.form-inputs span{
padding: 1%;
}
</style>
<%= simple_form_for([:settings,@settings_order_queue_station]) do |f| %>
<%= f.error_notification %>
@@ -8,6 +13,8 @@
<%= f.input :printer_name %>
<%= f.input :font_size %>
<%= f.input :print_copy %>
<%= f.label "Select Zones", :class => 'control-label' %>
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'ta'%>
<%= f.input :cut_per_item %>
<%= f.input :use_alternate_name %>
<%= f.input :processing_items, as: :hidden %>

View File

@@ -0,0 +1,16 @@
<%= simple_form_for([:settings,@zone,@settings_room]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.input :status %>
<%= f.input :seater %>
<%= f.input :order_by %>
<%= f.input :is_active %>
<%= f.input :created_by, :collection => Employee.collection %>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! settings_table, :id, :name, :status, :seater, :order_by, :is_active, :created_by, :created_at, :updated_at
json.url settings_table_url(settings_room, format: :json)

View 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_zone_rooms_path %>">Rooms</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', settings_table: @settings_room %>
</div>

View File

@@ -0,0 +1,51 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li>Rooms</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_zone_room_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Type</th>
<th>Seater</th>
<th>Order by</th>
<th>is Active</th>
<th>Created By</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<% @settings_rooms.each do |room| %>
<tr>
<td><%= link_to room.name, settings_menu_path(room) %></td>
<td><%= room.status %></td>
<td>Room</td>
<td><%= room.seater rescue "-" %></td>
<td><%= room.order_by rescue "-" %></td>
<td><%= room.is_active %></td>
<% if Employee.exists?(room.created_by) %>
<td><%= Employee.find(room.created_by).name %></td>
<% else %>
<td><%= room.created_by %></td>
<% end %>
<td><%= room.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_zone_room_path(@zone,room) %></td>
<td><%= link_to 'Destroy', settings_zone_room_path(@zone,room), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,11 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_zone_path(@zone) %>">Zone</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', settings_table: @settings_room %>
</div>

View File

@@ -0,0 +1,49 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_zone_rooms_path %>">Rooms</a></li>
<li>Details</li>
<span style="float: right">
</span>
</ul>
</div>
<br/>
<div class="card">
<div class="card-block">
<h4 class="card-title">Room</h4>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Room</th>
<th>Seater</th>
<th>Order by</th>
<th>is Active</th>
<th>Created By</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= link_to @room.name, settings_menu_path(@room) %></td>
<td><%= @room.status %></td>
<td>Room</td>
<td><%= @room.seater rescue "-" %></td>
<td><%= @room.order_by rescue "-" %></td>
<td><%= @room.is_active rescue "-" %></td>
<% if Employee.exists?(@room.created_by) %>
<td><%= Employee.find(@room.created_by).name %></td>
<% else %>
<td><%= @room.created_by %></td>
<% end %>
<td><%= @room.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_zone_room_path(@zone,@room) %></td>
<td><%= link_to 'Destroy', settings_zone_room_path(@zone,@room), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,16 @@
<%= simple_form_for([:settings,@zone,@settings_table]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.input :status %>
<%= f.input :seater %>
<%= f.input :order_by %>
<%= f.input :is_active %>
<%= f.input :created_by, :collection => Employee.collection %>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! settings_table, :id, :name, :status, :seater, :order_by, :is_active, :created_by, :created_at, :updated_at
json.url settings_table_url(settings_table, format: :json)

View 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_zone_tables_path %>">Tables</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', settings_table: @settings_table %>
</div>

View File

@@ -0,0 +1,49 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li>Tables</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_zone_table_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Seater</th>
<th>Order by</th>
<th>is Active</th>
<th>Created By</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<% @settings_tables.each do |table| %>
<tr>
<td><%= link_to table.name, settings_menu_path(table) %></td>
<td><%= table.status %></td>
<td><%= table.seater rescue "-" %></td>
<td><%= table.order_by rescue "-" %></td>
<td><%= table.is_active %></td>
<% if Employee.exists?(table.created_by) %>
<td><%= Employee.find(table.created_by).name %></td>
<% else %>
<td><%= table.created_by %></td>
<% end %>
<td><%= table.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_zone_table_path(@zone,table) %></td>
<td><%= link_to 'Destroy', settings_zone_table_path(@zone,table), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,11 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_zone_path(@zone) %>">Zone</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', settings_table: @settings_table %>
</div>

View File

@@ -0,0 +1,47 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_zone_tables_path %>">Tables</a></li>
<li>Details</li>
<span style="float: right">
</span>
</ul>
</div>
<br/>
<div class="card">
<div class="card-block">
<h4 class="card-title">Table</h4>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Seater</th>
<th>Order by</th>
<th>is Active</th>
<th>Created By</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= link_to @table.name, settings_menu_path(@table) %></td>
<td><%= @table.status %></td>
<td><%= @table.seater rescue "-" %></td>
<td><%= @table.order_by rescue "-" %></td>
<td><%= @table.is_active rescue "-" %></td>
<% if Employee.exists?(@table.created_by) %>
<td><%= Employee.find(@table.created_by).name %></td>
<% else %>
<td><%= @table.created_by %></td>
<% end %>
<td><%= @table.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_zone_table_path(@zone,@table) %></td>
<td><%= link_to 'Destroy', settings_zone_table_path(@zone,@table), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@@ -1,10 +1,10 @@
<%= simple_form_for(@settings_zone) do |f| %>
<%= simple_form_for([:settings,@settings_zone]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.input :is_active %>
<%= f.input :created_by %>
<%= f.input :created_by, :collection => Employee.collection %>
</div>
<div class="form-actions">

View File

@@ -1,6 +1,10 @@
<h1>Editing Settings Zone</h1>
<%= render 'form', settings_zone: @settings_zone %>
<%= link_to 'Show', @settings_zone %> |
<%= link_to 'Back', settings_zones_path %>
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_zones_path %>">Zones</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', settings_zone: @settings_zone %>
</div>

View File

@@ -1,31 +1,41 @@
<p id="notice"><%= notice %></p>
<h1>Settings Zones</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Is active</th>
<th>Created by</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @settings_zones.each do |settings_zone| %>
<tr>
<td><%= settings_zone.name %></td>
<td><%= settings_zone.is_active %></td>
<td><%= settings_zone.created_by %></td>
<td><%= link_to 'Show', settings_zone %></td>
<td><%= link_to 'Edit', edit_settings_zone_path(settings_zone) %></td>
<td><%= link_to 'Destroy', settings_zone, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li>Zones</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_zone_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Is active</th>
<th>Created by</th>
<th colspan="3"></th>
</tr>
</thead>
<%= link_to 'New Settings Zone', new_settings_zone_path %>
<tbody>
<% @settings_zones.each do |settings_zone| %>
<tr>
<td><%= settings_zone.name %></td>
<td><%= settings_zone.is_active %></td>
<% if Employee.exists?(settings_zone.created_by) %>
<td><%= Employee.find(settings_zone.created_by).name %></td>
<% else %>
<td><%= settings_zone.created_by %></td>
<% end %>
<td><%= link_to 'Show', settings_zone_path(settings_zone) %></td>
<td><%= link_to 'Edit', edit_settings_zone_path(settings_zone) %></td>
<td><%= link_to 'Destroy', settings_zone_path(settings_zone), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -1,19 +1,97 @@
<p id="notice"><%= notice %></p>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_zones_path %>">Zones</a></li>
<li>Details</li>
<span style="float: right">
<%= link_to 'Back', settings_zones_path %>
</span>
</ul>
</div>
<p>
<strong>Name:</strong>
<%= @settings_zone.name %>
</p>
<br/>
<div class="card">
<div class="card-block">
<h4 class="card-title">Zone</h4>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Is active</th>
<th>Created by</th>
<th colspan="2"></th>
</tr>
</thead>
<p>
<strong>Is active:</strong>
<%= @settings_zone.is_active %>
</p>
<tbody>
<tr>
<td><%= @settings_zone.name %></td>
<td><%= @settings_zone.is_active %></td>
<% if Employee.exists?(@settings_zone.created_by) %>
<td><%= Employee.find(@settings_zone.created_by).name %></td>
<% else %>
<td><%= @settings_zone.created_by %></td>
<% end %>
<td><%= link_to 'Edit', edit_settings_zone_path(@settings_zone) %></td>
<td><%= link_to 'Destroy', settings_zone_path(@settings_zone), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<div class="card">
<div class="card-block">
<h4 class="card-title">Dining Facilities
<span style="float: right">
<%= link_to "New Table",new_settings_zone_table_path(@settings_zone),:class => 'btn btn-primary btn-sm' %>
<%= link_to "New Room",new_settings_zone_room_path(@settings_zone),:class => 'btn btn-primary btn-sm' %>
</span>
</h4>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Seater</th>
<th>Is active</th>
<th>Created by</th>
<th colspan="2"></th>
</tr>
</thead>
<p>
<strong>Created by:</strong>
<%= @settings_zone.created_by %>
</p>
<%= link_to 'Edit', edit_settings_zone_path(@settings_zone) %> |
<%= link_to 'Back', settings_zones_path %>
<tbody>
<% @settings_tables.each do |settings_table|%>
<tr>
<td><%= link_to settings_table.name, settings_zone_table_path(@settings_zone,settings_table) %></td>
<td>Table</td>
<td><%= settings_table.seater %></td>
<td><%= settings_table.is_active %></td>
<% if Employee.exists?(settings_table.created_by) %>
<td><%= Employee.find(settings_table.created_by).name %></td>
<% else %>
<td><%= settings_table.created_by %></td>
<% end %>
<td><%= settings_table.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_zone_table_path(@settings_zone, settings_table) %></td>
</tr>
<% end %>
<% @settings_rooms.each do |room|%>
<tr>
<td><%= link_to room.name, settings_zone_room_path(@settings_zone,room) %></td>
<td>Room</td>
<td><%= room.seater %></td>
<td><%= room.is_active %></td>
<% if Employee.exists?(room.created_by) %>
<td><%= Employee.find(room.created_by).name %></td>
<% else %>
<td><%= room.created_by %></td>
<% end %>
<td><%= room.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_zone_room_path(@settings_zone, room) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>

View File

@@ -4,7 +4,7 @@ class CreateDiningFacilities < ActiveRecord::Migration[5.1]
t.references :zone, foreign_key: true
t.string :name, :null => false
t.string :status, :null => false, :default => "available"
t.string :type, :null => false, :default => "table"
t.string :type, :null => false, :default => "Table"
t.integer :seater, :null => false, :default => 2
t.integer :order_by