fix(care): point Messaging settings at suite defaults, not API keys
Deploy Ladill Care / deploy (push) Successful in 35s
Deploy Ladill Care / deploy (push) Successful in 35s
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.
This commit is contained in:
@@ -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'),
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<x-app-layout title="Integrations">
|
||||
<x-settings.page title="Integrations">
|
||||
<p class="text-sm text-slate-600">
|
||||
Configure messaging and payment gateways for encounter billing.
|
||||
Use <a href="https://sms.ladill.com" target="_blank" rel="noopener" class="text-teal-700 underline">SMS</a>
|
||||
and <a href="https://bird.ladill.com" target="_blank" rel="noopener" class="text-teal-700 underline">email</a>
|
||||
for outbound messages; connect Paystack, Flutterwave, or Hubtel so bill payments land in your account (0% Ladill fee).
|
||||
<strong class="font-semibold text-slate-800">Patient email and SMS work by default</strong> via suite messaging —
|
||||
set a Ladill mailbox and optional sender ID under
|
||||
<a href="{{ function_exists('ladill_account_url') ? ladill_account_url('/account/settings/messaging') : (config('smtp.messaging_settings_url') ?? '#') }}"
|
||||
class="text-teal-700 underline" target="_blank" rel="noopener">Account → Messaging</a>.
|
||||
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).
|
||||
</p>
|
||||
|
||||
@if (! $canManage)
|
||||
|
||||
@@ -145,15 +145,20 @@
|
||||
@if ($canManage)
|
||||
<section class="rounded-2xl border border-slate-200 bg-white p-6" x-data="{ tab: 'sms' }">
|
||||
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Message patient</h2>
|
||||
<p class="mt-1 text-xs text-slate-500">Requires SMS and email credentials. <a href="{{ route('care.integrations') }}" class="text-teal-700 underline">Manage integrations</a></p>
|
||||
<p class="mt-1 text-xs text-slate-500">
|
||||
Uses suite messaging by default (no API keys).
|
||||
<a href="{{ $messagingSettingsUrl ?? '#' }}" class="text-teal-700 underline" target="_blank" rel="noopener">Account messaging settings</a>
|
||||
·
|
||||
<a href="{{ route('care.integrations') }}" class="text-slate-500 underline">Advanced keys</a>
|
||||
</p>
|
||||
@if (! ($messagingSmsReady ?? false) || ! ($messagingEmailReady ?? false))
|
||||
<p class="mt-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800">
|
||||
@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
|
||||
</p>
|
||||
@endif
|
||||
|
||||
@@ -89,11 +89,22 @@
|
||||
@endif
|
||||
|
||||
@if ($canManage)
|
||||
<x-settings.card title="Messaging" description="Configure SMS and email credentials for outbound messages.">
|
||||
<a href="{{ route('care.integrations') }}" class="text-sm font-medium text-teal-700 underline">Open messaging integrations →</a>
|
||||
<x-settings.card title="Messaging" description="Patient email and SMS use suite messaging by default — no Bird or SMS API keys required.">
|
||||
<p class="text-sm text-slate-600">
|
||||
Set a Ladill mailbox (From address) and optional SMS sender ID under Account → Messaging.
|
||||
Plan allowances cover included sends; Pro overage bills your wallet.
|
||||
</p>
|
||||
<div class="mt-3 flex flex-wrap gap-x-4 gap-y-2 text-sm font-medium">
|
||||
<a href="{{ $messagingSettingsUrl ?? '#' }}" class="text-teal-700 underline" target="_blank" rel="noopener">
|
||||
Account messaging settings →
|
||||
</a>
|
||||
<a href="{{ route('care.integrations') }}" class="text-slate-500 underline">
|
||||
Advanced: optional product API keys
|
||||
</a>
|
||||
</div>
|
||||
</x-settings.card>
|
||||
|
||||
<x-settings.card title="Patient notifications" description="Automatically notify patients when appointments are booked or video visits are scheduled. Requires connected SMS / Bird credentials.">
|
||||
<x-settings.card title="Patient notifications" description="Automatically notify patients when appointments are booked or video visits are scheduled via suite messaging (mailbox + plan allowances).">
|
||||
<div class="space-y-4 text-sm">
|
||||
<div>
|
||||
<p class="font-medium text-slate-800">When an appointment is booked</p>
|
||||
@@ -105,7 +116,7 @@
|
||||
<span>
|
||||
Send SMS confirmation
|
||||
@unless ($messagingSmsReady)
|
||||
<span class="block text-xs text-amber-700">Connect SMS in Integrations before this can send.</span>
|
||||
<span class="block text-xs text-amber-700">Platform SMS is not configured on this Care instance, and no product SMS key is connected.</span>
|
||||
@endunless
|
||||
</span>
|
||||
</label>
|
||||
@@ -116,7 +127,7 @@
|
||||
<span>
|
||||
Send email confirmation
|
||||
@unless ($messagingEmailReady)
|
||||
<span class="block text-xs text-amber-700">Connect Bird email in Integrations before this can send.</span>
|
||||
<span class="block text-xs text-amber-700">Platform email is not configured, and no Bird key is connected. Set a mailbox under Account → Messaging after platform keys are live.</span>
|
||||
@endunless
|
||||
</span>
|
||||
</label>
|
||||
@@ -133,7 +144,7 @@
|
||||
<span>
|
||||
Send SMS with join link
|
||||
@unless ($messagingSmsReady)
|
||||
<span class="block text-xs text-amber-700">Connect SMS in Integrations before this can send.</span>
|
||||
<span class="block text-xs text-amber-700">Platform SMS is not configured on this Care instance, and no product SMS key is connected.</span>
|
||||
@endunless
|
||||
</span>
|
||||
</label>
|
||||
@@ -143,7 +154,7 @@
|
||||
class="mt-0.5">
|
||||
<span>
|
||||
Send email with join link
|
||||
<span class="block text-xs text-slate-500">Uses Bird when connected; otherwise Meet emails the invite.</span>
|
||||
<span class="block text-xs text-slate-500">Uses suite messaging when available; otherwise Meet may email the invite.</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user