Merging 'devel' branch

This commit is contained in:
Amministratore 2023-07-06 12:16:16 +02:00
commit d3f0695866
5 changed files with 110 additions and 4 deletions

View File

@ -7,6 +7,7 @@ use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\RigaProgetto; use App\Models\RigaProgetto;
use function GuzzleHttp\json_encode; use function GuzzleHttp\json_encode;
use Barryvdh\DomPDF\Facade\Pdf;
class ProgettiController extends Controller class ProgettiController extends Controller
{ {
@ -64,9 +65,14 @@ class ProgettiController extends Controller
return redirect(Route('progetti')); return redirect(Route('progetti'));
} }
public function stampaPDF(Request $id) public function stampaPDFProgetto(Request $id)
{ {
$progetto_id=$id['id'];
$progetto = Progetti::getProgettoById($progetto_id);
$righe = RigaProgetto::getRigheProgetto($progetto_id);
$costo_tot=RigaProgetto::getCostoRighe($progetto_id);
$pdf=Pdf::loadview('progetti.PDF.scheda',['dettaglio'=>$progetto,'righe'=>$righe, 'tot'=>$costo_tot]);
return $pdf->stream();
} }
} }

View File

@ -1,3 +1,9 @@
$(document).ready(function() {
$('#listaAutomobili').DataTable({
responsive: true
});
});
$(document).ready(function() { $(document).ready(function() {
$('#automobili').DataTable({ $('#automobili').DataTable({
responsive: true, responsive: true,

View File

@ -24,7 +24,7 @@
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-bordered table-hover" <table class="table table-striped table-bordered table-hover"
id="automobili"> id="listaAutomobili">
<thead> <thead>
<tr> <tr>

View File

@ -0,0 +1,93 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Scheda Progetto</title>
<style type="text/css">
* {
font-family: Verdana, Arial, sans-serif;
}
table{
font-size: x-small;
}
tfoot tr td{
font-weight: bold;
font-size: x-small;
}
.gray {
background-color: lightgray
}
</style>
</head>
<body>
@foreach($tot as $totale) @endforeach @foreach($dettaglio ?? '' as $progetto)
<table width="100%">
<tr>
<!-- <td valign="top"><img src="{{asset('images/meteor-logo.png')}}" alt="" width="150"/></td> -->
<td>
<h3>Progetto: #{{$progetto->id}}:{{$progetto->nome}}</h3>
<p> {{$progetto->descrizione}}</p>
</td>
</tr>
</table>
<hr>
<table width="100%">
<tr>
<td><strong>Creato il:</strong> {{ date('d/m/Y',strtotime($progetto->data_creazione)) }}</td>
<td><strong>Inizio:</strong> {{ date('d/m/Y',strtotime($progetto->data_inizio)) }}</td>
<td><strong>Termine:</strong> {{ date('d/m/Y',strtotime($progetto->data_fine)) }}</td>
<td><strong>Stato:</strong> {{ $progetto->stato }}</td>
</tr>
<tr>
<td><strong>Budget iniziale:</strong> {{ $progetto->budget }}</td>
<td><strong>Costi sostenuti:</strong> {{ $totale->costo}}</td>
<td><strong>Scostamento:</strong>{{ $progetto->budget - $totale->costo}}</td>
<td><strong>Coordinatore:</strong> {{ $progetto->name }}</td>
</tr>
<tr>
<td colspan="4" class="gray">DESCRIZIONE:</td>
</tr>
<tr>
<td colspan="4">{{ $progetto->note }}</td>
</tr>
</table>
@endforeach
<br/>
<table width="100%">
<thead style="background-color: lightgray;">
<tr>
<th>Data</th>
<th>Descrizione</th>
<th>Ore</th>
<th>Costi</th>
</tr>
</thead>
<tbody>
@foreach($righe as $riga)
<tr>
<td>{{ date('d/m/Y',strtotime($riga->data)) }}</td>
<td>{{ $riga->descrizione }}</td>
<td>{{ $riga->ore }}</td>
<td>{{ $riga->prezzo }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
<td align="right">Totale</td>
<td align="right" class="gray">{{ $totale->costo}} &euro;</td>
</tr>
</tfoot>
</table>
</body>
</html>

View File

@ -146,6 +146,7 @@ Route::group(['middleware'=>['permission:progetti']], function(){
Route::get('progetti/coordinatori', [ProgettiController::class, 'getCoordinatori']); Route::get('progetti/coordinatori', [ProgettiController::class, 'getCoordinatori']);
Route::get('progetti/close',[ProgettiController::class, 'chiudiProgetto']); Route::get('progetti/close',[ProgettiController::class, 'chiudiProgetto']);
Route::get('progetti/reopen',[ProgettiController::class, 'riapriProgetto']); Route::get('progetti/reopen',[ProgettiController::class, 'riapriProgetto']);
Route::get('progetti/print',[ProgettiController::class,'stampaPDFProgetto']);
}); });