-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/Email-Staff-Hours'
# Conflicts: # src/dotnet/HQ.Server/Program.cs # src/dotnet/HQ.Server/Services/EmailMessageService.cs
- Loading branch information
Showing
7 changed files
with
232 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
|
||
using HQ.Abstractions.Staff; | ||
using HQ.Abstractions.Times; | ||
|
||
namespace HQ.Abstractions.Emails | ||
{ | ||
public class EmployeeHoursEmail : NotificationEmail | ||
{ | ||
//This will contain staff name and hours | ||
public List<StaffHoursModel> Staff { get; set; } = null!; | ||
public DateOnly Date { get; set; } | ||
|
||
public DateOnly PeriodBegin { get; set; } | ||
public DateOnly PeriodEnd { get; set; } | ||
|
||
public static new EmployeeHoursEmail Sample = new() | ||
{ | ||
Heading = "Staff Hours", | ||
Message = "Staff with red signify they have less working hours than expected", | ||
ButtonLabel = "Open HQ", | ||
ButtonUrl = new Uri("http://hq.localhost:4200/dashboard"), | ||
Date = new DateOnly(2024, 7, 17), | ||
PeriodBegin = new DateOnly(2024, 7, 17), | ||
PeriodEnd = new DateOnly(2024, 7, 23), | ||
|
||
Staff = new List<StaffHoursModel>{ | ||
new StaffHoursModel{ | ||
StaffName = "Amr", | ||
HoursLastWeek= 0, | ||
HoursLastMonth = 0, | ||
HoursThisMonth = 4, | ||
MissingHours = true | ||
}, | ||
new StaffHoursModel{ | ||
StaffName = "Ryan", | ||
HoursLastWeek= 5, | ||
HoursLastMonth = 6, | ||
HoursThisMonth = 7, | ||
LessThanExpectedHours = true | ||
}, | ||
new StaffHoursModel{ | ||
StaffName = "Pri", | ||
HoursLastWeek= 8, | ||
HoursLastMonth = 9, | ||
HoursThisMonth = 10 | ||
} | ||
} | ||
|
||
}; | ||
public class StaffHoursModel | ||
{ | ||
public decimal HoursLastWeek { get; set; } | ||
public decimal HoursLastMonth { get; set; } | ||
public decimal HoursThisMonth { get; set; } | ||
public string? StaffName { get; set; } | ||
public bool MissingHours { get; set; } | ||
public bool LessThanExpectedHours { get; set; } | ||
public int WorkHours { get; set; } | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/dotnet/HQ.Email/Views/Emails/HTML/EmployeeHours.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@model HQ.Abstractions.Emails.EmployeeHoursEmail | ||
@{ | ||
Layout = "_LayoutEmailNotificationHTML"; | ||
} | ||
<mj-text> | ||
<div><strong>Dates:</strong> @Model.PeriodBegin - @Model.PeriodEnd</div> | ||
</mj-text> | ||
<mj-table> | ||
<tr style="white;padding:15px 0;color:white;text-align:center;padding:15px 5px;"> | ||
<td style="padding: 0 15px 0 0;font-weight:bold;border-bottom:1px solid white;">Staff</td> | ||
<td style="padding: 0 15px;font-weight:bold;border-bottom:1px solid white;">Last Week</td> | ||
<td style="padding: 0 15px;font-weight:bold;border-bottom:1px solid white;">This Month</td> | ||
<td style="padding: 0 15px;font-weight:bold;border-bottom:1px solid white;">Last Month</td> | ||
</tr> | ||
@foreach (var staff in Model.Staff) | ||
{ | ||
@if (staff.LessThanExpectedHours || staff.MissingHours) | ||
{ | ||
<tr style="color:red; text-align:center;"> | ||
<td style="padding: 0 15px 0 0;">@staff.StaffName</td> | ||
<td style="padding: 0 15px;">@staff.HoursLastWeek</td> | ||
<td style="padding: 0 15px;">@staff.HoursThisMonth</td> | ||
<td style="padding: 0 15px;">@staff.HoursLastMonth</td> | ||
</tr> | ||
} | ||
else | ||
{ | ||
<tr style="color:white; text-align:center;"> | ||
<td style="padding: 0 15px 0 0;">@staff.StaffName</td> | ||
<td style="padding: 0 15px;">@staff.HoursLastWeek</td> | ||
<td style="padding: 0 15px;">@staff.HoursThisMonth</td> | ||
<td style="padding: 0 15px;">@staff.HoursLastMonth</td> | ||
</tr> | ||
} | ||
} | ||
</mj-table> | ||
<mj-text></mj-text> |
53 changes: 53 additions & 0 deletions
53
src/dotnet/HQ.Email/Views/Emails/Text/EmployeeHours.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@model HQ.Abstractions.Emails.EmployeeHoursEmail | ||
@if (!String.IsNullOrEmpty(Model.Heading)) | ||
{ | ||
<text>@Model.Heading</text> | ||
<text>---</text> | ||
<text></text> | ||
} | ||
|
||
@if (!String.IsNullOrEmpty(Model.Message)) | ||
{ | ||
<text>@Model.Message</text> | ||
<text></text> | ||
} | ||
|
||
Dates: <text>@Model.PeriodBegin - @Model.PeriodEnd</text> | ||
|
||
<table> | ||
<tr style="white;padding:15px 0;color:white;text-align:center;padding:15px 5px;"> | ||
<td style="padding: 0 15px 0 0;font-weight:bold;border-bottom:1px solid white;">Staff</td> | ||
<td style="padding: 0 15px;font-weight:bold;border-bottom:1px solid white;">Last Week</td> | ||
<td style="padding: 0 15px;font-weight:bold;border-bottom:1px solid white;">This Month</td> | ||
<td style="padding: 0 15px;font-weight:bold;border-bottom:1px solid white;">Last Month</td> | ||
</tr> | ||
@foreach (var staff in @Model.Staff) | ||
{ | ||
@if (staff.LessThanExpectedHours || staff.MissingHours) | ||
{ | ||
|
||
<tr style="color:red; text-align:center;"> | ||
<td style="padding: 0 15px 0 0;">@staff.StaffName</td> | ||
<td style="padding: 0 15px;">@staff.HoursLastWeek</td> | ||
<td style="padding: 0 15px;">@staff.HoursThisMonth</td> | ||
<td style="padding: 0 15px;">@staff.HoursLastMonth</td> | ||
</tr> | ||
|
||
} | ||
else | ||
{ | ||
<tr style="color:white; text-align:center;"> | ||
<td style="padding: 0 15px 0 0;">@staff.StaffName</td> | ||
<td style="padding: 0 15px;">@staff.HoursLastWeek</td> | ||
<td style="padding: 0 15px;">@staff.HoursThisMonth</td> | ||
<td style="padding: 0 15px;">@staff.HoursLastMonth</td> | ||
</tr> | ||
} | ||
|
||
} | ||
|
||
@if (!String.IsNullOrEmpty(Model.ButtonLabel) && Model.ButtonUrl != null) | ||
{ | ||
<text>@Model.ButtonLabel: @Model.ButtonUrl</text> | ||
} | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters