Fix blank/missing items in spending report (#2432)

* Fixes blank/missing items in spending report

Use left (outer) join when connecting product to optional product group

* Properly display ungrouped items in table and chart

---------

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
Torqu3Wr3nch
2024-01-09 12:36:09 -05:00
committed by GitHub
parent 99f448dd64
commit 151bd7f025
3 changed files with 27 additions and 6 deletions

View File

@@ -77,6 +77,8 @@
<option @if($productGroup->id == $selectedGroup) selected="selected" @endif
value="{{ $productGroup->id }}">{{ $productGroup->name }}</option>
@endforeach
<option class="font-italic font-weight-light"
value="ungrouped">{{ $__t('Ungrouped') }}</option>
</select>
</div>
</div>
@@ -112,8 +114,16 @@
<tbody class="d-none">
@foreach($metrics as $metric)
<tr>
<td data-chart-label="{{ $metric->name }}">
<td>
@if($groupBy == 'productgroup')
@if(empty($metric->name))
<span class="font-italic font-weight-light">{{ $__t('Ungrouped') }}</span>
@else
{{ $metric->name }}
@endif
@else
{{ $metric->name }}
@endif
</td>
<td data-chart-value="{{ $metric->total }}"
data-order="{{ $metric->total }}">
@@ -121,7 +131,11 @@
</td>
@if($groupBy == 'product')
<td>
@if(empty($metric->group_name))
<span class="font-italic font-weight-light">{{ $__t('Ungrouped') }}</span>
@else
{{ $metric->group_name }}
@endif
</td>
@endif
</tr>