From 84ef42382a785bd0c36433354726d49574c6be85 Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Fri, 16 Aug 2024 13:28:14 +0200 Subject: [PATCH] Progress --- app/Http/Controllers/AuthController.php | 2 +- app/Http/Controllers/DashboardController.php | 11 - .../Controllers/MaintenanceController.php | 28 ++- app/Http/Middleware/GenerateMenus.php | 1 - app/Livewire/MaintenanceHistory/Form.php | 14 +- resources/views/home.blade.php | 189 ------------------ .../maintenance/history-detail-done.blade.php | 37 ++++ .../maintenance/planned-detail-done.blade.php | 4 +- resources/views/welcome.blade.php | 172 ---------------- routes/web.php | 4 - 10 files changed, 67 insertions(+), 395 deletions(-) delete mode 100644 app/Http/Controllers/DashboardController.php delete mode 100644 resources/views/home.blade.php create mode 100644 resources/views/maintenance/history-detail-done.blade.php delete mode 100644 resources/views/welcome.blade.php diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index e0fa251..573ce67 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -9,5 +9,5 @@ class AuthController { use Authentication; - protected string $redirectTo = "dashboard"; + protected string $redirectTo = "maintenance.planned"; } diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php deleted file mode 100644 index 2e84f96..0000000 --- a/app/Http/Controllers/DashboardController.php +++ /dev/null @@ -1,11 +0,0 @@ - $maintenance_history, + 'maintenance_history' => $maintenance_history ?? [], ]); } @@ -37,8 +37,8 @@ class MaintenanceController extends BaseController return view('maintenance.planned-detail-done', [ 'maintenance_history' => $maintenance_history, - 'maintenance_task_status' => $request->input('maintenance_task_status'), - 'maintenance_host_skipped' => $request->input('maintenance_host_skipped'), + 'maintenance_task_status' => $request->input('maintenance_task_status') ?? [], + 'maintenance_host_skipped' => $request->input('maintenance_host_skipped') ?? [], ]); } @@ -48,19 +48,29 @@ class MaintenanceController extends BaseController abort(404); } + $request->validate([ + "skippedHostsSummary.*.*" => 'required|string' + ]); + + // if ($request->has('skippedHostsSummary') || $request->has('skippedHostTasksSummary')) + // { + // return redirect()->back()->with('error', __('boilerplate::ui.incorect.old.password')); + // } + + foreach ($request->input('skippedHostsSummary') as $history_host_id => $summary) { $maintenance_history->historyHosts->find($history_host_id)->update([ 'summary' => $summary, ]); } - if (!$request->has('skippedHostsTasksSummary')) { + if ($request->has('skippedHostTasksSummary')) { foreach ($maintenance_history->historyHosts as $history_host) { - if (!isset($request->input('skippedHostsTasksSummary')[$history_host->id])) + if (!isset($request->input('skippedHostTasksSummary')[$history_host->id])) continue; - foreach ($request->input('skippedHostsTasksSummary')[$history_host->id] as $history_task_id => $task_summary) { - $history_host->find($history_task_id)->update([ + foreach ($request->input('skippedHostTasksSummary')[$history_host->id] as $history_task_id => $task_summary) { + $history_host->historyTasks->find($history_task_id)->update([ 'summary' => $task_summary, ]); } @@ -80,6 +90,8 @@ class MaintenanceController extends BaseController public function historyDetail(Request $request, MaintenanceHistory $maintenance_history) { - dd($maintenance_history->historyHosts); + return view('maintenance.history-detail-done', [ + 'maintenance_history' => $maintenance_history ?? [] + ]); } } diff --git a/app/Http/Middleware/GenerateMenus.php b/app/Http/Middleware/GenerateMenus.php index eda83c5..8463b84 100644 --- a/app/Http/Middleware/GenerateMenus.php +++ b/app/Http/Middleware/GenerateMenus.php @@ -26,7 +26,6 @@ class GenerateMenus Menu::make('main-menu', function ($menu) { $systemRoutes = [ - 'ui.dashboard' => [' fas fa-home', 'dashboard'], 'ui.planned' => [' fas fa-home', 'maintenance.planned'], 'ui.history' => [' fas fa-home', 'maintenance.history'], ]; diff --git a/app/Livewire/MaintenanceHistory/Form.php b/app/Livewire/MaintenanceHistory/Form.php index 7cf9969..a9872b4 100644 --- a/app/Livewire/MaintenanceHistory/Form.php +++ b/app/Livewire/MaintenanceHistory/Form.php @@ -24,13 +24,13 @@ class Form extends Component public function mount ($model = null){ if (!empty($model)) { - $maintenance-history = MaintenanceHistory::find($model); + $maintenanceHistory = MaintenanceHistory::find($model); $this->model = $model; - $this->maintenance_id = $maintenance-history->maintenance_id; - $this->start_at = $maintenance-history->start_at; - $this->finished_at = $maintenance-history->finished_at; + $this->maintenance_id = $maintenanceHistory->maintenance_id; + $this->start_at = $maintenanceHistory->start_at; + $this->finished_at = $maintenanceHistory->finished_at; $this->action = 'update'; } @@ -46,9 +46,9 @@ class Form extends Component public function update() { $validatedData = $this->validate(); - $maintenance-history = MaintenanceHistory::find($this->model); - if (!empty($maintenance-history)) { - $maintenance-history->update($validatedData); + $maintenanceHistory = MaintenanceHistory::find($this->model); + if (!empty($maintenanceHistory)) { + $maintenanceHistory->update($validatedData); } $this->dispatch('closeModal'); } diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php deleted file mode 100644 index dc4921b..0000000 --- a/resources/views/home.blade.php +++ /dev/null @@ -1,189 +0,0 @@ - -
- -
-
- -

