diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php
index 13c542a36..b937e738a 100644
--- a/app/Http/Controllers/SettingsController.php
+++ b/app/Http/Controllers/SettingsController.php
@@ -335,7 +335,17 @@ class SettingsController extends Controller
return redirect()->route('settings.subscriptions.index');
}
- return view('settings.users.link');
+ // Get invitations sent by current user's account
+ $sentInvitations = auth()->user()->account->accountLinks()
+ ->with(['user', 'invitedBy'])
+ ->get();
+
+ // Get invitations received by current user
+ $receivedInvitations = AccountLink::where('user_id', auth()->user()->id)
+ ->with(['account', 'invitedBy'])
+ ->get();
+
+ return view('settings.users.link', compact('sentInvitations', 'receivedInvitations'));
}
/**
diff --git a/resources/js/app.js b/resources/js/app.js
index 741e6cf17..c3b10a79d 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -327,6 +327,7 @@ common.loadLanguage(window.Laravel.locale, true).then((i18n) => {
locale: i18n.locale,
reminders_frequency: 'once',
accept_invite_user: false,
+ accept_link_user: false,
date_met_the_contact: 'known',
global_relationship_form_new_contact: true,
global_profile_default_view: window.Laravel.profileDefaultView,
diff --git a/resources/lang/en/mail.php b/resources/lang/en/mail.php
index 749f3d190..c346ad9a4 100644
--- a/resources/lang/en/mail.php
+++ b/resources/lang/en/mail.php
@@ -50,4 +50,11 @@ return [
'export_description' => 'You requested a data export on :date. It is now ready to download.',
'export_download' => 'Download export',
+ 'account_link_title' => 'Monica – Account Link Invitation from :name',
+ 'account_link_intro' => ':name (:email) has invited you to link your Monica account with theirs.',
+ 'account_link_explanation' => 'By accepting this invitation, both accounts will share the same contact data and CRM information. You will be able to access and manage the same contacts, relationships, and data.',
+ 'account_link_link' => 'To accept the account link invitation, click on the link below:',
+ 'account_link_button' => 'Accept Account Link',
+ 'account_link_expiration' => 'This link will expire in :count days.',
+
];
diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php
index 7a8f1bad0..56937ac2b 100644
--- a/resources/lang/en/settings.php
+++ b/resources/lang/en/settings.php
@@ -197,6 +197,45 @@ return [
'users_list_delete_confirmation' => 'Are you sure to delete this user from your account?',
'users_invitation_need_subscription' => 'Adding more users requires a subscription.',
+ // Account linking
+ 'users_list_link_user' => 'Link existing user',
+ 'users_link_breadcrumb' => 'Link existing user',
+ 'users_link_title' => 'Link an existing Monica user to your account',
+ 'users_link_description' => 'Invite an existing Monica user to link their account with yours. Both accounts will share the same contact data and CRM information.',
+ 'users_link_email_field' => 'Enter the email of the existing Monica user',
+ 'users_link_submit' => 'Send invitation',
+ 'users_link_pending_title' => 'Pending account link invitations',
+ 'users_link_pending_description' => 'These are account link invitations you\'ve sent that haven\'t been accepted yet.',
+ 'users_link_no_pending' => 'No pending account link invitations.',
+ 'users_link_invited_by' => 'Invited by :user',
+ 'users_link_invited_on' => 'Sent on :date',
+ 'users_link_cancel_confirm' => 'Are you sure you want to cancel this account link invitation?',
+ 'users_link_confirmation' => 'Please confirm that you want to invite this user before proceeding with the invitation',
+ 'users_link_sent_title' => 'Invitations you\'ve sent',
+ 'users_link_sent_description' => 'Account link invitations you\'ve sent that are awaiting response.',
+ 'users_link_received_title' => 'Invitations you\'ve received',
+ 'users_link_received_description' => 'Account link invitations others have sent to you.',
+ 'users_link_no_sent' => 'No outgoing invitations.',
+ 'users_link_no_received' => 'No incoming invitations.',
+ 'users_link_status_pending' => 'Pending',
+ 'users_link_status_awaiting_response' => 'Awaiting your response',
+ 'account_link_decline_confirm' => 'Are you sure you want to decline this invitation?',
+
+ 'account_link_title' => 'Link Your Account',
+ 'account_link_invitation_from' => 'Invitation from :name',
+ 'account_link_invitation_description' => 'You have been invited to link your Monica account with account #:account. If you accept, both accounts will share the same contact data.',
+ 'account_link_what_happens_title' => 'What happens when you accept:',
+ 'account_link_what_happens_1' => 'Your current account data will be merged with the inviter\'s account',
+ 'account_link_what_happens_2' => 'You will have access to all contacts and data in the linked account',
+ 'account_link_what_happens_3' => 'This action cannot be undone',
+ 'account_link_accept' => 'Accept invitation',
+ 'account_link_decline' => 'Decline',
+ 'account_link_back_to_dashboard' => 'Back to dashboard',
+ 'account_link_login_required' => 'Please login to accept this account link invitation.',
+ 'account_link_wrong_user' => 'This invitation is not for your account.',
+ 'account_link_success' => 'Account successfully linked! You now have access to the shared account data.',
+ 'account_link_declined' => 'Account link invitation declined.',
+
'subscriptions_account_current_plan' => 'Your current plan',
'subscriptions_account_current_legacy' => 'Current plan, not selectable anymore:',
'subscriptions_account_current_paid_plan' => 'You are on the :name plan. Thanks so much for being a subscriber.',
diff --git a/resources/views/settings/users/accept-link.blade.php b/resources/views/settings/users/accept-link.blade.php
new file mode 100644
index 000000000..a6a556059
--- /dev/null
+++ b/resources/views/settings/users/accept-link.blade.php
@@ -0,0 +1,61 @@
+@extends('marketing.skeleton')
+
+@section('content')
+
+
+
+
+
+
+
+
+
 }})
+
+
+
{{ trans('settings.account_link_title') }}
+
+ @include ('partials.errors')
+
+
+
{{ trans('settings.account_link_invitation_from', ['name' => $accountLink->invitedBy->first_name]) }}
+
{{ trans('settings.account_link_invitation_description', ['account' => $accountLink->account->id]) }}
+
+
+
+
+
{{ trans('settings.account_link_what_happens_title') }}
+
+ - {{ trans('settings.account_link_what_happens_1') }}
+ - {{ trans('settings.account_link_what_happens_2') }}
+ - {{ trans('settings.account_link_what_happens_3') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@endsection
\ No newline at end of file
diff --git a/resources/views/settings/users/blank.blade.php b/resources/views/settings/users/blank.blade.php
index 986b91f25..5576d03b0 100644
--- a/resources/views/settings/users/blank.blade.php
+++ b/resources/views/settings/users/blank.blade.php
@@ -43,7 +43,11 @@
{{ trans('settings.users_blank_description') }}
- {{ trans('settings.users_blank_cta') }}
+
+ {{ trans('settings.users_blank_cta') }}
+ {{ trans('app.or') }}
+ {{ trans('settings.users_list_link_user') }}
+
@if (config('monica.requires_subscription') && $accountHasLimitations)
{{ trans('settings.users_invitation_need_subscription') }}
diff --git a/resources/views/settings/users/index.blade.php b/resources/views/settings/users/index.blade.php
index 6ee9ec987..66ff5ac6e 100644
--- a/resources/views/settings/users/index.blade.php
+++ b/resources/views/settings/users/index.blade.php
@@ -36,7 +36,10 @@