fix redirect and null exceptioin on dashboard screen
parent
2cd71d3828
commit
9a541b8389
|
@ -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));
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<div class="col-sm">
|
||||
<table class="table " >
|
||||
<tbody>
|
||||
<tr>
|
||||
<tr th:if="${jobCardProgress != null }">
|
||||
<td style="padding:0px;">
|
||||
<div style="border: 2px solid #d5d8dc; padding: 10px; border-radius: 10px; height: 370px;">
|
||||
<h1 style="text-align: center;">Job Card Report</h1>
|
||||
|
@ -54,7 +54,7 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr th:if="${phasesTimes != null }">
|
||||
<td style="display: flex; flex-direction: column; align-items: center; border: none !important; outline: none;">
|
||||
<div style="display: flex; gap: 10px;">
|
||||
<div th:each="phase, index : ${phasesTimes.keySet()}" style="border: 2px solid #d5d8dc; border-radius: 10px; text-align: center; padding:20px;">
|
||||
|
@ -65,7 +65,7 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${cuttingDetails != null and cuttingDetails.get('accounts') != null}">
|
||||
<tr th:if="${cuttingDetails != null && cuttingDetails.get('accounts') != null}">
|
||||
<td style="padding: 0px; text-align: center;">
|
||||
<div style="background-color: black; color: white; padding: 10px; font-size: 18px; font-weight: bold; text-align: center;">
|
||||
Cutting Detail
|
||||
|
@ -96,7 +96,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr th:if="${stitchingDetails != null and stitchingDetails.get('accounts') != null}">
|
||||
<tr th:if="${stitchingDetails != null && stitchingDetails.get('accounts') != null}">
|
||||
<td style="padding: 0px; text-align: center; ">
|
||||
<div style="background-color: black; color: white; padding: 10px; font-size: 18px; font-weight: bold; text-align: center;">
|
||||
Stitching Detail
|
||||
|
@ -127,7 +127,7 @@
|
|||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${dailyProgress.get('dates') != null}">
|
||||
<tr th:if="${dailyProgress != null}">
|
||||
<td style="padding-left: 150px;">
|
||||
<div style="border: 2px solid #d5d8dc; padding-top: 10px; border-radius: 10px; height: 560px; width: 80%; overflow-x: auto;">
|
||||
<div id="barChart" class="barChart" style="height: 500px; width: 1600px;"
|
||||
|
|
Loading…
Reference in New Issue