feature - 7 - Hide users selection if no users exist

This commit is contained in:
myrmidex 2025-12-28 21:15:08 +01:00
parent ecfadbc2ad
commit dc00300f44
2 changed files with 50 additions and 37 deletions

View file

@ -83,6 +83,7 @@ class="w-full p-2 border rounded bg-gray-600 border-secondary text-gray-100 focu
@error('name') <span class="text-danger text-xs">{{ $message }}</span> @enderror @error('name') <span class="text-danger text-xs">{{ $message }}</span> @enderror
</div> </div>
@if($users->count() > 0)
<div class="mb-6"> <div class="mb-6">
<label class="block text-sm font-medium mb-2">Assign to Users</label> <label class="block text-sm font-medium mb-2">Assign to Users</label>
<div class="space-y-2 max-h-40 overflow-y-auto border border-secondary rounded p-3 bg-gray-700"> <div class="space-y-2 max-h-40 overflow-y-auto border border-secondary rounded p-3 bg-gray-700">
@ -103,6 +104,11 @@ class="rounded border-secondary bg-gray-600 text-primary focus:ring-accent-blue
</div> </div>
@error('selectedUsers') <span class="text-danger text-xs">{{ $message }}</span> @enderror @error('selectedUsers') <span class="text-danger text-xs">{{ $message }}</span> @enderror
</div> </div>
@else
<div class="mb-6">
<p class="text-gray-400 text-sm italic">No users available to assign. <a href="{{ route('users.index') }}" class="text-accent-blue hover:underline">Add users</a> to assign them to dishes.</p>
</div>
@endif
<div class="flex justify-end space-x-3"> <div class="flex justify-end space-x-3">
<button type="button" <button type="button"
@ -135,6 +141,7 @@ class="w-full p-2 border rounded bg-gray-600 border-secondary text-gray-100 focu
@error('name') <span class="text-danger text-xs">{{ $message }}</span> @enderror @error('name') <span class="text-danger text-xs">{{ $message }}</span> @enderror
</div> </div>
@if($users->count() > 0)
<div class="mb-6"> <div class="mb-6">
<label class="block text-sm font-medium mb-2">Assign to Users</label> <label class="block text-sm font-medium mb-2">Assign to Users</label>
<div class="space-y-2 max-h-40 overflow-y-auto border border-secondary rounded p-3 bg-gray-700"> <div class="space-y-2 max-h-40 overflow-y-auto border border-secondary rounded p-3 bg-gray-700">
@ -155,6 +162,11 @@ class="rounded border-secondary bg-gray-600 text-primary focus:ring-accent-blue
</div> </div>
@error('selectedUsers') <span class="text-danger text-xs">{{ $message }}</span> @enderror @error('selectedUsers') <span class="text-danger text-xs">{{ $message }}</span> @enderror
</div> </div>
@else
<div class="mb-6">
<p class="text-gray-400 text-sm italic">No users available to assign. <a href="{{ route('users.index') }}" class="text-accent-blue hover:underline">Add users</a> to assign them to dishes.</p>
</div>
@endif
<div class="flex justify-end space-x-3"> <div class="flex justify-end space-x-3">
<button type="button" <button type="button"

View file

@ -50,7 +50,8 @@ public function testCanOpenCreateDishModal(): void
->pause(1000) ->pause(1000)
->assertSee('Add New Dish') ->assertSee('Add New Dish')
->assertSee('Dish Name') ->assertSee('Dish Name')
->assertSee('Assign to Users') ->assertSee('No users available to assign')
->assertSee('Add users')
->assertSee('Create Dish') ->assertSee('Create Dish')
->assertSee('Cancel'); ->assertSee('Cancel');
}); });