fix(weeztix): allow OAuth reconnect in wizard step 2 and re-sync company
Always sync company from profile after OAuth; remove skip when company_guid was already set. Step 2 shows reconnect for connected users plus link to step 3. Made-with: Cursor
This commit is contained in:
@@ -86,17 +86,14 @@ final class WeeztixService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist company_guid when still empty after OAuth (single company per page; chosen in Weeztix login).
|
* Sync company_guid/name from the Weeztix user profile for the current access token (after OAuth).
|
||||||
* Uses the first company returned from the user profile when several are present.
|
* Runs on every successful connect or reconnect so a different company chosen in Weeztix is stored here.
|
||||||
|
* Uses the first company returned from the profile when several are present.
|
||||||
*/
|
*/
|
||||||
public function ensureCompanyStoredFromWeeztix(): void
|
public function ensureCompanyStoredFromWeeztix(): void
|
||||||
{
|
{
|
||||||
$this->config->refresh();
|
$this->config->refresh();
|
||||||
|
|
||||||
if (is_string($this->config->company_guid) && $this->config->company_guid !== '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$companies = $this->getCompanies();
|
$companies = $this->getCompanies();
|
||||||
if ($companies === []) {
|
if ($companies === []) {
|
||||||
|
|||||||
@@ -212,22 +212,30 @@
|
|||||||
|
|
||||||
@if ($wz !== null && $wz->is_connected)
|
@if ($wz !== null && $wz->is_connected)
|
||||||
<div class="rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-900">
|
<div class="rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-900">
|
||||||
{{ __('Je bent al verbonden. Ga door naar de coupon.') }}
|
{{ __('Je bent verbonden. Start opnieuw de Weeztix-login hieronder om een ander bedrijf te kiezen; het gekoppelde bedrijf wordt daarna automatisch bijgewerkt.') }}
|
||||||
</div>
|
</div>
|
||||||
<a
|
@endif
|
||||||
href="{{ route('admin.pages.weeztix.edit', ['page' => $page, 'wizard' => 1, 'step' => 3]) }}"
|
|
||||||
class="inline-flex rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500"
|
<div class="flex flex-wrap items-center gap-3">
|
||||||
>
|
|
||||||
{{ __('Naar stap 3: coupon') }}
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
<a
|
<a
|
||||||
href="{{ $oauthUrl }}"
|
href="{{ $oauthUrl }}"
|
||||||
class="inline-flex rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500"
|
class="inline-flex rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500"
|
||||||
>
|
>
|
||||||
{{ __('Verbind met Weeztix') }}
|
@if ($wz !== null && $wz->is_connected)
|
||||||
|
{{ __('Opnieuw verbinden met Weeztix') }}
|
||||||
|
@else
|
||||||
|
{{ __('Verbind met Weeztix') }}
|
||||||
|
@endif
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@if ($wz !== null && $wz->is_connected)
|
||||||
|
<a
|
||||||
|
href="{{ route('admin.pages.weeztix.edit', ['page' => $page, 'wizard' => 1, 'step' => 3]) }}"
|
||||||
|
class="inline-flex rounded-lg border border-slate-300 bg-white px-4 py-2.5 text-sm font-semibold text-slate-800 shadow-sm hover:bg-slate-50"
|
||||||
|
>
|
||||||
|
{{ __('Naar stap 3: coupon') }}
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="pt-4">
|
<p class="pt-4">
|
||||||
<a href="{{ route('admin.pages.weeztix.edit', ['page' => $page, 'wizard' => 1, 'step' => 1]) }}" class="text-sm font-medium text-slate-600 hover:text-slate-900">{{ __('← Terug naar stap 1') }}</a>
|
<a href="{{ route('admin.pages.weeztix.edit', ['page' => $page, 'wizard' => 1, 'step' => 1]) }}" class="text-sm font-medium text-slate-600 hover:text-slate-900">{{ __('← Terug naar stap 1') }}</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user