diff --git a/app/Services/WeeztixService.php b/app/Services/WeeztixService.php index e1f4388..3c9ee95 100644 --- a/app/Services/WeeztixService.php +++ b/app/Services/WeeztixService.php @@ -86,17 +86,14 @@ final class WeeztixService } /** - * Persist company_guid when still empty after OAuth (single company per page; chosen in Weeztix login). - * Uses the first company returned from the user profile when several are present. + * Sync company_guid/name from the Weeztix user profile for the current access token (after OAuth). + * 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 { $this->config->refresh(); - if (is_string($this->config->company_guid) && $this->config->company_guid !== '') { - return; - } - try { $companies = $this->getCompanies(); if ($companies === []) { diff --git a/resources/views/admin/weeztix/edit.blade.php b/resources/views/admin/weeztix/edit.blade.php index 3a7f433..a97bf75 100644 --- a/resources/views/admin/weeztix/edit.blade.php +++ b/resources/views/admin/weeztix/edit.blade.php @@ -212,22 +212,30 @@ @if ($wz !== null && $wz->is_connected)
- {{ __('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.') }}
- - {{ __('Naar stap 3: coupon') }} - - @else + @endif + +
- {{ __('Verbind met Weeztix') }} + @if ($wz !== null && $wz->is_connected) + {{ __('Opnieuw verbinden met Weeztix') }} + @else + {{ __('Verbind met Weeztix') }} + @endif - @endif + @if ($wz !== null && $wz->is_connected) + + {{ __('Naar stap 3: coupon') }} + + @endif +

{{ __('← Terug naar stap 1') }}