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

@@ -5,6 +5,15 @@ class ItemsController < ApplicationController
def index
@items = Item.all.includes(:category, :user, :room).order(created_at: :desc)
if params[:query].present?
query_str = "%#{params[:query]}%"
# Durchsucht Name, SKU, Seriennummer und deine Sticker-ID gleichzeitig
@items = @items.where(
"items.name LIKE :q OR items.sku LIKE :q OR items.serial_number LIKE :q OR items.sticker_id LIKE :q",
q: query_str
)
end
respond_to do |format|
format.html # Rendert ganz normal deine Bestandsliste im Browser
format.csv do