From 784e740da3844422a3de4f38c3fd780b2b215b2d Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Wed, 6 Sep 2017 11:18:02 +0630 Subject: [PATCH] rename in_juty to in_duty --- .idea/workspace.xml | 683 ++++++++++-------- .../origami/in_duties_controller.rb | 170 +++++ .../origami/in_juties_controller.rb | 170 ----- app/helpers/origami/in_duties_helper.rb | 2 + app/helpers/origami/in_juties_helper.rb | 2 - app/models/{in_juty.rb => in_duty.rb} | 2 +- app/views/origami/home/show.html.erb | 6 +- .../_assign_in_duty.html.erb} | 0 .../_edit_in_duty.html.erb} | 2 +- .../{in_juties => in_duties}/_form.html.erb | 2 +- .../origami/in_duties/_in_duty.json.jbuilder | 2 + .../assign_in_duty.html.erb} | 20 +- .../{in_juties => in_duties}/edit.html.erb | 4 +- .../origami/in_duties/edit_in_duty.html.erb | 6 + .../{in_juties => in_duties}/index.html.erb | 46 +- .../origami/in_duties/index.json.jbuilder | 1 + .../index_in_duty.html.erb} | 48 +- .../{in_juties => in_duties}/new.html.erb | 4 +- .../{in_juties => in_duties}/show.html.erb | 18 +- .../origami/in_duties/show.json.jbuilder | 1 + .../origami/in_juties/_in_juty.json.jbuilder | 2 - .../origami/in_juties/edit_in_juty.html.erb | 6 - .../origami/in_juties/index.json.jbuilder | 1 - .../origami/in_juties/show.json.jbuilder | 1 - config/routes.rb | 16 +- ....rb => 20170823081748_create_in_duties.rb} | 6 +- ...r_spec.rb => in_duties_controller_spec.rb} | 4 +- .../{in_juty_spec.rb => in_duty_spec.rb} | 2 +- 28 files changed, 640 insertions(+), 587 deletions(-) create mode 100644 app/controllers/origami/in_duties_controller.rb delete mode 100644 app/controllers/origami/in_juties_controller.rb create mode 100644 app/helpers/origami/in_duties_helper.rb delete mode 100644 app/helpers/origami/in_juties_helper.rb rename app/models/{in_juty.rb => in_duty.rb} (78%) rename app/views/origami/{in_juties/_assign_in_juty.html.erb => in_duties/_assign_in_duty.html.erb} (100%) rename app/views/origami/{in_juties/_edit_in_juty.html.erb => in_duties/_edit_in_duty.html.erb} (87%) rename app/views/origami/{in_juties => in_duties}/_form.html.erb (95%) create mode 100644 app/views/origami/in_duties/_in_duty.json.jbuilder rename app/views/origami/{in_juties/assign_in_juty.html.erb => in_duties/assign_in_duty.html.erb} (76%) rename app/views/origami/{in_juties => in_duties}/edit.html.erb (61%) create mode 100644 app/views/origami/in_duties/edit_in_duty.html.erb rename app/views/origami/{in_juties => in_duties}/index.html.erb (54%) create mode 100644 app/views/origami/in_duties/index.json.jbuilder rename app/views/origami/{in_juties/index_in_juty.html.erb => in_duties/index_in_duty.html.erb} (58%) rename app/views/origami/{in_juties => in_duties}/new.html.erb (58%) rename app/views/origami/{in_juties => in_duties}/show.html.erb (59%) create mode 100644 app/views/origami/in_duties/show.json.jbuilder delete mode 100644 app/views/origami/in_juties/_in_juty.json.jbuilder delete mode 100644 app/views/origami/in_juties/edit_in_juty.html.erb delete mode 100644 app/views/origami/in_juties/index.json.jbuilder delete mode 100644 app/views/origami/in_juties/show.json.jbuilder rename db/migrate/{20170823081747_create_in_juties.rb => 20170823081748_create_in_duties.rb} (54%) rename spec/controllers/origami/{in_juties_controller_spec.rb => in_duties_controller_spec.rb} (97%) rename spec/models/{in_juty_spec.rb => in_duty_spec.rb} (68%) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 467886cf..3ddc5623 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,15 +2,28 @@ + + + + + + + + + + + + + + + + + + + - - - - - - - - + + @@ -25,7 +38,7 @@ - + @@ -54,68 +67,104 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + - - - + + + + + + + + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -124,40 +173,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -166,7 +181,7 @@ - + @@ -176,7 +191,7 @@ - + @@ -186,7 +201,7 @@ - + @@ -196,7 +211,7 @@ - + @@ -206,7 +221,7 @@ - + @@ -252,7 +267,19 @@ custom_excel load promotion_original_product + in_juti + Juty + Juti + Juties + juties + juty + + Duties + Duty + duty + duties + - @@ -946,6 +994,7 @@ + @@ -958,7 +1007,6 @@ - @@ -1023,196 +1071,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1290,7 +1148,7 @@ - + @@ -1315,7 +1173,7 @@ - + @@ -1333,7 +1191,7 @@ - + @@ -1341,7 +1199,7 @@ - + @@ -1357,7 +1215,7 @@ - + @@ -1365,7 +1223,7 @@ - + @@ -1381,7 +1239,7 @@ - + @@ -1389,18 +1247,16 @@ - + - - - - - + + + @@ -1436,10 +1292,205 @@ + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/origami/in_duties_controller.rb b/app/controllers/origami/in_duties_controller.rb new file mode 100644 index 00000000..eaf23c5a --- /dev/null +++ b/app/controllers/origami/in_duties_controller.rb @@ -0,0 +1,170 @@ +class Origami::InDutiesController < BaseOrigamiController + before_action :set_in_duty, only: %i[show edit update edit_in_duty update_for_in_duty destroy destroy_in_duty] + + # GET /in_duties + # GET /in_duties.json + def index + @in_duties = InDuty.all + end + + def index_in_duty + @duty_in = InDuty.where('dinning_id=?', params[:table_id]) + @table = DiningFacility.find(params[:table_id]) + @in_duty = InDuty.new + @duties_in = Kaminari.paginate_array(@duty_in).page(params[:page]).per(10) + end + + # GET /in_duties/1 + # GET /in_duties/1.json + def show; end + + # GET /in_duties/new + def new + # this one use for new + @in_duty = InDuty.new + @table = DiningFacility.find(params[:table_id]) + @commissioner = @in_duty.commissioner + render partial: 'form' + end + + # GET /in_duties/1/edit + def edit; end + + def edit_in_duty + @in_duty = InDuty.find(params[:id]) + @table = DiningFacility.find(params[:table_id]) + @commissioner = @in_duty.commissioner + + # render json: {in_duty: @in_duty, commissioner: @commissioner} + render partial: 'form' + end + + def assign_in_duty + @in_duty = InDuty.new + @table = DiningFacility.find(params[:table_id]) + end + + # POST /in_duties + # POST /in_duties.json + def create + @in_duty = InDuty.new(in_duty_params) + + respond_to do |format| + if @in_duty.save + format.html { redirect_to origami_in_duties_path, notice: 'In duty was successfully created.' } + format.json { render :show, status: :created, location: @in_duty } + else + format.html { render :new } + format.json { render json: @in_duty.errors, status: :unprocessable_entity } + end + end + end + + def create_for_in_duty + # this one use for create and update + in_duty = in_duty_params + in_time = DateTime.new in_duty['in_time(1i)'].to_i, in_duty['in_time(2i)'].to_i, in_duty['in_time(3i)'].to_i, in_duty['in_time(4i)'].to_i, in_duty['in_time(5i)'].to_i + in_time = in_time.change(offset: '+06:30') + out_time = DateTime.new in_duty['out_time(1i)'].to_i, in_duty['out_time(2i)'].to_i, in_duty['out_time(3i)'].to_i, in_duty['out_time(4i)'].to_i, in_duty['out_time(5i)'].to_i + out_time = out_time.change(offset: '+06:30') + @in_duty = InDuty.new + in_duty_id = in_duty[:id] + unless in_duty_id.empty? + @in_duty = InDuty.find(in_duty_id.to_i) + end + + @in_duty.dinning_id = in_duty_params[:dinning_id] + @in_duty.commissioner_ids = in_duty_params[:commissioner_ids] + @in_duty.in_time = in_time + @in_duty.out_time = out_time + + respond_to do |format| + if @in_duty.save + if in_duty_id.nil? + format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully created.' } + format.json { render :show, status: :created, location: @in_duty } + else + format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully updated.' } + format.json { render :show, status: :created, location: @in_duty } + end + else + format.html { render :new } + format.json { render json: @in_duty.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /in_duties/1 + # PATCH/PUT /in_duties/1.json + def update + in_duty = in_duty_params + in_time = DateTime.new in_duty['in_time(1i)'].to_i, in_duty['in_time(2i)'].to_i, in_duty['in_time(3i)'].to_i, in_duty['in_time(4i)'].to_i, in_duty['in_time(5i)'].to_i + in_time = in_time.change(offset: '+06:30') + out_time = DateTime.new in_duty['out_time(1i)'].to_i, in_duty['out_time(2i)'].to_i, in_duty['out_time(3i)'].to_i, in_duty['out_time(4i)'].to_i, in_duty['out_time(5i)'].to_i + out_time = out_time.change(offset: '+06:30') + @in_duty.commissioner_ids = in_duty_params[:commissioner_ids] + @in_duty.in_time = in_time + @in_duty.out_time = out_time + respond_to do |format| + if @in_duty.save + format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully updated.' } + format.json { render :show, status: :ok, location: @in_duty } + else + format.html { render :edit } + format.json { render json: @in_duty.errors, status: :unprocessable_entity } + end + end + end + + def update_for_in_duty + in_duty = in_duty_params + in_time = DateTime.new in_duty['in_time(1i)'].to_i, in_duty['in_time(2i)'].to_i, in_duty['in_time(3i)'].to_i, in_duty['in_time(4i)'].to_i, in_duty['in_time(5i)'].to_i + in_time = in_time.change(offset: '+06:30') + out_time = DateTime.new in_duty['out_time(1i)'].to_i, in_duty['out_time(2i)'].to_i, in_duty['out_time(3i)'].to_i, in_duty['out_time(4i)'].to_i, in_duty['out_time(5i)'].to_i + out_time = out_time.change(offset: '+06:30') + @in_duty.commissioner_ids = in_duty_params[:commissioner_ids] + @in_duty.in_time = in_time + @in_duty.out_time = out_time + respond_to do |format| + if @in_duty.save + format.html { redirect_to origami_index_in_duty_path(in_duty_params[:dinning_id]), notice: 'In duty was successfully updated.' } + format.json { render :show, status: :ok, location: @in_duty } + else + format.html { render :edit } + format.json { render json: @in_duty.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /in_duties/1 + # DELETE /in_duties/1.json + def destroy + @in_duty.destroy + respond_to do |format| + format.html { redirect_to origami_in_duties_path, notice: 'In duty was successfully removed.' } + format.json { head :no_content } + end + end + + def destroy_in_duty + @table_id = params[:table_id] + @in_duty.destroy + + respond_to do |format| + format.html { redirect_to origami_index_in_duty_path(@table_id), notice: 'In duty was successfully removed.' } + format.json { head :no_content } + end + end + + private + + # Use callbacks to share common setup or constraints between actions. + def set_in_duty + @in_duty = InDuty.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def in_duty_params + params.require(:in_duty).permit(:id, :dinning_id, :commissioner_ids, :in_time, :out_time) + end +end diff --git a/app/controllers/origami/in_juties_controller.rb b/app/controllers/origami/in_juties_controller.rb deleted file mode 100644 index d78ef348..00000000 --- a/app/controllers/origami/in_juties_controller.rb +++ /dev/null @@ -1,170 +0,0 @@ -class Origami::InJutiesController < BaseOrigamiController - before_action :set_in_juty, only: %i[show edit update edit_in_juty update_for_in_juty destroy destroy_in_juty] - - # GET /in_juties - # GET /in_juties.json - def index - @in_juties = InJuty.all - end - - def index_in_juty - @juty_in = InJuty.where('dinning_id=?', params[:table_id]) - @table = DiningFacility.find(params[:table_id]) - @in_juty = InJuty.new - @juties_in = Kaminari.paginate_array(@juty_in).page(params[:page]).per(10) - end - - # GET /in_juties/1 - # GET /in_juties/1.json - def show; end - - # GET /in_juties/new - def new - # this one use for new - @in_juty = InJuty.new - @table = DiningFacility.find(params[:table_id]) - @commissioner = @in_juty.commissioner - render partial: 'form' - end - - # GET /in_juties/1/edit - def edit; end - - def edit_in_juty - @in_juty = InJuty.find(params[:id]) - @table = DiningFacility.find(params[:table_id]) - @commissioner = @in_juty.commissioner - - # render json: {in_juty: @in_juty, commissioner: @commissioner} - render partial: 'form' - end - - def assign_in_juty - @in_juty = InJuty.new - @table = DiningFacility.find(params[:table_id]) - end - - # POST /in_juties - # POST /in_juties.json - def create - @in_juty = InJuty.new(in_juty_params) - - respond_to do |format| - if @in_juty.save - format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully created.' } - format.json { render :show, status: :created, location: @in_juty } - else - format.html { render :new } - format.json { render json: @in_juty.errors, status: :unprocessable_entity } - end - end - end - - def create_for_in_juty - # this one use for create and update - in_juty = in_juty_params - in_time = DateTime.new in_juty['in_time(1i)'].to_i, in_juty['in_time(2i)'].to_i, in_juty['in_time(3i)'].to_i, in_juty['in_time(4i)'].to_i, in_juty['in_time(5i)'].to_i - in_time = in_time.change(offset: '+06:30') - out_time = DateTime.new in_juty['out_time(1i)'].to_i, in_juty['out_time(2i)'].to_i, in_juty['out_time(3i)'].to_i, in_juty['out_time(4i)'].to_i, in_juty['out_time(5i)'].to_i - out_time = out_time.change(offset: '+06:30') - @in_juty = InJuty.new - in_juty_id = in_juty[:id] - unless in_juty_id.empty? - @in_juty = InJuty.find(in_juty_id.to_i) - end - - @in_juty.dinning_id = in_juty_params[:dinning_id] - @in_juty.commissioner_ids = in_juty_params[:commissioner_ids] - @in_juty.in_time = in_time - @in_juty.out_time = out_time - - respond_to do |format| - if @in_juty.save - if in_juty_id.nil? - format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully created.' } - format.json { render :show, status: :created, location: @in_juty } - else - format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' } - format.json { render :show, status: :created, location: @in_juty } - end - else - format.html { render :new } - format.json { render json: @in_juty.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /in_juties/1 - # PATCH/PUT /in_juties/1.json - def update - in_juty = in_juty_params - in_time = DateTime.new in_juty['in_time(1i)'].to_i, in_juty['in_time(2i)'].to_i, in_juty['in_time(3i)'].to_i, in_juty['in_time(4i)'].to_i, in_juty['in_time(5i)'].to_i - in_time = in_time.change(offset: '+06:30') - out_time = DateTime.new in_juty['out_time(1i)'].to_i, in_juty['out_time(2i)'].to_i, in_juty['out_time(3i)'].to_i, in_juty['out_time(4i)'].to_i, in_juty['out_time(5i)'].to_i - out_time = out_time.change(offset: '+06:30') - @in_juty.commissioner_ids = in_juty_params[:commissioner_ids] - @in_juty.in_time = in_time - @in_juty.out_time = out_time - respond_to do |format| - if @in_juty.save - format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' } - format.json { render :show, status: :ok, location: @in_juty } - else - format.html { render :edit } - format.json { render json: @in_juty.errors, status: :unprocessable_entity } - end - end - end - - def update_for_in_juty - in_juty = in_juty_params - in_time = DateTime.new in_juty['in_time(1i)'].to_i, in_juty['in_time(2i)'].to_i, in_juty['in_time(3i)'].to_i, in_juty['in_time(4i)'].to_i, in_juty['in_time(5i)'].to_i - in_time = in_time.change(offset: '+06:30') - out_time = DateTime.new in_juty['out_time(1i)'].to_i, in_juty['out_time(2i)'].to_i, in_juty['out_time(3i)'].to_i, in_juty['out_time(4i)'].to_i, in_juty['out_time(5i)'].to_i - out_time = out_time.change(offset: '+06:30') - @in_juty.commissioner_ids = in_juty_params[:commissioner_ids] - @in_juty.in_time = in_time - @in_juty.out_time = out_time - respond_to do |format| - if @in_juty.save - format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' } - format.json { render :show, status: :ok, location: @in_juty } - else - format.html { render :edit } - format.json { render json: @in_juty.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /in_juties/1 - # DELETE /in_juties/1.json - def destroy - @in_juty.destroy - respond_to do |format| - format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully removed.' } - format.json { head :no_content } - end - end - - def destroy_in_juty - @table_id = params[:table_id] - @in_juty.destroy - - respond_to do |format| - format.html { redirect_to origami_index_in_juty_path(@table_id), notice: 'In juty was successfully removed.' } - format.json { head :no_content } - end - end - - private - - # Use callbacks to share common setup or constraints between actions. - def set_in_juty - @in_juty = InJuty.find(params[:id]) - end - - # Never trust parameters from the scary internet, only allow the white list through. - def in_juty_params - params.require(:in_juty).permit(:id, :dinning_id, :commissioner_ids, :in_time, :out_time) - end -end diff --git a/app/helpers/origami/in_duties_helper.rb b/app/helpers/origami/in_duties_helper.rb new file mode 100644 index 00000000..afd35e07 --- /dev/null +++ b/app/helpers/origami/in_duties_helper.rb @@ -0,0 +1,2 @@ +module Origami::InDutiesHelper +end diff --git a/app/helpers/origami/in_juties_helper.rb b/app/helpers/origami/in_juties_helper.rb deleted file mode 100644 index 2792da8d..00000000 --- a/app/helpers/origami/in_juties_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Origami::InJutiesHelper -end diff --git a/app/models/in_juty.rb b/app/models/in_duty.rb similarity index 78% rename from app/models/in_juty.rb rename to app/models/in_duty.rb index 2f023ff0..485787c7 100644 --- a/app/models/in_juty.rb +++ b/app/models/in_duty.rb @@ -1,4 +1,4 @@ -class InJuty < ApplicationRecord +class InDuty < ApplicationRecord belongs_to :dining_facility, foreign_key: 'dinning_id' belongs_to :commissioner, foreign_key: 'commissioner_ids' end diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 680894ff..c0fd2ff5 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -333,7 +333,7 @@ - + @@ -580,9 +580,9 @@ window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/load_commissioners"; }); - $('#in_juties').on('click', function () { + $('#in_duties').on('click', function () { var dining_id = "<%= @dining.id %>" - window.location.href = '/origami/assign_in_juty/'+ dining_id; + window.location.href = '/origami/assign_in_duty/'+ dining_id; }); $('#void').on('click', function () { diff --git a/app/views/origami/in_juties/_assign_in_juty.html.erb b/app/views/origami/in_duties/_assign_in_duty.html.erb similarity index 100% rename from app/views/origami/in_juties/_assign_in_juty.html.erb rename to app/views/origami/in_duties/_assign_in_duty.html.erb diff --git a/app/views/origami/in_juties/_edit_in_juty.html.erb b/app/views/origami/in_duties/_edit_in_duty.html.erb similarity index 87% rename from app/views/origami/in_juties/_edit_in_juty.html.erb rename to app/views/origami/in_duties/_edit_in_duty.html.erb index a297ac65..41a492eb 100644 --- a/app/views/origami/in_juties/_edit_in_juty.html.erb +++ b/app/views/origami/in_duties/_edit_in_duty.html.erb @@ -1,4 +1,4 @@ -<%= simple_form_for([:origami, @in_juty]) do |f| %> +<%= simple_form_for([:origami, @in_duty]) do |f| %> <%= f.error_notification %>
diff --git a/app/views/origami/in_juties/_form.html.erb b/app/views/origami/in_duties/_form.html.erb similarity index 95% rename from app/views/origami/in_juties/_form.html.erb rename to app/views/origami/in_duties/_form.html.erb index 61342d7b..3351dbd3 100644 --- a/app/views/origami/in_juties/_form.html.erb +++ b/app/views/origami/in_duties/_form.html.erb @@ -1,4 +1,4 @@ -<%= simple_form_for @in_juty, :url => origami_index_in_juty_path(@table.id), :method => :post do |f| %> +<%= simple_form_for @in_duty, :url => origami_index_in_duty_path(@table.id), :method => :post do |f| %> <%= f.error_notification %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %> diff --git a/app/views/origami/in_duties/_in_duty.json.jbuilder b/app/views/origami/in_duties/_in_duty.json.jbuilder new file mode 100644 index 00000000..6b13c2f9 --- /dev/null +++ b/app/views/origami/in_duties/_in_duty.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! in_duty, :id, :created_at, :updated_at +json.url in_duty_url(in_duty, format: :json) diff --git a/app/views/origami/in_juties/assign_in_juty.html.erb b/app/views/origami/in_duties/assign_in_duty.html.erb similarity index 76% rename from app/views/origami/in_juties/assign_in_juty.html.erb rename to app/views/origami/in_duties/assign_in_duty.html.erb index 7176dea6..31e95a50 100644 --- a/app/views/origami/in_juties/assign_in_juty.html.erb +++ b/app/views/origami/in_duties/assign_in_duty.html.erb @@ -1,9 +1,9 @@
- <%= simple_form_for([:origami,@in_juty]) do |f| %> + <%= simple_form_for([:origami,@in_duty]) do |f| %> <%= f.error_notification %>
@@ -22,10 +22,10 @@
- <%= link_to 'Back', origami_index_in_juty_path(@table.id), class: 'btn btn-success' %> + <%= link_to 'Back', origami_index_in_duty_path(@table.id), class: 'btn btn-success' %>
- +
@@ -45,18 +45,18 @@ $(function() { $('.datepicker').css('cursor','pointer'); }); - $('#in_juty').on('click', function () { - var ajax_url = "/origami/assign_in_juty"; - var commissioner_ids = $('#in_juty_commissioner_ids').val(); - var in_time = $('#in_juty_in_time').val(); - var out_time = $('#in_juty_out_time').val(); + $('#in_duty').on('click', function () { + var ajax_url = "/origami/assign_in_duty"; + var commissioner_ids = $('#in_duty_commissioner_ids').val(); + var in_time = $('#in_duty_in_time').val(); + var out_time = $('#in_duty_out_time').val(); var dining_id = '<%= @table.id %>' $.ajax({ type: "POST", url: ajax_url, data: 'dining_id=' + dining_id + "&commissioner_ids=" + commissioner_ids +'&in_time=' + in_time + "&out_time=" + out_time, success: function (result) { - window.location.href = '/origami/assign_in_juty/'+ dining_id; + window.location.href = '/origami/assign_in_duty/'+ dining_id; } }); }) diff --git a/app/views/origami/in_juties/edit.html.erb b/app/views/origami/in_duties/edit.html.erb similarity index 61% rename from app/views/origami/in_juties/edit.html.erb rename to app/views/origami/in_duties/edit.html.erb index 3a6fc774..3e64b2f2 100644 --- a/app/views/origami/in_juties/edit.html.erb +++ b/app/views/origami/in_duties/edit.html.erb @@ -2,9 +2,9 @@ - <%= render 'form', in_juty: @in_juty %> + <%= render 'form', in_duty: @in_duty %>
\ No newline at end of file diff --git a/app/views/origami/in_duties/edit_in_duty.html.erb b/app/views/origami/in_duties/edit_in_duty.html.erb new file mode 100644 index 00000000..bcc984aa --- /dev/null +++ b/app/views/origami/in_duties/edit_in_duty.html.erb @@ -0,0 +1,6 @@ +
+ + <%= render 'edit_in_duty', in_duty: @in_duty %> +
\ No newline at end of file diff --git a/app/views/origami/in_juties/index.html.erb b/app/views/origami/in_duties/index.html.erb similarity index 54% rename from app/views/origami/in_juties/index.html.erb rename to app/views/origami/in_duties/index.html.erb index ff5a0fd3..355a7afb 100644 --- a/app/views/origami/in_juties/index.html.erb +++ b/app/views/origami/in_duties/index.html.erb @@ -14,27 +14,27 @@ - <% @juties_in.each do |in_juty| %> - + <% @duties_in.each do |in_duty| %> + - <%= in_juty.dining_facility.name rescue '-' %> - <%= in_juty.commissioner.name rescue '-' %> - <%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %> - <%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %> - <%= link_to 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id, in_juty), method: :delete, data: {confirm: 'Are you sure?'} %> + <%= in_duty.dining_facility.name rescue '-' %> + <%= in_duty.commissioner.name rescue '-' %> + <%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %> + <%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %> + <%= link_to 'Destroy', origami_destroy_in_duty_path(in_duty.dining_facility.id, in_duty), method: :delete, data: {confirm: 'Are you sure?'} %> <% end %> - <%= paginate @juties_in %> + <%= paginate @duties_in %>
- <%= render 'form', in_juty: @in_juty, table: @table %> + <%= render 'form', in_duty: @in_duty, table: @table %>
- <%= link_to t('.new', :default => t("helpers.links.new")), new_origami_in_juty_path, :class => 'btn btn-primary btn-sm' %> + <%= link_to t('.new', :default => t("helpers.links.new")), new_origami_in_duty_path, :class => 'btn btn-primary btn-sm' %>
@@ -43,13 +43,13 @@