diff --git a/resources/views/admin/pireps/pirep_card.blade.php b/resources/views/admin/pireps/pirep_card.blade.php index 73943fb6..d8afaf41 100644 --- a/resources/views/admin/pireps/pirep_card.blade.php +++ b/resources/views/admin/pireps/pirep_card.blade.php @@ -9,7 +9,7 @@ {{ $pirep->airline->code }}{{ $pirep->ident }} -
+
@if($pirep->state === PirepState::PENDING)
@elseif($pirep->state === PirepState::ACCEPTED) @@ -82,3 +82,6 @@
+ + + diff --git a/resources/views/admin/pireps/scripts.blade.php b/resources/views/admin/pireps/scripts.blade.php index 3738419b..0c1f1fe1 100644 --- a/resources/views/admin/pireps/scripts.blade.php +++ b/resources/views/admin/pireps/scripts.blade.php @@ -65,6 +65,23 @@ changeStatus(values, (data) => { const destContainer = '#pirep_' + values.pirep_id + '_actionbar'; $(destContainer).html(data); + + const statusContainer = '#pirep_' + values.pirep_id + '_status_container'; + let new_badge; + let new_badge_text; + + if (values.new_status === '{{ App\Models\Enums\PirepState::ACCEPTED }}') { + new_badge = 'badge badge-success'; + new_badge_text = 'Accepted' + } + + if (values.new_status === '{{ App\Models\Enums\PirepState::REJECTED }}') { + new_badge = 'badge badge-danger'; + new_badge_text = 'Rejected' + } + + $(statusContainer).children(0).removeClass().addClass(new_badge); + $(statusContainer).children(0).html(new_badge_text); }); });