{{-- Unsubscribe Preferences Page - Displays current subscription preferences for the user (Home Report, Follow-up Emails, Refinance Alerts). - Shows checkboxes as checked when user is currently subscribed (not unsubscribed). - Automatically checks "Unsubscribe from All" if all individual preferences are unchecked (all unsubscribed). - Keeps individual checkboxes enabled; "Unsubscribe from All" only toggles their checked state. - Submits preferences via POST with encrypted user and token parameters. - JavaScript keeps the "Unsubscribe All" checkbox in sync with individual ones and vice versa. Developer: Theshan Thanushka Date: 2025-08-06 --}} @extends('front.layout') @section('content') @php // Show checkboxes as checked when user is subscribed (not unsubscribed) // This makes more sense - user can see what they're currently receiving // Check if user has ever logged in (last_login_at has a value) $hasLoggedIn = !is_null($user->last_login_at); $allUnsubscribed = $user->unsubscribed_from_property_emails && $user->unsubscribed_from_opportunity_alerts; // If user has never logged in, include follow-up emails in the "all unsubscribed" check if (!$hasLoggedIn) { $allUnsubscribed = $allUnsubscribed && $user->unsubscribed_from_followups; } @endphp