Added list of items with changed assignment in dashboard
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
2026-05-25 03:04:35 +02:00
parent 33f79f07ae
commit 650b83bdf4
2 changed files with 55 additions and 4 deletions

View File

@@ -11,5 +11,8 @@ class DashboardController < ApplicationController
# 4. Holt die letzten 10 registrierten Artikel für die Aktivitätenanzeige # 4. Holt die letzten 10 registrierten Artikel für die Aktivitätenanzeige
@recent_items = Item.order(created_at: :desc).limit(10).includes(:category, :user, :room) @recent_items = Item.order(created_at: :desc).limit(10).includes(:category, :user, :room)
# NEU: Die letzten 5 Zuweisungs-Ereignisse laden
@recent_assignments = AssignmentLog.order(created_at: :desc).limit(5).includes(:item, :user, :room)
end end
end end

View File

@@ -83,4 +83,52 @@
</div> </div>
<% end %> <% end %>
</div> </div>
<div class="bg-white border border-gray-200 rounded-xl shadow-sm p-6 mt-6">
<h2 class="text-base font-bold text-gray-800 mb-4 flex items-center gap-2">
<!-- Heroicon: arrows-right-left -->
<svg class="h-5 w-5 text-gray-500" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5" />
</svg>
Letzte Artikel-Zuordnungen & Bewegungen
</h2>
<% if @recent_assignments.any? %>
<div class="space-y-3">
<% @recent_assignments.each do |log| %>
<div class="flex items-start sm:items-center justify-between p-3 bg-gray-50 rounded-lg text-sm border border-gray-100 gap-4">
<div class="flex items-center gap-3 min-w-0">
<!-- Markantes blaues Badge für die Sticker-ID des bewegten Artikels -->
<span class="p-1.5 bg-blue-100 text-blue-700 rounded-md font-mono text-[10px] font-bold shrink-0">
#<%= log.item.sticker_id %>
</span>
<div class="min-w-0">
<p class="font-semibold text-gray-800 truncate">
<%= link_to log.item.name, item_path(log.item), class: "hover:text-blue-600 transition" %>
</p>
<p class="text-xs text-gray-500 truncate">
<% if log.user.present? %>
Ausgegeben an: 👤 <%= log.user.name %>
<% elsif log.room.present? %>
Standort: 📍 <%= log.room.name_with_building %>
<% else %>
📦 Ins Hauptlager gelegt
<% end %>
</p>
</div>
</div>
<div class="text-xs text-gray-400 text-right shrink-0">
<%= time_ago_in_words(log.created_at) %> vor
</div>
</div>
<% end %>
</div>
<% else %>
<div class="text-center py-6 text-gray-400 text-sm">
Es wurden noch keine Artikel-Bewegungen im System registriert.
</div>
<% end %>
</div>
</div> </div>