Rewrite Application Status Page in Livewire
This commit is contained in:
parent
0c705c7235
commit
a66c65e38a
33
app/Livewire/ApplicationStatus.php
Normal file
33
app/Livewire/ApplicationStatus.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Models\Application;
|
||||||
|
use Livewire\Component;
|
||||||
|
use Livewire\Attributes\Layout;
|
||||||
|
|
||||||
|
#[Layout('components.layouts.guest')]
|
||||||
|
class ApplicationStatus extends Component
|
||||||
|
{
|
||||||
|
public $uuid;
|
||||||
|
|
||||||
|
public $application;
|
||||||
|
|
||||||
|
public function mount(string $uuid)
|
||||||
|
{
|
||||||
|
$this->uuid = $uuid;
|
||||||
|
$this->loadApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadApplication()
|
||||||
|
{
|
||||||
|
$this->application = Application::with('uploads')->where('uuid', $this->uuid)->firstOrFail();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.application-status')->with([
|
||||||
|
'application' => $this->application,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
<x-layouts.guest :title="__('Application Status')">
|
<div wire:poll.10s="loadApplication" class="max-w-2xl mx-auto mt-10 flex flex-col gap-6">
|
||||||
<div class="max-w-2xl mx-auto mt-10">
|
<div class="max-w-2xl mx-auto mt-10">
|
||||||
<div class="p-5 mb-4 dark:bg-pink-950/50 rounded-lg">
|
<div class="p-5 mb-4 dark:bg-pink-950/50 rounded-lg">
|
||||||
<flux:heading size="xl">Application Status</flux:heading>
|
<flux:heading size="xl">Application Status</flux:heading>
|
||||||
@ -10,13 +10,18 @@
|
|||||||
];
|
];
|
||||||
@endphp
|
@endphp
|
||||||
<flux:text class="mt-2 text-lg">
|
<flux:text class="mt-2 text-lg">
|
||||||
<p><strong>Status:</strong> {{ $status[$application->status] }}</p>
|
<p>
|
||||||
<p><strong>Created:</strong>
|
<strong>Status:</strong>
|
||||||
{{ Carbon\Carbon::parse($application->created_at)->diffForHumans(['parts' => 2]) }}</p>
|
{{ $status[$application->status] }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Created:</strong>
|
||||||
|
{{ Carbon\Carbon::parse($application->created_at)->diffForHumans(['parts' => 2]) }}
|
||||||
|
</p>
|
||||||
</flux:text>
|
</flux:text>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="mt-4 font-semibold">Uploaded Files:</h2>
|
<h2 class="mt-4 font-semibold">Uploaded Photos:</h2>
|
||||||
<div class="flex flex-wrap gap-4 mt-4">
|
<div class="flex flex-wrap gap-4 mt-4">
|
||||||
@foreach ($application->uploads as $upload)
|
@foreach ($application->uploads as $upload)
|
||||||
<div>
|
<div>
|
||||||
@ -26,4 +31,4 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</x-layouts.guest>
|
</div>
|
@ -6,6 +6,7 @@ use App\Livewire\Settings\Profile;
|
|||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::get('/', App\Livewire\ApplicationForm::class)->name('home');
|
Route::get('/', App\Livewire\ApplicationForm::class)->name('home');
|
||||||
|
Route::get('/application-status/{uuid}', App\Livewire\ApplicationStatus::class)->name('application');
|
||||||
|
|
||||||
Route::view('dashboard', 'dashboard')
|
Route::view('dashboard', 'dashboard')
|
||||||
->middleware(['auth', 'verified'])
|
->middleware(['auth', 'verified'])
|
||||||
@ -19,9 +20,4 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::get('settings/appearance', Appearance::class)->name('settings.appearance');
|
Route::get('settings/appearance', Appearance::class)->name('settings.appearance');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/application-status/{uuid}', function ($uuid) {
|
|
||||||
$application = App\Models\Application::where('uuid', $uuid)->firstOrFail();
|
|
||||||
return view('application-status', compact('application'));
|
|
||||||
})->name('application.status');
|
|
||||||
|
|
||||||
require __DIR__ . '/auth.php';
|
require __DIR__ . '/auth.php';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user