Skip to content

Commit

Permalink
Add ability to add multiple ranks to a subfleet at once (#1870)
Browse files Browse the repository at this point in the history
Co-authored-by: Nabeel S. <[email protected]>
  • Loading branch information
arthurpar06 and nabeelio authored Sep 10, 2024
1 parent 53c82f8 commit 14cc6ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/Admin/SubfleetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,10 @@ public function ranks(int $id, Request $request): View

// associate rank with the subfleet
if ($request->isMethod('post')) {
$rank = $this->rankRepo->find($request->input('rank_id'));
$this->fleetSvc->addSubfleetToRank($subfleet, $rank);
foreach ($request->input('rank_ids') as $rank_id) {
$rank = $this->rankRepo->find($rank_id);
$this->fleetSvc->addSubfleetToRank($subfleet, $rank);
}
} // override definitions
elseif ($request->isMethod('put')) {
$override = [];
Expand Down
9 changes: 4 additions & 5 deletions resources/views/admin/subfleets/ranks.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@
'method' => 'post',
'class' => 'modify_rank form-inline'])
}}
{{ Form::select('rank_id', $avail_ranks, null, [
'placeholder' => 'Select Rank',
'class' => 'ac-fare-dropdown form-control input-lg select2',
])
<label for="rank_ids">Add ranks:</label>
{{ Form::select('rank_ids[]', $avail_ranks, null, [
'multiple' => 'multiple',
'class' => 'select2 form-control input-lg'])
}}
{{ Form::button('<i class="glyphicon glyphicon-plus"></i> add',
['type' => 'submit',
Expand Down

0 comments on commit 14cc6ce

Please sign in to comment.