fix needed angeltypes in shifttypes and locations, search for more user related data in log

This commit is contained in:
Xu 2023-12-29 15:21:38 +01:00 committed by Igor Scheller
parent 8603d47fe0
commit 7d5837c5f1
3 changed files with 23 additions and 16 deletions

View File

@ -28,7 +28,7 @@ function location_view(Location $location, ShiftsFilterRenderer $shiftsFilterRen
} }
$neededAngelTypes = ''; $neededAngelTypes = '';
if (auth()->can('admin_shifts')) { if (auth()->can('admin_shifts') && $location->neededAngelTypes->isNotEmpty()) {
$neededAngelTypes .= '<h3>' . __('location.required_angels') . '</h3><ul>'; $neededAngelTypes .= '<h3>' . __('location.required_angels') . '</h3><ul>';
foreach ($location->neededAngelTypes as $neededAngelType) { foreach ($location->neededAngelTypes as $neededAngelType) {
if ($neededAngelType->count) { if ($neededAngelType->count) {

View File

@ -9,6 +9,7 @@
<h3>{{ __('general.description') }}</h3> <h3>{{ __('general.description') }}</h3>
{{ shifttype.description|md }} {{ shifttype.description|md }}
</div> </div>
{% if shifttype.neededAngelTypes.isNotEmpty() %}
<div class="col-md-12"> <div class="col-md-12">
<h3>{{ __('location.required_angels') }}</h3> <h3>{{ __('location.required_angels') }}</h3>
<ul> <ul>
@ -23,4 +24,5 @@
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Engelsystem\Models; namespace Engelsystem\Models;
use Carbon\Carbon; use Carbon\Carbon;
use Engelsystem\Models\User\User;
use Engelsystem\Models\User\UsesUserModel; use Engelsystem\Models\User\UsesUserModel;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
@ -57,7 +58,11 @@ class LogEntry extends BaseModel
->limit(10000); ->limit(10000);
if (!empty($userId)) { if (!empty($userId)) {
$query->where('user_id', $userId); $query->where(function (Builder $query) use ($userId): void {
$user = User::findOrFail($userId);
$query->where('user_id', $userId)
->orWhere('message', 'like', '%' . $user->name . ' (' . $userId . ')%');
});
} }
if (!empty($keyword)) { if (!empty($keyword)) {