99 lines
5.3 KiB
PHP
99 lines
5.3 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\AggregateController;
|
|
use App\Http\Controllers\AggregateSelectionController;
|
|
use App\Http\Controllers\Auth\LoginController;
|
|
use App\Http\Controllers\CableController;
|
|
use App\Http\Controllers\DashboardController;
|
|
use App\Http\Controllers\EquipmentFileController;
|
|
use App\Http\Controllers\MeteringController;
|
|
use App\Http\Controllers\PipingController;
|
|
use App\Http\Controllers\EngineController;
|
|
use App\Http\Controllers\PumpController;
|
|
use App\Http\Controllers\WellController;
|
|
use App\Http\Controllers\WellOperationController;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| SoftSPM_2 - trasy webowe (nakładka)
|
|
|--------------------------------------------------------------------------
|
|
| Pierwszy pionowy slice: logowanie (sys_users) + pulpit (placeholder).
|
|
| Kolejne moduły (Studnie, Diagnostyka, Raporty) dokładamy etapami,
|
|
| migrując sites/siteNNN.php z legacy.
|
|
*/
|
|
|
|
Route::get('/', fn () => redirect()->route('dashboard'));
|
|
|
|
// --- Logowanie ---
|
|
Route::middleware('guest')->group(function () {
|
|
Route::get('/login', [LoginController::class, 'show'])->name('login');
|
|
Route::post('/login', [LoginController::class, 'attempt'])->name('login.attempt');
|
|
});
|
|
|
|
// --- Obszar zalogowany ---
|
|
Route::middleware(['auth', \App\Http\Middleware\SetLocale::class])->group(function () {
|
|
Route::post('/logout', [LoginController::class, 'logout'])->name('logout');
|
|
|
|
// Zmiana języka (menu użytkownika) - zapis w cookie na ~400 dni, powrót na poprzednią stronę.
|
|
Route::get('/locale/{lang}', function (string $lang) {
|
|
$supported = ['pl', 'en', 'de'];
|
|
$response = redirect()->back();
|
|
if (in_array($lang, $supported, true)) {
|
|
$response->withCookie(cookie('locale', $lang, 60 * 24 * 400));
|
|
}
|
|
return $response;
|
|
})->name('locale.set');
|
|
|
|
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
|
|
|
|
// Landing sekcji - pokazuje podmenu sekcji w lewym menu (gdy sekcja nie ma
|
|
// własnej strony startowej). Klik w pozycję podmenu otwiera funkcję.
|
|
Route::get('/s/{section}', function (string $section) {
|
|
abort_unless(collect(config('navigation'))->contains('key', $section), 404);
|
|
return view('section', ['sectionKey' => $section]);
|
|
})->name('section');
|
|
|
|
// Studnie (migracja sites/site401.php + site301A/E/inf)
|
|
Route::get('/wells', [WellController::class, 'index'])->name('wells.index');
|
|
Route::get('/wells/create', [WellController::class, 'create'])->name('wells.create');
|
|
Route::post('/wells', [WellController::class, 'store'])->name('wells.store');
|
|
Route::get('/wells/{drs}/edit', [WellController::class, 'edit'])->name('wells.edit');
|
|
Route::put('/wells/{drs}', [WellController::class, 'update'])->name('wells.update');
|
|
|
|
// Eksploatacja studni (migracja grupy site401) - osobny moduł pod sekcją Eksploatacja
|
|
Route::get('/eksploatacja/studnie', [WellOperationController::class, 'index'])->name('well-operation.index');
|
|
Route::get('/eksploatacja/studnie/{drs}/parametry', [WellOperationController::class, 'params'])->name('well-operation.params');
|
|
Route::post('/eksploatacja/studnie/{drs}/parametry', [WellOperationController::class, 'paramsStore'])->name('well-operation.params-store');
|
|
Route::post('/eksploatacja/studnie/{drs}/pobierz', [WellOperationController::class, 'fetchData'])->name('well-operation.fetch');
|
|
Route::get('/eksploatacja/studnie/{drs}', [WellOperationController::class, 'show'])->name('well-operation.show');
|
|
|
|
// Katalogi (migracja site203/site204 + A/E/inf - pełny CRUD)
|
|
Route::prefix('catalog')->group(function () {
|
|
Route::resource('pumps', PumpController::class); // names: pumps.*, param {pump}
|
|
Route::resource('engines', EngineController::class); // names: engines.*, param {engine}
|
|
|
|
// Wybór agregatu pompowego (site201) - narzędzie doboru wg Q/H
|
|
Route::get('aggregate-selection', [AggregateSelectionController::class, 'index'])
|
|
->name('aggregate-selection.index');
|
|
|
|
// Wspólne strumieniowanie załączników wyposażenia (BLOB) dla katalogów seg_equipments
|
|
Route::get('equipment/files/{file}', [EquipmentFileController::class, 'file'])->name('equipment.file');
|
|
|
|
// Katalog kabli (site206) - seg_equipments EQU_TYPE_ID=13
|
|
Route::resource('cables', CableController::class); // names: cables.*, param {cable}
|
|
|
|
// Katalog orurowania i armatury (site207) - seg_equipments EQU_TYPE_ID=15 (+ średnica/długość)
|
|
Route::resource('piping', PipingController::class); // names: piping.*, param {piping}
|
|
|
|
// Katalog opomiarowania (site208) - seg_equipments EQU_TYPE_ID=14
|
|
Route::resource('metering', MeteringController::class); // names: metering.*, param {metering}
|
|
|
|
// Katalog agregatów (site205) - lista -> szczegóły, edycja = przypisanie silników
|
|
Route::get('aggregates', [AggregateController::class, 'index'])->name('aggregates.index');
|
|
Route::get('aggregates/{pump}/edit', [AggregateController::class, 'edit'])->name('aggregates.edit');
|
|
Route::put('aggregates/{pump}', [AggregateController::class, 'update'])->name('aggregates.update');
|
|
Route::get('aggregates/{pump}', [AggregateController::class, 'show'])->name('aggregates.show');
|
|
});
|
|
});
|