Prechádzať zdrojové kódy

Selected Census Entries

Andrew Grant 7 mesiacov pred
rodič
commit
bfde63148a

+ 3 - 0
src/main/java/scot/carricksoftware/grants/constants/AttributeConstants.java

@@ -38,6 +38,9 @@ public class AttributeConstants {
     @SuppressWarnings("unused")
     public static final String CENSUS_COMMAND = "censusCommand";
 
+    public static final String CENSUS = "census";
+
+
     @SuppressWarnings({"unused"})
     public static final String CENSUS_ENTRIES = "censusEntries";
     @SuppressWarnings("unused")

+ 1 - 1
src/main/java/scot/carricksoftware/grants/constants/ViewConstants.java

@@ -35,7 +35,7 @@ public class ViewConstants {
     public static final String CENSUS_ENTRY_LIST = "censusentry/list";
     public static final String CENSUS_ENTRY_FORM = "censusentry/form";
 
-    public static final String SELECTED_CENUS_LIST = "selectedCensus/list";
+    public static final String SELECTED_CENSUS_LIST = "selectedCensus/list";
 
     @SuppressWarnings("unused")
     public static final String BIRTH_CERTIFICATE_LIST = "certificates/birthCertificate/list";

+ 7 - 2
src/main/java/scot/carricksoftware/grants/controllers/census/census/SelectedSelectedCensusListControllerImpl.java

@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.PathVariable;
 import scot.carricksoftware.grants.constants.*;
 import scot.carricksoftware.grants.controllers.ControllerHelper;
 import scot.carricksoftware.grants.services.census.census.CensusService;
+import scot.carricksoftware.grants.services.census.censusentry.CensusEntryService;
 
 import static java.lang.Integer.max;
 
@@ -26,11 +27,13 @@ public class SelectedSelectedCensusListControllerImpl implements SelectedCensusL
     private int currentPage = 0;
     private final ControllerHelper controllerHelper;
     private final CensusService censusService;
+    private final CensusEntryService censusEntryService;
 
     public SelectedSelectedCensusListControllerImpl(ControllerHelper controllerHelper,
-                                                    CensusService censusService) {
+                                                    CensusService censusService, CensusEntryService censusEntryService) {
         this.controllerHelper = controllerHelper;
         this.censusService = censusService;
+        this.censusEntryService = censusEntryService;
     }
 
     @SuppressWarnings("SameReturnValue")
@@ -101,7 +104,9 @@ public class SelectedSelectedCensusListControllerImpl implements SelectedCensusL
     @Override
     public String censusEntriesEntries(@Valid @PathVariable final String id, Model model) {
         logger.debug("CensusEntriesListControllerImpl::censusEntriesEntries");
-        return ViewConstants.SELECTED_CENUS_LIST;
+        model.addAttribute(AttributeConstants.CENSUS_ENTRIES, censusEntryService.getPagedCensusEntries(currentPage));
+        model.addAttribute(AttributeConstants.CENSUS, censusService.findById(Long.valueOf(id)));
+        return ViewConstants.SELECTED_CENSUS_LIST;
     }
 
 

+ 1 - 1
src/main/resources/templates/selectedCensus/list.html

@@ -23,7 +23,7 @@
 
     <div class="container border border-info
                     rounded-3 text-center p-4">
-        <h3>Census Entries for </h3>
+        <h3>Census Entries for <span th:text="${census.toString()}"></span></h3>
         <table class="table table-striped table-bordered">
             <thead class="table-dark">
             <tr>