Fixed /stockentries group by purchased_date (fixes #1419)

This commit is contained in:
Bernd Bestel 2021-06-28 19:14:15 +02:00
parent b8e15b990b
commit 69f8c237ff
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 18 additions and 17 deletions

View File

@ -965,6 +965,12 @@ $(".change-table-columns-visibility-button").on("click", function(e)
return; return;
} }
var shadowColumnIndex = $(this.header()).attr("data-shodow-rowgroup-column");
if (shadowColumnIndex)
{
index = shadowColumnIndex;
}
var checked = "checked"; var checked = "checked";
if (!visible) if (!visible)
{ {

View File

@ -62,18 +62,15 @@
data-table-selector="#stockentries-table" data-table-selector="#stockentries-table"
href="#"><i class="fas fa-eye"></i></a> href="#"><i class="fas fa-eye"></i></a>
</th> </th>
<th class="d-none">product_id</th> <!-- This must be in the first column for searching --> <th class="d-none">Hidden product_id</th> <!-- This must be in the first column for searching -->
<th>{{ $__t('Product') }}</th> <th>{{ $__t('Product') }}</th>
<th>{{ $__t('Amount') }}</th> <th>{{ $__t('Amount') }}</th>
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) <th class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) d-none @endif">{{ $__t('Due date') }}</th>
<th>{{ $__t('Due date') }}</th> <th class="@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) d-none @endif">{{ $__t('Location') }}</th>
@endif <th class="@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) d-none @endif">{{ $__t('Store') }}</th>
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)<th>{{ $__t('Location') }}</th>@endif <th class="@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) d-none @endif">{{ $__t('Price') }}</th>
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) <th data-shodow-rowgroup-column="9">{{ $__t('Purchased date') }}</th>
<th>{{ $__t('Store') }}</th> <th class="d-none">Hidden purchased_date</th>
<th>{{ $__t('Price') }}</th>
@endif
<th>{{ $__t('Purchased date') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
@ -237,39 +234,37 @@
<span id="stock-{{ $stockEntry->id }}-opened-amount" <span id="stock-{{ $stockEntry->id }}-opened-amount"
class="small font-italic">@if($stockEntry->open == 1){{ $__t('Opened') }}@endif</span> class="small font-italic">@if($stockEntry->open == 1){{ $__t('Opened') }}@endif</span>
</td> </td>
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) <td class="@if(GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) d-none @endif">
<td>
<span id="stock-{{ $stockEntry->id }}-due-date">{{ $stockEntry->best_before_date }}</span> <span id="stock-{{ $stockEntry->id }}-due-date">{{ $stockEntry->best_before_date }}</span>
<time id="stock-{{ $stockEntry->id }}-due-date-timeago" <time id="stock-{{ $stockEntry->id }}-due-date-timeago"
class="timeago timeago-contextual" class="timeago timeago-contextual"
datetime="{{ $stockEntry->best_before_date }} 23:59:59"></time> datetime="{{ $stockEntry->best_before_date }} 23:59:59"></time>
</td> </td>
@endif
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
<td id="stock-{{ $stockEntry->id }}-location" <td id="stock-{{ $stockEntry->id }}-location"
class="@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) d-none @endif"
data-location-id="{{ $stockEntry->location_id }}"> data-location-id="{{ $stockEntry->location_id }}">
{{ FindObjectInArrayByPropertyValue($locations, 'id', $stockEntry->location_id)->name }} {{ FindObjectInArrayByPropertyValue($locations, 'id', $stockEntry->location_id)->name }}
</td> </td>
@endif
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<td id="stock-{{ $stockEntry->id }}-shopping-location" <td id="stock-{{ $stockEntry->id }}-shopping-location"
class="@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) d-none @endif"
data-shopping-location-id="{{ $stockEntry->shopping_location_id }}"> data-shopping-location-id="{{ $stockEntry->shopping_location_id }}">
@if (FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id) !== null) @if (FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id) !== null)
{{ FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id)->name }} {{ FindObjectInArrayByPropertyValue($shoppinglocations, 'id', $stockEntry->shopping_location_id)->name }}
@endif @endif
</td> </td>
<td id="stock-{{ $stockEntry->id }}-price" <td id="stock-{{ $stockEntry->id }}-price"
class="@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) d-none @endif"
class="locale-number locale-number-currency" class="locale-number locale-number-currency"
data-price-id="{{ $stockEntry->price }}"> data-price-id="{{ $stockEntry->price }}">
{{ $stockEntry->price }} {{ $stockEntry->price }}
</td> </td>
@endif
<td> <td>
<span id="stock-{{ $stockEntry->id }}-purchased-date">{{ $stockEntry->purchased_date }}</span> <span id="stock-{{ $stockEntry->id }}-purchased-date">{{ $stockEntry->purchased_date }}</span>
<time id="stock-{{ $stockEntry->id }}-purchased-date-timeago" <time id="stock-{{ $stockEntry->id }}-purchased-date-timeago"
class="timeago timeago-contextual" class="timeago timeago-contextual"
datetime="{{ $stockEntry->purchased_date }} 23:59:59"></time> datetime="{{ $stockEntry->purchased_date }} 23:59:59"></time>
</td> </td>
<td class="d-none">{{ $stockEntry->purchased_date }}</td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,