Globale Live-Suche, Kontaktkarten-Personensuche, neue Beitragsansicht, Termine mit Seitenleiste, Demo-Inhalte, Plugin-Upload-Fix
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m24s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m26s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m46s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m31s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m18s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m24s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m26s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m46s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m31s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m18s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9b06e65802
commit
b276e1c6d0
211 changed files with 3580 additions and 1072 deletions
|
|
@ -4,7 +4,10 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Http\Resources\PersonResource;
|
||||
use App\Models\User;
|
||||
use App\Search\GlobalSearch;
|
||||
use App\Support\ContactCards;
|
||||
use App\Support\ProfileFields;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -80,6 +83,28 @@ class PeopleController extends Controller
|
|||
return response()->json(['people' => PersonResource::collection($people)->resolve()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Live-Suche der Kachel „Personen finden“: Kontaktkarten mit den im Admin gewählten Feldern.
|
||||
*/
|
||||
public function cards(Request $request, ContactCards $cards, Settings $settings): JsonResponse
|
||||
{
|
||||
$search = trim((string) ($request->validate(['q' => ['nullable', 'string', 'max:100']])['q'] ?? ''));
|
||||
|
||||
if (mb_strlen($search) < 2) {
|
||||
return response()->json(['people' => [], 'total' => 0]);
|
||||
}
|
||||
|
||||
$query = User::query()->active();
|
||||
|
||||
GlobalSearch::whereTerms($query, ['name', 'email', 'job_title', 'department', 'location', 'phone', 'mobile'], $search);
|
||||
|
||||
$total = (clone $query)->count();
|
||||
$people = $query->orderBy('last_name')->orderBy('first_name')->orderBy('name')->limit(5)->get();
|
||||
$fields = (array) $settings->get(ContactCards::PEOPLE_SEARCH_FIELDS, ContactCards::DEFAULT_PEOPLE_SEARCH_FIELDS);
|
||||
|
||||
return response()->json(['people' => $cards->cards($people, $request->user(), $fields), 'total' => $total]);
|
||||
}
|
||||
|
||||
public function show(User $user): Response
|
||||
{
|
||||
abort_unless($user->is_active, 404);
|
||||
|
|
|
|||
31
app/Http/Controllers/SearchController.php
Normal file
31
app/Http/Controllers/SearchController.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Search\GlobalSearch;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
class SearchController extends Controller
|
||||
{
|
||||
public function index(Request $request, GlobalSearch $search): Response
|
||||
{
|
||||
$query = trim((string) $request->validate(['q' => ['nullable', 'string', 'max:100']])['q'] ?? '');
|
||||
|
||||
return Inertia::render('Search/Index', [
|
||||
'query' => $query,
|
||||
'groups' => $search->run($request->user(), $query, 20),
|
||||
'minLength' => GlobalSearch::MIN_LENGTH,
|
||||
]);
|
||||
}
|
||||
|
||||
/** Vorschläge für das Suchfeld in der Kopfzeile */
|
||||
public function live(Request $request, GlobalSearch $search): JsonResponse
|
||||
{
|
||||
$query = trim((string) $request->validate(['q' => ['nullable', 'string', 'max:100']])['q'] ?? '');
|
||||
|
||||
return response()->json(['query' => $query, 'groups' => $search->run($request->user(), $query, 4)]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue