Skip to content

Commit 58b6feb

Browse files
authored
Merge pull request #17356 from grokability/show-only-taken-licenses
[FD-49569 ] - Show only assigned in license tab
2 parents d1ddd8d + 41c4920 commit 58b6feb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

app/Http/Controllers/Api/LicenseSeatsController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ public function index(Request $request, $licenseId) : JsonResponse | array
2929
$seats = LicenseSeat::with('license', 'user', 'asset', 'user.department')
3030
->where('license_seats.license_id', $licenseId);
3131

32+
if ($request->input('status') == 'available') {
33+
$seats->whereNull('license_seats.assigned_to');
34+
}
35+
36+
if ($request->input('status') == 'assigned') {
37+
$seats->whereNotNull('license_seats.assigned_to');
38+
}
39+
40+
3241
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
3342

3443
if ($request->input('sort') == 'department') {

resources/views/licenses/view.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
<span class="hidden-lg hidden-md">
3232
<x-icon type="seats" class="fa-2x" />
3333
</span>
34-
<span class="hidden-xs hidden-sm">{{ trans('admin/licenses/form.seats') }}</span>
35-
<span class="badge badge-secondary">{{ number_format($license->availCount()->count()) }} / {{ number_format($license->seats) }}</span>
34+
<span class="hidden-xs hidden-sm">{{ trans('general.assigned') }}</span>
35+
<span class="badge badge-secondary">{{ number_format($license->assignedCount()->count()) }} / {{ number_format($license->seats) }}</span>
3636

3737
</a>
3838
</li>
@@ -443,7 +443,7 @@
443443
data-sort-order="asc"
444444
data-sort-name="name"
445445
class="table table-striped snipe-table"
446-
data-url="{{ route('api.licenses.seats.index', $license->id) }}"
446+
data-url="{{ route('api.licenses.seats.index', [$license->id, 'status' => 'assigned']) }}"
447447
data-export-options='{
448448
"fileName": "export-seats-{{ str_slug($license->name) }}-{{ date('Y-m-d') }}",
449449
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]

0 commit comments

Comments
 (0)