diff --git a/Areas/MMS/Controllers/MarineController.cs b/Areas/MMS/Controllers/MarineController.cs index 07e5b87..e857dd3 100644 --- a/Areas/MMS/Controllers/MarineController.cs +++ b/Areas/MMS/Controllers/MarineController.cs @@ -8,6 +8,8 @@ namespace PSTW_CentralSystem.Areas.MMS.Controllers { [Area("MMS")] + //testing from main laptop + //[Authorize(Policy = "RoleModulePolicy")] public class MarineController : Controller { @@ -19,21 +21,21 @@ namespace PSTW_CentralSystem.Areas.MMS.Controllers { return View(); } - // Generates and returns a Tar Ball Sampling Report PDF + public IActionResult GenerateReport() { try { - var document = new TarBallPDF(); + // Retrieve specific data based on the id, if required + var document = new TarBallPDF(); // Use id to customize the report if needed var pdf = document.GeneratePdf(); var fileName = $"TarBallReport_{DateTime.Now:yyyyMMdd_HHmmss}.pdf"; return File(pdf, "application/pdf", fileName); } catch (Exception ex) { - // Log the error (use a logger if configured) Console.WriteLine(ex.Message); - return StatusCode(StatusCodes.Status500InternalServerError, "An error occurred while generating the PDF. "+ex.Message); + return StatusCode(StatusCodes.Status500InternalServerError, "An error occurred while generating the PDF. " + ex.Message); } } @@ -41,20 +43,17 @@ namespace PSTW_CentralSystem.Areas.MMS.Controllers { try { - // Generate the PDF document - var document = new TarBallPDF(); + // Retrieve specific data based on the id, if required + var document = new TarBallPDF(); // Use id to customize the PDF if needed var pdf = document.GeneratePdf(); - - // Return the PDF for inline viewing return File(pdf, "application/pdf"); } catch (Exception ex) { - // Log the error (use a logger if configured) Console.WriteLine(ex.Message); return StatusCode(StatusCodes.Status500InternalServerError, "An error occurred while viewing the PDF. " + ex.Message); } } - //ahbsf + } } diff --git a/Areas/MMS/Views/Marine/TarBallForm.cshtml b/Areas/MMS/Views/Marine/TarBallForm.cshtml index 21f9e30..f8cd8b6 100644 --- a/Areas/MMS/Views/Marine/TarBallForm.cshtml +++ b/Areas/MMS/Views/Marine/TarBallForm.cshtml @@ -7,9 +7,8 @@
-| ??? | -Date | -Station | -Approval Status | -|
|---|---|---|---|---|
| - | - | - | - - - | -- View PDF - Download PDF - | -
| No. | +Date | +Station | +Approval Status | +|
| {{ data.no }} | +{{ data.date }} | +{{ data.station }} | + ++ + + | ++ View PDF + Download PDF + | +