freezer app completed
This commit is contained in:
4
resources/views/add.blade.php
Normal file
4
resources/views/add.blade.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<x-layout>
|
||||
<h1 class="m-4 text-2xl text-center">Aggiungi elemento</h1>
|
||||
<x-form method="POST" action="/add"></x-form>
|
||||
</x-layout>
|
||||
58
resources/views/components/form.blade.php
Normal file
58
resources/views/components/form.blade.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<form {{ $attributes }}>
|
||||
@csrf
|
||||
<div class="p-4">
|
||||
<div>
|
||||
<label for="name"
|
||||
class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Nome
|
||||
</label>
|
||||
<input required type="text" id="name" name="name"
|
||||
class="bg-gray-50 border border-gray-300
|
||||
text-gray-900 text-sm rounded-lg focus:ring-blue-500
|
||||
focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700
|
||||
dark:border-gray-600 dark:placeholder-gray-400 dark:text-white
|
||||
dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
</div>
|
||||
<div>
|
||||
<label for="description"
|
||||
class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Descrizione
|
||||
</label>
|
||||
<input type="text" id="description" name="description"
|
||||
class="bg-gray-50 border border-gray-300
|
||||
text-gray-900 text-sm rounded-lg focus:ring-blue-500
|
||||
focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700
|
||||
dark:border-gray-600 dark:placeholder-gray-400 dark:text-white
|
||||
dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
</div>
|
||||
<div>
|
||||
<label for="in_date"
|
||||
class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Data inserimento
|
||||
</label>
|
||||
<input required type="date" id="in_date" name="in_date"
|
||||
class="bg-gray-50 border border-gray-300
|
||||
text-gray-900 text-sm rounded-lg focus:ring-blue-500
|
||||
focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700
|
||||
dark:border-gray-600 dark:placeholder-gray-400 dark:text-white
|
||||
dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
</div>
|
||||
<div>
|
||||
<label for="quantity"
|
||||
class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Quantitá
|
||||
</label>
|
||||
<input required type="number" id="quantity" name="quantity"
|
||||
class="bg-gray-50 border border-gray-300
|
||||
text-gray-900 text-sm rounded-lg focus:ring-blue-500
|
||||
focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700
|
||||
dark:border-gray-600 dark:placeholder-gray-400 dark:text-white
|
||||
dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
||||
</div>
|
||||
<input type="submit" value="Aggiungi"
|
||||
class="mt-4 text-white bg-sky-700 hover:bg-sky-800
|
||||
focus:ring-4 focus:outline-none focus:ring-sky-300
|
||||
font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5
|
||||
text-center dark:bg-sky-600 dark:hover:bg-sky-700 dark:focus:ring-sky-800">
|
||||
</div>
|
||||
</form>
|
||||
16
resources/views/components/layout.blade.php
Normal file
16
resources/views/components/layout.blade.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
@vite('resources/css/app.css')
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="p-4">
|
||||
<x-navigation></x-navigation>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
1
resources/views/components/link.blade.php
Normal file
1
resources/views/components/link.blade.php
Normal file
@@ -0,0 +1 @@
|
||||
<a {{ $attributes }} class="m-2 p-2 bg-sky-100 rounded-lg hover:bg-sky-200">{{ $slot }}</a>
|
||||
4
resources/views/components/navigation.blade.php
Normal file
4
resources/views/components/navigation.blade.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<nav>
|
||||
<x-link href="/">Home</x-link>
|
||||
<x-link href="/add">Aggiungi</x-link>
|
||||
</nav>
|
||||
77
resources/views/components/table.blade.php
Normal file
77
resources/views/components/table.blade.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<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>
|
||||
7
resources/views/freezer.blade.php
Normal file
7
resources/views/freezer.blade.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<x-layout>
|
||||
<h1 class="m-4 text-2xl text-center">Freezer App</h1>
|
||||
<x-table :items="$items"></x-table>
|
||||
<div class="mt-2">
|
||||
{{ $items->links() }}
|
||||
</div>
|
||||
</x-layout>
|
||||
Reference in New Issue
Block a user