Added Room and some little design updates
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-28 01:04:19 +02:00
parent e161582c4a
commit af10dca289
17 changed files with 750 additions and 217 deletions

View File

@@ -1,82 +1,75 @@
<div class="bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden">
<!-- ========================================================================= -->
<!-- 1. HANDY-ANSICHT: OPTIMIERTE INVENTAR-CARDS (md:hidden) -->
<!-- ========================================================================= -->
<div class="block md:hidden divide-y divide-gray-200 bg-white">
<% items.each do |item| %>
<div class="p-4 space-y-3 hover:bg-gray-50/50 transition">
<!-- Zeile 1: Name, Kategorie & die markante Sticker-ID Plakette -->
<div class="flex justify-between items-start gap-3">
<!-- ========================================================================= -->
<!-- 1. MOBIL-ANSICHT: TEXTE BÜNDIG ZUM ARTIKELNAMEN & VERTIKALE BUTTONS -->
<!-- ========================================================================= -->
<div class="block md:hidden divide-y divide-gray-200 bg-white">
<% items.each do |item| %>
<div class="p-4 hover:bg-gray-50/50 transition flex items-center justify-between gap-4">
<!-- LINKER BEREICH: STRUKTURIERTER INHALT -->
<div class="flex-1 min-w-0 flex items-start gap-3">
<!-- Das ID-Badge steht als sauberer, fester Anker ganz links -->
<%= link_to item_path(item), data: { turbo_frame: "_top" }, class: "shrink-0 transition hover:scale-105 active:scale-95 block mt-0.5" do %>
<span class="inline-flex items-center font-mono font-black text-xs text-white bg-blue-600 px-2.5 py-0.5 rounded shadow-sm tracking-widest">
#<%= item.sticker_id %>
</span>
<% end %>
<!-- DIESER CONTAINER ERZWINGT DIE BÜNDIGKEIT UNTER DEM NAMEN -->
<div class="flex-1 min-w-0 space-y-2">
<!-- Zeile 1: Fetter Artikelname -->
<div class="min-w-0">
<h4 class="font-bold text-gray-900 text-sm leading-snug truncate"><%= item.name %></h4>
<p class="text-xs text-gray-500 font-medium mt-0.5"><%= item.category.name %></p>
<%= link_to item_path(item), data: { turbo_frame: "_top" }, class: "font-black text-gray-900 hover:text-blue-600 text-base leading-tight block truncate" do %>
<%= item.name %>
<% end %>
</div>
<!-- Rechte Box für ID und den optimal platzierten Preis direkt darunter -->
<div class="flex flex-col items-end gap-1.5 shrink-0">
<span class="inline-flex items-center font-mono font-black text-xs text-white bg-blue-600 px-2.5 py-1 rounded-md shadow-sm tracking-wider">
#<%= item.sticker_id %>
</span>
<span class="text-xs font-bold text-gray-600 font-mono bg-gray-100 px-1.5 py-0.5 rounded">
<%= number_to_currency(item.price, unit: "€", separator: ",", delimiter: ".", format: "%n %u") %>
</span>
<!-- Zeile 2: Kategorie & SKU (Jetzt perfekt bündig unter dem Namen!) -->
<div class="flex items-center gap-2 text-xs font-medium text-gray-500 font-mono">
<span class="font-sans font-bold text-gray-400"><%= item.category.name %></span>
<span class="text-gray-300">•</span>
<span>SKU: <span class="text-gray-700 font-bold"><%= item.sku %></span></span>
</div>
</div>
<!-- Zeile 2: Technische Gerätedaten (SKU & Seriennummer) -->
<div class="grid grid-cols-2 gap-3 bg-gray-50 p-2.5 rounded-lg text-xs font-mono text-gray-600">
<div class="truncate">
<span class="text-gray-400 font-sans block text-[10px] uppercase font-bold tracking-wider mb-0.5">SKU</span>
<%= item.sku %>
</div>
<div class="truncate">
<span class="text-gray-400 font-sans block text-[10px] uppercase font-bold tracking-wider mb-0.5">Seriennummer</span>
<%= item.serial_number %>
</div>
</div>
<!-- Zeile 3: Standort & Quick-Actions -->
<div class="flex justify-between items-center pt-1">
<!-- Standort-Badge -->
<div class="text-xs">
<!-- Zeile 3: Das Standort-Badge (Ebenfalls perfekt bündig unter dem Namen) -->
<div class="pt-0.5">
<% if item.user.present? %>
<span class="inline-flex items-center gap-1 text-gray-900 font-semibold bg-green-50 text-green-800 px-2 py-1 rounded-md border border-green-200">
👤 <%= item.user.name %>
<span class="inline-flex items-center gap-1.5 text-xs font-bold bg-green-50 text-green-800 px-2.5 py-1 rounded-md border border-green-200 shadow-sm">
<svg class="h-3.5 w-3.5 text-green-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 1 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" /></svg>
<%= item.user.name %>
</span>
<% elsif item.room.present? %>
<span class="inline-flex items-center gap-1 text-gray-700 bg-blue-50 text-blue-800 px-2 py-1 rounded-md border border-blue-200">
📍 <%= item.room.name %>
<span class="inline-flex items-center gap-1.5 text-xs font-bold bg-blue-50 text-blue-800 px-2.5 py-1 rounded-md border border-blue-200 shadow-sm">
<svg class="h-3.5 w-3.5 text-blue-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25s-7.5-4.108-7.5-11.25a7.5 7.5 0 1 1 15 0Z" /></svg>
<%= item.room.name %>
</span>
<% else %>
<span class="inline-flex items-center gap-1 text-amber-800 bg-amber-50 px-2 py-1 rounded-md border border-amber-200 font-medium">
📦 Hauptlager
<span class="inline-flex items-center gap-1.5 text-xs font-bold bg-amber-50 text-amber-900 px-2.5 py-1 rounded-md border border-amber-200 shadow-sm">
<svg class="h-3.5 w-3.5 text-amber-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l5.25 3.03M12 12.75v9" /></svg>
Hauptlager
</span>
<% end %>
</div>
<!-- Aktions-Icons -->
<div class="flex items-center gap-1 shrink-0">
<!-- DETAILS BUTTON mit _top Ausbruch -->
<%= link_to item_path(item),
data: { turbo_frame: "_top" },
class: "p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-lg border border-gray-200 bg-white shadow-sm" do %>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg>
<% end %>
<!-- BEARBEITEN BUTTON mit _top Ausbruch -->
<%= link_to edit_item_path(item),
data: { turbo_frame: "_top" },
class: "p-2 text-gray-500 hover:text-amber-600 hover:bg-amber-50 rounded-lg border border-gray-200 bg-white shadow-sm" do %>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" /></svg>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<!-- RECHTER BEREICH: VERTIKAL GESTAPELTE QUICK-ACTIONS -->
<div class="flex flex-col gap-2 shrink-0">
<%= link_to item_path(item), data: { turbo_frame: "_top" }, class: "p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-lg border border-gray-200 bg-white shadow-sm flex items-center justify-center", title: "Details" do %>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg>
<% end %>
<%= link_to edit_item_path(item), data: { turbo_frame: "_top" }, class: "p-2 text-gray-500 hover:text-amber-600 hover:bg-amber-50 rounded-lg border border-gray-200 bg-white shadow-sm flex items-center justify-center", title: "Bearbeiten" do %>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" /></svg>
<% end %>
</div>
</div>
<% end %>
</div>
<!-- ========================================================================= -->
<!-- 2. DESKTOP-ANSICHT: STICKY-TABELLE (hidden md:block) -->
@@ -86,8 +79,8 @@
<thead class="bg-gray-50 sticky top-0 z-20 shadow-[0_1px_0_0_rgba(229,231,235,1)]">
<tr>
<th scope="col" class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">Artikel / Details</th>
<th scope="col" class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">Seriennummer (SN)</th>
<th scope="col" class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">Aktueller Standort / Inhaber</th>
<th scope="col" class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">SN</th>
<th scope="col" class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">Standort / Inhaber</th>
<th scope="col" class="px-6 py-3 text-start font-semibold text-gray-500 uppercase tracking-wider">Sticker-ID</th>
<th scope="col" class="px-6 py-3 text-end font-semibold text-gray-500 uppercase tracking-wider">Wert</th>
<th scope="col" class="px-6 py-3 text-end font-semibold text-gray-500 uppercase tracking-wider">Aktionen</th>
@@ -101,46 +94,77 @@
<div class="text-xs text-gray-400">SKU: <%= item.sku %> • <%= item.category.name %></div>
</td>
<td class="px-6 py-4 whitespace-nowrap font-mono text-xs text-gray-600"><%= item.serial_number %></td>
<td class="px-6 py-4 whitespace-nowrap text-gray-700">
<!-- Spalte 3: Inhaber-Weiche mit markanten Badges (Desktop Tabelle) -->
<td class="px-6 py-4 whitespace-nowrap text-sm">
<% if item.user.present? %>
<span class="inline-flex items-center gap-1.5 text-gray-900 font-medium">👤 <%= item.user.name %></span>
<span class="inline-flex items-center gap-1.5 text-gray-900 font-semibold bg-green-50 text-green-800 px-2.5 py-1 rounded-md border border-green-200 shadow-sm">
<!-- Heroicon: user -->
<svg class="h-4 w-4 text-green-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" />
</svg>
<%= item.user.name %>
</span>
<% elsif item.room.present? %>
<span class="inline-flex items-center gap-1.5 text-gray-600">📍 <%= item.room.name_with_building %></span>
<span class="inline-flex items-center gap-1.5 text-gray-900 font-semibold bg-blue-50 text-blue-800 px-2.5 py-1 rounded-md border border-blue-200 shadow-sm">
<!-- Heroicon: map-pin -->
<svg class="h-4 w-4 text-blue-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25s-7.5-4.108-7.5-11.25a7.5 7.5 0 1 1 15 0Z" />
</svg>
<%= item.room.name_with_building %>
</span>
<% else %>
<span class="inline-flex items-center py-0.5 px-2 rounded-full text-xs font-medium bg-amber-50 text-amber-800 border border-amber-200">📦 Im Hauptlager</span>
<span class="inline-flex items-center gap-1.5 text-amber-900 font-semibold bg-amber-50 text-amber-800 px-2.5 py-1 rounded-md border border-amber-200 shadow-sm">
<!-- Heroicon: cube / box -->
<svg class="h-4 w-4 text-amber-600 shrink-0" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l5.25 3.03M12 12.75v9" />
</svg>
Hauptlager
</span>
<% end %>
</td>
<!-- STICKER-ID ALS BADGE (Jetzt auch in der Desktop-Tabelle markant) -->
<!-- Erste Tabellenspalte der Desktop-Schleife -->
<td class="px-6 py-4 whitespace-nowrap">
<span class="inline-flex items-center font-mono font-bold text-xs text-white bg-blue-600 px-2 py-0.5 rounded shadow-sm tracking-wider">
#<%= item.sticker_id %>
</span>
</td>
<%= link_to item_path(item), data: { turbo_frame: "_top" }, class: "inline-block transition hover:scale-105" do %>
<span class="inline-flex items-center font-mono font-black text-xs text-white bg-blue-600 px-2.5 py-1 rounded-md shadow-sm tracking-widest">
#<%= item.sticker_id %>
</span>
<% end %>
<td class="px-6 py-4 whitespace-nowrap text-end font-medium text-gray-900">
<%= number_to_currency(item.price, unit: "€", separator: ",", delimiter: ".", format: "%n %u") %>
</td>
<!-- In der Schleife der Desktop-Tabelle (_list.html.erb) -->
<td class="px-6 py-4 whitespace-nowrap text-end font-medium text-xs">
<!-- Letzte Spalte der Desktop-Tabelle in app/views/items/_list.html.erb -->
<td class="px-6 py-4 whitespace-nowrap text-end font-medium text-xs w-24 shrink-0">
<!-- Mit 'justify-end' fluchten die echten Button-Boxen perfekt bündig rechts -->
<div class="flex items-center justify-end gap-2">
<!-- DETAILS ICON mit _top Ausbruch -->
<%= link_to item_path(item),
data: { turbo_frame: "_top" },
class: "p-1.5 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-colors border border-transparent hover:border-blue-100",
<!-- DETAILS BUTTON (Weißes Button-Design mit feinem Rahmen & Schatten) -->
<%= link_to item_path(item),
data: { turbo_frame: "_top" },
class: "p-2 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-lg border border-gray-200 bg-white shadow-sm flex items-center justify-center transition",
title: "Details anzeigen" do %>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
</svg>
<% end %>
<!-- BEARBEITEN ICON mit _top Ausbruch -->
<%= link_to edit_item_path(item),
data: { turbo_frame: "_top" },
class: "p-1.5 text-gray-500 hover:text-amber-600 hover:bg-amber-50 rounded-lg transition-colors border border-transparent hover:border-amber-100",
<!-- BEARBEITEN BUTTON (Weißes Button-Design mit feinem Rahmen & Schatten) -->
<%= link_to edit_item_path(item),
data: { turbo_frame: "_top" },
class: "p-2 text-gray-500 hover:text-amber-600 hover:bg-amber-50 rounded-lg border border-gray-200 bg-white shadow-sm flex items-center justify-center transition",
title: "Artikel bearbeiten" do %>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" /></svg>
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
</svg>
<% end %>
</div>
</td>
</tr>
<% end %>
</tbody>