- Updated the PVC models in the database and adjusted the tests accordingly to reflect the new model counts and codes. - Removed deprecated models from the JSON data for PVC systems. - Added new GLB models for "scorrevole_sf_3_ante" and "scorrevole_sf_4_ante". - Enhanced the development scripts to streamline the build process for both frontends. - Updated documentation to reflect changes in the development environment and deployment process. - Improved the styling of texture radio options for better visibility. - Fixed URL handling in the configurator to ensure proper routing and API calls.
42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
use App\Models\Preventivo;
|
|
use App\Support\PreventivoPdf;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
Route::get('/', function () {
|
|
return view('welcome');
|
|
});
|
|
|
|
Route::get('/admin/preventivi/{preventivo}/pdf', function (Preventivo $preventivo) {
|
|
if (! $preventivo->pdf_path || ! Storage::disk('local')->exists($preventivo->pdf_path)) {
|
|
$preventivo->pdf_path = PreventivoPdf::genera($preventivo);
|
|
$preventivo->save();
|
|
}
|
|
|
|
return Storage::disk('local')->response(
|
|
$preventivo->pdf_path,
|
|
'preventivo-'.($preventivo->numero ?? $preventivo->id).'.pdf'
|
|
);
|
|
})->middleware(['auth'])->name('preventivi.pdf.show');
|
|
|
|
// Configuratore 3D e app cliente (preventivo) sono build Vite statiche dentro public/ (vedi build.sh):
|
|
// i file (js, css, assets) li serve direttamente il web server, qui gestiamo solo l'index.
|
|
// Lo slash finale è obbligatorio perché i path runtime sono relativi (./assets/...).
|
|
foreach (['configuratore', 'preventivo'] as $frontend) {
|
|
Route::get($frontend, function (Request $request) use ($frontend) {
|
|
if (! str_ends_with($request->getPathInfo(), '/')) {
|
|
$query = $request->getQueryString();
|
|
|
|
return redirect('/'.$frontend.'/'.($query ? '?'.$query : ''), 301);
|
|
}
|
|
|
|
$index = public_path($frontend.'/index.html');
|
|
abort_unless(is_file($index), 404, "Build di {$frontend} assente: eseguire build.sh.");
|
|
|
|
return response()->file($index, ['Cache-Control' => 'no-cache']);
|
|
})->name($frontend);
|
|
}
|