corretto lunghezza stringa colonne ntelaio e nmotore
This commit is contained in:
parent
39f1fb8eb2
commit
bb783b9bf1
@ -50,9 +50,10 @@ class AutoController extends Controller
|
|||||||
public function getAutoDetails(request $id)
|
public function getAutoDetails(request $id)
|
||||||
{
|
{
|
||||||
// Ritorna i dettagli dell'auto
|
// Ritorna i dettagli dell'auto
|
||||||
return view('auto.detail',[
|
/*return view('auto.detail',[
|
||||||
'dettagli' => Auto::getAutoById($id['id']),
|
'dettagli' => Auto::getAutoById($id['id']),]);*/
|
||||||
]);
|
return Operazione::getOperazioni($id['id']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,4 +17,8 @@ class Accessori extends Model
|
|||||||
'descrizione'=>$data['descrizione'],
|
'descrizione'=>$data['descrizione'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getElementsbyOperazione($data) {
|
||||||
|
return DB::table('accessoris')->where('fk_operazione_id','=',$data)->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,8 @@ class Manutenzione extends Model
|
|||||||
'descrizione'=>$data['descrizione'],
|
'descrizione'=>$data['descrizione'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getElementsbyOperazione($data) {
|
||||||
|
return DB::table('manutenziones')->where('fk_operazione_id','=',$data)->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,13 +61,30 @@ class Operazione extends Model
|
|||||||
public static function getOperazioni($autoId)
|
public static function getOperazioni($autoId)
|
||||||
{
|
{
|
||||||
// Ritorna la lista delle operazioni effettuate sull'auto
|
// Ritorna la lista delle operazioni effettuate sull'auto
|
||||||
|
$automobile=Auto::getAutoById($autoId);
|
||||||
$data=DB::table('operaziones')
|
$data=DB::table('operaziones')
|
||||||
->leftJoin('accessoris','operaziones.id','=','accessoris.fk_operazione_id')
|
|
||||||
->leftJoin('manutenziones','operaziones.id','=','manutenziones.fk_operazione_id')
|
|
||||||
->leftJoin('rifornimentos', 'operaziones.id','=','rifornimentos.fk_operazione_id')
|
|
||||||
->leftJoin('revisiones','operaziones.id','=','revisiones.fk_operazione_id')
|
|
||||||
->where('fk_auto_id','=',$autoId)
|
->where('fk_auto_id','=',$autoId)
|
||||||
|
->orderBy('km')
|
||||||
->get();
|
->get();
|
||||||
return $data;
|
foreach ($data as $dato)
|
||||||
|
{
|
||||||
|
$accessori[$dato->id]=Accessori::getElementsbyOperazione($dato->id);
|
||||||
|
$manutenzione[$dato->id]=Manutenzione::getElementsbyOperazione($dato->id);
|
||||||
|
$revisione[$dato->id]=Revisione::getElementsbyOperazione($dato->id);
|
||||||
|
$rifornimento[$dato->id]=Rifornimento::getElementsbyOperazione($dato->id);
|
||||||
|
if(isset($dato->km)){$km=$dato->km;}else{$km=0;}
|
||||||
|
}
|
||||||
|
// Debug
|
||||||
|
/* dd($rifornimento);*/
|
||||||
|
return view('auto.detail',[
|
||||||
|
'dettagli'=>$automobile,
|
||||||
|
'km'=>$km,
|
||||||
|
|
||||||
|
'operazione'=>$data,
|
||||||
|
'accessori'=>$accessori,
|
||||||
|
'manutenzione'=>$manutenzione,
|
||||||
|
'revisione'=>$revisione,
|
||||||
|
'rifornimento'=>$rifornimento,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,8 @@ class Revisione extends Model
|
|||||||
'dataproxrevisione'=>$data['dataproxrevisione'],
|
'dataproxrevisione'=>$data['dataproxrevisione'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getElementsbyOperazione($data) {
|
||||||
|
return DB::table('revisiones')->where('fk_operazione_id','=',$data)->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,8 @@ class Rifornimento extends Model
|
|||||||
'fk_operazione_id'=>$id
|
'fk_operazione_id'=>$id
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getElementsbyOperazione($data) {
|
||||||
|
return DB::table('rifornimentos')->where('fk_operazione_id','=',$data)->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,10 @@ class CreateAutosTable extends Migration
|
|||||||
$table->string('cilindrata',10);
|
$table->string('cilindrata',10);
|
||||||
$table->string('alimentazione',10);
|
$table->string('alimentazione',10);
|
||||||
$table->string('cvfiscali',10);
|
$table->string('cvfiscali',10);
|
||||||
$table->string('ntelaio',10);
|
$table->string('ntelaio',30);
|
||||||
$table->string('nmotore',10);
|
$table->string('nmotore',30)->nullable();
|
||||||
$table->date('data_acquisto');
|
$table->date('data_acquisto');
|
||||||
$table->text('note');
|
$table->text('note')->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,5 +14,10 @@ class DatabaseSeeder extends Seeder
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
// \App\Models\User::factory(10)->create();
|
// \App\Models\User::factory(10)->create();
|
||||||
|
$this->call([
|
||||||
|
UserSeeder::class,
|
||||||
|
TagSeeder::class,
|
||||||
|
CategorieSeeder::class,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace Database\Seeders;
|
|||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
class UserSeeder extends Seeder
|
class UserSeeder extends Seeder
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
@section('content')
|
@section('content')
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header">Dettaglio Automobili</h1>
|
<h1 class="page-header">{{ $dettagli->marca; }} {{ $dettagli->modello; }} targa: {{ $dettagli->targa; }}</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@ -15,45 +15,219 @@
|
|||||||
Dettaglio auto {{ $dettagli->targa }}
|
Dettaglio auto {{ $dettagli->targa }}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-bordered table-hover" id="automobili">
|
<table class="table table-striped table-bordered table-hover" id="">
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Marca</th>
|
<th>Marca:</th>
|
||||||
<th>Modello</th>
|
<th>Modello:</th>
|
||||||
<th>Targa</th>
|
<th>Targa:</th>
|
||||||
<th>Alimentazione</th>
|
<th>Alimentazione:</th>
|
||||||
<th>Cilindrata</th>
|
<th>Cilindrata:</th>
|
||||||
<th>Cavalli Fisc.</th>
|
<th>Cavalli Fisc.:</th>
|
||||||
<th>Num.Telaio</th>
|
<th>Num.Telaio:</th>
|
||||||
<th>Num. Motore</th>
|
<th>Num. Motore:</th>
|
||||||
<th>Data acquisto</th>
|
<th>Data acquisto:</th>
|
||||||
<th>Note</th>
|
<th>Kilometraggio:</th>
|
||||||
</tr>
|
<th>Note:</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $dettagli->marca; }}</td>
|
<td>{{ $dettagli->marca; }}</td>
|
||||||
<td>{{ $dettagli->modello; }}</td>
|
<td>{{ $dettagli->modello; }}</td>
|
||||||
<td>{{ $dettagli->targa; }}</td>
|
<td>{{ $dettagli->targa; }}</td>
|
||||||
<td>{{ $dettagli->alimentazione; }}</td>
|
<td>{{ $dettagli->alimentazione; }}</td>
|
||||||
<td>{{ $dettagli->cilindrata; }}</td>
|
<td>{{ $dettagli->cilindrata; }}</td>
|
||||||
<td>{{ $dettagli->cvfiscali; }}</td>
|
<td>{{ $dettagli->cvfiscali; }}</td>
|
||||||
<td>{{ $dettagli->ntelaio; }}</td>
|
<td>{{ $dettagli->ntelaio; }}</td>
|
||||||
<td>{{ $dettagli->nmotore; }}</td>
|
<td>{{ $dettagli->nmotore; }}</td>
|
||||||
<td>{{ $dettagli->data_acquisto; }}</td>
|
<td>{{ $dettagli->data_acquisto; }}</td>
|
||||||
<td>{{ $dettagli->note; }}</td>
|
<td>{{ $km ?? ''; }}</td>
|
||||||
</tr>
|
<td>{{ $dettagli->note; }}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Revisioni -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Revisioni auto {{ $dettagli->targa }}
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="revisione">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Data</th>
|
||||||
|
<th>Km</th>
|
||||||
|
<th>Superata</th>
|
||||||
|
<th>Centro Revisione</th>
|
||||||
|
<th>Descrizione</th>
|
||||||
|
<th>Prossima revisione</th>
|
||||||
|
<th>Importo</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($operazione as $operazioni)
|
||||||
|
@if ($operazioni->type =='revisione')
|
||||||
|
<tr>
|
||||||
|
<td>{{ $operazioni->data; }}</td>
|
||||||
|
<td>{{ $operazioni->km; }}</td>
|
||||||
|
<td>{{ $revisione[$operazioni->id][0]->superata; }}</td>
|
||||||
|
<td>{{ $revisione[$operazioni->id][0]->centrorevisione; }}</td>
|
||||||
|
<td>{{ $revisione[$operazioni->id][0]->descrizione; }}</td>
|
||||||
|
<td>{{ $revisione[$operazioni->id][0]->dataproxrevisione; }}</td>
|
||||||
|
<td>{{ $operazioni->importo; }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Fine Revisioni -->
|
||||||
|
|
||||||
|
<!-- Manutenzioni -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Manutenzione auto {{ $dettagli->targa }}
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="manutenzione">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Data</th>
|
||||||
|
<th>Km</th>
|
||||||
|
<th>Descrizione</th>
|
||||||
|
<th>Importo</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($operazione as $operazioni)
|
||||||
|
@if ($operazioni->type =='manutenzione')
|
||||||
|
<tr>
|
||||||
|
<td>{{ $operazioni->data; }}</td>
|
||||||
|
<td>{{ $operazioni->km; }}</td>
|
||||||
|
<td>{{ $manutenzione[$operazioni->id][0]->descrizione; }}</td>
|
||||||
|
<td>{{ $operazioni->importo; }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Fine Manutenzioni -->
|
||||||
|
|
||||||
|
<!-- Accessori -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Accessori/Ricambi auto {{ $dettagli->targa }}
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="accessori">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Data</th>
|
||||||
|
<th>Km</th>
|
||||||
|
<th>Descrizione</th>
|
||||||
|
<th>Importo</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($operazione as $operazioni)
|
||||||
|
@if ($operazioni->type=='accessori')
|
||||||
|
<tr>
|
||||||
|
<td>{{ $operazioni->data; }}</td>
|
||||||
|
<td>{{ $operazioni->km; }}</td>
|
||||||
|
<td>{{ $accessori[$operazioni->id][0]->descrizione; }}</td>
|
||||||
|
<td>{{ $operazioni->importo; }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Fine Accessori -->
|
||||||
|
|
||||||
|
<!-- Rifornimenti -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Rifornimenti auto {{ $dettagli->targa }}
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="">
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Data</th>
|
||||||
|
<th>Km</th>
|
||||||
|
<th>Distributore</th>
|
||||||
|
<th>Euro al litro</th>
|
||||||
|
<th>Litri</th>
|
||||||
|
<th>Importo</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($operazione as $operazioni)
|
||||||
|
@if ($operazioni->type =='rifornimento')
|
||||||
|
<tr>
|
||||||
|
<td>{{ $operazioni->data; }}</td>
|
||||||
|
<td>{{ $operazioni->km; }}</td>
|
||||||
|
<td>{{ $rifornimento[$operazioni->id][0]->distributore; }}</td>
|
||||||
|
<td>{{ $rifornimento[$operazioni->id][0]->eurolitro; }}</td>
|
||||||
|
<td>{{ $rifornimento[$operazioni->id][0]->litri; }}</td>
|
||||||
|
<td>{{ $operazioni->importo; }}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Fine Rifornimenti -->
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- /.col-lg-12 -->
|
<!-- /.col-lg-12 -->
|
||||||
|
Loading…
Reference in New Issue
Block a user