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 = '';
if (auth()->can('admin_shifts')) {
if (auth()->can('admin_shifts') && $location->neededAngelTypes->isNotEmpty()) {
$neededAngelTypes .= '<h3>' . __('location.required_angels') . '</h3><ul>';
foreach ($location->neededAngelTypes as $neededAngelType) {
if ($neededAngelType->count) {

View File

@ -9,18 +9,20 @@
<h3>{{ __('general.description') }}</h3>
{{ shifttype.description|md }}
</div>
<div class="col-md-12">
<h3>{{ __('location.required_angels') }}</h3>
<ul>
{% for neededAngelType in shifttype.neededAngelTypes %}
{% if neededAngelType.count %}
<li>
<a href="{{ url('angeltypes', {'action':'view', 'angeltype_id': neededAngelType.angelType.id}) }}">
{{ neededAngelType.angelType.name -}}
</a>: {{ neededAngelType.count }}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% if shifttype.neededAngelTypes.isNotEmpty() %}
<div class="col-md-12">
<h3>{{ __('location.required_angels') }}</h3>
<ul>
{% for neededAngelType in shifttype.neededAngelTypes %}
{% if neededAngelType.count %}
<li>
<a href="{{ url('angeltypes', {'action':'view', 'angeltype_id': neededAngelType.angelType.id}) }}">
{{ neededAngelType.angelType.name -}}
</a>: {{ neededAngelType.count }}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endif %}
{% endblock %}

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Engelsystem\Models;
use Carbon\Carbon;
use Engelsystem\Models\User\User;
use Engelsystem\Models\User\UsesUserModel;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
@ -57,7 +58,11 @@ class LogEntry extends BaseModel
->limit(10000);
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)) {