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

@@ -44,11 +44,20 @@
<%= l job.created_at.localtime.to_date %>
</td>
<td class="p-2 py-3 text-center">
<%= l job.paid_at.localtime.to_date if job.paid_at %>
</td>
<td class="p-2 py-3">
<span class="badge badge-status text-status-<%= job.status.to_sym %> bg-status-<%= job.status %>-light">
<%= job.status %>
</span>
</td>
<% if job.created_by_operator %>
<%= link_to admin_user_path(job.creator) do %>
<span class="badge badge-status">Operator</span>
<% end %>
<% else %>
<%= link_to admin_user_path(job.creator) do %>
<span class="badge badge-status badge-hover">Kunden</span>
<% end %>
<% end %>
</span>
</td>
<td class="p-2 py-3">
<span class="badge badge-status text-status-<%= job.status.to_sym %> bg-status-<%= job.status %>-light">
<%= job.status %>
</span>
</td>
</tr>

View File

@@ -15,6 +15,8 @@
<%= f.search_field :costumer_firstname_or_costumer_lastname_or_pdf_blob_filename_cont, placeholder: "Suchen", oninput: 'this.form.requestSubmit();' %>
<%= f.label :status_eq, "Status:" %>
<%= f.select :status_eq, Job.statuses.keys, {include_blank: "alle"}, onchange: 'this.form.requestSubmit();' %>
<%= f.label :created_by_operator_eq, "Erstellt vom:" %>
<%= f.select :created_by_operator_eq, [["Operator", true],["Kunden", false]], {include_blank: "alle"}, onchange: 'this.form.requestSubmit();' %>
<%= f.submit "Filter anwenden", class: "py-2 px-3 bg-hsrm-red hover:bg-hsrm-red-light shadow-lg text-white inline-block font-medium cursor-pointer" %>
</div>
<% end %>
@@ -40,7 +42,7 @@
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :costum_qm_plan, "no DIN") %></th>
<th class="w-1 p-2 py-3 text-center"><%= sort_link(@q, :cost, "Kosten") %></th>
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :created_at, "Erstellt am") %></th>
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :created_at, "Bezahlt am") %></th>
<th class="w-1 p-2 py-3 text-center text-nowrap"><%= sort_link(@q, :created_by_operator, "Erstellt von") %></th>
<th class="w-1 p-2 py-3 text-center"><%= sort_link(@q, :status, "Status") %></th>
</tr>
</thead>