feat(admin): Weeztix setup wizard, integration status badges
- Summary view when Weeztix is configured; edits only via 3-step wizard - Step 1: reuse or replace OAuth client ID/secret; callback URL shown - Step 2: OAuth connect (resume wizard after callback when started from wizard) - Step 3: coupon, prefix, usage; finishing exits wizard - PreregistrationPage: mailwizz/weeztix integration status helpers - Pages index: Integrations column with MW/WZ badges; edit page: status cards Made-with: Cursor
This commit is contained in:
@@ -8,18 +8,34 @@ use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Admin\UpdateWeeztixConfigRequest;
|
||||
use App\Models\PreregistrationPage;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class WeeztixController extends Controller
|
||||
{
|
||||
public function edit(PreregistrationPage $page): View
|
||||
public function edit(Request $request, PreregistrationPage $page): View
|
||||
{
|
||||
$this->authorize('update', $page);
|
||||
|
||||
$page->load('weeztixConfig');
|
||||
|
||||
return view('admin.weeztix.edit', compact('page'));
|
||||
$showWizard = $page->weeztixConfig === null || $request->boolean('wizard');
|
||||
$wizardStep = $showWizard ? min(3, max(1, (int) $request->query('step', 1))) : 1;
|
||||
if ($showWizard && $page->weeztixConfig === null && $wizardStep !== 1) {
|
||||
return redirect()
|
||||
->route('admin.pages.weeztix.edit', ['page' => $page, 'wizard' => 1, 'step' => 1]);
|
||||
}
|
||||
$hasStoredCredentials = $page->weeztixConfig !== null
|
||||
&& is_string($page->weeztixConfig->client_id)
|
||||
&& $page->weeztixConfig->client_id !== '';
|
||||
|
||||
return view('admin.weeztix.edit', compact(
|
||||
'page',
|
||||
'showWizard',
|
||||
'wizardStep',
|
||||
'hasStoredCredentials'
|
||||
));
|
||||
}
|
||||
|
||||
public function update(UpdateWeeztixConfigRequest $request, PreregistrationPage $page): RedirectResponse
|
||||
@@ -41,8 +57,26 @@ class WeeztixController extends Controller
|
||||
);
|
||||
});
|
||||
|
||||
$page->load('weeztixConfig');
|
||||
|
||||
if ($request->boolean('wizard')) {
|
||||
if ($request->boolean('wizard_coupon_save')) {
|
||||
return redirect()
|
||||
->route('admin.pages.weeztix.edit', ['page' => $page])
|
||||
->with('status', __('Weeztix-configuratie opgeslagen.'));
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('admin.pages.weeztix.edit', [
|
||||
'page' => $page,
|
||||
'wizard' => 1,
|
||||
'step' => 2,
|
||||
])
|
||||
->with('status', __('Weeztix-configuratie opgeslagen.'));
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->route('admin.pages.weeztix.edit', $page)
|
||||
->route('admin.pages.weeztix.edit', ['page' => $page])
|
||||
->with('status', __('Weeztix-configuratie opgeslagen.'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user