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:
2024-10-01 17:45:52 +02:00
parent de3aa07259
commit 5b60eb64ad
13 changed files with 212 additions and 69 deletions

View File

@@ -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