Skip to content

Commit 73cacd7

Browse files
committed
Merge branch 'dev' into accessibility-exchangeGH-2562
2 parents a9f4c20 + 297572f commit 73cacd7

File tree

12 files changed

+337
-0
lines changed

12 files changed

+337
-0
lines changed

app/Http/Controllers/EngagementController.php

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
use App\Models\User;
3333
use App\Notifications\AccessNeedsFacilitationRequested;
3434
use App\Notifications\EngagementAdded;
35+
use App\Notifications\JoinedEngagement;
36+
use App\Notifications\LeftEngagement;
3537
use App\Notifications\OrganizationAddedToEngagement;
3638
use App\Notifications\OrganizationRemovedFromEngagement;
3739
use App\Notifications\ParticipantInvited;
@@ -642,6 +644,7 @@ public function join(Request $request, Engagement $engagement): RedirectResponse
642644
$engagement->participants()->save(Auth::user()->individual, ['status' => 'confirmed']);
643645

644646
$engagement->project->notify(new ParticipantJoined($engagement));
647+
Auth::user()->notify(new JoinedEngagement($engagement));
645648

646649
flash(__('You have successfully signed up for this engagement.'), 'success|'.__('You have successfully signed up for this engagement.', [], 'en'));
647650

@@ -725,6 +728,7 @@ public function leave(Request $request, Engagement $engagement): RedirectRespons
725728
Auth::user()->individual->engagements()->detach($engagement->id);
726729

727730
$engagement->project->notify(new ParticipantLeft($engagement));
731+
Auth::user()->notify(new LeftEngagement($engagement));
728732

729733
flash(__('You have successfully left this engagement.'), 'success|'.__('You have successfully left this engagement.', [], 'en'));
730734

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
namespace App\Notifications;
4+
5+
use App\Models\Engagement;
6+
use Illuminate\Notifications\Messages\MailMessage;
7+
use Illuminate\Notifications\Messages\VonageMessage;
8+
9+
class JoinedEngagement extends PlatformNotification
10+
{
11+
public Engagement $engagement;
12+
13+
public mixed $projectable;
14+
15+
public function __construct(Engagement $engagement)
16+
{
17+
$this->engagement = $engagement;
18+
$this->projectable = $this->engagement->project->projectable;
19+
}
20+
21+
public function toMail(): MailMessage
22+
{
23+
return (new MailMessage)
24+
->subject(__('Signed up for :engagement', ['engagement' => $this->engagement->getTranslation('name', locale())]))
25+
->markdown(
26+
'mail.joined-engagement',
27+
[
28+
'engagement' => $this->engagement,
29+
'projectable' => $this->projectable,
30+
]
31+
);
32+
}
33+
34+
public function toVonage(): VonageMessage
35+
{
36+
return (new VonageMessage)
37+
->content(
38+
__('You have signed up for :engagement by :projectable', [
39+
'engagement' => $this->engagement->getTranslation('name', locale()),
40+
'projectable' => $this->projectable->getTranslation('name', locale()),
41+
]).'. '.__(
42+
'View this engagement at :url.',
43+
[
44+
'url' => localized_route('engagements.show', $this->engagement),
45+
]
46+
)
47+
)
48+
->unicode();
49+
}
50+
51+
public function toArray(): array
52+
{
53+
return [
54+
'engagement_id' => $this->engagement->id,
55+
];
56+
}
57+
}

