Number of plans can no be incremented or decremented
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class Operator::JobsController < ApplicationController
|
||||
before_action :set_job, only: %i[show edit update destroy cancel]
|
||||
before_action :set_job, only: %i[show edit update destroy cancel increment_page decrement_page]
|
||||
|
||||
# GET /jobs or /jobs.json
|
||||
def index
|
||||
@@ -29,9 +29,9 @@ class Operator::JobsController < ApplicationController
|
||||
respond_to do |format|
|
||||
if @job.save
|
||||
flash[:notice] = "Job was successfully created."
|
||||
Turbo::StreamsChannel.broadcast_prepend_later_to "jobs", target: :jobs, partial: "jobs/job_tr",
|
||||
Turbo::StreamsChannel.broadcast_prepend_later_to "jobs", target: :jobs, partial: "operator/jobs/job_tr",
|
||||
locals: { job: @job }
|
||||
format.html { redirect_to jobs_url }
|
||||
format.html { redirect_to operator_jobs_url }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
end
|
||||
@@ -43,7 +43,7 @@ class Operator::JobsController < ApplicationController
|
||||
respond_to do |format|
|
||||
if @job.update(job_params)
|
||||
broadcast_update_job
|
||||
format.html { redirect_to jobs_url, notice: "Job was successfully updated." }
|
||||
format.html { redirect_to operator_jobs_url, notice: "Job was successfully updated." }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
end
|
||||
@@ -60,7 +60,7 @@ class Operator::JobsController < ApplicationController
|
||||
respond_to do |format|
|
||||
broadcast_update_job
|
||||
format.turbo_stream
|
||||
format.html { redirect_to jobs_url }
|
||||
format.html { redirect_to operator_jobs_url }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,7 +70,23 @@ class Operator::JobsController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
Turbo::StreamsChannel.broadcast_remove_to "jobs", target: @job
|
||||
format.html { redirect_to jobs_url, notice: "Job was successfully destroyed." }
|
||||
format.html { redirect_to operator_jobs_url, notice: "Job was successfully destroyed." }
|
||||
end
|
||||
end
|
||||
|
||||
def increment_page
|
||||
@job.increment_page(params[:din])
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to operator_jobs_url, notice: "Job was successfully updated." }
|
||||
end
|
||||
end
|
||||
|
||||
def decrement_page
|
||||
@job.decrement_page(params[:din])
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to operator_jobs_url, notice: "Job was successfully updated." }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -87,7 +103,7 @@ class Operator::JobsController < ApplicationController
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def job_params
|
||||
params.require(:job).permit(:operator_id, :costumer_id, :opertator_firstname, :operator_lastname, :costumer_firstname, :costumer_lastname)
|
||||
params.require(:job).permit(:operator_id, :costumer_id, :operator_firstname, :operator_lastname, :costumer_firstname, :costumer_lastname)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user