diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 51e937f..b1c7506 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -11,5 +11,8 @@ class DashboardController < ApplicationController # 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) + + # NEU: Die letzten 5 Zuweisungs-Ereignisse laden + @recent_assignments = AssignmentLog.order(created_at: :desc).limit(5).includes(:item, :user, :room) end end diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index f0fac74..d8054d8 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -1,10 +1,10 @@ <% content_for :title, "Dashboard Übersicht" %>
- +
- +
@@ -16,7 +16,7 @@

<%= @total_items %>

- +
@@ -51,7 +51,7 @@ Zuletzt registrierte Artikel - + <% if @recent_items.any? %>
<% @recent_items.each do |item| %> @@ -83,4 +83,52 @@
<% end %>
+
+

+ + + + + Letzte Artikel-Zuordnungen & Bewegungen +

+ + <% if @recent_assignments.any? %> +
+ <% @recent_assignments.each do |log| %> +
+
+ + + #<%= log.item.sticker_id %> + + +
+

+ <%= link_to log.item.name, item_path(log.item), class: "hover:text-blue-600 transition" %> +

+

+ <% if log.user.present? %> + Ausgegeben an: 👤 <%= log.user.name %> + <% elsif log.room.present? %> + Standort: 📍 <%= log.room.name_with_building %> + <% else %> + 📦 Ins Hauptlager gelegt + <% end %> +

+
+
+ +
+ <%= time_ago_in_words(log.created_at) %> vor +
+
+ <% end %> +
+ <% else %> +
+ Es wurden noch keine Artikel-Bewegungen im System registriert. +
+ <% end %> +
+