head 1

-

head 2

-

head 3

-

head 4

-
head 5
-
head 6
- -
-

Tabs

- - -
- -
-
- PS -
-
- PS -
-
- PS -
-
- PS -
-
- PS -
-
- PS -
-
- -
-

Buttons

- - - - - - - - - - -
- -
-

Badges

- Primary - Secondary - Success - Danger - Warning - Info - Light - Dark -
- Primary - Secondary - Success - Danger - Warning - Info - Light - Dark -
-
- -
-

Breadcrumbs

- - - - - -
- -
-

Alerts

- - - - - - - - -
- -
-

Pagination

- -
- -
-

Colors

-
Primary with contrasting color
-
Secondary with contrasting color
-
Success with contrasting color
-
Danger with contrasting color
-
Warning with contrasting color
-
Info with contrasting color
-
Light with contrasting color
-
Dark with contrasting color
-
-
-
diff --git a/resources/views/maintenance/history-detail-done.blade.php b/resources/views/maintenance/history-detail-done.blade.php new file mode 100644 index 0000000..1130377 --- /dev/null +++ b/resources/views/maintenance/history-detail-done.blade.php @@ -0,0 +1,37 @@ + +
+ +

{!! $maintenance_history->maintenance->description !!}

+ @foreach ($maintenance_history->historyHosts as $historyHost) +

+ @if (empty($historyHost->summary)) + + @else + + @endif{{ $historyHost->host->hostname }} +

+ @if (!empty($historyHost->summary)) + {{ __('Oduvodnění') }} +

{!! $historyHost->summary !!}

+ @endif + @foreach ($historyHost->historyTasks as $historyTask) +

+ @if (empty($historyTask->summary)) + + @else + + @endif + {{ $historyTask->maintenanceTask->task->name }} +

+ @if (!empty($historyTask->summary)) + {{ __('Oduvodnění') }} +

{!! $historyTask->summary !!}

+ @endif + @endforeach + +
+ @endforeach +
+
diff --git a/resources/views/maintenance/planned-detail-done.blade.php b/resources/views/maintenance/planned-detail-done.blade.php index 5a8d934..6e37d04 100644 --- a/resources/views/maintenance/planned-detail-done.blade.php +++ b/resources/views/maintenance/planned-detail-done.blade.php @@ -7,11 +7,11 @@ @foreach ($maintenance_history->historyHosts as $historyHost) @if (in_array($historyHost->id, array_keys($maintenance_host_skipped))) - + @else @foreach ($historyHost->historyTasks as $historyTask) @if (!isset($maintenance_task_status[$historyHost->id][$historyTask->id])) - + @else @endif diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php deleted file mode 100644 index a9898e3..0000000 --- a/resources/views/welcome.blade.php +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - Laravel - - - - - - - - - - - - diff --git a/routes/web.php b/routes/web.php index 7d7e211..880473b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,11 +3,7 @@ use Illuminate\Support\Facades\Route; Route::auth(); -Route::get('/', function () { - return view('welcome'); -}); -Route::get('/dashboard', [App\Http\Controllers\DashboardController::class, 'index'])->name('dashboard'); Route::get('/maintenance/planned', [App\Http\Controllers\MaintenanceController::class, 'planned'])->name('maintenance.planned'); Route::get('/maintenance/planned/{maintenance_history}', [App\Http\Controllers\MaintenanceController::class, 'plannedDetail'])->name('maintenance.planned.detail'); Route::put('/maintenance/planned/{maintenance_history}', [App\Http\Controllers\MaintenanceController::class, 'plannedDetailPut'])->name('maintenance.planned.detail.put');