From b495bc23163f990b3727a0f42749ff7aa8757c83 Mon Sep 17 00:00:00 2001 From: Flavio Barachino Date: Tue, 28 Mar 2023 20:58:29 +0200 Subject: [PATCH] Lavorazioni su Automobili (inserimento e visualizzazione --- app/Http/Controllers/AutoController.php | 53 ++++++++++++++++++++- composer.lock | 37 ++++++++------- public/css/app.css | 1 + public/css/startmin.css | 1 + public/pages/note.txt | 2 + resources/views/auto/form.blade.php | 63 +++++++++++++++++++++++++ resources/views/auto/list.blade.php | 61 ++++++++++++++++++++++++ resources/views/tmp/form.blade.php | 37 +++++++++++++++ resources/views/tmp/test.blade.php | 16 +++++++ routes/admin.php | 4 +- 10 files changed, 255 insertions(+), 20 deletions(-) create mode 100644 public/pages/note.txt create mode 100644 resources/views/auto/form.blade.php create mode 100644 resources/views/auto/list.blade.php create mode 100644 resources/views/tmp/form.blade.php create mode 100644 resources/views/tmp/test.blade.php diff --git a/app/Http/Controllers/AutoController.php b/app/Http/Controllers/AutoController.php index 0aacbcb..7270a29 100644 --- a/app/Http/Controllers/AutoController.php +++ b/app/Http/Controllers/AutoController.php @@ -2,13 +2,64 @@ namespace App\Http\Controllers; + use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; + class AutoController extends Controller { // - public function index() + public static function index() { // lista le auto inserite nel gestionale + $lista=DB::table('autos')->select(['targa','marca','modello','id'])->get(); + // dd($lista); // debug + return view('auto.list',['title'=>'Automobile', 'automobili'=>$lista]); + } + + public function newAuto() + { + // mostra il form di inserimento di una nuova Auto + return view('auto.form',['title'=>'Form Automobile']); + } + + public function saveAuto(Request $request) + { + // inserisce l'auto nel database e torna alla lista + // dd($request); + + DB::table('autos')->insert([ + 'targa'=>$request['targa'], + 'marca'=>$request['marca'], + 'modello'=>$request['modello'], + 'cilindrata'=>$request['cilindrata'], + 'cvfiscali'=>$request['cvfiscali'], + 'alimentazione'=>$request['alimentazione'], + 'ntelaio'=>$request['ntelaio'], + 'nmotore'=>$request['nmotore'], + 'data_acquisto'=>$request['data_acquisto'], + 'note'=>$request['note'], + ]); + + if ($request['another']=='on') + { + route('auto_new'); + } + else { + route('auto_list'); + } + + } + + public function getAutoDetails(request $id) + { + + // Ritorna i dettagli dell'auto + } + + public function getTCOAuto(request $id) + { + } } diff --git a/composer.lock b/composer.lock index bc9c795..27146e9 100644 --- a/composer.lock +++ b/composer.lock @@ -1861,16 +1861,16 @@ }, { "name": "league/commonmark", - "version": "2.3.9", + "version": "2.4.0", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "c1e114f74e518daca2729ea8c4bf1167038fa4b5" + "reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/c1e114f74e518daca2729ea8c4bf1167038fa4b5", - "reference": "c1e114f74e518daca2729ea8c4bf1167038fa4b5", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d44a24690f16b8c1808bf13b1bd54ae4c63ea048", + "reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048", "shasum": "" }, "require": { @@ -1906,7 +1906,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" } }, "autoload": { @@ -1963,7 +1963,7 @@ "type": "tidelift" } ], - "time": "2023-02-15T14:07:24+00:00" + "time": "2023-03-24T15:16:10+00:00" }, { "name": "league/config", @@ -3197,16 +3197,16 @@ }, { "name": "psy/psysh", - "version": "v0.11.12", + "version": "v0.11.14", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "52cb7c47d403c31c0adc9bf7710fc355f93c20f7" + "reference": "8c2e264def7a8263a68ef6f0b55ce90b77d41e17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/52cb7c47d403c31c0adc9bf7710fc355f93c20f7", - "reference": "52cb7c47d403c31c0adc9bf7710fc355f93c20f7", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/8c2e264def7a8263a68ef6f0b55ce90b77d41e17", + "reference": "8c2e264def7a8263a68ef6f0b55ce90b77d41e17", "shasum": "" }, "require": { @@ -3267,9 +3267,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.12" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.14" }, - "time": "2023-01-29T21:24:40+00:00" + "time": "2023-03-28T03:41:01+00:00" }, { "name": "ralouphie/getallheaders", @@ -7546,16 +7546,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.5", + "version": "9.6.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" + "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b65d59a059d3004a040c16a82e07bbdf6cfdd115", + "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115", "shasum": "" }, "require": { @@ -7628,7 +7628,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.6" }, "funding": [ { @@ -7644,7 +7645,7 @@ "type": "tidelift" } ], - "time": "2023-03-09T06:34:10+00:00" + "time": "2023-03-27T11:43:46+00:00" }, { "name": "sebastian/cli-parser", diff --git a/public/css/app.css b/public/css/app.css index 61d553a..2eeebb5 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -1,4 +1,5 @@ @import url(https://fonts.googleapis.com/css?family=Nunito); + @charset "UTF-8"; /*! * Bootstrap v5.1.3 (https://getbootstrap.com/) diff --git a/public/css/startmin.css b/public/css/startmin.css index 8491456..0a11181 100644 --- a/public/css/startmin.css +++ b/public/css/startmin.css @@ -4,6 +4,7 @@ * For details, see http://www.apache.org/licenses/LICENSE-2.0. */ + body { background-color: #f8f8f8; } diff --git a/public/pages/note.txt b/public/pages/note.txt new file mode 100644 index 0000000..3b63c24 --- /dev/null +++ b/public/pages/note.txt @@ -0,0 +1,2 @@ +@import url('https://fonts.googleapis.com/css2?family=Titillium+Web:wght@300;600&display=swap'); +font-family: 'Titillium Web', sans-serif; \ No newline at end of file diff --git a/resources/views/auto/form.blade.php b/resources/views/auto/form.blade.php new file mode 100644 index 0000000..46bd991 --- /dev/null +++ b/resources/views/auto/form.blade.php @@ -0,0 +1,63 @@ +@extends('admin') +@section('content') +
+
+

Inserisci Automobile

+
+
+
+
+
+
+
+ Lista delle automobili +
+
+ +
+ @csrf +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+
+ + + +@endsection + +@section('script') + +@endsection diff --git a/resources/views/auto/list.blade.php b/resources/views/auto/list.blade.php new file mode 100644 index 0000000..09c1c7c --- /dev/null +++ b/resources/views/auto/list.blade.php @@ -0,0 +1,61 @@ +@extends('admin') +@section('content') +
+
+

Lista Automobili

+
+
+
+ + +
+
+
+
+ Lista delle automobili +
+
+
+ + + + + + + + + + + @foreach($automobili ?? '' as $automobile) + + + + + + + @endforeach + + +
MarcaModelloTarga
{{ $automobile->marca; }}{{ $automobile->modello; }}{{ $automobile->targa; }} +   +   +
+
+
+
+
+
+ + + +@endsection + +@section('script') + +@endsection diff --git a/resources/views/tmp/form.blade.php b/resources/views/tmp/form.blade.php new file mode 100644 index 0000000..16b4cc9 --- /dev/null +++ b/resources/views/tmp/form.blade.php @@ -0,0 +1,37 @@ +@extends('admin') +@section('content') +
+
+

{{ $title }}

+
+
+
+ +
+
+
+
+ Segnaposto temporaneo per view {{ $title }} +
+
+
+
+
+
+
+ @csrf +
+
+ + +
+ + +
+ +
+
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/tmp/test.blade.php b/resources/views/tmp/test.blade.php new file mode 100644 index 0000000..47fb591 --- /dev/null +++ b/resources/views/tmp/test.blade.php @@ -0,0 +1,16 @@ +@extends('admin') +@section('content') +
+
+

{{ $title }}

+
+
+
+ + +
+
+ Segnaposto temporaneo per view {{ $title }} +
+
+@endsection \ No newline at end of file diff --git a/routes/admin.php b/routes/admin.php index c42ae3e..ae2d3bf 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -9,7 +9,7 @@ use App\Http\Controllers\DocumentiController; use App\Http\Controllers\MovimentiController; use App\Http\Controllers\TagController; use App\Http\Controllers\FullCalenderController; - +use App\Http\Controllers\AutoController; /* |-------------------------------------------------------------------------- | Web Routes @@ -65,6 +65,8 @@ Route::get('/', [MovimentiController::class,'dashboard']); # Automobili Route::get('auto', [AutoController::class, 'index'])->name('auto_list'); + Route::get('auto/new', [AutoController::class, 'newAuto'])->name('auto_new'); + Route::post('auto/new', [AutoController::class, 'saveAuto'])->name('auto_save'); /// TEST routes Route::get('fullcalender', [FullCalenderController::class, 'index']);