Added has_many assoziations for creator and cashier to jobs, fixed all views according to that changes. Implemented allocation of roles infos when status changes in job model.
This commit is contained in:
@@ -22,8 +22,7 @@ class Operator::JobsController < ApplicationController
|
||||
def create
|
||||
@job = Job.new(job_params)
|
||||
@job.created_by_operator = true
|
||||
# TODO: rename costumer to creater? When created by operator the operator is referenced instead of costumer.
|
||||
@job.costumer = current_user
|
||||
@job.creator = current_user
|
||||
|
||||
respond_to do |format|
|
||||
if @job.save
|
||||
@@ -40,6 +39,8 @@ class Operator::JobsController < ApplicationController
|
||||
def update
|
||||
@job.assign_attributes(job_params)
|
||||
@status_changed = @job.status_changed?
|
||||
@job.current_user = current_user if @status_changed
|
||||
|
||||
respond_to do |format|
|
||||
if @job.save
|
||||
broadcast_update_job
|
||||
|
||||
Reference in New Issue
Block a user