Generazione delle basi per le relazioni della base degli affitti
This commit is contained in:
parent
5dbe0a2c85
commit
ed47d85375
65
app/Http/Controllers/AnagraficaInquiliniController.php
Normal file
65
app/Http/Controllers/AnagraficaInquiliniController.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\AnagraficaInquilini;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class AnagraficaInquiliniController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(AnagraficaInquilini $anagraficaInquilini)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit(AnagraficaInquilini $anagraficaInquilini)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, AnagraficaInquilini $anagraficaInquilini)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(AnagraficaInquilini $anagraficaInquilini)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
71
app/Http/Controllers/CotrattiAffittiController.php
Normal file
71
app/Http/Controllers/CotrattiAffittiController.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\CotrattiAffitti;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class CotrattiAffittiController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return view('affitti.contratti.index',[
|
||||||
|
'contratti' => CotrattiAffitti::all()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return view('affitti.contratti.create',[
|
||||||
|
'immobili' => \App\Models\Immobili::all()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(CotrattiAffitti $cotrattiAffitti)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit(CotrattiAffitti $cotrattiAffitti)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, CotrattiAffitti $cotrattiAffitti)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(CotrattiAffitti $cotrattiAffitti)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
65
app/Http/Controllers/TipoContrattoController.php
Normal file
65
app/Http/Controllers/TipoContrattoController.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\TipoContratto;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TipoContrattoController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(TipoContratto $tipoContratto)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit(TipoContratto $tipoContratto)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, TipoContratto $tipoContratto)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(TipoContratto $tipoContratto)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
10
app/Models/AnagraficaInquilini.php
Normal file
10
app/Models/AnagraficaInquilini.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class AnagraficaInquilini extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
14
app/Models/CotrattiAffitti.php
Normal file
14
app/Models/CotrattiAffitti.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class CotrattiAffitti extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
public function immobile()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Immobili::class, 'immobile_id');
|
||||||
|
}
|
||||||
|
}
|
10
app/Models/TipoContratto.php
Normal file
10
app/Models/TipoContratto.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class TipoContratto extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
@ -440,7 +440,7 @@ return [
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => 'Contratti di locazione',
|
'text' => 'Contratti di locazione',
|
||||||
'url' => 'admin/affitti/locazioni',
|
'url' => 'admin/affitti/contratti',
|
||||||
'icon' => 'fas fa-fw fa-tags',
|
'icon' => 'fas fa-fw fa-tags',
|
||||||
'can' => ['affitti'],
|
'can' => ['affitti'],
|
||||||
],
|
],
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('cotratti_affittis', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->foreignId('immobile_id');
|
||||||
|
$table->foreignId('tipo_contratto_id');
|
||||||
|
$table->date('data_inizio')->nullable();
|
||||||
|
$table->date('data_fine')->nullable();
|
||||||
|
$table->unsignedTinyInteger('tacito_rinnovo');
|
||||||
|
$table->string('canone_mensile')->nullable();
|
||||||
|
$table->string('deposito_cauzionale')->nullable();
|
||||||
|
$table->string('spese_condominiali')->nullable();
|
||||||
|
$table->string('iva')->nullable();
|
||||||
|
$table->string('registrazione')->nullable();
|
||||||
|
$table->string('note')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('cotratti_affittis');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('tipo_contrattos', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('tipo_contrattos');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('anagrafica_inquilinis', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('anagrafica_inquilinis');
|
||||||
|
}
|
||||||
|
};
|
46
resources/views/affitti/contratti/index.blade.php
Normal file
46
resources/views/affitti/contratti/index.blade.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
@extends('adminlte::page')
|
||||||
|
|
||||||
|
@section('title', 'Contratti Affitti')
|
||||||
|
@section('content_header')
|
||||||
|
<h1>Contratti Affitti</h1>
|
||||||
|
@stop
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<a href="{{ route('contratti.create') }}" class="btn btn-primary mb-3">Crea Nuovo Contratto</a>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Nome</th>
|
||||||
|
<th>Descrizione</th>
|
||||||
|
<th>Immobile</th>
|
||||||
|
<th>Data Inizio</th>
|
||||||
|
<th>Data Fine</th>
|
||||||
|
<th>Azioni</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($contratti as $contratto)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $contratto->id }}</td>
|
||||||
|
<td>{{ $contratto->nome }}</td>
|
||||||
|
<td>{{ $contratto->descrizione }}</td>
|
||||||
|
<td>{{ $contratto->immobile ? $contratto->immobile->indirizzo : 'N/A' }}</td>
|
||||||
|
<td>{{ $contratto->data_inizio }}</td>
|
||||||
|
<td>{{ $contratto->data_fine }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ route('contratti.show', $contratto->id) }}" class="btn btn-info btn-sm">Visualizza</a>
|
||||||
|
<a href="{{ route('contratti.edit', $contratto->id) }}" class="btn btn-warning btn-sm">Modifica</a>
|
||||||
|
<form action="{{ route('contratti.destroy', $contratto->id) }}" method="POST" style="display:inline;">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Sei sicuro di voler eliminare questo contratto?')">Elimina</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
@endsection
|
@ -263,13 +263,13 @@ Route::middleware([
|
|||||||
Route::get('admin/affitti/associaContratto', [App\Http\Controllers\ImmobiliController::class,'associaContratto'])->name('affitti_contratti.associa');
|
Route::get('admin/affitti/associaContratto', [App\Http\Controllers\ImmobiliController::class,'associaContratto'])->name('affitti_contratti.associa');
|
||||||
|
|
||||||
// Cotratti
|
// Cotratti
|
||||||
Route::get('admin/affitti/contratti', [App\Http\Controllers\ContrattiAffittiController::class,'index'])->name('contratti_affitti');
|
Route::get('admin/affitti/contratti', [App\Http\Controllers\CotrattiAffittiController::class,'index'])->name('contratti_affitti');
|
||||||
Route::get('admin/affitti/contratti/create', [App\Http\Controllers\ContrattiAffittiController::class,'create'])->name('contratti_affitti.create');
|
Route::get('admin/affitti/contratti/create', [App\Http\Controllers\CotrattiAffittiController::class,'create'])->name('contratti_affitti.create');
|
||||||
Route::post('admin/affitti/contratti', [App\Http\Controllers\ContrattiAffittiController::class,'store'])->name('contratti_affitti.store');
|
Route::post('admin/affitti/contratti', [App\Http\Controllers\CotrattiAffittiController::class,'store'])->name('contratti_affitti.store');
|
||||||
Route::get('admin/affitti/contratti/{contrattiAffitti}', [App\Http\Controllers\ContrattiAffittiController::class,'show'])->name('contratti_affitti.show');
|
Route::get('admin/affitti/contratti/{contrattiAffitti}', [App\Http\Controllers\CotrattiAffittiController::class,'show'])->name('contratti_affitti.show');
|
||||||
Route::get('admin/affitti/contratti/{contrattiAffitti}/edit', [App\Http\Controllers\ContrattiAffittiController::class,'edit'])->name('contratti_affitti.edit');
|
Route::get('admin/affitti/contratti/{contrattiAffitti}/edit', [App\Http\Controllers\CotrattiAffittiController::class,'edit'])->name('contratti_affitti.edit');
|
||||||
Route::put('admin/affitti/contratti/{contrattiAffitti}', [App\Http\Controllers\ContrattiAffittiController::class,'update'])->name('contratti_affitti.update');
|
Route::put('admin/affitti/contratti/{contrattiAffitti}', [App\Http\Controllers\CotrattiAffittiController::class,'update'])->name('contratti_affitti.update');
|
||||||
Route::delete('admin/affitti/contratti/{contrattiAffitti}', [App\Http\Controllers\ContrattiAffittiController::class,'destroy'])->name('contratti_affitti');
|
Route::delete('admin/affitti/contratti/{contrattiAffitti}', [App\Http\Controllers\CotrattiAffittiController::class,'destroy'])->name('contratti_affitti');
|
||||||
});
|
});
|
||||||
|
|
||||||
// API
|
// API
|
||||||
|
Loading…
x
Reference in New Issue
Block a user