Zone Created_at Bug Fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
class Settings::RoomsController < ApplicationController
|
class Settings::RoomsController < ApplicationController
|
||||||
before_action :set_settings_room, only: [:show, :edit, :update, :destroy]
|
before_action :set_settings_room, only: [:show, :edit, :update, :destroy]
|
||||||
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create]
|
before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create,:destroy]
|
||||||
# GET /settings/rooms
|
# GET /settings/rooms
|
||||||
# GET /settings/rooms.json
|
# GET /settings/rooms.json
|
||||||
def index
|
def index
|
||||||
@@ -28,9 +28,10 @@ class Settings::RoomsController < ApplicationController
|
|||||||
@settings_room = Room.new(settings_room_params)
|
@settings_room = Room.new(settings_room_params)
|
||||||
@settings_room.type = DiningFacility::ROOM_TYPE
|
@settings_room.type = DiningFacility::ROOM_TYPE
|
||||||
@settings_room.zone_id = params[:zone_id]
|
@settings_room.zone_id = params[:zone_id]
|
||||||
|
@settings_room.created_by = current_login_employee.name
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_room.save
|
if @settings_room.save
|
||||||
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully created.' }
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' }
|
||||||
format.json { render :show, status: :created, location: @settings_room }
|
format.json { render :show, status: :created, location: @settings_room }
|
||||||
else
|
else
|
||||||
puts "abc"
|
puts "abc"
|
||||||
@@ -43,9 +44,10 @@ class Settings::RoomsController < ApplicationController
|
|||||||
# PATCH/PUT /settings/rooms/1
|
# PATCH/PUT /settings/rooms/1
|
||||||
# PATCH/PUT /settings/rooms/1.json
|
# PATCH/PUT /settings/rooms/1.json
|
||||||
def update
|
def update
|
||||||
|
@settings_room.created_by = current_login_employee.name
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_room.update(settings_room_params)
|
if @settings_room.update(settings_room_params)
|
||||||
format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully updated.' }
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully updated.' }
|
||||||
format.json { render :show, status: :ok, location: @settings_room }
|
format.json { render :show, status: :ok, location: @settings_room }
|
||||||
else
|
else
|
||||||
format.html { render :edit }
|
format.html { render :edit }
|
||||||
@@ -59,7 +61,7 @@ class Settings::RoomsController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
@settings_room.destroy
|
@settings_room.destroy
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to settings_zones_path, notice: 'Room was successfully destroyed.' }
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully destroyed.' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ class Settings::TablesController < ApplicationController
|
|||||||
@settings_table = Table.new(settings_table_params)
|
@settings_table = Table.new(settings_table_params)
|
||||||
@settings_table.type = DiningFacility::TABLE_TYPE
|
@settings_table.type = DiningFacility::TABLE_TYPE
|
||||||
@settings_table.zone_id = params[:zone_id]
|
@settings_table.zone_id = params[:zone_id]
|
||||||
|
@settings_table.created_by = current_login_employee.name
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_table.save
|
if @settings_table.save
|
||||||
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully created.' }
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully created.' }
|
||||||
format.json { render :show, status: :created, location: @settings_table }
|
format.json { render :show, status: :created, location: @settings_table }
|
||||||
else
|
else
|
||||||
puts "abc"
|
|
||||||
format.html { render :new }
|
format.html { render :new }
|
||||||
format.json { render json: @settings_table.errors, status: :unprocessable_entity }
|
format.json { render json: @settings_table.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
@@ -43,9 +43,10 @@ class Settings::TablesController < ApplicationController
|
|||||||
# PATCH/PUT /settings/tables/1
|
# PATCH/PUT /settings/tables/1
|
||||||
# PATCH/PUT /settings/tables/1.json
|
# PATCH/PUT /settings/tables/1.json
|
||||||
def update
|
def update
|
||||||
|
@settings_table.created_by = current_login_employee.name
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_table.update(settings_table_params)
|
if @settings_table.update(settings_table_params)
|
||||||
format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully updated.' }
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully updated.' }
|
||||||
format.json { render :show, status: :ok, location: @settings_table }
|
format.json { render :show, status: :ok, location: @settings_table }
|
||||||
else
|
else
|
||||||
format.html { render :edit }
|
format.html { render :edit }
|
||||||
@@ -59,7 +60,7 @@ class Settings::TablesController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
@settings_table.destroy
|
@settings_table.destroy
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to settings_zones_path, notice: 'Table was successfully destroyed.' }
|
format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully destroyed.' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Settings::ZonesController < ApplicationController
|
|||||||
# POST /settings/zones.json
|
# POST /settings/zones.json
|
||||||
def create
|
def create
|
||||||
@settings_zone = Zone.new(settings_zone_params)
|
@settings_zone = Zone.new(settings_zone_params)
|
||||||
|
@settings_zone.created_by = current_login_employee.name
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_zone.save
|
if @settings_zone.save
|
||||||
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully created.' }
|
format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully created.' }
|
||||||
@@ -43,6 +43,7 @@ class Settings::ZonesController < ApplicationController
|
|||||||
# PATCH/PUT /settings/zones/1.json
|
# PATCH/PUT /settings/zones/1.json
|
||||||
def update
|
def update
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@settings_zone.created_by = current_login_employee.name
|
||||||
if @settings_zone.update(settings_zone_params)
|
if @settings_zone.update(settings_zone_params)
|
||||||
format.html { redirect_to settings_zone_path(@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 }
|
format.json { render :show, status: :ok, location: @settings_zone }
|
||||||
@@ -56,6 +57,8 @@ class Settings::ZonesController < ApplicationController
|
|||||||
# DELETE /settings/zones/1
|
# DELETE /settings/zones/1
|
||||||
# DELETE /settings/zones/1.json
|
# DELETE /settings/zones/1.json
|
||||||
def destroy
|
def destroy
|
||||||
|
@settings_zone.rooms.destroy
|
||||||
|
@settings_zone.tables.destroy
|
||||||
@settings_zone.destroy
|
@settings_zone.destroy
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' }
|
format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' }
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
<%= f.input :seater %>
|
<%= f.input :seater %>
|
||||||
<%= f.input :order_by %>
|
<%= f.input :order_by %>
|
||||||
<%= f.input :is_active %>
|
<%= f.input :is_active %>
|
||||||
<%= f.input :created_by, :collection => Employee.collection %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
<%= f.input :seater %>
|
<%= f.input :seater %>
|
||||||
<%= f.input :order_by %>
|
<%= f.input :order_by %>
|
||||||
<%= f.input :is_active %>
|
<%= f.input :is_active %>
|
||||||
<%= f.input :created_by, :collection => Employee.collection %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
<%= f.input :name %>
|
<%= f.input :name %>
|
||||||
<%= f.input :is_active %>
|
<%= f.input :is_active %>
|
||||||
<%= f.input :created_by, :collection => Employee.collection %>
|
<!-- <%= f.input :created_by, :collection => Employee.collection %> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
Reference in New Issue
Block a user