From a3373e0288341edabd855826134086639079da30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20B=C3=B6hm?= Date: Mon, 12 Aug 2024 04:22:54 +0200 Subject: [PATCH] Started with operator index --- app/controllers/operator/jobs_controller.rb | 4 +- app/models/job.rb | 2 +- app/views/operator/jobs/_job.html.erb | 17 +----- app/views/operator/jobs/_job_tr.html.erb | 7 +-- app/views/operator/jobs/index.html.erb | 68 +++++++++++++++++++-- 5 files changed, 70 insertions(+), 28 deletions(-) diff --git a/app/controllers/operator/jobs_controller.rb b/app/controllers/operator/jobs_controller.rb index daae288..c9380bd 100644 --- a/app/controllers/operator/jobs_controller.rb +++ b/app/controllers/operator/jobs_controller.rb @@ -3,7 +3,9 @@ class Operator::JobsController < ApplicationController # GET /jobs or /jobs.json def index - @jobs = Job.currently_working_on + @openjobs = Job.open.order(:created_at) + @printingjobs = Job.printing.order(:status_changed_at) + @pickupjobs = Job.pickup.order(:status_changed_at) end diff --git a/app/models/job.rb b/app/models/job.rb index ba68253..67d369b 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -45,7 +45,7 @@ class Job < ApplicationRecord .where("status_changed_at >= ?", Time.now.beginning_of_day)) # .in_status_order .order(created_at: :desc) - .order(:costumer_firstname, :costumer_lastname) + #.order(:costumer_firstname, :costumer_lastname) .with_attached_pdf # scope from activestorage for .includes(pdf_attachment: :blob) # .references(:pdf_attachment, :blob) # creates big join table end diff --git a/app/views/operator/jobs/_job.html.erb b/app/views/operator/jobs/_job.html.erb index 09334b9..b1b3793 100644 --- a/app/views/operator/jobs/_job.html.erb +++ b/app/views/operator/jobs/_job.html.erb @@ -1,77 +1,64 @@
+

Operator: <%= job.operator_id %>

-

Costumer: <%= job.costumer_id %>

-

Operator firstname: <%= job.operator_firstname %>

-

Operator lastname: <%= job.operator_lastname %>

-

Costumer firstname: <%= job.costumer_firstname %>

-

Costumer lastname: <%= job.costumer_lastname %>

-

Paid: <%= job.paid %>

-

Printed at: <%= job.printed_at %>

-

Intern: <%= job.intern %>

-

Cost center: <%= job.cost_center %>

-

Number of plans a0: <%= job.number_of_plans_a0 %>

-

Number of plans a1: <%= job.number_of_plans_a1 %>

-

Number of plans a2: <%= job.number_of_plans_a2 %>

-

Number of plans a3: <%= job.number_of_plans_a3 %>

-

Costum qm plan: <%= job.costum_qm_plan %>

-
diff --git a/app/views/operator/jobs/_job_tr.html.erb b/app/views/operator/jobs/_job_tr.html.erb index 9554337..bd07dc8 100644 --- a/app/views/operator/jobs/_job_tr.html.erb +++ b/app/views/operator/jobs/_job_tr.html.erb @@ -57,10 +57,7 @@ - <% if job.able_to_cancel? %> - <%= button_to icon("x-circle", class: "text-hsrm-red size-8 inline", title: "Abbrechen"), cancel_job_path(job), method: :patch, form: {data: {turbo_confirm: 'Den Plottauftrag wirklich abbrechen?'}}, form_class: "inline" %> - <% else %> - <%= icon("x-circle", class: "text-hsrm-gray text-opacity-50 size-8 inline", title: "Kann nicht mehr abgebrochen werden") %> - <% end %> + <%= link_to icon("folder-arrow-down", class: "text-hsrm-gray size-8 inline", title: "Download"), job.pdf, download:true %> + <%= button_to icon("x-circle", class: "text-hsrm-red size-8 inline", title: "Abbrechen"), cancel_job_path(job), method: :patch, form: {data: {turbo_confirm: 'Den Plottauftrag wirklich abbrechen?'}}, form_class: "inline" %> diff --git a/app/views/operator/jobs/index.html.erb b/app/views/operator/jobs/index.html.erb index 62d564f..a53db75 100644 --- a/app/views/operator/jobs/index.html.erb +++ b/app/views/operator/jobs/index.html.erb @@ -1,10 +1,10 @@ -<%= turbo_stream_from 'jobs' %> +<%= turbo_stream_from 'operator_jobs' %> +<% content_for :title, "Current Print Jobs" %>
- <%#= render partial: 'layouts/flash' %> - <% content_for :title, "Current Print Jobs" %>
-

Aktuelle Plottaufträge <%= Date.today.strftime("%d.%m.%Y") %>

- <%= link_to "Plottauftrag aufgeben", new_job_path, class: "px-3 py-2 bg-hsrm-red drop-shadow-lg transition-colors hover:bg-hsrm-red-light text-white block font-medium" %> +

+ abholbereite Plottaufträge +

@@ -24,7 +24,63 @@ - <%= render partial: "job_tr", collection: @jobs, as: :job %> + <%= render partial: "job_tr", collection: @pickupjobs, as: :job %> + <%#= link_to "Show this job", job, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> + +
+
+
+

+ aktuell druckende Plottaufträge +

+
+
+ + + + + + + + + + + + + + + + + + <%= render partial: "job_tr", collection: @printingjobs, as: :job %> + <%#= link_to "Show this job", job, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> + +
ID Auftraggeber PDF A0 A1 A2 A3 noDIN Kosten Status
+
+
+

+ offene Plottaufträge +

+
+
+ + + + + + + + + + + + + + + + + + <%= render partial: "job_tr", collection: @openjobs, as: :job %> <%#= link_to "Show this job", job, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
ID Auftraggeber PDF A0 A1 A2 A3 noDIN Kosten Status