feat: Mailwizz overview vs wizard flow and wizard step guard
Load Weeztix config for coupon mapping context, redirect incomplete configs to step one, and expand admin Mailwizz UI and tests. Made-with: Cursor
This commit is contained in:
@@ -8,18 +8,29 @@ use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Admin\UpdateMailwizzConfigRequest;
|
||||
use App\Models\PreregistrationPage;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class MailwizzController extends Controller
|
||||
{
|
||||
public function edit(PreregistrationPage $page): View
|
||||
public function edit(Request $request, PreregistrationPage $page): View|RedirectResponse
|
||||
{
|
||||
$this->authorize('update', $page);
|
||||
|
||||
$page->load('mailwizzConfig');
|
||||
$page->load(['mailwizzConfig', 'weeztixConfig']);
|
||||
|
||||
return view('admin.mailwizz.edit', compact('page'));
|
||||
$config = $page->mailwizzConfig;
|
||||
$showWizard = $config === null || $request->boolean('wizard');
|
||||
if ($showWizard && $config === null) {
|
||||
$requestedStep = min(4, max(1, (int) $request->query('step', 1)));
|
||||
if ($requestedStep !== 1) {
|
||||
return redirect()
|
||||
->route('admin.pages.mailwizz.edit', ['page' => $page, 'wizard' => 1, 'step' => 1]);
|
||||
}
|
||||
}
|
||||
|
||||
return view('admin.mailwizz.edit', compact('page', 'showWizard'));
|
||||
}
|
||||
|
||||
public function update(UpdateMailwizzConfigRequest $request, PreregistrationPage $page): RedirectResponse
|
||||
|
||||
Reference in New Issue
Block a user