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

@@ -6,6 +6,10 @@
</p>
<p><%= user.email %></p>
<p>E-Mail Verifiziert:
<%= icon bool_icon(user.verified), class: "icon #{user.verified ? "text-green-600" : "text-red-600"}" %>
<p><%= user.created_at %></p>
</div>
<%= icon bool_icon(user.verified), class: "icon #{user.verified ? "text-green-600" : "text-red-600"}" %></p>
<p><%= user.created_at %></p>
<p>Druckaufträge als Kunde: <%= @user.jobs_as_costumer.size %></p>
<p>davon abgebrochen: <%= @user.jobs_as_cosutmer.canceled.size %></p>
<p>Druckaufträge als Operator: <%= @user.jobs_as_operator.size %></p>
<p>Druckaufträge kassiert: <%= @user.cashed_jobs.size %></p>
</div>

View File

@@ -18,7 +18,7 @@
<%= highlight user.email, [params.dig(:q, :firstname_or_lastname_or_email_cont).to_s, params.dig(:q, :email_start).to_s] %>
</td>
<td class="p-2 py-3 text-right">
<%= user.jobs_as_costumer.where.not(status: :canceled).size %>
<%= user.created_jobs.not_canceled.size %>
</td>
<td class="p-2 py-3 text-center">
<%= l user.created_at.localtime.to_date %>

View File

@@ -1,14 +1,8 @@
<div>
<h1 class="text-4xl font-bold">Benutzer Details</h1>
<h1 class="text-4xl font-bold text-hsrm-gray py-4">Benutzer Details</h1>
<%= render partial: 'user', locals: { user: @user } %>
</div>
<p>Some Stats:
<ul>
<li>Druckaufträge insgesammt: <%= @user.jobs_as_costumer.size %></li>
<li>davon abgebrochen: <%= @user.jobs_as_costumer.canceled.size %></li>
<li>letzten 5 Druckaufträge</li>
</ul>
</p>
<h1 class="py-4 text-4xl font-bold text-hsrm-gray">Die letzten 10 Druckaufträge</h1>
<div class="min-w-full overflow-auto shadow-lg">
<table class="w-full py-8 table-auto">
<thead class="font-semibold tracking-wide bg-gray-200 border-b-2 border-gray-300 text text-hsrm-gray">
@@ -27,7 +21,7 @@
</tr>
</thead>
<tbody id='jobs' class="divide-y divivde-gray-300">
<%= render partial: "jobs/job_tr", collection: @user.jobs_as_costumer.limit(5), as: :job, locals: { no_actions: true } %>
<%= render partial: "jobs/job_tr", collection: @user.created_jobs.order(created_at: :desc).limit(10), as: :job, locals: { no_actions: true } %>
</tbody>
</table>
</div>