Added Search function for items and fixed javascript controller
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 04:23:08 +02:00
parent 650b83bdf4
commit 204a6c05dc
9 changed files with 178 additions and 121 deletions

View File

@@ -1,19 +1,19 @@
<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">
<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>
</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">
@@ -58,10 +58,17 @@
<!-- Aktions-Icons -->
<div class="flex items-center gap-1 shrink-0">
<%= link_to item_path(item), 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 %>
<!-- 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 %>
<%= link_to edit_item_path(item), 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 %>
<!-- 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>
@@ -103,23 +110,33 @@
<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>
<% end %>
</td>
<!-- STICKER-ID ALS BADGE (Jetzt auch in der Desktop-Tabelle markant) -->
<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>
<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">
<div class="flex items-center justify-end gap-2">
<%= link_to item_path(item), 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", title: "Details anzeigen" do %>
<!-- 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",
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>
<% end %>
<%= link_to edit_item_path(item), 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", title: "Artikel bearbeiten" do %>
<!-- 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",
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>
<% end %>
</div>