added induties

This commit is contained in:
Myat Zin Wai Maw
2019-06-17 17:45:21 +06:30
parent 98bbf419fe
commit 047f2941cb
37 changed files with 822 additions and 24 deletions

View File

@@ -18,6 +18,7 @@ class Settings::CommissionersController < ApplicationController
def new
@commissioner = Commissioner.new
@employee = Employee.all.order('name asc')
end
# GET /commissioners/1/edit
@@ -35,14 +36,21 @@ class Settings::CommissionersController < ApplicationController
unless @commissioner.resigned_date.nil?
@commissioner.resigned_date = @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d')
end
respond_to do |format|
if @commissioner.save
format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'}
format.json {render :show, status: :created, location: @commissioner}
else
format.html {render :new}
format.json {render json: @commissioner.errors, status: :unprocessable_entity}
# puts params[:from_induty].length
if (params[:from_induty] != "true")
respond_to do |format|
if @commissioner.save
format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'}
format.json {render :show, status: :created, location: @commissioner}
else
format.html {render :new}
format.json {render json: @commissioner.errors, status: :unprocessable_entity}
end
end
else
@commissioner.save
flash[:notice] = 'Commissioner was successfully created.'
redirect_to induties_assign_in_duties_path(params[:booking_id])
end
end