diff --git a/src/main/java/com/utopiaindustries/controller/ReportingController.java b/src/main/java/com/utopiaindustries/controller/ReportingController.java index 54ea0a3..51a4708 100644 --- a/src/main/java/com/utopiaindustries/controller/ReportingController.java +++ b/src/main/java/com/utopiaindustries/controller/ReportingController.java @@ -11,6 +11,7 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.time.LocalDate; import java.util.ArrayList; @@ -45,7 +46,11 @@ public class ReportingController { @GetMapping( "/job-card-report") public String jobCardReport(@RequestParam( value = "job-card-id", required = false ) String jobCardId, - Model model ){ + Model model, RedirectAttributes redirectAttributes ){ + if( jobCardId == null || jobCardId.isEmpty()) { + redirectAttributes.addFlashAttribute("error", "Please Re-Select Job Card" ); + return "/reporting/job-card-report"; + } model.addAttribute("totalProduction", reportingService.getTotalProduction(jobCardId)); model.addAttribute("phasesTimes", reportingService.getEachPhaseTotalTime(jobCardId)); model.addAttribute("segregateItems", reportingService.getSegregateItems(jobCardId)); diff --git a/src/main/resources/templates/reporting/job-card-report.html b/src/main/resources/templates/reporting/job-card-report.html index 285a116..9324b07 100644 --- a/src/main/resources/templates/reporting/job-card-report.html +++ b/src/main/resources/templates/reporting/job-card-report.html @@ -12,7 +12,7 @@
Job Card Report@@ -54,7 +54,7 @@ |
@@ -65,7 +65,7 @@
|
Cutting Detail
@@ -96,7 +96,7 @@
|
Stitching Detail
@@ -127,7 +127,7 @@
|