Development 4.4.2 #8
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantContactGetController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'email' => $tenant->email,
|
||||||
|
'email_finance' => $tenant->email_finance,
|
||||||
|
'postcode' => $tenant->postcode,
|
||||||
|
'city' => $tenant->city,
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/contact',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantContactUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
$tenant->update([
|
||||||
|
'email' => $request->input('email'),
|
||||||
|
'email_finance' => $request->input('email_finance'),
|
||||||
|
'postcode' => $request->input('postcode'),
|
||||||
|
'city' => $request->input('city'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Kontaktdaten wurden gespeichert.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantGdprGetController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'gdpr_text' => $tenant->gdpr_text ?? '',
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/gdpr',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantGdprUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
$tenant->update([
|
||||||
|
'gdpr_text' => $request->input('gdpr_text'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Datenschutzerklärung wurde gespeichert.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantImpressGetController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'impress_text' => $tenant->impress_text ?? '',
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/impress',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantImpressUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
$tenant->update([
|
||||||
|
'impress_text' => $request->input('impress_text'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Impressum wurde gespeichert.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantPaymentGetController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'account_iban' => $tenant->account_iban,
|
||||||
|
'account_bic' => $tenant->account_bic,
|
||||||
|
'account_name' => $tenant->account_name,
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/payment',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ManagedTenantPaymentUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
$tenant->update([
|
||||||
|
'account_iban' => $request->input('account_iban'),
|
||||||
|
'account_bic' => $request->input('account_bic'),
|
||||||
|
'account_name' => $request->input('account_name'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Bezahldaten wurden gespeichert.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ class TenantContactGetController extends CommonController
|
|||||||
'email_finance' => $this->tenant->email_finance,
|
'email_finance' => $this->tenant->email_finance,
|
||||||
'postcode' => $this->tenant->postcode,
|
'postcode' => $this->tenant->postcode,
|
||||||
'city' => $this->tenant->city,
|
'city' => $this->tenant->city,
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenant/contact',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TenantCreateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::create([
|
||||||
|
'name' => $request->input('name'),
|
||||||
|
'slug' => $request->input('slug'),
|
||||||
|
'url' => $request->input('url'),
|
||||||
|
'email' => '',
|
||||||
|
'email_finance' => '',
|
||||||
|
'account_name' => '',
|
||||||
|
'account_iban' => '',
|
||||||
|
'account_bic' => '',
|
||||||
|
'city' => '',
|
||||||
|
'postcode' => '',
|
||||||
|
'is_active_local_group' => true,
|
||||||
|
'has_active_instance' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Stamm wurde angelegt.',
|
||||||
|
'slug' => $tenant->slug,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Providers\InertiaProvider;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class TenantEditPageController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): Response
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
$inertiaProvider = new InertiaProvider('Admin/TenantEdit', [
|
||||||
|
'tenant' => [
|
||||||
|
'name' => $tenant->name,
|
||||||
|
'slug' => $tenant->slug,
|
||||||
|
'url' => $tenant->url,
|
||||||
|
'is_active_local_group' => $tenant->is_active_local_group,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
return $inertiaProvider->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ class TenantGdprGetController extends CommonController
|
|||||||
{
|
{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'gdpr_text' => $this->tenant->gdpr_text ?? '',
|
'gdpr_text' => $this->tenant->gdpr_text ?? '',
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenant/gdpr',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TenantGeneralGetController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'name' => $tenant->name,
|
||||||
|
'slug' => $tenant->slug,
|
||||||
|
'url' => $tenant->url,
|
||||||
|
'is_active_local_group' => $tenant->is_active_local_group,
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/general',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TenantGeneralUpdateController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(string $slug, Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenant = Tenant::where('slug', $slug)->firstOrFail();
|
||||||
|
|
||||||
|
$tenant->update([
|
||||||
|
'name' => $request->input('name'),
|
||||||
|
'slug' => $request->input('slug'),
|
||||||
|
'url' => $request->input('url'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Allgemeine Daten wurden gespeichert.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ class TenantImpressGetController extends CommonController
|
|||||||
{
|
{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'impress_text' => $this->tenant->impress_text ?? '',
|
'impress_text' => $this->tenant->impress_text ?? '',
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenant/impress',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Tenant;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TenantListApiController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$tenants = Tenant::where('has_active_instance', true)->get()->map(function ($tenant) {
|
||||||
|
return [
|
||||||
|
'name' => $tenant->name,
|
||||||
|
'slug' => $tenant->slug,
|
||||||
|
'url' => $tenant->url,
|
||||||
|
'is_active_local_group' => $tenant->is_active_local_group,
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
return response()->json(['tenants' => $tenants]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domains\Admin\Controllers;
|
||||||
|
|
||||||
|
use App\Providers\InertiaProvider;
|
||||||
|
use App\Scopes\CommonController;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class TenantListPageController extends CommonController
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request): Response
|
||||||
|
{
|
||||||
|
$inertiaProvider = new InertiaProvider('Admin/TenantList', []);
|
||||||
|
return $inertiaProvider->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ class TenantPaymentGetController extends CommonController
|
|||||||
'account_iban' => $this->tenant->account_iban,
|
'account_iban' => $this->tenant->account_iban,
|
||||||
'account_bic' => $this->tenant->account_bic,
|
'account_bic' => $this->tenant->account_bic,
|
||||||
'account_name' => $this->tenant->account_name,
|
'account_name' => $this->tenant->account_name,
|
||||||
|
'saveEndpoint' => '/api/v1/admin/tenant/payment',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantContactGetController;
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantContactUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantGdprGetController;
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantGdprUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantImpressGetController;
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantImpressUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantPaymentGetController;
|
||||||
|
use App\Domains\Admin\Controllers\ManagedTenantPaymentUpdateController;
|
||||||
use App\Domains\Admin\Controllers\TenantContactGetController;
|
use App\Domains\Admin\Controllers\TenantContactGetController;
|
||||||
use App\Domains\Admin\Controllers\TenantContactUpdateController;
|
use App\Domains\Admin\Controllers\TenantContactUpdateController;
|
||||||
use App\Domains\Admin\Controllers\TenantPaymentGetController;
|
use App\Domains\Admin\Controllers\TenantCreateController;
|
||||||
use App\Domains\Admin\Controllers\TenantPaymentUpdateController;
|
|
||||||
use App\Domains\Admin\Controllers\TenantImpressGetController;
|
|
||||||
use App\Domains\Admin\Controllers\TenantImpressUpdateController;
|
|
||||||
use App\Domains\Admin\Controllers\TenantGdprGetController;
|
use App\Domains\Admin\Controllers\TenantGdprGetController;
|
||||||
use App\Domains\Admin\Controllers\TenantGdprUpdateController;
|
use App\Domains\Admin\Controllers\TenantGdprUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantGeneralGetController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantGeneralUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantImpressGetController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantImpressUpdateController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantListApiController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantPaymentGetController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantPaymentUpdateController;
|
||||||
use App\Middleware\AdminRoleMiddleware;
|
use App\Middleware\AdminRoleMiddleware;
|
||||||
use App\Middleware\IdentifyTenant;
|
use App\Middleware\IdentifyTenant;
|
||||||
|
use App\Middleware\LvOnlyMiddleware;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->group(function () {
|
Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->group(function () {
|
||||||
@@ -23,4 +36,23 @@ Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->
|
|||||||
Route::get('/gdpr', TenantGdprGetController::class);
|
Route::get('/gdpr', TenantGdprGetController::class);
|
||||||
Route::post('/gdpr', TenantGdprUpdateController::class);
|
Route::post('/gdpr', TenantGdprUpdateController::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::middleware(LvOnlyMiddleware::class)->group(function () {
|
||||||
|
Route::prefix('api/v1/admin/tenants')->group(function () {
|
||||||
|
Route::get('/list', TenantListApiController::class);
|
||||||
|
Route::post('/create', TenantCreateController::class);
|
||||||
|
Route::prefix('/{slug}')->group(function () {
|
||||||
|
Route::get('/general', TenantGeneralGetController::class);
|
||||||
|
Route::post('/general', TenantGeneralUpdateController::class);
|
||||||
|
Route::get('/contact', ManagedTenantContactGetController::class);
|
||||||
|
Route::post('/contact', ManagedTenantContactUpdateController::class);
|
||||||
|
Route::get('/payment', ManagedTenantPaymentGetController::class);
|
||||||
|
Route::post('/payment', ManagedTenantPaymentUpdateController::class);
|
||||||
|
Route::get('/impress', ManagedTenantImpressGetController::class);
|
||||||
|
Route::post('/impress', ManagedTenantImpressUpdateController::class);
|
||||||
|
Route::get('/gdpr', ManagedTenantGdprGetController::class);
|
||||||
|
Route::post('/gdpr', ManagedTenantGdprUpdateController::class);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,14 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Domains\Admin\Controllers\AdminDashboardController;
|
use App\Domains\Admin\Controllers\AdminDashboardController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantEditPageController;
|
||||||
|
use App\Domains\Admin\Controllers\TenantListPageController;
|
||||||
use App\Domains\Admin\Controllers\TenantPageController;
|
use App\Domains\Admin\Controllers\TenantPageController;
|
||||||
use App\Middleware\AdminRoleMiddleware;
|
use App\Middleware\AdminRoleMiddleware;
|
||||||
use App\Middleware\IdentifyTenant;
|
use App\Middleware\IdentifyTenant;
|
||||||
|
use App\Middleware\LvOnlyMiddleware;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->group(function () {
|
Route::middleware([IdentifyTenant::class, 'auth', AdminRoleMiddleware::class])->group(function () {
|
||||||
Route::prefix('admin')->group(function () {
|
Route::prefix('admin')->group(function () {
|
||||||
Route::get('/', AdminDashboardController::class);
|
Route::get('/', AdminDashboardController::class);
|
||||||
Route::get('/tenant', TenantPageController::class);
|
Route::get('/tenant', TenantPageController::class);
|
||||||
|
|
||||||
|
Route::middleware(LvOnlyMiddleware::class)->group(function () {
|
||||||
|
Route::get('/tenants', TenantListPageController::class);
|
||||||
|
Route::get('/tenants/{slug}', TenantEditPageController::class);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ const form = ref({
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const response = await request('/api/v1/admin/tenant/contact', {
|
const saveUrl = props.data.saveEndpoint ?? '/api/v1/admin/tenant/contact'
|
||||||
|
const response = await request(saveUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: form.value,
|
body: form.value,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ function autoGenerate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const response = await request('/api/v1/admin/tenant/gdpr', {
|
const saveUrl = props.data.saveEndpoint ?? '/api/v1/admin/tenant/gdpr'
|
||||||
|
const response = await request(saveUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { gdpr_text: content.value },
|
body: { gdpr_text: content.value },
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useAjax } from "../../../../../resources/js/components/ajaxHandler.js";
|
||||||
|
import { toast } from "vue3-toastify";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const { request } = useAjax()
|
||||||
|
|
||||||
|
const editing = ref(false)
|
||||||
|
const form = ref({
|
||||||
|
name: props.data.name ?? '',
|
||||||
|
slug: props.data.slug ?? '',
|
||||||
|
url: props.data.url ?? '',
|
||||||
|
})
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
const saveUrl = props.data.saveEndpoint ?? '/api/v1/admin/tenants/' + props.data.slug + '/general'
|
||||||
|
const response = await request(saveUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
body: form.value,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response && response.status === 'success') {
|
||||||
|
toast.success(response.message)
|
||||||
|
editing.value = false
|
||||||
|
} else {
|
||||||
|
toast.error(response?.message ?? 'Fehler beim Speichern')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-if="!editing">
|
||||||
|
<table class="data-table">
|
||||||
|
<tr><th>Name:</th><td>{{ form.name }}</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>
|
||||||
|
<span class="badge-active">Aktiv</span>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
<button class="btn-edit" @click="editing = true">Bearbeiten</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
<table class="data-table">
|
||||||
|
<tr>
|
||||||
|
<th>Name:</th>
|
||||||
|
<td><input type="text" v-model="form.name" class="form-input" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Slug:</th>
|
||||||
|
<td><input type="text" v-model="form.slug" class="form-input" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>URL:</th>
|
||||||
|
<td><input type="text" v-model="form.url" class="form-input" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr><th>Status:</th><td>
|
||||||
|
<span class="badge-active">Aktiv</span>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn-save" @click="save">Speichern</button>
|
||||||
|
<button class="btn-cancel" @click="editing = false">Abbrechen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.data-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table th {
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px 12px;
|
||||||
|
width: 200px;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-active {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 3px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #166534;
|
||||||
|
background-color: #dcfce7;
|
||||||
|
border: 1px solid #22c55e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit, .btn-save, .btn-cancel {
|
||||||
|
margin-top: 15px;
|
||||||
|
padding: 8px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit {
|
||||||
|
background-color: #1d4899;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel:hover {
|
||||||
|
background-color: #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -16,7 +16,8 @@ const { request } = useAjax()
|
|||||||
const content = ref(props.data.impress_text ?? '')
|
const content = ref(props.data.impress_text ?? '')
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const response = await request('/api/v1/admin/tenant/impress', {
|
const saveUrl = props.data.saveEndpoint ?? '/api/v1/admin/tenant/impress'
|
||||||
|
const response = await request(saveUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { impress_text: content.value },
|
body: { impress_text: content.value },
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ const form = ref({
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
const response = await request('/api/v1/admin/tenant/payment', {
|
const saveUrl = props.data.saveEndpoint ?? '/api/v1/admin/tenant/payment'
|
||||||
|
const response = await request(saveUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: form.value,
|
body: form.value,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<script setup>
|
||||||
|
import AdminAppLayout from "../../../../resources/js/layouts/AdminAppLayout.vue";
|
||||||
|
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
|
||||||
|
import TabbedPage from "../../../Views/Components/TabbedPage.vue";
|
||||||
|
import TenantGeneral from "./Partials/TenantGeneral.vue";
|
||||||
|
import TenantContact from "./Partials/TenantContact.vue";
|
||||||
|
import TenantPayment from "./Partials/TenantPayment.vue";
|
||||||
|
import TenantImpress from "./Partials/TenantImpress.vue";
|
||||||
|
import TenantGdpr from "./Partials/TenantGdpr.vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
tenant: Object,
|
||||||
|
})
|
||||||
|
|
||||||
|
const slug = props.tenant.slug
|
||||||
|
|
||||||
|
const tabs = [
|
||||||
|
{
|
||||||
|
title: 'Allgemeines',
|
||||||
|
component: TenantGeneral,
|
||||||
|
endpoint: '/api/v1/admin/tenants/' + slug + '/general',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Kontaktdaten',
|
||||||
|
component: TenantContact,
|
||||||
|
endpoint: '/api/v1/admin/tenants/' + slug + '/contact',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Bezahldaten',
|
||||||
|
component: TenantPayment,
|
||||||
|
endpoint: '/api/v1/admin/tenants/' + slug + '/payment',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Impressum',
|
||||||
|
component: TenantImpress,
|
||||||
|
endpoint: '/api/v1/admin/tenants/' + slug + '/impress',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Datenschutzerklärung',
|
||||||
|
component: TenantGdpr,
|
||||||
|
endpoint: '/api/v1/admin/tenants/' + slug + '/gdpr',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AdminAppLayout :title="props.tenant.name">
|
||||||
|
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
|
||||||
|
<tabbed-page :tabs="tabs" />
|
||||||
|
</shadowed-box>
|
||||||
|
</AdminAppLayout>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
<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()
|
||||||
|
|
||||||
|
function openTenant(slug) {
|
||||||
|
window.location.href = '/admin/tenants/' + slug
|
||||||
|
}
|
||||||
|
|
||||||
|
const tenants = ref([])
|
||||||
|
const showCreate = ref(false)
|
||||||
|
const createForm = ref({
|
||||||
|
name: '',
|
||||||
|
slug: '',
|
||||||
|
url: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await loadTenants()
|
||||||
|
})
|
||||||
|
|
||||||
|
async function loadTenants() {
|
||||||
|
const response = await fetch('/api/v1/admin/tenants/list', {
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
},
|
||||||
|
credentials: 'same-origin',
|
||||||
|
})
|
||||||
|
const data = await response.json()
|
||||||
|
tenants.value = data.tenants
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createTenant() {
|
||||||
|
const response = await request('/api/v1/admin/tenants/create', {
|
||||||
|
method: 'POST',
|
||||||
|
body: createForm.value,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (response && response.status === 'success') {
|
||||||
|
toast.success(response.message)
|
||||||
|
showCreate.value = false
|
||||||
|
createForm.value = { name: '', slug: '', url: '' }
|
||||||
|
await loadTenants()
|
||||||
|
} else {
|
||||||
|
toast.error(response?.message ?? 'Fehler beim Anlegen')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AdminAppLayout title="Stämme">
|
||||||
|
<shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
|
||||||
|
<table class="tenant-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Slug</th>
|
||||||
|
<th>URL</th>
|
||||||
|
<th>Status</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="tenant in tenants" :key="tenant.slug" class="tenant-row" @click="openTenant(tenant.slug)">
|
||||||
|
<td>{{ tenant.name }}</td>
|
||||||
|
<td>{{ tenant.slug }}</td>
|
||||||
|
<td>{{ tenant.url }}</td>
|
||||||
|
<td>
|
||||||
|
<span :class="tenant.is_active_local_group ? 'badge-active' : 'badge-inactive'">
|
||||||
|
{{ tenant.is_active_local_group ? 'Aktiv' : 'Inaktiv' }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div style="margin-top: 20px;">
|
||||||
|
<button v-if="!showCreate" class="btn-create" @click="showCreate = true">Neuen Stamm anlegen</button>
|
||||||
|
|
||||||
|
<div v-if="showCreate" class="create-form">
|
||||||
|
<h3>Neuen Stamm anlegen</h3>
|
||||||
|
<table class="form-table">
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<td><input type="text" v-model="createForm.name" class="form-input" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Slug</th>
|
||||||
|
<td><input type="text" v-model="createForm.slug" class="form-input" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>URL</th>
|
||||||
|
<td><input type="text" v-model="createForm.url" class="form-input" /></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn-save" @click="createTenant">Anlegen</button>
|
||||||
|
<button class="btn-cancel" @click="showCreate = false">Abbrechen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</shadowed-box>
|
||||||
|
</AdminAppLayout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tenant-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tenant-table thead th {
|
||||||
|
text-align: left;
|
||||||
|
padding: 10px 16px;
|
||||||
|
background-color: #f9fafb;
|
||||||
|
color: #374151;
|
||||||
|
font-weight: bold;
|
||||||
|
border-bottom: 2px solid #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tenant-table tbody td {
|
||||||
|
padding: 10px 16px;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tenant-row {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tenant-row:hover {
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-active {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 3px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #166534;
|
||||||
|
background-color: #dcfce7;
|
||||||
|
border: 1px solid #22c55e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-inactive {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 3px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #991b1b;
|
||||||
|
background-color: #fee2e2;
|
||||||
|
border: 1px solid #ef4444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-table th {
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px 12px;
|
||||||
|
width: 100px;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-table td {
|
||||||
|
padding: 8px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-create {
|
||||||
|
padding: 8px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
background-color: #1d4899;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-create:hover {
|
||||||
|
background-color: #163a7a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-save, .btn-cancel {
|
||||||
|
padding: 8px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
class LvOnlyMiddleware
|
||||||
|
{
|
||||||
|
public function handle($request, Closure $next)
|
||||||
|
{
|
||||||
|
if (app('tenant')->slug !== 'lv') {
|
||||||
|
return redirect('/admin')->with('message', 'Diese Funktion ist nur auf LV-Ebene verfügbar.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -105,6 +105,11 @@ const props = defineProps({
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<ul class="nav-links">
|
||||||
|
<li v-if="globalProps.tenant.slug === 'lv'">
|
||||||
|
<a href="/admin/tenants" @click="closeSidebar">Stämme</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user