diff --git a/Areas/OTcalculate/Controllers/HodDashboardController.cs b/Areas/OTcalculate/Controllers/HodDashboardController.cs index 7491183..0f1f920 100644 --- a/Areas/OTcalculate/Controllers/HodDashboardController.cs +++ b/Areas/OTcalculate/Controllers/HodDashboardController.cs @@ -18,5 +18,9 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Controllers { return View(); } + public IActionResult OtReview() + { + return View(); + } } } diff --git a/Areas/OTcalculate/Services/OvertimePdfService.cs b/Areas/OTcalculate/Services/OvertimePdfService.cs index 1d3bd1c..97440c0 100644 --- a/Areas/OTcalculate/Services/OvertimePdfService.cs +++ b/Areas/OTcalculate/Services/OvertimePdfService.cs @@ -15,7 +15,7 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services int departmentId, string userFullName, string departmentName, - byte[]? logoImage = null // Optional logo image + byte[]? logoImage = null ) { records = records @@ -31,7 +31,6 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services page.Size(PageSizes.A4.Landscape()); page.Margin(30); - // Header section with logo and user info page.Content().Column(column => { column.Item().Row(row => @@ -103,7 +102,6 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services AddHeaderCell("Description", "#e3f2fd"); }); - // Data Rows // Data Rows double totalOTSum = 0; int totalBreakSum = 0; @@ -112,7 +110,6 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services if (!records.Any()) { - // Show message row if no records uint colspan = (uint)(departmentId == 2 ? 13 : 12); table.Cell().ColumnSpan(colspan) @@ -124,7 +121,6 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services .FontColor(Colors.Grey.Darken2) .Italic(); } - else { foreach (var r in records) @@ -165,7 +161,6 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services table.Cell().Background(rowBg).Border(0.25f).Padding(5).Text(r.OtDescription ?? "-").FontSize(9).WrapAnywhere().LineHeight(1.2f); } - // Totals Row var totalOTTimeSpan = TimeSpan.FromHours(totalOTSum); var totalBreakTimeSpan = TimeSpan.FromMinutes(totalBreakSum); @@ -196,7 +191,6 @@ namespace PSTW_CentralSystem.Areas.OTcalculate.Services return stream; } - private TimeSpan CalculateTotalOT(OtRegisterModel r) { TimeSpan office = (r.OfficeTo ?? TimeSpan.Zero) - (r.OfficeFrom ?? TimeSpan.Zero); diff --git a/Areas/OTcalculate/Views/HodDashboard/HodApproval.cshtml b/Areas/OTcalculate/Views/HodDashboard/HodApproval.cshtml index db6acb4..da357b1 100644 --- a/Areas/OTcalculate/Views/HodDashboard/HodApproval.cshtml +++ b/Areas/OTcalculate/Views/HodDashboard/HodApproval.cshtml @@ -2,16 +2,67 @@ ViewData["Title"] = "Overtime Approval"; Layout = "~/Views/Shared/_Layout.cshtml"; } -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -
-
-
-
-
Rate
- -
-
- -
+
+ + + + + + + + + + + + + + + + + + + + +
NameSubmission DateMonth/YearAction
{{ submission.userName }}{{ formatDate(submission.submissionDate) }}{{ submission.monthYear }}
No overtime records submitted for review.
+ +@section Scripts { + + +} \ No newline at end of file diff --git a/Areas/OTcalculate/Views/HodDashboard/OtReview.cshtml b/Areas/OTcalculate/Views/HodDashboard/OtReview.cshtml new file mode 100644 index 0000000..7dd3ab5 --- /dev/null +++ b/Areas/OTcalculate/Views/HodDashboard/OtReview.cshtml @@ -0,0 +1,169 @@ +@{ + ViewData["Title"] = "Overtime Review"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + +
+

Overtime Records for {{ reviewedUserName }} - {{ formatMonthYear(selectedMonth, selectedYear) }}

+ +
+ +@section Scripts { + + + } \ No newline at end of file diff --git a/Areas/OTcalculate/Views/Overtime/OtRecords.cshtml b/Areas/OTcalculate/Views/Overtime/OtRecords.cshtml index 20a188e..f8dea82 100644 --- a/Areas/OTcalculate/Views/Overtime/OtRecords.cshtml +++ b/Areas/OTcalculate/Views/Overtime/OtRecords.cshtml @@ -353,13 +353,34 @@ }, async submitRecords() { try { - const res = await fetch('/OvertimeAPI/SaveOvertimeRecordsWithPdf', { + const recordsToSubmit = this.filteredRecords.map(record => ({ + overtimeId: record.overtimeId, // Make sure to include the ID for updates + otDate: record.otDate, + officeFrom: record.officeFrom, + officeTo: record.officeTo, + officeBreak: record.officeBreak, + outsideFrom: record.outsideFrom, + outsideTo: record.outsideTo, + outsideBreak: record.outsideBreak, + stationId: record.stationId, + otDescription: record.otDescription, + otDays: record.otDays, + filePath: record.filePath, // Include existing file path + userId: this.userId + // Add other relevant fields if necessary + })); + + const res = await fetch('/OvertimeAPI/SubmitOvertimeRecords', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(this.otRecords) + body: JSON.stringify(recordsToSubmit) }); - if (res.ok) alert("Overtime records submitted successfully."); - else alert("Submission failed."); + if (res.ok) { + alert("Overtime records submitted for review."); + // Optionally, clear the local records or redirect the user + } else { + alert("Submission failed: " + await res.text()); + } } catch (err) { console.error("Submission error:", err); alert("An error occurred during submission."); diff --git a/Areas/OTcalculate/Views/Overtime/OtRegister.cshtml b/Areas/OTcalculate/Views/Overtime/OtRegister.cshtml index 1b49b92..bf57a70 100644 --- a/Areas/OTcalculate/Views/Overtime/OtRegister.cshtml +++ b/Areas/OTcalculate/Views/Overtime/OtRegister.cshtml @@ -251,7 +251,7 @@ formatTime(timeString) { if (!timeString) return null; const [hours, minutes] = timeString.split(':'); - return `${hours.padStart(2, '0')}:${minutes.padStart(2, '0')}:00`; // Ensure valid HH:mm:ss format + return `${hours.padStart(2, '0')}:${minutes.padStart(2, '0')}:00`; // HH:mm:ss format }, async addOvertime() { if (this.isPSTWAIR && !this.selectedAirStation) { diff --git a/wwwroot/Media/Overtime/OT_1f536404-6970-4ef7-bd5f-560807b76a05.pdf b/wwwroot/Media/Overtime/OT_1f536404-6970-4ef7-bd5f-560807b76a05.pdf new file mode 100644 index 0000000..ebd87b5 Binary files /dev/null and b/wwwroot/Media/Overtime/OT_1f536404-6970-4ef7-bd5f-560807b76a05.pdf differ diff --git a/wwwroot/Media/Overtime/OT_56a769f2-e911-48bd-8872-a4f749d82fa1.pdf b/wwwroot/Media/Overtime/OT_56a769f2-e911-48bd-8872-a4f749d82fa1.pdf new file mode 100644 index 0000000..ebd87b5 Binary files /dev/null and b/wwwroot/Media/Overtime/OT_56a769f2-e911-48bd-8872-a4f749d82fa1.pdf differ diff --git a/wwwroot/Media/Overtime/OT_f46b391b-dc33-49cc-bac3-642c469c66c5.pdf b/wwwroot/Media/Overtime/OT_f46b391b-dc33-49cc-bac3-642c469c66c5.pdf new file mode 100644 index 0000000..ebd87b5 Binary files /dev/null and b/wwwroot/Media/Overtime/OT_f46b391b-dc33-49cc-bac3-642c469c66c5.pdf differ