Support oft parent groups
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\CreateParentGroup;
|
||||
|
||||
use App\Enumerations\ParticipantGroupType;
|
||||
use App\Models\ParentGroup;
|
||||
|
||||
class CreateParentGroupAction
|
||||
{
|
||||
public function __construct(private CreateParentGroupRequest $request)
|
||||
{
|
||||
}
|
||||
|
||||
public function execute(): CreateParentGroupResponse
|
||||
{
|
||||
$response = new CreateParentGroupResponse();
|
||||
|
||||
$name = trim($this->request->name);
|
||||
|
||||
if ($name === '') {
|
||||
$response->message = 'Bitte einen Namen angeben.';
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
$response->parentGroup = ParentGroup::create([
|
||||
'name' => $name,
|
||||
'is_fallback' => false,
|
||||
]);
|
||||
|
||||
$response->success = true;
|
||||
$response->message = sprintf('%s „%s" wurde angelegt.', ParticipantGroupType::ParentGroup->label(), $name);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\CreateParentGroup;
|
||||
|
||||
class CreateParentGroupRequest
|
||||
{
|
||||
public function __construct(
|
||||
public string $name,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\CreateParentGroup;
|
||||
|
||||
use App\Models\ParentGroup;
|
||||
|
||||
class CreateParentGroupResponse
|
||||
{
|
||||
public bool $success = false;
|
||||
public string $message = '';
|
||||
public ?ParentGroup $parentGroup = null;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Domains\Admin\Actions\CreateTenant;
|
||||
|
||||
use App\Enumerations\ParticipantGroupType;
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\Tenant;
|
||||
@@ -16,10 +17,17 @@ class CreateTenantAction
|
||||
{
|
||||
$response = new CreateTenantResponse();
|
||||
|
||||
if ($this->request->parentGroup === null) {
|
||||
$response->message = sprintf('Bitte bei „%s" eine Auswahl treffen.', ParticipantGroupType::ParentGroup->label());
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
$tenant = Tenant::create([
|
||||
'name' => $this->request->name,
|
||||
'slug' => $this->request->slug,
|
||||
'url' => $this->request->url,
|
||||
'parent_group_id' => $this->request->parentGroup->id,
|
||||
'email' => '',
|
||||
'email_finance' => '',
|
||||
'account_name' => '',
|
||||
@@ -46,7 +54,7 @@ class CreateTenantAction
|
||||
}
|
||||
|
||||
$response->success = true;
|
||||
$response->message = 'Stamm wurde angelegt.';
|
||||
$response->message = sprintf('%s wurde angelegt.', ParticipantGroupType::LocalGroup->label());
|
||||
$response->slug = $tenant->slug;
|
||||
|
||||
return $response;
|
||||
|
||||
@@ -2,12 +2,16 @@
|
||||
|
||||
namespace App\Domains\Admin\Actions\CreateTenant;
|
||||
|
||||
use App\Models\ParentGroup;
|
||||
|
||||
class CreateTenantRequest
|
||||
{
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public string $slug,
|
||||
public string $url,
|
||||
/** Pflicht; null heißt, die übermittelte ID war unbekannt. */
|
||||
public ?ParentGroup $parentGroup,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\DeleteParentGroup;
|
||||
|
||||
class DeleteParentGroupAction
|
||||
{
|
||||
public function __construct(private DeleteParentGroupRequest $request)
|
||||
{
|
||||
}
|
||||
|
||||
public function execute(): DeleteParentGroupResponse
|
||||
{
|
||||
$response = new DeleteParentGroupResponse();
|
||||
|
||||
// Die Fallback-Gruppe nimmt Mandanten ohne Zuordnung auf und muss deshalb bestehen bleiben.
|
||||
if ($this->request->parentGroup->is_fallback) {
|
||||
$response->message = sprintf('„%s" kann nicht gelöscht werden.', $this->request->parentGroup->name);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
if ($this->request->inUse) {
|
||||
$response->message = sprintf(
|
||||
'„%s" ist noch zugeordnet und kann deshalb nicht gelöscht werden.',
|
||||
$this->request->parentGroup->name,
|
||||
);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->request->parentGroup->delete();
|
||||
|
||||
$response->success = true;
|
||||
$response->message = sprintf('„%s" wurde gelöscht.', $this->request->parentGroup->name);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\DeleteParentGroup;
|
||||
|
||||
use App\Models\ParentGroup;
|
||||
|
||||
class DeleteParentGroupRequest
|
||||
{
|
||||
public function __construct(
|
||||
public ParentGroup $parentGroup,
|
||||
/** Ob die Gruppe noch von einem Mandanten oder einer Anmeldung verwendet wird. */
|
||||
public bool $inUse,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\DeleteParentGroup;
|
||||
|
||||
class DeleteParentGroupResponse
|
||||
{
|
||||
public bool $success = false;
|
||||
public string $message = '';
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\RenameParentGroup;
|
||||
|
||||
class RenameParentGroupAction
|
||||
{
|
||||
public function __construct(private RenameParentGroupRequest $request)
|
||||
{
|
||||
}
|
||||
|
||||
public function execute(): RenameParentGroupResponse
|
||||
{
|
||||
$response = new RenameParentGroupResponse();
|
||||
|
||||
$name = trim($this->request->name);
|
||||
|
||||
if ($name === '') {
|
||||
$response->message = 'Bitte einen Namen angeben.';
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Umbenennen ist jederzeit möglich: Mandanten und Anmeldungen verweisen über die ID.
|
||||
$this->request->parentGroup->update(['name' => $name]);
|
||||
|
||||
$response->success = true;
|
||||
$response->message = 'Der Name wurde gespeichert.';
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\RenameParentGroup;
|
||||
|
||||
use App\Models\ParentGroup;
|
||||
|
||||
class RenameParentGroupRequest
|
||||
{
|
||||
public function __construct(
|
||||
public ParentGroup $parentGroup,
|
||||
public string $name,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\RenameParentGroup;
|
||||
|
||||
class RenameParentGroupResponse
|
||||
{
|
||||
public bool $success = false;
|
||||
public string $message = '';
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateGlobalSettings;
|
||||
|
||||
use App\Models\GlobalSetting;
|
||||
|
||||
class UpdateGlobalSettingsAction
|
||||
{
|
||||
public function __construct(private UpdateGlobalSettingsRequest $request)
|
||||
{
|
||||
}
|
||||
|
||||
public function execute(): UpdateGlobalSettingsResponse
|
||||
{
|
||||
$response = new UpdateGlobalSettingsResponse();
|
||||
|
||||
$values = [
|
||||
GlobalSetting::LOCAL_GROUP_LABEL => trim($this->request->localGroupLabel),
|
||||
GlobalSetting::LOCAL_GROUP_LABEL_PLURAL => trim($this->request->localGroupLabelPlural),
|
||||
GlobalSetting::PARENT_GROUP_LABEL => trim($this->request->parentGroupLabel),
|
||||
GlobalSetting::PARENT_GROUP_LABEL_PLURAL => trim($this->request->parentGroupLabelPlural),
|
||||
];
|
||||
|
||||
// Eine leere Bezeichnung ließe Überschriften und Auswahlfelder ohne Beschriftung zurück.
|
||||
if (in_array('', $values, true)) {
|
||||
$response->message = 'Bitte alle Bezeichnungen ausfüllen.';
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->request->globalSettings->setMany($values);
|
||||
|
||||
$response->success = true;
|
||||
$response->message = 'Einstellungen wurden gespeichert.';
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateGlobalSettings;
|
||||
|
||||
use App\Repositories\GlobalSettingRepository;
|
||||
|
||||
class UpdateGlobalSettingsRequest
|
||||
{
|
||||
public function __construct(
|
||||
public GlobalSettingRepository $globalSettings,
|
||||
public string $localGroupLabel,
|
||||
public string $localGroupLabelPlural,
|
||||
public string $parentGroupLabel,
|
||||
public string $parentGroupLabelPlural,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateGlobalSettings;
|
||||
|
||||
class UpdateGlobalSettingsResponse
|
||||
{
|
||||
public bool $success = false;
|
||||
public string $message = '';
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateTenantGeneral;
|
||||
|
||||
use App\Enumerations\ParticipantGroupType;
|
||||
|
||||
class UpdateTenantGeneralAction
|
||||
{
|
||||
public function __construct(private UpdateTenantGeneralRequest $request)
|
||||
@@ -12,10 +14,17 @@ class UpdateTenantGeneralAction
|
||||
{
|
||||
$response = new UpdateTenantGeneralResponse();
|
||||
|
||||
if ($this->request->parentGroup === null) {
|
||||
$response->message = sprintf('Bitte bei „%s" eine Auswahl treffen.', ParticipantGroupType::ParentGroup->label());
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->request->tenant->update([
|
||||
'name' => $this->request->name,
|
||||
'slug' => $this->request->slug,
|
||||
'url' => $this->request->url,
|
||||
'parent_group_id' => $this->request->parentGroup->id,
|
||||
]);
|
||||
|
||||
$response->success = true;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateTenantGeneral;
|
||||
|
||||
use App\Models\ParentGroup;
|
||||
use App\Models\Tenant;
|
||||
|
||||
class UpdateTenantGeneralRequest
|
||||
@@ -11,6 +12,8 @@ class UpdateTenantGeneralRequest
|
||||
public string $name,
|
||||
public string $slug,
|
||||
public string $url,
|
||||
/** Pflicht; null heißt, die übermittelte ID war unbekannt. */
|
||||
public ?ParentGroup $parentGroup,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Enumerations\ParticipantGroupType;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class GlobalSettingsGetController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'groupLabels' => ParticipantGroupType::labels(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Providers\InertiaProvider;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Response;
|
||||
|
||||
class GlobalSettingsPageController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
return new InertiaProvider('Admin/GlobalSettings', [])->render();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Domains\Admin\Actions\UpdateGlobalSettings\UpdateGlobalSettingsAction;
|
||||
use App\Domains\Admin\Actions\UpdateGlobalSettings\UpdateGlobalSettingsRequest;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class GlobalSettingsUpdateController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): JsonResponse
|
||||
{
|
||||
$response = new UpdateGlobalSettingsAction(new UpdateGlobalSettingsRequest(
|
||||
globalSettings: $this->globalSettings,
|
||||
localGroupLabel: (string) $request->input('localGroup'),
|
||||
localGroupLabelPlural: (string) $request->input('localGroupPlural'),
|
||||
parentGroupLabel: (string) $request->input('parentGroup'),
|
||||
parentGroupLabelPlural: (string) $request->input('parentGroupPlural'),
|
||||
))->execute();
|
||||
|
||||
return response()->json([
|
||||
'status' => $response->success ? 'success' : 'error',
|
||||
'message' => $response->message,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Domains\Admin\Actions\CreateParentGroup\CreateParentGroupAction;
|
||||
use App\Domains\Admin\Actions\CreateParentGroup\CreateParentGroupRequest;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ParentGroupCreateController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): JsonResponse
|
||||
{
|
||||
$response = new CreateParentGroupAction(new CreateParentGroupRequest(
|
||||
name: (string) $request->input('name'),
|
||||
))->execute();
|
||||
|
||||
return response()->json([
|
||||
'status' => $response->success ? 'success' : 'error',
|
||||
'message' => $response->message,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Domains\Admin\Actions\DeleteParentGroup\DeleteParentGroupAction;
|
||||
use App\Domains\Admin\Actions\DeleteParentGroup\DeleteParentGroupRequest;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ParentGroupDeleteController extends CommonController
|
||||
{
|
||||
public function __invoke(int $id, Request $request): JsonResponse
|
||||
{
|
||||
$parentGroup = $this->adminParentGroups->findById($id);
|
||||
|
||||
if ($parentGroup === null) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Eintrag nicht gefunden.'], 404);
|
||||
}
|
||||
|
||||
$response = new DeleteParentGroupAction(new DeleteParentGroupRequest(
|
||||
parentGroup: $parentGroup,
|
||||
inUse: $this->adminParentGroups->isInUse($parentGroup),
|
||||
))->execute();
|
||||
|
||||
return response()->json([
|
||||
'status' => $response->success ? 'success' : 'error',
|
||||
'message' => $response->message,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ParentGroupListApiController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): JsonResponse
|
||||
{
|
||||
$parentGroups = $this->adminParentGroups->all()->map(fn ($parentGroup) => [
|
||||
'id' => $parentGroup->id,
|
||||
'name' => $parentGroup->name,
|
||||
'isFallback' => $parentGroup->is_fallback,
|
||||
'tenantCount' => $parentGroup->tenants_count,
|
||||
'deletable' => !$parentGroup->is_fallback && !$this->adminParentGroups->isInUse($parentGroup),
|
||||
]);
|
||||
|
||||
return response()->json(['parentGroups' => $parentGroups]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Enumerations\ParticipantGroupType;
|
||||
use App\Providers\InertiaProvider;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Response;
|
||||
|
||||
class ParentGroupListPageController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
return new InertiaProvider('Admin/ParentGroupList', [
|
||||
'groupLabels' => ParticipantGroupType::labels(),
|
||||
])->render();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Domains\Admin\Actions\RenameParentGroup\RenameParentGroupAction;
|
||||
use App\Domains\Admin\Actions\RenameParentGroup\RenameParentGroupRequest;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ParentGroupUpdateController extends CommonController
|
||||
{
|
||||
public function __invoke(int $id, Request $request): JsonResponse
|
||||
{
|
||||
$parentGroup = $this->adminParentGroups->findById($id);
|
||||
|
||||
if ($parentGroup === null) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Eintrag nicht gefunden.'], 404);
|
||||
}
|
||||
|
||||
$response = new RenameParentGroupAction(new RenameParentGroupRequest(
|
||||
parentGroup: $parentGroup,
|
||||
name: (string) $request->input('name'),
|
||||
))->execute();
|
||||
|
||||
return response()->json([
|
||||
'status' => $response->success ? 'success' : 'error',
|
||||
'message' => $response->message,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ class TenantCreateController extends CommonController
|
||||
name: $request->input('name'),
|
||||
slug: $request->input('slug'),
|
||||
url: $request->input('url'),
|
||||
parentGroup: $this->adminParentGroups->findById((int) $request->input('parent_group_id')),
|
||||
));
|
||||
|
||||
$response = $action->execute();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Enumerations\ParticipantGroupType;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -17,6 +18,12 @@ class TenantGeneralGetController extends CommonController
|
||||
'slug' => $tenant->slug,
|
||||
'url' => $tenant->url,
|
||||
'is_active_local_group' => $tenant->is_active_local_group,
|
||||
'parent_group_id' => $tenant->parent_group_id,
|
||||
'parentGroups' => $this->adminParentGroups->all()->map(fn ($parentGroup) => [
|
||||
'id' => $parentGroup->id,
|
||||
'name' => $parentGroup->name,
|
||||
]),
|
||||
'parentGroupLabel' => ParticipantGroupType::ParentGroup->label(),
|
||||
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/general',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class TenantGeneralUpdateController extends CommonController
|
||||
name: $request->input('name'),
|
||||
slug: $request->input('slug'),
|
||||
url: $request->input('url'),
|
||||
parentGroup: $this->adminParentGroups->findById((int) $request->input('parent_group_id')),
|
||||
));
|
||||
|
||||
$response = $action->execute();
|
||||
|
||||
@@ -18,9 +18,17 @@ class TenantListApiController extends CommonController
|
||||
'slug' => $tenant->slug,
|
||||
'url' => $tenant->url,
|
||||
'is_active_local_group' => $tenant->is_active_local_group,
|
||||
'parentGroup' => $tenant->parentGroup?->name,
|
||||
];
|
||||
});
|
||||
|
||||
return response()->json(['tenants' => $mapped]);
|
||||
// Auswahl für das Anlage-Formular (Pflichtangabe).
|
||||
$parentGroups = $this->adminParentGroups->all()->map(fn ($parentGroup) => [
|
||||
'id' => $parentGroup->id,
|
||||
'name' => $parentGroup->name,
|
||||
'isFallback' => $parentGroup->is_fallback,
|
||||
]);
|
||||
|
||||
return response()->json(['tenants' => $mapped, 'parentGroups' => $parentGroups]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Enumerations\ParticipantGroupType;
|
||||
use App\Providers\InertiaProvider;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -11,7 +12,9 @@ class TenantListPageController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$inertiaProvider = new InertiaProvider('Admin/TenantList', []);
|
||||
$inertiaProvider = new InertiaProvider('Admin/TenantList', [
|
||||
'groupLabels' => ParticipantGroupType::labels(),
|
||||
]);
|
||||
return $inertiaProvider->render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Repositories;
|
||||
|
||||
use App\Models\ParentGroup;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class AdminParentGroupRepository
|
||||
{
|
||||
/** Alle Parent Groups, alphabetisch mit „Ohne Zuordnung" am Ende, mit der Zahl zugeordneter Mandanten. */
|
||||
public function all(): Collection
|
||||
{
|
||||
return ParentGroup::withCount('tenants')
|
||||
->ordered()
|
||||
->get();
|
||||
}
|
||||
|
||||
public function findById(int $id): ?ParentGroup
|
||||
{
|
||||
return ParentGroup::find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ob die Parent Group noch verwendet wird -- von einem Mandanten oder von einer Anmeldung. Anmeldungen sind
|
||||
* mandantengebunden; gezählt wird hier bewusst über alle Mandanten hinweg.
|
||||
*/
|
||||
public function isInUse(ParentGroup $parentGroup): bool
|
||||
{
|
||||
return $parentGroup->tenants()->exists()
|
||||
|| $parentGroup->eventParticipants()->withoutGlobalScopes()->exists();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ use App\Domains\Admin\Controllers\DocumentAssetUpdateController;
|
||||
use App\Domains\Admin\Controllers\DocumentTemplatesGetController;
|
||||
use App\Domains\Admin\Controllers\DocumentTemplatesPreviewController;
|
||||
use App\Domains\Admin\Controllers\DocumentTemplatesUpdateController;
|
||||
use App\Domains\Admin\Controllers\GlobalSettingsGetController;
|
||||
use App\Domains\Admin\Controllers\GlobalSettingsUpdateController;
|
||||
use App\Domains\Admin\Controllers\ManagedTenantContactGetController;
|
||||
use App\Domains\Admin\Controllers\ManagedTenantContactUpdateController;
|
||||
use App\Domains\Admin\Controllers\ManagedTenantGdprGetController;
|
||||
@@ -15,6 +17,10 @@ use App\Domains\Admin\Controllers\ManagedTenantPaymentGetController;
|
||||
use App\Domains\Admin\Controllers\ManagedTenantPaymentUpdateController;
|
||||
use App\Domains\Admin\Controllers\ManagedTenantTaxGetController;
|
||||
use App\Domains\Admin\Controllers\ManagedTenantTaxUpdateController;
|
||||
use App\Domains\Admin\Controllers\ParentGroupCreateController;
|
||||
use App\Domains\Admin\Controllers\ParentGroupDeleteController;
|
||||
use App\Domains\Admin\Controllers\ParentGroupListApiController;
|
||||
use App\Domains\Admin\Controllers\ParentGroupUpdateController;
|
||||
use App\Domains\Admin\Controllers\TenantContactGetController;
|
||||
use App\Domains\Admin\Controllers\TenantContactUpdateController;
|
||||
use App\Domains\Admin\Controllers\TenantCreateController;
|
||||
@@ -76,6 +82,12 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
|
||||
Route::post('/assets', DocumentAssetUpdateController::class);
|
||||
Route::delete('/assets/{name}', DocumentAssetDeleteController::class);
|
||||
});
|
||||
|
||||
// Bezeichnungen der Gruppen-Ebenen gelten ebenfalls app-weit.
|
||||
Route::prefix('api/v1/admin/settings')->group(function () {
|
||||
Route::get('/', GlobalSettingsGetController::class);
|
||||
Route::post('/', GlobalSettingsUpdateController::class);
|
||||
});
|
||||
});
|
||||
|
||||
Route::middleware(LvOnlyMiddleware::class)->group(function () {
|
||||
@@ -97,5 +109,12 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
|
||||
Route::post('/tax', ManagedTenantTaxUpdateController::class);
|
||||
});
|
||||
});
|
||||
|
||||
Route::prefix('api/v1/admin/parent-groups')->group(function () {
|
||||
Route::get('/list', ParentGroupListApiController::class);
|
||||
Route::post('/create', ParentGroupCreateController::class);
|
||||
Route::post('/{id}', ParentGroupUpdateController::class)->whereNumber('id');
|
||||
Route::delete('/{id}', ParentGroupDeleteController::class)->whereNumber('id');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
use App\Domains\Admin\Controllers\AdminDashboardController;
|
||||
use App\Domains\Admin\Controllers\DocumentTemplatesPageController;
|
||||
use App\Domains\Admin\Controllers\GlobalSettingsPageController;
|
||||
use App\Domains\Admin\Controllers\ParentGroupListPageController;
|
||||
use App\Domains\Admin\Controllers\TenantEditPageController;
|
||||
use App\Domains\Admin\Controllers\TenantListPageController;
|
||||
use App\Domains\Admin\Controllers\TenantPageController;
|
||||
@@ -21,11 +23,13 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
|
||||
// App-weit gültige Dokumentvorlagen -- nur für Hauptadministrator*innen.
|
||||
Route::middleware(MainAdminRoleMiddleware::class)->group(function () {
|
||||
Route::get('/document-templates', DocumentTemplatesPageController::class);
|
||||
Route::get('/settings', GlobalSettingsPageController::class);
|
||||
});
|
||||
|
||||
Route::middleware(LvOnlyMiddleware::class)->group(function () {
|
||||
Route::get('/tenants', TenantListPageController::class);
|
||||
Route::get('/tenants/{slug}', TenantEditPageController::class);
|
||||
Route::get('/parent-groups', ParentGroupListPageController::class);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import AdminAppLayout from "../../../../resources/js/layouts/AdminAppLayout.vue";
|
||||
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
|
||||
import { useAjax } from "../../../../resources/js/components/ajaxHandler.js";
|
||||
import { toast } from "vue3-toastify";
|
||||
|
||||
const { request } = useAjax()
|
||||
|
||||
const form = ref({
|
||||
localGroup: '',
|
||||
localGroupPlural: '',
|
||||
parentGroup: '',
|
||||
parentGroupPlural: '',
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const response = await request('/api/v1/admin/settings')
|
||||
Object.assign(form.value, response?.groupLabels ?? {})
|
||||
})
|
||||
|
||||
async function save() {
|
||||
const response = await request('/api/v1/admin/settings', {
|
||||
method: 'POST',
|
||||
body: form.value,
|
||||
})
|
||||
|
||||
if (response && response.status === 'success') {
|
||||
toast.success(response.message)
|
||||
} else {
|
||||
toast.error(response?.message ?? 'Fehler beim Speichern')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AdminAppLayout title="Einstellungen">
|
||||
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
|
||||
<h3>Bezeichnungen der Gruppen</h3>
|
||||
<p class="hint">
|
||||
Gelten für alle Mandanten: in Anmeldungen, Teilnehmendenlisten, Exporten und in der Verwaltung.
|
||||
</p>
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Einzahl</th>
|
||||
<th>Mehrzahl</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Gruppe (Mandant)</th>
|
||||
<td><input type="text" v-model="form.localGroup" class="form-input" placeholder="z. B. Stamm" /></td>
|
||||
<td><input type="text" v-model="form.localGroupPlural" class="form-input" placeholder="z. B. Stämme" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Übergeordnete Gruppe</th>
|
||||
<td><input type="text" v-model="form.parentGroup" class="form-input" placeholder="z. B. Bund" /></td>
|
||||
<td><input type="text" v-model="form.parentGroupPlural" class="form-input" placeholder="z. B. Bünde" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button class="btn-save" @click="save">Speichern</button>
|
||||
</shadowed-box>
|
||||
</AdminAppLayout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.hint {
|
||||
color: #6b7280;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.data-table th {
|
||||
text-align: left;
|
||||
padding: 8px 12px;
|
||||
color: #374151;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.data-table td {
|
||||
padding: 8px 12px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
width: 100%;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
font-size: 0.95rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.btn-save {
|
||||
margin-top: 15px;
|
||||
padding: 8px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
font-size: 0.9rem;
|
||||
background-color: #16a34a;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-save:hover {
|
||||
background-color: #15803d;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,249 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import AdminAppLayout from "../../../../resources/js/layouts/AdminAppLayout.vue";
|
||||
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
|
||||
import { useAjax } from "../../../../resources/js/components/ajaxHandler.js";
|
||||
import { toast } from "vue3-toastify";
|
||||
|
||||
const props = defineProps({
|
||||
groupLabels: {
|
||||
type: Object,
|
||||
default: () => ({ localGroupPlural: 'Stämme', parentGroup: 'Bund', parentGroupPlural: 'Bünde' }),
|
||||
},
|
||||
})
|
||||
|
||||
const { request } = useAjax()
|
||||
|
||||
const parentGroups = ref([])
|
||||
const newName = ref('')
|
||||
const showCreate = ref(false)
|
||||
// ID des Eintrags, der gerade umbenannt wird, samt Entwurf des neuen Namens.
|
||||
const editingId = ref(null)
|
||||
const editName = ref('')
|
||||
|
||||
onMounted(async () => {
|
||||
await loadParentGroups()
|
||||
})
|
||||
|
||||
async function loadParentGroups() {
|
||||
const response = await request('/api/v1/admin/parent-groups/list')
|
||||
parentGroups.value = response?.parentGroups ?? []
|
||||
}
|
||||
|
||||
async function createParentGroup() {
|
||||
const response = await request('/api/v1/admin/parent-groups/create', {
|
||||
method: 'POST',
|
||||
body: { name: newName.value },
|
||||
})
|
||||
|
||||
if (response && response.status === 'success') {
|
||||
toast.success(response.message)
|
||||
newName.value = ''
|
||||
showCreate.value = false
|
||||
await loadParentGroups()
|
||||
} else {
|
||||
toast.error(response?.message ?? 'Fehler beim Anlegen')
|
||||
}
|
||||
}
|
||||
|
||||
function startEditing(parentGroup) {
|
||||
editingId.value = parentGroup.id
|
||||
editName.value = parentGroup.name
|
||||
}
|
||||
|
||||
async function saveName(parentGroup) {
|
||||
const response = await request('/api/v1/admin/parent-groups/' + parentGroup.id, {
|
||||
method: 'POST',
|
||||
body: { name: editName.value },
|
||||
})
|
||||
|
||||
if (response && response.status === 'success') {
|
||||
toast.success(response.message)
|
||||
editingId.value = null
|
||||
await loadParentGroups()
|
||||
} else {
|
||||
toast.error(response?.message ?? 'Fehler beim Speichern')
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteParentGroup(parentGroup) {
|
||||
if (!confirm('„' + parentGroup.name + '" wirklich löschen?')) {
|
||||
return
|
||||
}
|
||||
|
||||
const response = await request('/api/v1/admin/parent-groups/' + parentGroup.id, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
|
||||
if (response && response.status === 'success') {
|
||||
toast.success(response.message)
|
||||
await loadParentGroups()
|
||||
} else {
|
||||
toast.error(response?.message ?? 'Fehler beim Löschen')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AdminAppLayout :title="props.groupLabels.parentGroupPlural">
|
||||
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
|
||||
<table class="parent-group-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Zugeordnete {{ props.groupLabels.localGroupPlural }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="parentGroup in parentGroups" :key="parentGroup.id">
|
||||
<td>
|
||||
<input v-if="editingId === parentGroup.id" type="text" v-model="editName" class="form-input"
|
||||
@keyup.enter="saveName(parentGroup)" />
|
||||
<span v-else>{{ parentGroup.name }}</span>
|
||||
</td>
|
||||
<td>{{ parentGroup.tenantCount }}</td>
|
||||
<td class="actions">
|
||||
<template v-if="editingId === parentGroup.id">
|
||||
<button class="btn-save" @click="saveName(parentGroup)">Speichern</button>
|
||||
<button class="btn-cancel" @click="editingId = null">Abbrechen</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button class="btn-edit" @click="startEditing(parentGroup)">Umbenennen</button>
|
||||
<button v-if="parentGroup.deletable" class="btn-delete" @click="deleteParentGroup(parentGroup)">Löschen</button>
|
||||
</template>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="hint">
|
||||
Löschen ist nur möglich, solange keine {{ props.groupLabels.localGroupPlural }} und keine Anmeldungen
|
||||
zugeordnet sind. „Ohne Zuordnung" bleibt immer bestehen.
|
||||
</p>
|
||||
|
||||
<div style="margin-top: 20px;">
|
||||
<button v-if="!showCreate" class="btn-create" @click="showCreate = true">Neuen Eintrag anlegen</button>
|
||||
|
||||
<div v-if="showCreate" class="create-form">
|
||||
<h3>Neuen Eintrag anlegen ({{ props.groupLabels.parentGroup }})</h3>
|
||||
<input type="text" v-model="newName" class="form-input" placeholder="Name"
|
||||
@keyup.enter="createParentGroup" />
|
||||
<div class="btn-group">
|
||||
<button class="btn-save" @click="createParentGroup">Anlegen</button>
|
||||
<button class="btn-cancel" @click="showCreate = false">Abbrechen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</shadowed-box>
|
||||
</AdminAppLayout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.parent-group-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.parent-group-table thead th {
|
||||
text-align: left;
|
||||
padding: 10px 16px;
|
||||
background-color: #f9fafb;
|
||||
color: #374151;
|
||||
font-weight: bold;
|
||||
border-bottom: 2px solid #d1d5db;
|
||||
}
|
||||
|
||||
.parent-group-table tbody td {
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin-top: 12px;
|
||||
color: #6b7280;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.create-form {
|
||||
margin-top: 15px;
|
||||
padding: 20px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
background-color: #f9fafb;
|
||||
}
|
||||
|
||||
.create-form h3 {
|
||||
margin: 0 0 15px 0;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
width: 100%;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 6px;
|
||||
font-size: 0.95rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.btn-create, .btn-save, .btn-cancel, .btn-edit, .btn-delete {
|
||||
padding: 6px 16px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.btn-create, .btn-edit {
|
||||
background-color: #1d4899;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-create:hover, .btn-edit:hover {
|
||||
background-color: #163a7a;
|
||||
}
|
||||
|
||||
.btn-save {
|
||||
background-color: #16a34a;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-save:hover {
|
||||
background-color: #15803d;
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
background-color: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
.btn-cancel:hover {
|
||||
background-color: #d1d5db;
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
background-color: #dc2626;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-delete:hover {
|
||||
background-color: #b91c1c;
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useAjax } from "../../../../../resources/js/components/ajaxHandler.js";
|
||||
import { toast } from "vue3-toastify";
|
||||
|
||||
@@ -17,8 +17,16 @@ const form = ref({
|
||||
name: props.data.name ?? '',
|
||||
slug: props.data.slug ?? '',
|
||||
url: props.data.url ?? '',
|
||||
parent_group_id: props.data.parent_group_id ?? null,
|
||||
})
|
||||
|
||||
// Übergeordnete Gruppe (z. B. „Bund") -- Pflichtangabe, Auswahl aus der LV-seitig gepflegten Liste.
|
||||
const parentGroups = props.data.parentGroups ?? []
|
||||
const parentGroupLabel = props.data.parentGroupLabel ?? 'Bund'
|
||||
const parentGroupName = computed(() =>
|
||||
parentGroups.find(g => g.id === form.value.parent_group_id)?.name ?? '—'
|
||||
)
|
||||
|
||||
async function save() {
|
||||
const saveUrl = props.data.saveEndpoint ?? '/api/v1/admin/tenants/' + props.data.slug + '/general'
|
||||
const response = await request(saveUrl, {
|
||||
@@ -39,6 +47,7 @@ async function save() {
|
||||
<div v-if="!editing">
|
||||
<table class="data-table">
|
||||
<tr><th>Name:</th><td>{{ form.name }}</td></tr>
|
||||
<tr><th>{{ parentGroupLabel }}:</th><td>{{ parentGroupName }}</td></tr>
|
||||
<tr><th>Slug:</th><td>{{ form.slug }}</td></tr>
|
||||
<tr><th>URL:</th><td>{{ form.url }}</td></tr>
|
||||
<tr><th>Status:</th><td>
|
||||
@@ -54,6 +63,14 @@ async function save() {
|
||||
<th>Name:</th>
|
||||
<td><input type="text" v-model="form.name" class="form-input" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ parentGroupLabel }}:</th>
|
||||
<td>
|
||||
<select v-model="form.parent_group_id" class="form-input">
|
||||
<option v-for="group in parentGroups" :key="group.id" :value="group.id">{{ group.name }}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Slug:</th>
|
||||
<td><input type="text" v-model="form.slug" class="form-input" /></td>
|
||||
|
||||
@@ -5,6 +5,13 @@ import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
|
||||
import { useAjax } from "../../../../resources/js/components/ajaxHandler.js";
|
||||
import { toast } from "vue3-toastify";
|
||||
|
||||
const props = defineProps({
|
||||
groupLabels: {
|
||||
type: Object,
|
||||
default: () => ({ localGroup: 'Stamm', localGroupPlural: 'Stämme', parentGroup: 'Bund' }),
|
||||
},
|
||||
})
|
||||
|
||||
const { request } = useAjax()
|
||||
|
||||
function openTenant(slug) {
|
||||
@@ -12,12 +19,16 @@ function openTenant(slug) {
|
||||
}
|
||||
|
||||
const tenants = ref([])
|
||||
const parentGroups = ref([])
|
||||
const showCreate = ref(false)
|
||||
const createForm = ref({
|
||||
const emptyForm = () => ({
|
||||
name: '',
|
||||
slug: '',
|
||||
url: '',
|
||||
// Pflichtangabe; vorbelegt mit „Ohne Zuordnung", sobald die Liste geladen ist.
|
||||
parent_group_id: parentGroups.value.find(g => g.isFallback)?.id ?? null,
|
||||
})
|
||||
const createForm = ref(emptyForm())
|
||||
|
||||
onMounted(async () => {
|
||||
await loadTenants()
|
||||
@@ -33,6 +44,11 @@ async function loadTenants() {
|
||||
})
|
||||
const data = await response.json()
|
||||
tenants.value = data.tenants
|
||||
parentGroups.value = data.parentGroups ?? []
|
||||
|
||||
if (createForm.value.parent_group_id === null) {
|
||||
createForm.value.parent_group_id = parentGroups.value.find(g => g.isFallback)?.id ?? null
|
||||
}
|
||||
}
|
||||
|
||||
async function createTenant() {
|
||||
@@ -44,7 +60,7 @@ async function createTenant() {
|
||||
if (response && response.status === 'success') {
|
||||
toast.success(response.message)
|
||||
showCreate.value = false
|
||||
createForm.value = { name: '', slug: '', url: '' }
|
||||
createForm.value = emptyForm()
|
||||
await loadTenants()
|
||||
} else {
|
||||
toast.error(response?.message ?? 'Fehler beim Anlegen')
|
||||
@@ -53,12 +69,13 @@ async function createTenant() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AdminAppLayout title="Stämme">
|
||||
<AdminAppLayout :title="props.groupLabels.localGroupPlural">
|
||||
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
|
||||
<table class="tenant-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>{{ props.groupLabels.parentGroup }}</th>
|
||||
<th>Slug</th>
|
||||
<th>URL</th>
|
||||
<th>Status</th>
|
||||
@@ -67,6 +84,7 @@ async function createTenant() {
|
||||
<tbody>
|
||||
<tr v-for="tenant in tenants" :key="tenant.slug" class="tenant-row" @click="openTenant(tenant.slug)">
|
||||
<td>{{ tenant.name }}</td>
|
||||
<td>{{ tenant.parentGroup ?? '—' }}</td>
|
||||
<td>{{ tenant.slug }}</td>
|
||||
<td>{{ tenant.url }}</td>
|
||||
<td>
|
||||
@@ -79,15 +97,23 @@ async function createTenant() {
|
||||
</table>
|
||||
|
||||
<div style="margin-top: 20px;">
|
||||
<button v-if="!showCreate" class="btn-create" @click="showCreate = true">Neuen Stamm anlegen</button>
|
||||
<button v-if="!showCreate" class="btn-create" @click="showCreate = true">Neuen Eintrag anlegen ({{ props.groupLabels.localGroup }})</button>
|
||||
|
||||
<div v-if="showCreate" class="create-form">
|
||||
<h3>Neuen Stamm anlegen</h3>
|
||||
<h3>Neuen Eintrag anlegen ({{ props.groupLabels.localGroup }})</h3>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><input type="text" v-model="createForm.name" class="form-input" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ props.groupLabels.parentGroup }}</th>
|
||||
<td>
|
||||
<select v-model="createForm.parent_group_id" class="form-input">
|
||||
<option v-for="group in parentGroups" :key="group.id" :value="group.id">{{ group.name }}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Slug</th>
|
||||
<td><input type="text" v-model="createForm.slug" class="form-input" /></td>
|
||||
|
||||
Reference in New Issue
Block a user