Gestalte den Mitgliederbereich fuer den Kursraum
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
abcdc6908e
commit
1d8315c9a4
21 files changed
+1064
-169
No files matched your search
@@ -5,6 +5,7 @@
|
||||
use App\Domain\Catalog\ArticleRelease;
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\EditorialDimension;
|
||||
use App\Domain\Catalog\IdentityDimension;
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Entitlement\DecideAccess;
|
||||
@@ -22,19 +23,37 @@
|
||||
|
||||
class LibraryController extends Controller
|
||||
{
|
||||
public function index(Request $request): View
|
||||
public function index(Request $request, ?string $sicht = null): View
|
||||
{
|
||||
$catalog = app(LibraryCatalog::class)->index($request->user());
|
||||
$untouched = $catalog['programs'] === [] && $catalog['modules'] === [] && $catalog['materials'] === [];
|
||||
$query = trim((string) $request->query('q', ''));
|
||||
|
||||
$nutzung = (string) $request->query('nutzung', '');
|
||||
$dimensionIds = array_values(array_filter(array_map(intval(...), (array) $request->query('dimension', []))));
|
||||
$dimensions = app(IdentityDimension::class);
|
||||
|
||||
foreach (['programs', 'modules'] as $shelf) {
|
||||
if ($query !== '') {
|
||||
$catalog[$shelf] = array_values(array_filter(
|
||||
$catalog[$shelf],
|
||||
fn (array $card): bool => $this->matches($card, $query),
|
||||
));
|
||||
}
|
||||
if ($dimensionIds !== []) {
|
||||
$catalog[$shelf] = array_values(array_filter(
|
||||
$catalog[$shelf],
|
||||
fn (array $card): bool => $dimensions->matches($card['composition'], $dimensionIds),
|
||||
));
|
||||
}
|
||||
if (in_array($nutzung, ['nutzbar', 'teilweise', 'nicht enthalten'], true)) {
|
||||
$catalog[$shelf] = array_values(array_filter(
|
||||
$catalog[$shelf],
|
||||
fn (array $card): bool => ($card['coverage'] ?? '') === $nutzung,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if ($query !== '') {
|
||||
$catalog['programs'] = array_values(array_filter(
|
||||
$catalog['programs'],
|
||||
fn (array $card): bool => $this->matches($card, $query),
|
||||
));
|
||||
$catalog['materials'] = array_values(array_filter(
|
||||
$catalog['materials'],
|
||||
fn (array $card): bool => $this->matches($card, $query),
|
||||
@@ -42,10 +61,6 @@ public function index(Request $request): View
|
||||
}
|
||||
|
||||
if ($dimensionIds !== []) {
|
||||
$catalog['programs'] = array_values(array_filter(
|
||||
$catalog['programs'],
|
||||
fn (array $card): bool => $dimensions->matches($card['composition'], $dimensionIds),
|
||||
));
|
||||
$catalog['materials'] = array_values(array_filter(
|
||||
$catalog['materials'],
|
||||
function (array $card) use ($dimensions, $dimensionIds): bool {
|
||||
@@ -59,7 +74,29 @@ function (array $card) use ($dimensions, $dimensionIds): bool {
|
||||
));
|
||||
}
|
||||
|
||||
return view('member.library', [...$catalog, 'query' => $query]);
|
||||
if ($nutzung === 'teilweise' || $nutzung === 'nicht enthalten') {
|
||||
$catalog['materials'] = [];
|
||||
}
|
||||
|
||||
return view('member.library', [
|
||||
...$catalog,
|
||||
'query' => $query,
|
||||
'sicht' => $sicht,
|
||||
'nutzung' => $nutzung,
|
||||
'dimensionIds' => $dimensionIds,
|
||||
'filterDimensions' => EditorialDimension::query()->with('values')->orderBy('label')->get(),
|
||||
'libraryEmpty' => $untouched,
|
||||
]);
|
||||
}
|
||||
|
||||
public function programs(Request $request): View
|
||||
{
|
||||
return $this->index($request, 'programme');
|
||||
}
|
||||
|
||||
public function modules(Request $request): View
|
||||
{
|
||||
return $this->index($request, 'module');
|
||||
}
|
||||
|
||||
public function program(Request $request, Composition $composition): View
|
||||
|
||||
@@ -4,15 +4,22 @@
|
||||
|
||||
use App\Domain\Identity\AccountStatus;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\LibraryCatalog;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class MemberController extends Controller
|
||||
{
|
||||
public function dashboard(): View
|
||||
public function dashboard(Request $request): View
|
||||
{
|
||||
return view('member.dashboard');
|
||||
$catalog = app(LibraryCatalog::class)->index($request->user());
|
||||
|
||||
return view('member.dashboard', [
|
||||
'programCount' => count($catalog['programs']),
|
||||
'moduleCount' => count($catalog['modules']),
|
||||
'materialCount' => count($catalog['materials']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function profile(): View
|
||||
|
||||
Reference in new issue
Block a user