fix(assessments): enable engine by default and wire into live UI
Deploy Ladill Care / deploy (push) Successful in 54s

The assessment engine was built but opt-in and hidden: flag defaulted
off, no sidebar entry, and no settings toggle. Default assessments_engine
on, auto-seed catalog when empty, add Settings toggle and Assessments
nav, and surface guidance from the patients list.
This commit is contained in:
isaacclad
2026-07-16 23:05:48 +00:00
parent 2ce4bc8993
commit f6780b9958
13 changed files with 120 additions and 4 deletions
@@ -7,6 +7,7 @@ use App\Http\Controllers\Care\Concerns\ScopesToAccount;
use App\Models\Branch;
use App\Services\Care\AppointmentPatientNotifier;
use App\Services\Care\AuditLogger;
use App\Services\Care\CareFeatures;
use App\Services\Care\CarePermissions;
use App\Services\Care\PlanService;
use App\Services\Billing\PlatformEmailClient;
@@ -45,6 +46,8 @@ class SettingsController extends Controller
$suiteEmailReady = $platformEmail->isConfigured();
$suiteSmsReady = $platformSms->isConfigured();
$careFeatures = app(CareFeatures::class);
return view('care.settings.edit', [
'organization' => $organization,
'canManage' => $canManage,
@@ -53,6 +56,7 @@ class SettingsController extends Controller
'canViewTeam' => $permissions->can($member, 'admin.members.view'),
'hasBranchesFeature' => $plans->hasFeature($organization, 'branches'),
'canUseQueueIntegration' => $plans->canUseQueueIntegration($organization),
'assessmentsEngineEnabled' => $careFeatures->enabled($organization, CareFeatures::ASSESSMENTS_ENGINE),
'messagingSmsReady' => $suiteSmsReady || $credential->hasValidSms(),
'messagingEmailReady' => $suiteEmailReady || $credential->hasValidBird(),
'suiteMessagingReady' => $suiteEmailReady || $suiteSmsReady,
@@ -82,6 +86,7 @@ class SettingsController extends Controller
'logo' => ['nullable', 'image', 'mimes:jpeg,png,jpg,webp,svg', 'max:2048'],
'remove_logo' => ['nullable', 'boolean'],
'queue_integration_enabled' => ['nullable', 'boolean'],
'assessments_engine' => ['nullable', 'boolean'],
'notify_appointment_booked_sms' => ['nullable', 'boolean'],
'notify_appointment_booked_email' => ['nullable', 'boolean'],
'notify_video_scheduled_sms' => ['nullable', 'boolean'],
@@ -92,6 +97,14 @@ class SettingsController extends Controller
$settings['onboarded'] = true;
$settings['facility_type'] = $validated['facility_type'];
$rollout = is_array($settings['rollout'] ?? null) ? $settings['rollout'] : [];
// Explicit save so opt-out is stored (engine defaults ON when unset).
$rollout[CareFeatures::ASSESSMENTS_ENGINE] = $request->boolean('assessments_engine');
$settings['rollout'] = $rollout;
if ($rollout[CareFeatures::ASSESSMENTS_ENGINE]) {
app(CareFeatures::class)->ensureAssessmentCatalog();
}
// Queue integration is Pro/Enterprise only — free plans cannot enable it.
$wantsQueue = $request->boolean('queue_integration_enabled');
if ($wantsQueue && ! $plans->canUseQueueIntegration($organization)) {