From 2a00d4321bf2d11f23fb99e85265337ff53ca13d Mon Sep 17 00:00:00 2001 From: isaacclad Date: Thu, 16 Jul 2026 11:31:34 +0000 Subject: [PATCH] fix(care): point Messaging settings at suite defaults, not API keys Care still linked to Integrations for Bird/SMS credentials after zero-config suite messaging. Update copy and readiness checks so suite platform keys count as ready; Account Messaging is primary, product keys are advanced. --- .../Controllers/Care/PatientController.php | 10 ++++++-- .../Controllers/Care/SettingsController.php | 22 +++++++++++++--- .../views/care/integrations/edit.blade.php | 10 +++++--- resources/views/care/patients/show.blade.php | 13 +++++++--- resources/views/care/settings/edit.blade.php | 25 +++++++++++++------ 5 files changed, 59 insertions(+), 21 deletions(-) diff --git a/app/Http/Controllers/Care/PatientController.php b/app/Http/Controllers/Care/PatientController.php index 67bc557..9576d01 100644 --- a/app/Http/Controllers/Care/PatientController.php +++ b/app/Http/Controllers/Care/PatientController.php @@ -95,11 +95,17 @@ class PatientController extends Controller ->can($this->member($request), 'patients.manage'); $credential = app(\App\Services\Messaging\MessagingCredentialsService::class) ->forOrganization($this->organization($request)); + $suiteEmailReady = app(\App\Services\Billing\PlatformEmailClient::class)->isConfigured(); + $suiteSmsReady = app(\App\Services\Billing\PlatformSmsClient::class)->isConfigured(); return view('care.patients.show', array_merge($dashboard, [ 'canManage' => $canManage, - 'messagingSmsReady' => $credential->hasValidSms(), - 'messagingEmailReady' => $credential->hasValidBird(), + 'messagingSmsReady' => $suiteSmsReady || $credential->hasValidSms(), + 'messagingEmailReady' => $suiteEmailReady || $credential->hasValidBird(), + 'suiteMessagingReady' => $suiteEmailReady || $suiteSmsReady, + 'messagingSettingsUrl' => function_exists('ladill_account_url') + ? ladill_account_url('/account/settings/messaging') + : (string) config('smtp.messaging_settings_url', 'https://account.ladill.com/account/settings/messaging'), 'genders' => config('care.genders'), 'allergySeverities' => config('care.allergy_severities'), 'documentTypes' => config('care.document_types'), diff --git a/app/Http/Controllers/Care/SettingsController.php b/app/Http/Controllers/Care/SettingsController.php index 987fe6d..d2450fc 100644 --- a/app/Http/Controllers/Care/SettingsController.php +++ b/app/Http/Controllers/Care/SettingsController.php @@ -9,6 +9,8 @@ use App\Services\Care\AppointmentPatientNotifier; use App\Services\Care\AuditLogger; use App\Services\Care\CarePermissions; use App\Services\Care\PlanService; +use App\Services\Billing\PlatformEmailClient; +use App\Services\Billing\PlatformSmsClient; use App\Services\Messaging\MessagingCredentialsService; use App\Services\Queue\QueueClient; use App\Support\OrganizationBranding; @@ -20,8 +22,12 @@ class SettingsController extends Controller { use ScopesToAccount; - public function edit(Request $request, MessagingCredentialsService $credentials): View - { + public function edit( + Request $request, + MessagingCredentialsService $credentials, + PlatformEmailClient $platformEmail, + PlatformSmsClient $platformSms, + ): View { $this->authorizeAbility($request, 'settings.view'); $organization = $this->organization($request); $member = $this->member($request); @@ -35,6 +41,10 @@ class SettingsController extends Controller $plans = app(PlanService::class); + // Suite platform keys (zero-config) OR optional product credentials. + $suiteEmailReady = $platformEmail->isConfigured(); + $suiteSmsReady = $platformSms->isConfigured(); + return view('care.settings.edit', [ 'organization' => $organization, 'canManage' => $canManage, @@ -43,8 +53,12 @@ class SettingsController extends Controller 'canViewTeam' => $permissions->can($member, 'admin.members.view'), 'hasBranchesFeature' => $plans->hasFeature($organization, 'branches'), 'canUseQueueIntegration' => $plans->canUseQueueIntegration($organization), - 'messagingSmsReady' => $credential->hasValidSms(), - 'messagingEmailReady' => $credential->hasValidBird(), + 'messagingSmsReady' => $suiteSmsReady || $credential->hasValidSms(), + 'messagingEmailReady' => $suiteEmailReady || $credential->hasValidBird(), + 'suiteMessagingReady' => $suiteEmailReady || $suiteSmsReady, + 'messagingSettingsUrl' => function_exists('ladill_account_url') + ? ladill_account_url('/account/settings/messaging') + : (string) config('smtp.messaging_settings_url', 'https://account.ladill.com/account/settings/messaging'), 'facilityTypes' => [ 'clinic' => 'Clinic', 'hospital' => 'Hospital', diff --git a/resources/views/care/integrations/edit.blade.php b/resources/views/care/integrations/edit.blade.php index ad3227b..3eb061e 100644 --- a/resources/views/care/integrations/edit.blade.php +++ b/resources/views/care/integrations/edit.blade.php @@ -1,10 +1,12 @@

- Configure messaging and payment gateways for encounter billing. - Use SMS - and email - for outbound messages; connect Paystack, Flutterwave, or Hubtel so bill payments land in your account (0% Ladill fee). + Patient email and SMS work by default via suite messaging — + set a Ladill mailbox and optional sender ID under + Account → Messaging. + Product SMS and Bird API keys below are optional (power users / custom keys). + Connect Paystack, Flutterwave, or Hubtel so bill payments land in your account (0% Ladill fee).

@if (! $canManage) diff --git a/resources/views/care/patients/show.blade.php b/resources/views/care/patients/show.blade.php index e2b1e10..3189530 100644 --- a/resources/views/care/patients/show.blade.php +++ b/resources/views/care/patients/show.blade.php @@ -145,15 +145,20 @@ @if ($canManage)

Message patient

-

Requires SMS and email credentials. Manage integrations

+

+ Uses suite messaging by default (no API keys). + Account messaging settings + · + Advanced keys +

@if (! ($messagingSmsReady ?? false) || ! ($messagingEmailReady ?? false))

@if (! ($messagingSmsReady ?? false) && ! ($messagingEmailReady ?? false)) - Connect SMS and Bird in Integrations before messaging patients. + Messaging is not available yet. Bind a mailbox under Account → Messaging once platform keys are configured, or connect product keys under Integrations. @elseif (! ($messagingSmsReady ?? false)) - Connect Ladill SMS in Integrations to enable SMS. + SMS is not available (platform SMS key missing and no product SMS credentials). @else - Connect Ladill Bird in Integrations to enable email. + Email is not available (platform email key missing and no Bird credentials). Set a mailbox under Account → Messaging when suite email is live. @endif

@endif diff --git a/resources/views/care/settings/edit.blade.php b/resources/views/care/settings/edit.blade.php index 459035c..e00f3c7 100644 --- a/resources/views/care/settings/edit.blade.php +++ b/resources/views/care/settings/edit.blade.php @@ -89,11 +89,22 @@ @endif @if ($canManage) - - Open messaging integrations → + +

+ Set a Ladill mailbox (From address) and optional SMS sender ID under Account → Messaging. + Plan allowances cover included sends; Pro overage bills your wallet. +

+
- +

When an appointment is booked

@@ -105,7 +116,7 @@ Send SMS confirmation @unless ($messagingSmsReady) - Connect SMS in Integrations before this can send. + Platform SMS is not configured on this Care instance, and no product SMS key is connected. @endunless @@ -116,7 +127,7 @@ Send email confirmation @unless ($messagingEmailReady) - Connect Bird email in Integrations before this can send. + Platform email is not configured, and no Bird key is connected. Set a mailbox under Account → Messaging after platform keys are live. @endunless @@ -133,7 +144,7 @@ Send SMS with join link @unless ($messagingSmsReady) - Connect SMS in Integrations before this can send. + Platform SMS is not configured on this Care instance, and no product SMS key is connected. @endunless @@ -143,7 +154,7 @@ class="mt-0.5"> Send email with join link - Uses Bird when connected; otherwise Meet emails the invite. + Uses suite messaging when available; otherwise Meet may email the invite.