Compare commits
4 Commits
2f3d64b5b9
...
7b7ba97032
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b7ba97032 | |||
| f4068c10bd | |||
| 4f3342a850 | |||
| 1195da6843 |
@@ -22,13 +22,13 @@
|
|||||||
@apply block w-24;
|
@apply block w-24;
|
||||||
}
|
}
|
||||||
.icon {
|
.icon {
|
||||||
@apply inline text-hsrm-gray size-7 drop-shadow hover:text-opacity-75;
|
@apply inline text-hsrm-gray size-7 drop-shadow;
|
||||||
}
|
}
|
||||||
.icon-disabled {
|
.icon-disabled {
|
||||||
@apply text-opacity-25 hover:text-opacity-25;
|
@apply text-opacity-25 hover:text-opacity-25;
|
||||||
}
|
}
|
||||||
.icon-nohover {
|
.icon-hover {
|
||||||
@apply hover:text-opacity-100;
|
@apply hover:text-opacity-75;
|
||||||
}
|
}
|
||||||
.card-status {
|
.card-status {
|
||||||
@apply uppercase shadow-lg bg-opacity-60 min-h-20 hover:bg-opacity-80;
|
@apply uppercase shadow-lg bg-opacity-60 min-h-20 hover:bg-opacity-80;
|
||||||
|
|||||||
@@ -4,10 +4,25 @@ module ApplicationHelper
|
|||||||
options[:aria] = true
|
options[:aria] = true
|
||||||
options[:nocomment] = true
|
options[:nocomment] = true
|
||||||
options[:variant] ||= :outline
|
options[:variant] ||= :outline
|
||||||
#options[:class] = options.fetch(:class, nil)
|
# options[:class] = options.fetch(:class, nil)
|
||||||
options[:class] = "size-5" unless options[:class]
|
options[:class] = "size-5" unless options[:class]
|
||||||
path = options.fetch(:path, "icons/#{options[:variant]}/#{name}.svg")
|
path = options.fetch(:path, "icons/#{options[:variant]}/#{name}.svg")
|
||||||
icon = path
|
icon = path
|
||||||
inline_svg_tag(icon, options)
|
inline_svg_tag(icon, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bool_icon(bool)
|
||||||
|
case bool
|
||||||
|
when true then "check"
|
||||||
|
else "x-mark"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def operator?
|
||||||
|
controller.class.name.split("::").first=="Operator"
|
||||||
|
end
|
||||||
|
|
||||||
|
def admin?
|
||||||
|
controller.class.name.split("::").first=="Admin"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,4 +34,8 @@ class User < ApplicationRecord
|
|||||||
after_update if: :password_digest_previously_changed? do
|
after_update if: :password_digest_previously_changed? do
|
||||||
sessions.where.not(id: Current.session).delete_all
|
sessions.where.not(id: Current.session).delete_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def name
|
||||||
|
[ firstname, " ", lastname ].join
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<header class="container flex items-center justify-between px-4 py-6 mx-auto border-b-2 border-gray-300">
|
<header class="container flex items-center justify-between px-4 py-6 mx-auto border-b-2 border-gray-300">
|
||||||
<a href="/" class="text-4xl font-bold text-hsrm-gray">Plottservice Fachbereich AB</a>
|
<a href="/" class="text-4xl font-bold text-hsrm-gray">Plottservice Fachbereich AB</a>
|
||||||
<% if user_signed_in? && current_user.admin? || current_user.operator? %>
|
<% if user_signed_in? && (current_user.admin? || current_user.operator?) %>
|
||||||
<nav>
|
<nav>
|
||||||
<ul class="flex justify-center font-semibold items-color">
|
<ul class="flex justify-center space-x-2 font-semibold items-color">
|
||||||
<li class="relative">
|
<li class="relative">
|
||||||
<button class="px-4 py-2 cursor-default hover:text-hsrm-red">
|
<button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= admin? && 'border-hsrm-red-light' %>">
|
||||||
<%= link_to_if current_user.admin?, "Admin", admin_dashboard_path %>
|
<%= link_to_if current_user.admin?, "Admin", admin_dashboard_path %>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="relative">
|
<li class="relative">
|
||||||
<button class="px-4 py-2 cursor-default hover:text-hsrm-red">
|
<button class="px-4 py-2 cursor-default hover:text-hsrm-red border-b-4 <%= operator? && 'border-hsrm-red-light' %>">
|
||||||
<%= link_to 'Operator', operator_jobs_path %>
|
<%= link_to 'Operator', operator_jobs_path %>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -1,64 +1,76 @@
|
|||||||
<div id="<%= dom_id job %>">
|
<div id="<%= dom_id job %>" class="flex flex-row space-x-4 shadow">
|
||||||
<iframe src=<%= url_for(@job.pdf) %>
|
<div>
|
||||||
width="700" height="780" style="border: none;"></iframe>
|
<iframe src=<%= url_for(@job.pdf) %> width="400" height="600" style="border: solid 1px;"></iframe>
|
||||||
<p class="my-5">
|
</div>
|
||||||
<strong class="block font-medium mb-1">Operator:</strong>
|
<div>
|
||||||
|
<p class="my-3">
|
||||||
|
<strong class="mb-1 font-medium">Operator ID:</strong>
|
||||||
<%= job.operator_id %>
|
<%= job.operator_id %>
|
||||||
|
<% if job.operator %>
|
||||||
|
(<%= job.operator.name %>)
|
||||||
|
<% else %>
|
||||||
|
-
|
||||||
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Costumer:</strong>
|
<strong class="mb-1 font-medium">Costumer ID:</strong>
|
||||||
<%= job.costumer_id %>
|
<%= job.costumer_id %>
|
||||||
|
<% if job.costumer %>
|
||||||
|
(<%= job.costumer.name %>)
|
||||||
|
<% else %>
|
||||||
|
-
|
||||||
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Operator firstname:</strong>
|
<strong class="mb-1 font-medium">Operator:</strong>
|
||||||
<%= job.operator_firstname %>
|
<%= "#{job.operator_firstname} #{job.operator_lastname}" %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Operator lastname:</strong>
|
<strong class="mb-1 font-medium">Costumer:</strong>
|
||||||
<%= job.operator_lastname %>
|
<%= "#{job.costumer_firstname} #{job.costumer_lastname}" %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Costumer firstname:</strong>
|
<strong class="mb-1 font-medium">Paid:</strong>
|
||||||
<%= job.costumer_firstname %>
|
<%= icon bool_icon(job.paid), class: "icon" %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Costumer lastname:</strong>
|
<strong class="mb-1 font-medium">Paid at:</strong>
|
||||||
<%= job.costumer_lastname %>
|
<%= job.paid_at %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Paid:</strong>
|
<strong class="mb-1 font-medium">Printed:</strong>
|
||||||
<%= job.paid %>
|
<%= icon bool_icon(job.printed), class: "icon" %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Printed at:</strong>
|
<strong class="mb-1 font-medium">Printed at:</strong>
|
||||||
<%= job.printed_at %>
|
<%= job.printed_at %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Intern:</strong>
|
<strong class="mb-1 font-medium">Intern:</strong>
|
||||||
<%= job.intern %>
|
<%= icon bool_icon(job.intern), class: "icon" %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Cost center:</strong>
|
<strong class="mb-1 font-medium">Cost center:</strong>
|
||||||
<%= job.cost_center %>
|
<%= job.cost_center %>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
<p class="my-3">
|
||||||
<strong class="block font-medium mb-1">Number of plans a0:</strong>
|
<strong class="block mb-1 font-medium">Plans:
|
||||||
<%= job.number_of_plans_a0 %>
|
<table class="text-center">
|
||||||
|
<tr class="p-2 bg-gray-300">
|
||||||
|
<th class="p-2">a0</th>
|
||||||
|
<th class="p-2">a1</th>
|
||||||
|
<th class="p-2">a2</th>
|
||||||
|
<th class="p-2">a3</th>
|
||||||
|
<th class="p-2">costum</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= job.number_of_plans_a0 %></td>
|
||||||
|
<td><%= job.number_of_plans_a1 %></td>
|
||||||
|
<td><%= job.number_of_plans_a2 %></td>
|
||||||
|
<td><%= job.number_of_plans_a3 %></td>
|
||||||
|
<td><%= job.costum_qm_plan %> qm</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</p>
|
</p>
|
||||||
<p class="my-5">
|
</div>
|
||||||
<strong class="block font-medium mb-1">Number of plans a1:</strong>
|
</div>
|
||||||
<%= job.number_of_plans_a1 %>
|
|
||||||
</p>
|
|
||||||
<p class="my-5">
|
|
||||||
<strong class="block font-medium mb-1">Number of plans a2:</strong>
|
|
||||||
<%= job.number_of_plans_a2 %>
|
|
||||||
</p>
|
|
||||||
<p class="my-5">
|
|
||||||
<strong class="block font-medium mb-1">Number of plans a3:</strong>
|
|
||||||
<%= job.number_of_plans_a3 %>
|
|
||||||
</p>
|
|
||||||
<p class="my-5">
|
|
||||||
<strong class="block font-medium mb-1">Costum qm plan:</strong>
|
|
||||||
<%= job.costum_qm_plan %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<tr id="<%= dom_id job %>" class="bg-status-<%= job.status %>-light odd:bg-opacity-20 even:bg-opacity-10 text-hsrm-gray whitespace-nowrap hover:bg-opacity-30">
|
<tr id="<%= dom_id job %>" class="bg-status-<%= job.status %>-light odd:bg-opacity-20 even:bg-opacity-10 text-hsrm-gray whitespace-nowrap hover:bg-opacity-30">
|
||||||
<td class="p-2 py-3 text-center">
|
<td class="p-2 py-3 text-center">
|
||||||
|
<%= link_to operator_job_path(job) do %>
|
||||||
<span class="badge badge-xl text-status-<%= job.status %> bg-status-<%= job.status %>-light">
|
<span class="badge badge-xl text-status-<%= job.status %> bg-status-<%= job.status %>-light">
|
||||||
<%= job.id %>
|
<%= job.id %>
|
||||||
</span>
|
</span>
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td class="p-2 py-3 text-center">
|
<td class="p-2 py-3 text-center">
|
||||||
<% if job.pdf.attached? %>
|
<% if job.pdf.attached? %>
|
||||||
@@ -60,29 +62,29 @@
|
|||||||
<td class="p-2 py-3 text-right">
|
<td class="p-2 py-3 text-right">
|
||||||
<!-- TODO: move logic to model -->
|
<!-- TODO: move logic to model -->
|
||||||
<% if job.printing? || job.canceled? || job.paid? %>
|
<% if job.printing? || job.canceled? || job.paid? %>
|
||||||
<%= button_to icon(status_icon(:open), class: "icon", title: "Zurück in die Warteschlange"), operator_job_path(job), method: :patch, params: {:job => {status: :open}}, form_class: "inline" %>
|
<%= button_to icon(status_icon(:open), class: "icon icon-hover", title: "Zurück in die Warteschlange"), operator_job_path(job), method: :patch, params: {:job => {status: :open}}, form_class: "inline" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= icon(status_icon(:open), class: "icon icon-disabled", title: "") %>
|
<%= icon(status_icon(:open), class: "icon icon-disabled", title: "") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if job.open? || job.canceled? || job.paid? %>
|
<% if job.open? || job.canceled? || job.paid? %>
|
||||||
<%= button_to icon(status_icon(:printing), class: "icon", title: "Drucken"), operator_job_path(job), method: :patch, params: {:job => {status: :printing}}, form_class: "inline" %>
|
<%= button_to icon(status_icon(:printing), class: "icon icon-hover", title: "Drucken"), operator_job_path(job), method: :patch, params: {:job => {status: :printing}}, form_class: "inline" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= icon(status_icon(:printing), class: "icon icon-disabled", title: "") %>
|
<%= icon(status_icon(:printing), class: "icon icon-disabled", title: "") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if job.printing? || job.paid? %>
|
<% if job.printing? || job.paid? %>
|
||||||
<% job.printing? && turbo_confirm = 'Sind die Pläne gedruckt und die Seitenanzahl und QM korrekt?' %>
|
<% job.printing? && turbo_confirm = 'Sind die Pläne gedruckt und die Seitenanzahl und QM korrekt?' %>
|
||||||
<%= button_to icon(status_icon(:pickup), class: "icon", title: "Pläne sind fertig gedruckt und bereit abgeholt zu werden."), operator_job_path(job), method: :patch, params: {:job => {status: :pickup}}, form: {data: {turbo_confirm: turbo_confirm}}, form_class: "inline" %>
|
<%= button_to icon(status_icon(:pickup), class: "icon icon-hover", title: "Pläne sind fertig gedruckt und bereit abgeholt zu werden."), operator_job_path(job), method: :patch, params: {:job => {status: :pickup}}, form: {data: {turbo_confirm: turbo_confirm}}, form_class: "inline" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= icon(status_icon(:pickup), class: "icon icon-disabled", title: "") %>
|
<%= icon(status_icon(:pickup), class: "icon icon-disabled", title: "") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if job.pickup? || job.printing? %>
|
<% if job.pickup? || job.printing? %>
|
||||||
<% job.printing? && turbo_confirm = 'Sind die Pläne gedruckt und die Seitenanzahl und QM korrekt?' %>
|
<% job.printing? && turbo_confirm = 'Sind die Pläne gedruckt und die Seitenanzahl und QM korrekt?' %>
|
||||||
<%= button_to icon(status_icon(:paid), class: "icon", title: "Bezahlt"), operator_job_path(job), method: :patch, params: {:job => {status: :paid}}, form: {data: {turbo_confirm: turbo_confirm}}, form_class: "inline" %>
|
<%= button_to icon(status_icon(:paid), class: "icon icon-hover", title: "Bezahlt"), operator_job_path(job), method: :patch, params: {:job => {status: :paid}}, form: {data: {turbo_confirm: turbo_confirm}}, form_class: "inline" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= icon(status_icon(:paid), class: "icon icon-disabled ", title: "") %>
|
<%= icon(status_icon(:paid), class: "icon icon-disabled ", title: "") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if job.open? || job.printing? || job.pickup? %>
|
<% if job.open? || job.printing? || job.pickup? %>
|
||||||
<%= button_to icon(status_icon(:canceled), class: "icon text-hsrm-red", title: "Abbrechen"), operator_job_path(job), method: :patch, params: {:job => {status: :canceled}}, form: {data: {turbo_confirm: 'Den Plottauftrag wirklich abbrechen?'}}, form_class: "inline" %>
|
<%= button_to icon(status_icon(:canceled), class: "icon icon-hover text-hsrm-red", title: "Abbrechen"), operator_job_path(job), method: :patch, params: {:job => {status: :canceled}}, form: {data: {turbo_confirm: 'Den Plottauftrag wirklich abbrechen?'}}, form_class: "inline" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= icon(status_icon(:canceled), class: "icon icon-disabled", title: "Kann nicht mehr abgebrochen werden") %>
|
<%= icon(status_icon(:canceled), class: "icon icon-disabled", title: "Kann nicht mehr abgebrochen werden") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
<div class="mx-auto md:w-2/3 w-full flex">
|
<div class="flex w-full mx-auto md:w-2/3">
|
||||||
<div class="mx-auto">
|
<div class="mx-auto">
|
||||||
<% if notice.present? %>
|
<% if notice.present? %>
|
||||||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
|
<p class="inline-block px-3 py-2 mb-5 font-medium text-green-500 rounded-lg bg-green-50" id="notice"><%= notice %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render @job %>
|
<%= render @job %>
|
||||||
|
<%= link_to "Edit this job", edit_operator_job_path(@job), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||||
<%= link_to "Edit this job", edit_job_path(@job), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
<%= link_to "Back to jobs", operator_jobs_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||||
<%= link_to "Back to jobs", jobs_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
|
||||||
<div class="inline-block ml-2">
|
<div class="inline-block ml-2">
|
||||||
<%= button_to "Destroy this job", @job, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
|
<%= button_to "Destroy this job", operator_job_path(@job), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Rails.application.routes.draw do
|
|||||||
resource :email_verification, only: [ :show, :create ]
|
resource :email_verification, only: [ :show, :create ]
|
||||||
resource :password_reset, only: [ :new, :edit, :create, :update ]
|
resource :password_reset, only: [ :new, :edit, :create, :update ]
|
||||||
end
|
end
|
||||||
resources :jobs do
|
resources :jobs, only: [ :index, :new, :create, :destroy ] do
|
||||||
member do
|
member do
|
||||||
patch "cancel"
|
patch "cancel"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user