This commit is contained in:
Stefan Zwischenbrugger 2026-03-29 21:51:19 +02:00
parent 42f86e9a2e
commit 122f6920dd
3 changed files with 29 additions and 7 deletions

View File

@ -3,6 +3,7 @@
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\File;
class ToggleShoppingItemRequest extends FormRequest
{
@ -34,7 +35,11 @@ class ToggleShoppingItemRequest extends FormRequest
'store_id' => ['nullable', 'integer', 'exists:stores,id'],
'new_store_name' => ['nullable', 'string', 'max:255'],
'price_decimal' => ['nullable', 'numeric', 'min:0', 'max:999999.99'],
'photo' => ['nullable', 'image', 'max:5120'],
'photo' => [
'nullable',
File::types(['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'])
->max(15 * 1024),
],
];
}
@ -49,8 +54,7 @@ class ToggleShoppingItemRequest extends FormRequest
'price_decimal.numeric' => 'Der Preis muss eine Zahl sein.',
'price_decimal.min' => 'Der Preis darf nicht negativ sein.',
'price_decimal.max' => 'Der Preis ist zu gross.',
'photo.image' => 'Das Foto muss ein Bild sein.',
'photo.max' => 'Das Foto darf maximal 5 MB gross sein.',
'photo.max' => 'Das Foto darf maximal 15 MB gross sein.',
];
}

View File

@ -150,6 +150,7 @@
loading="lazy"
>
</a>
<a href="{{ $item->latestPriceLog->photoUrl() }}" target="_blank" rel="noopener noreferrer" class="text-xs text-blue-600 hover:underline mt-1 inline-block">Foto oeffnen (bei HEIC oft noetig)</a>
</div>
@endif
</div>
@ -157,7 +158,7 @@
@include('shopping-list.partials.item-pencil-panel', [
'item' => $item,
'stores' => $stores,
'showToggleExtras' => false,
'showToggleExtras' => true,
])
</div>
</div>

View File

@ -62,8 +62,20 @@
@if($showToggleExtras)
<div class="my-4 border-t border-gray-200"></div>
<p class="mb-2 text-xs font-medium text-gray-700">Beim Abhaken (optional)</p>
<p class="mb-3 text-xs text-gray-500">Preis und Foto nur noetig, wenn du sie gleich mit erfassen willst reicht auch die Checkbox in der Liste.</p>
<p class="mb-2 text-xs font-medium text-gray-700">
@if($item->is_done)
Preis / Foto (optional)
@else
Beim Abhaken (optional)
@endif
</p>
<p class="mb-3 text-xs text-gray-500">
@if($item->is_done)
Neuen Kassenbon oder Preis eintragen. JPEG/PNG/WebP werden ueberall angezeigt; iPhone-HEIC: ggf. Foto-Link nutzen.
@else
Preis und Foto nur noetig, wenn du sie gleich mit erfassen willst reicht auch die Checkbox in der Liste.
@endif
</p>
<form
method="POST"
action="{{ route('shopping-items.toggle', $item) }}"
@ -123,6 +135,7 @@
loading="lazy"
>
</a>
<a href="{{ $item->latestPriceLog->photoUrl() }}" target="_blank" rel="noopener noreferrer" class="text-xs text-blue-600 hover:underline mt-1 inline-block">Foto in neuem Tab oeffnen</a>
</div>
@endif
@endif
@ -130,7 +143,11 @@
type="submit"
class="rounded-lg bg-emerald-600 text-white px-4 py-2.5 min-h-[44px] text-sm font-medium hover:bg-emerald-700"
>
Erledigt mit Angaben
@if($item->is_done)
Speichern
@else
Erledigt mit Angaben
@endif
</button>
</form>
@endif