BUB-12 Creazione gestione Documenti allegati al movimento
This commit is contained in:
parent
e97ffe2473
commit
3be3064505
39
app/Http/Controllers/DocumentiController.php
Normal file
39
app/Http/Controllers/DocumentiController.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class DocumentiController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
public function storeFile(Request $req){
|
||||||
|
if ($req->hasFile('filename'))
|
||||||
|
{
|
||||||
|
$movimento_id=$req->input('id');
|
||||||
|
$filename=$req->file('filename')->store('Documenti');
|
||||||
|
DB::table('documentis')
|
||||||
|
->insert([
|
||||||
|
'movimenti_id'=>$movimento_id,
|
||||||
|
'descrizione'=>$req->input('descrizione'),
|
||||||
|
'filename'=>$filename,
|
||||||
|
]);
|
||||||
|
return redirect(route('documenti',['id'=>$movimento_id,]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 'Nessun File trovato';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fileForm(Request $request){
|
||||||
|
$documenti = DB::table('documentis')
|
||||||
|
->where('movimenti_id','=',$request->input('id'))
|
||||||
|
->get();
|
||||||
|
return view('conti.documenti.insert', [
|
||||||
|
'id'=>$request->input('id'),
|
||||||
|
'documenti'=>$documenti
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
13
app/Models/Documenti.php
Normal file
13
app/Models/Documenti.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Documenti extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -13,7 +13,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('FILESYSTEM_DRIVER', 'local'),
|
'default' => env('FILESYSTEM_DRIVER', 'public'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -16,6 +16,30 @@ class CreateCondominiosTable extends Migration
|
|||||||
Schema::create('condominios', function (Blueprint $table) {
|
Schema::create('condominios', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
$table->date('dal');
|
||||||
|
$table->date('al');
|
||||||
|
$table->foreignId('pertinenza_id');
|
||||||
|
$table->decimal('generali',10,2);
|
||||||
|
$table->decimal('generali_civico',10,2);
|
||||||
|
$table->decimal('risc_consumo',10,2);
|
||||||
|
$table->decimal('risc_millesimi',10,2);
|
||||||
|
$table->decimal('acqua_calda_consumo',10,2);
|
||||||
|
$table->decimal('acqua_fredda_consumo',10,2);
|
||||||
|
$table->decimal('ripart_spese',10,2);
|
||||||
|
$table->decimal('ascensore',10,2);
|
||||||
|
$table->decimal('scala',10,2);
|
||||||
|
$table->decimal('autorimessa',10,2);
|
||||||
|
$table->decimal('gest_inquilini',10,2);
|
||||||
|
$table->decimal('parcheggi_isola',10,2);
|
||||||
|
$table->decimal('percorsi_ped',10,2);
|
||||||
|
$table->decimal('cancello_viale',10,2);
|
||||||
|
$table->decimal('zone_comuni_gen',10,2);
|
||||||
|
$table->decimal('mov_personali',10,2);
|
||||||
|
$table->decimal('tot_gestione',10,2);
|
||||||
|
$table->decimal('saldi_fine_es_prec',10,2);
|
||||||
|
$table->decimal('rate_versate',10,2);
|
||||||
|
$table->decimal('saldo_finale',10,2);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateDocumentisTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('documentis', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->foreignId('movimenti_id');
|
||||||
|
$table->string('descrizione');
|
||||||
|
$table->string('filename');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('documentis');
|
||||||
|
}
|
||||||
|
}
|
73
resources/views/conti/documenti/insert.blade.php
Normal file
73
resources/views/conti/documenti/insert.blade.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
@extends('admin')
|
||||||
|
@section('content')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<h1 class="page-header">Lista Documenti</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<!-- Content here -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<form action="" method="POST" enctype='multipart/form-data'>
|
||||||
|
@csrf
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="descrizione" class="form-label">Descrizione</label>
|
||||||
|
<input type="text" class="form-control" id="descrizione" name="descrizione">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="file" class="form-label">File</label>
|
||||||
|
<input type="file" class="form-control" id="file" name="filename">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<input type="hidden" name="movimenti_id" value="{{ $id }}">
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Lista dei documenti
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-bordered table-hover" id="categorie">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Descrizione</th>
|
||||||
|
<th>Azione</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($documenti as $documento)
|
||||||
|
<tr>
|
||||||
|
<td><a href="/storage/{{ $documento->filename }}">{{ $documento->descrizione; }}</a></td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-primary" href="/admin/doc_update?id={{ $documento->id; }}"><i class="fa fa-pencil-square-o fw"></i></a>
|
||||||
|
<a class="btn btn-danger" href="/admin/doc_delete?id={{ $documento->id; }}"><i class="fa fa-trash-o fa-fw"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- /.col-lg-12 -->
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
@section('script')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#categorie').DataTable({
|
||||||
|
responsive: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
@ -5,6 +5,7 @@ use App\Http\Controllers\CategorieController;
|
|||||||
use App\Http\Controllers\CondominioController;
|
use App\Http\Controllers\CondominioController;
|
||||||
use App\Http\Controllers\ContatoreEnElController;
|
use App\Http\Controllers\ContatoreEnElController;
|
||||||
use App\Http\Controllers\ContatoreGasController;
|
use App\Http\Controllers\ContatoreGasController;
|
||||||
|
use App\Http\Controllers\DocumentiController;
|
||||||
use App\Http\Controllers\MovimentiController;
|
use App\Http\Controllers\MovimentiController;
|
||||||
use App\Http\Controllers\TagController;
|
use App\Http\Controllers\TagController;
|
||||||
use App\Http\Controllers\FullCalenderController;
|
use App\Http\Controllers\FullCalenderController;
|
||||||
@ -58,6 +59,9 @@ Route::get('/', function () {
|
|||||||
|
|
||||||
Route::get('movimenti/report/movimenti_categoria', [MovimentiController::class,'listMovPerCateg']);
|
Route::get('movimenti/report/movimenti_categoria', [MovimentiController::class,'listMovPerCateg']);
|
||||||
Route::get('movimenti/report/movimentibycat', [MovimentiController::class,'listMovbyCat']);
|
Route::get('movimenti/report/movimentibycat', [MovimentiController::class,'listMovbyCat']);
|
||||||
|
Route::get('movdocs', [DocumentiController::class,'fileForm'])->name('documenti');
|
||||||
|
Route::post('movdocs', [DocumentiController::class,'storeFile']);
|
||||||
|
|
||||||
/// TEST routes
|
/// TEST routes
|
||||||
Route::get('fullcalender', [FullCalenderController::class, 'index']);
|
Route::get('fullcalender', [FullCalenderController::class, 'index']);
|
||||||
Route::post('fullcalenderAjax', [FullCalenderController::class, 'ajax']);
|
Route::post('fullcalenderAjax', [FullCalenderController::class, 'ajax']);
|
||||||
|
Loading…
Reference in New Issue
Block a user