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