tags management

This commit is contained in:
Doar Mihai
2026-02-21 16:12:57 +02:00
parent 898bddf614
commit 76d888760c
13 changed files with 850 additions and 2 deletions
+42
View File
@@ -97,6 +97,48 @@
</div>
</div>
<!-- Tags -->
@if($tags->count() > 0)
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
Tags
</label>
<div class="mt-1 space-y-2">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
@foreach($tags as $tag)
@php
$isChecked = old('tags')
? in_array($tag->id, old('tags'))
: $product->tags->contains($tag->id);
@endphp
<label class="relative flex items-start p-3 border border-gray-300 rounded-md cursor-pointer hover:bg-gray-50 transition-colors">
<div class="flex items-center h-5">
<input type="checkbox"
name="tags[]"
value="{{ $tag->id }}"
{{ $isChecked ? 'checked' : '' }}
class="focus:ring-primary-500 h-4 w-4 text-primary-600 border-gray-300 rounded">
</div>
<div class="ml-3 flex-1">
<div class="flex items-center gap-2">
<span class="inline-block w-3 h-3 rounded-full" style="background-color: {{ $tag->color }}"></span>
<span class="text-sm font-medium text-gray-900">{{ $tag->name }}</span>
</div>
@if($tag->description)
<p class="text-xs text-gray-500 mt-1">{{ $tag->description }}</p>
@endif
</div>
</label>
@endforeach
</div>
@error('tags')
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
@enderror
<p class="mt-2 text-sm text-gray-500">Select all tags that apply to your product.</p>
</div>
</div>
@endif
<!-- Current Thumbnail -->
@if($product->thumbnail_url)
<div>