Accept Pirep button not changing row inline #598 (#880)

This commit is contained in:
Yash Govekar 2020-10-26 19:48:00 +05:30 committed by GitHub
parent aaaf2e7c00
commit 060bebf8fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -9,7 +9,7 @@
{{ $pirep->airline->code }}{{ $pirep->ident }}
</a>
</h5>
<div>
<div id="pirep_{{ $pirep->id }}_status_container">
@if($pirep->state === PirepState::PENDING)
<div class="badge badge-warning">
@elseif($pirep->state === PirepState::ACCEPTED)
@ -82,3 +82,6 @@
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -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);
});
});