(
+ $"""
+ SELECT
+ payload ->> 'ChangeReason' as change_reason,
+ payload ->> 'ChangeReasonDetail' as change_reason_detail
+ FROM
+ events
+ WHERE
+ person_id = {personId}
+ AND event_name = 'AlertUpdatedEvent'
+ AND (payload #>> Array['Alert', 'AlertId'])::uuid = {Alert.AlertId}
+ AND payload #>> Array['Alert', 'EndDate'] is not null
+ AND payload #>> Array['OldAlert', 'EndDate'] is null
+ ORDER BY
+ created DESC
+ """)
+ .FirstOrDefaultAsync();
+ ChangeReason = changeReasonInfo?.ChangeReason;
+ ChangeReasonDetail = changeReasonInfo?.ChangeReasonDetail;
CanEdit = (await authorizationService.AuthorizeForAlertTypeAsync(
User,
Alert.AlertTypeId,
Permissions.Alerts.Write)) is { Succeeded: true };
}
+
+ private record ChangeReasonInfo(string ChangeReason, string ChangeReasonDetail);
}
diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Alerts/ReopenAlert/Index.cshtml b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Alerts/ReopenAlert/Index.cshtml
index f8401acbc..364331acf 100644
--- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Alerts/ReopenAlert/Index.cshtml
+++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Alerts/ReopenAlert/Index.cshtml
@@ -5,7 +5,7 @@
}
@section BeforeContent {
- Back
+ Back
}
diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/Alerts.cshtml b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/Alerts.cshtml
index 512ddc495..7134507b5 100644
--- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/Alerts.cshtml
+++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/Alerts.cshtml
@@ -50,7 +50,7 @@
@if (canWrite)
{
- Change
+ Change
}
@@ -65,7 +65,7 @@
@if (canWrite)
{
- Change
+ Change
}
@@ -81,7 +81,13 @@
End date
- @alert.EndDate?.ToString("d MMMM yyyy")
+
+ @if (canWrite)
+ {
+
+ Add
+
+ }