app/Notifications/LeftEngagement.php

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
namespace App\Notifications;
4+
5+
use App\Models\Engagement;
6+
use Illuminate\Notifications\Messages\MailMessage;
7+
use Illuminate\Notifications\Messages\VonageMessage;
8+
9+
class LeftEngagement extends PlatformNotification
10+
{
11+
public Engagement $engagement;
12+
13+
public mixed $projectable;
14+
15+
public function __construct(Engagement $engagement)
16+
{
17+
$this->engagement = $engagement;
18+
$this->projectable = $this->engagement->project->projectable;
19+
}
20+
21+
public function toMail(): MailMessage
22+
{
23+
return (new MailMessage)
24+
->subject(__('Left :engagement', ['engagement' => $this->engagement->getTranslation('name', locale())]))
25+
->markdown(
26+
'mail.left-engagement',
27+
[
28+
'engagement' => $this->engagement,
29+
'projectable' => $this->projectable,
30+
]
31+
);
32+
}
33+
34+
public function toVonage(): VonageMessage
35+
{
36+
return (new VonageMessage)
37+
->content(
38+
__('You have left :engagement by :projectable', [
39+
'engagement' => $this->engagement->getTranslation('name', locale()),
40+
'projectable' => $this->projectable->getTranslation('name', locale()),
41+
]).'. '.__(
42+
'View this engagement at :url.',
43+
[
44+
'url' => localized_route('engagements.show', $this->engagement),
45+
]
46+
)
47+
)
48+
->unicode();
49+
}
50+
51+
public function toArray(): array
52+
{
53+
return [
54+
'engagement_id' => $this->engagement->id,
55+
];
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace App\View\Components\Notification;
4+
5+
use App\Models\Engagement;
6+
use App\Models\Organization;
7+
use App\Models\RegulatedOrganization;
8+
use App\View\Components\Notification;
9+
use Illuminate\Contracts\View\View;
10+
use Illuminate\Notifications\DatabaseNotification;
11+
12+
class JoinedEngagement extends Notification
13+
{
14+
public Engagement $engagement;
15+
16+
public mixed $projectable;
17+
18+
public function __construct(DatabaseNotification $notification)
19+
{
20+
$this->engagement = Engagement::find($notification->data['engagement_id']);
21+
$this->projectable = $this->engagement->project->projectable;
22+
/** @var Organization|RegulatedOrganization */
23+
$projectable = $this->projectable;
24+
$this->title = __('Engagement joined');
25+
$this->body = safe_markdown('You have signed up for [:engagement](:engagement_url) by [:projectable](:projectable_url).', [
26+
'engagement' => $this->engagement->getTranslation('name', locale()),
27+
'engagement_url' => localized_route('engagements.show', $this->engagement),
28+
'projectable' => $projectable->getTranslation('name', locale()),
29+
'projectable_url' => localized_route($projectable->getRoutePrefix().'.show', $projectable),
30+
]);
31+
$this->interpretation = __('Engagement joined', [], 'en');
32+
33+
parent::__construct($notification);
34+
}
35+
36+
public function render(): View
37+
{
38+
return view('components.notification.joined-engagement', [
39+
'notification' => $this->notification,
40+
'read' => ! is_null($this->notification->read_at),
41+
'title' => $this->title,
42+
'body' => $this->body,
43+
'engagement' => $this->engagement,
44+
'interpretation' => $this->interpretation,
45+
]);
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace App\View\Components\Notification;
4+
5+
use App\Models\Engagement;
6+
use App\Models\Organization;
7+
use App\Models\RegulatedOrganization;
8+
use App\View\Components\Notification;
9+
use Illuminate\Contracts\View\View;
10+
use Illuminate\Notifications\DatabaseNotification;
11+
12+
class LeftEngagement extends Notification
13+
{
14+
public Engagement $engagement;
15+
16+
public mixed $projectable;
17+
18+
public function __construct(DatabaseNotification $notification)
19+
{
20+
$this->engagement = Engagement::find($notification->data['engagement_id']);
21+
$this->projectable = $this->engagement->project->projectable;
22+
/** @var Organization|RegulatedOrganization */
23+
$projectable = $this->projectable;
24+
$this->title = __('Left engagement');
25+
$this->body = safe_markdown('You left [:engagement](:engagement_url) by [:projectable](:projectable_url).', [
26+
'engagement' => $this->engagement->getTranslation('name', locale()),
27+
'engagement_url' => localized_route('engagements.show', $this->engagement),
28+
'projectable' => $projectable->getTranslation('name', locale()),
29+
'projectable_url' => localized_route($projectable->getRoutePrefix().'.show', $projectable),
30+
]);
31+
$this->interpretation = __('Left engagement', [], 'en');
32+
33+
parent::__construct($notification);
34+
}
35+
36+
public function render(): View
37+
{
38+
return view('components.notification.left-engagement', [
39+
'notification' => $this->notification,
40+
'read' => ! is_null($this->notification->read_at),
41+
'title' => $this->title,
42+
'body' => $this->body,
43+
'engagement' => $this->engagement,
44+
'interpretation' => $this->interpretation,
45+
]);
46+
}
47+
}

resources/lang/en.json

+12
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@
570570
"engagement description (French)": "engagement description (French)",
571571
"Engagement estimate has been submitted for your approval": "Engagement estimate has been submitted for your approval",
572572
"engagement format": "engagement format",
573+
"Engagement joined": "Engagement joined",
573574
"Engagement materials": "Engagement materials",
574575
"Engagement meetings": "Engagement meetings",
575576
"engagement name": "engagement name",
@@ -851,6 +852,8 @@
851852
"Leave engagement": "Leave engagement",
852853
"Leave organization": "Leave organization",
853854
"Leave this organization": "Leave this organization",
855+
"Left :engagement": "Left :engagement",
856+
"Left engagement": "Left engagement",
854857
"Light grey on grey": "Light grey on grey",
855858
"Light theme": "Light theme",
856859
"Link copied!": "Link copied!",
@@ -1458,6 +1461,7 @@
14581461
"show up on search results for them": "show up on search results for them",
14591462
"Signed language for interpretation": "Signed language for interpretation",
14601463
"signed language for translation": "signed language for translation",
1464+
"Signed up for :engagement": "Signed up for :engagement",
14611465
"Sign in": "Sign in",
14621466
"Sign language interpretation": "Sign language interpretation",
14631467
"Sign language interpretations": "Sign language interpretations",
@@ -1742,7 +1746,10 @@
17421746
"Video": "Video",
17431747
"Video recording": "Video recording",
17441748
"View": "View",
1749+
"View engagement": "View engagement",
1750+
"View engagement details": "View engagement details",
17451751
"View page": "View page",
1752+
"View this engagement at :url.": "View this engagement at :url.",
17461753
"Virtual or in-person": "Virtual or in-person",
17471754
"Virtual – phone call": "Virtual – phone call",
17481755
"Virtual – web conference": "Virtual – web conference",
@@ -1934,9 +1941,13 @@
19341941
"You have joined :invitationable as a :role": "You have joined :invitationable as a :role",
19351942
"You have joined as a :role": "You have joined as a :role",
19361943
"You have joined the team.": "You have joined the team.",
1944+
"You have left :engagement by :projectable": "You have left :engagement by :projectable",
1945+
"You have left [:engagement](:engagement_url) by [:projectable](:projectable_url).": "You have left [:engagement](:engagement_url) by [:projectable](:projectable_url).",
19371946
"You have not added any engagements yet.": "You have not added any engagements yet.",
19381947
"You have not passed the quiz.": "You have not passed the quiz.",
19391948
"You have now completed this course. Your certificate of completion has been sent to your email.": "You have now completed this course. Your certificate of completion has been sent to your email.",
1949+
"You have signed up for :engagement by :projectable": "You have signed up for :engagement by :projectable",
1950+
"You have signed up for [:engagement](:engagement_url) by [:projectable](:projectable_url).": "You have signed up for [:engagement](:engagement_url) by [:projectable](:projectable_url).",
19401951
"You have successfully added :notificationable to your list.": "You have successfully added :notificationable to your list.",
19411952
"You have successfully added :organization as the Community Organization you are consulting with for this engagement.": "You have successfully added :organization as the Community Organization you are consulting with for this engagement.",
19421953
"You have successfully added the Community Organization you are consulting with for this engagement.": "You have successfully added the Community Organization you are consulting with for this engagement.",
@@ -1959,6 +1970,7 @@
19591970
"You have successfully submitted an estimate request.": "You have successfully submitted an estimate request.",
19601971
"You have successfully unblocked.": "You have successfully unblocked.",
19611972
"You have successfully unblocked :blockable.": "You have successfully unblocked :blockable.",
1973+
"You left [:engagement](:engagement_url) by [:projectable](:projectable_url).": "You left [:engagement](:engagement_url) by [:projectable](:projectable_url).",
19621974
"You may accept this invitation by clicking the button below:": "You may accept this invitation by clicking the button below:",
19631975
"You must agree to the privacy policy.": "You must agree to the privacy policy.",
19641976
"You must agree to the terms of service.": "You must agree to the terms of service.",

resources/lang/fr.json

+12
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@
570570
"engagement description (French)": "description de la consultation (français)",
571571
"Engagement estimate has been submitted for your approval": "Le devis pour la consultation a été transmis pour votre approbation",
572572
"engagement format": "format de la consultation",
573+
"Engagement joined": "Engagement joined",
573574
"Engagement materials": "Documents de consultation",
574575
"Engagement meetings": "Réunions de la consultation",
575576
"engagement name": "nom de la consultation",
@@ -851,6 +852,8 @@
851852
"Leave engagement": "Quitter la consultation",
852853
"Leave organization": "Quitter l’organisation",
853854
"Leave this organization": "Quitter cette organisation",
855+
"Left :engagement": "Left :engagement",
856+
"Left engagement": "Left engagement",
854857
"Light grey on grey": "Gris clair sur gris",
855858
"Light theme": "Thème clair",
856859
"Link copied!": "Lien copié !",
@@ -1458,6 +1461,7 @@
14581461
"show up on search results for them": "apparaître dans les résultats de recherche",
14591462
"Signed language for interpretation": "Langue signée pour l’interprétation",
14601463
"signed language for translation": "traduction en langue des signes",
1464+
"Signed up for :engagement": "Signed up for :engagement",
14611465
"Sign in": "S’identifier",
14621466
"Sign language interpretation": "Interprétation en langue des signes",
14631467
"Sign language interpretations": "Interprétation en langue des signes",
@@ -1742,7 +1746,10 @@
17421746
"Video": "Vidéo",
17431747
"Video recording": "Enregistrement vidéo",
17441748
"View": "Afficher",
1749+
"View engagement": "View engagement",
1750+
"View engagement details": "View engagement details",
17451751
"View page": "Voir la page",
1752+
"View this engagement at :url.": "View this engagement at :url.",
17461753
"Virtual or in-person": "Virtuel ou en personne",
17471754
"Virtual – phone call": "Virtuel - appel téléphonique",
17481755
"Virtual – web conference": "Virtuel - conférence en ligne",
@@ -1934,9 +1941,13 @@
19341941
"You have joined :invitationable as a :role": "Vous avez rejoint :invitationable en tant que :role",
19351942
"You have joined as a :role": "Vous êtes maintenant :role",
19361943
"You have joined the team.": "Vous avez rejoint une équipe.",
1944+
"You have left :engagement by :projectable": "You have left :engagement by :projectable",
1945+
"You have left [:engagement](:engagement_url) by [:projectable](:projectable_url).": "You have left [:engagement](:engagement_url) by [:projectable](:projectable_url).",
19371946
"You have not added any engagements yet.": "Vous n’avez pas encore ajouté de consultations.",
19381947
"You have not passed the quiz.": "Vous n’avez pas réussi le jeu-questionnaire.",
19391948
"You have now completed this course. Your certificate of completion has been sent to your email.": "Vous avez complété avec succès ce sours. Votre certification de réussite vous a été envoyé par courriel.",
1949+
"You have signed up for :engagement by :projectable": "You have signed up for :engagement by :projectable",
1950+
"You have signed up for [:engagement](:engagement_url) by [:projectable](:projectable_url).": "You have signed up for [:engagement](:engagement_url) by [:projectable](:projectable_url).",
19401951
"You have successfully added :notificationable to your list.": "Vous avez ajouté avec succès :notificationable à votre liste.",
19411952
"You have successfully added :organization as the Community Organization you are consulting with for this engagement.": "Vous avez ajouté avec succès :organization comme l’organisation communautaire avec laquelle vous travaillez pour cette consultation.",
19421953
"You have successfully added the Community Organization you are consulting with for this engagement.": "Vous avez ajouté avec succès l’organisation communautaire avec laquelle vous travaillez pour cette consultation.",
@@ -1959,6 +1970,7 @@
19591970
"You have successfully submitted an estimate request.": "Votre demande de devis a été soumise avec succès.",
19601971
"You have successfully unblocked.": "Débloqué avec succès.",
19611972
"You have successfully unblocked :blockable.": "Vous avez débloqué :blockable.",
1973+
"You left [:engagement](:engagement_url) by [:projectable](:projectable_url).": "You left [:engagement](:engagement_url) by [:projectable](:projectable_url).",
19621974
"You may accept this invitation by clicking the button below:": "Vous pouvez accepter cette invitation en cliquant sur le bouton ci-dessous :",
19631975
"You must agree to the privacy policy.": "Vous devez accepter la politique de confidentialité.",
19641976
"You must agree to the terms of service.": "Vous devez accepter les conditions de service.",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<x-notification :notification="$notification">
2+
<x-slot name="title">{{ $title }}</x-slot>
3+
<x-slot name="body">{{ $body }}</x-slot>
4+
<x-slot name="actions">
5+
<a class="cta secondary"
6+
href="{{ localized_route('engagements.show', $engagement) }}">{{ __('View engagement') }}</a>
7+
</x-slot>
8+
</x-notification>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<x-notification :notification="$notification">
2+
<x-slot name="title">{{ $title }}</x-slot>
3+
<x-slot name="body">{{ $body }}</x-slot>
4+
<x-slot name="actions">
5+
<a class="cta secondary"
6+
href="{{ localized_route('engagements.show', $engagement) }}">{{ __('View engagement') }}</a>
7+
</x-slot>
8+
</x-notification>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@component('mail::message')
2+
{{
3+
safe_markdown('You have signed up for [:engagement](:engagement_url) by [:projectable](:projectable_url).', [
4+
'engagement' => $engagement->getTranslation('name', locale()),
5+
'engagement_url' => localized_route('engagements.show', $engagement),
6+
'projectable' => $projectable->getTranslation('name', locale()),
7+
'projectable_url' => localized_route($projectable->getRoutePrefix().'.show', $projectable),
8+
])
9+
}}
10+
11+
@component('mail::button', ['url' => localized_route('engagements.show', $engagement)])
12+
{{ __('View engagement details') }}
13+
@endcomponent
14+
@endcomponent

0 commit comments

Comments
 (0)