1
0
Files
Freezer-web-app/resources/views/components/table.blade.php
2025-03-31 17:22:29 +02:00

77 lines
3.1 KiB
PHP

<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
<tr>
<th scope="col" class="px-6 py-3">
Id
</th>
<th scope="col" class="px-6 py-3">
Nome
</th>
<th scope="col" class="px-6 py-3">
Descrizione
</th>
<th scope="col" class="px-6 py-3">
Data inserimento
</th>
<th scope="col" class="px-6 py-3">
Quantitá
</th>
<th scope="col" class="px-6 py-3">
Azioni
</th>
</tr>
</thead>
<tbody>
@foreach($items as $item)
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700 border-gray-200">
<td class="px-6 py-4">
{{ $item->id }}
</td>
<td class="px-6 py-4">
{{ $item->name }}
</td>
<td class="px-6 py-4">
{{ $item->description }}
</td>
<td class="px-6 py-4">
{{ $item->in_date }}
</td>
<td class="px-6 py-4">
{{ $item->quantity }}
</td>
<td class="px-6 py-4">
@if ($item->quantity == 0)
<form method="POST" action="/delete/{{ $item->id }}">
@csrf
@method("DELETE")
<input type="submit" class="text-white bg-red-700 hover:bg-red-800
focus:ring-4 focus:outline-none focus:ring-red-300
font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5
text-center dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800" value="Cancella">
</form>
@else
<div class="flex row">
<form method="POST" action="/reduce/{{ $item->id }}">
@csrf
@method("PUT")
<input type="submit" class="mr-2 text-white bg-yellow-700 hover:bg-yellow-800
focus:ring-4 focus:outline-none focus:ring-yellow-300
font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5
text-center dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800" value="-1">
</form>
<form method="POST" action="/increase/{{ $item->id }}">
@csrf
@method("PUT")
<input type="submit" class="text-white bg-green-700 hover:bg-green-800
focus:ring-4 focus:outline-none focus:ring-green-300
font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5
text-center dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800" value="+1">
</form>
</div>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>