Small improvements
This commit is contained in:
@@ -33,7 +33,7 @@ class CreateTenantAction
|
||||
|
||||
$paymentMethodDefaults = PaymentMethod::defaults();
|
||||
foreach (PaymentMethod::all() as $paymentMethod) {
|
||||
$defaults = $paymentMethodDefaults[$paymentMethod->slug] ?? ['name' => $paymentMethod->slug, 'description' => null];
|
||||
$defaults = $paymentMethodDefaults[$paymentMethod->slug] ?? ['name' => $paymentMethod->slug, 'description' => null, 'configuration' => []];
|
||||
|
||||
AvailablePaymentMethod::create([
|
||||
'tenant' => $tenant->slug,
|
||||
@@ -41,6 +41,7 @@ class CreateTenantAction
|
||||
'name' => $defaults['name'],
|
||||
'description' => $defaults['description'],
|
||||
'active' => true,
|
||||
'configuration' => PaymentMethod::sanitizeConfiguration($paymentMethod->slug, $defaults['configuration'] ?? []),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateTenantPayment;
|
||||
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Scopes\SiteScope;
|
||||
|
||||
class UpdateTenantPaymentAction
|
||||
{
|
||||
public function __construct(private UpdateTenantPaymentRequest $request)
|
||||
@@ -18,9 +22,41 @@ class UpdateTenantPaymentAction
|
||||
'account_name' => $this->request->accountName,
|
||||
]);
|
||||
|
||||
$this->syncTransferPaymentConfiguration();
|
||||
|
||||
$response->success = true;
|
||||
$response->message = 'Bezahldaten wurden gespeichert.';
|
||||
$response->message = 'IBAN-Informationen wurden gespeichert.';
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Übernimmt die eingegebenen IBAN-Daten direkt in die Tenant-Config der Überweisungs-Zahlungsart
|
||||
* (Kontoinhaber/IBAN/BIC), damit sie nicht doppelt gepflegt werden müssen. Bestehende weitere
|
||||
* Config-Werte (z.B. Symbol) bleiben erhalten. Der Ziel-Tenant kann ein verwalteter sein, daher
|
||||
* ohne SiteScope explizit auf den Tenant-Slug gefiltert.
|
||||
*/
|
||||
private function syncTransferPaymentConfiguration(): void
|
||||
{
|
||||
$slug = PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION;
|
||||
|
||||
$method = AvailablePaymentMethod::withoutGlobalScope(SiteScope::class)
|
||||
->where('tenant', $this->request->tenant->slug)
|
||||
->where('slug', $slug)
|
||||
->first();
|
||||
|
||||
if ($method === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$method->configuration = PaymentMethod::sanitizeConfiguration($slug, array_merge(
|
||||
$method->configuration ?? [],
|
||||
[
|
||||
'account_owner' => $this->request->accountName,
|
||||
'iban' => $this->request->accountIban,
|
||||
'bic' => $this->request->accountBic,
|
||||
],
|
||||
));
|
||||
$method->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ async function save() {
|
||||
|
||||
<FullScreenModal :show="editing !== null" @close="close">
|
||||
<template v-if="editing">
|
||||
<h2>Zahlungsweg bearbeiten</h2>
|
||||
<h2>Zahlungsmodul bearbeiten</h2>
|
||||
<table class="data-table">
|
||||
<tr><th>Name</th><td><input type="text" v-model="form.name" class="form-input" /></td></tr>
|
||||
<tr><th>Beschreibung</th><td><textarea v-model="form.description" class="form-input"></textarea></td></tr>
|
||||
@@ -103,6 +103,7 @@ async function save() {
|
||||
:options="PAYMENT_METHOD_ICONS" placeholder="Symbol wählen…"/>
|
||||
<TextEditor v-else-if="option.type === 'richtext'" v-model="form.configuration[option.name]"/>
|
||||
<input v-else type="text" v-model="form.configuration[option.name]" class="form-input"/>
|
||||
<span v-if="option.hint" class="option-hint">{{ option.hint }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -221,6 +222,13 @@ async function save() {
|
||||
color: #b45309;
|
||||
}
|
||||
|
||||
.option-hint {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
font-size: 0.8rem;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
|
||||
@@ -19,12 +19,12 @@ const tabs = [
|
||||
endpoint: '/api/v1/admin/tenant/contact',
|
||||
},
|
||||
{
|
||||
title: 'Bezahldaten',
|
||||
title: 'IBAN-Informationen',
|
||||
component: TenantPayment,
|
||||
endpoint: '/api/v1/admin/tenant/payment',
|
||||
},
|
||||
{
|
||||
title: 'Zahlungswege',
|
||||
title: 'Zahlungsmodule',
|
||||
component: TenantPaymentMethods,
|
||||
endpoint: '/api/v1/admin/tenant/payment-methods',
|
||||
},
|
||||
|
||||
@@ -26,7 +26,7 @@ const tabs = [
|
||||
endpoint: '/api/v1/admin/tenants/' + slug + '/contact',
|
||||
},
|
||||
{
|
||||
title: 'Bezahldaten',
|
||||
title: 'IBAN-Informationen',
|
||||
component: TenantPayment,
|
||||
endpoint: '/api/v1/admin/tenants/' + slug + '/payment',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user