Эх сурвалжийг харах

Birth Certificate mother and father place added to bootstrap

Andrew Grant 5 сар өмнө
parent
commit
c94b7b5945

+ 2 - 2
src/main/java/scot/carricksoftware/grants/bootstrap/DataLoadCertificates.java

@@ -81,8 +81,8 @@ public class DataLoadCertificates {
         birthCertificateCommand.setInformantResidence("2 Wilson Avenue, Edinburgh");
         birthCertificateCommand.setMotherUsualResidence(placeService.findById(1L));
         birthCertificateCommand.setUntrackedMotherUsualResidence("92 Broughton Road, Edinburgh");
-        birthCertificateCommand.setMotherPlaceOfBirth("MPOB");
-        birthCertificateCommand.setFatherPlaceOfBirth("FPOB");
+        birthCertificateCommand.setMotherPlaceOfBirth("Drop");
+        birthCertificateCommand.setFatherPlaceOfBirth("Drip");
         birthCertificateService.saveBirthCertificateCommand(birthCertificateCommand);
     }
 

+ 2 - 0
src/main/java/scot/carricksoftware/grants/capitalisation/certificates/birthcertificate/CapitaliseBirthCertificateImpl.java

@@ -37,6 +37,8 @@ public class CapitaliseBirthCertificateImpl implements CapitaliseBirthCertificat
         birthCertificateCommand.setDateAndPlaceOfMarriage(capitaliseString.capitalise(birthCertificateCommand.getDateAndPlaceOfMarriage()));
         birthCertificateCommand.setUntrackedFatherUsualResidence(capitaliseString.capitalise(birthCertificateCommand.getUntrackedFatherUsualResidence()));
         birthCertificateCommand.setInformantResidence(capitaliseString.capitalise(birthCertificateCommand.getInformantResidence()));
+        birthCertificateCommand.setMotherPlaceOfBirth(capitaliseString.capitalise(birthCertificateCommand.getMotherPlaceOfBirth()));
+        birthCertificateCommand.setFatherPlaceOfBirth(capitaliseString.capitalise(birthCertificateCommand.getFatherPlaceOfBirth()));
     }
 
 }

+ 57 - 35
src/main/resources/templates/certificates/birthCertificate/form.html

@@ -289,24 +289,35 @@
                     </div>
                 </td>
             </tr>
+            <tr>
+                <td style="text-align: right;">
+                    <label for="fatherPlaceOfBirth">Father's Place of Birth :&nbsp;</label>
+                </td>
+                <td style="text-align: left; ">
+                    <div>
+                        <input class="fatherPlaceOfBirth" id="fatherPlaceOfBirth"
+                               th:field="*{fatherPlaceOfBirth}" type="text">
+                    </div>
+                </td>
+            </tr>
             <tr>
                 <!---------------------------->
-            <td style="text-align: right; background-color: #FFFF00;">
-                <label for="fatherUsualResidence">Father Usual Residence :&nbsp;</label>
-            </td>
-            <td style="text-align: left;">
-                <select id="fatherUsualResidence" name="fatherUsualResidence" th:field="*{fatherUsualResidence}">
-                    <option th:value="${''}" th:text="${''}"></option>
-                    <option th:each="place : ${places}"
-                            th:value="${place.id}" th:text="${place.toString()}"></option>
-                </select>
-                <div th:if="${#fields.hasErrors('fatherUsualResidence')}">
-                    <ul class="text-danger">
-                        <li th:each="err : ${#fields.errors('fatherUsualResidence')}" th:text="${err}"/>
-                    </ul>
-                </div>
-            </td>
-        </tr>
+                <td style="text-align: right; background-color: #FFFF00;">
+                    <label for="fatherUsualResidence">Father Usual Residence :&nbsp;</label>
+                </td>
+                <td style="text-align: left;">
+                    <select id="fatherUsualResidence" name="fatherUsualResidence" th:field="*{fatherUsualResidence}">
+                        <option th:value="${''}" th:text="${''}"></option>
+                        <option th:each="place : ${places}"
+                                th:value="${place.id}" th:text="${place.toString()}"></option>
+                    </select>
+                    <div th:if="${#fields.hasErrors('fatherUsualResidence')}">
+                        <ul class="text-danger">
+                            <li th:each="err : ${#fields.errors('fatherUsualResidence')}" th:text="${err}"/>
+                        </ul>
+                    </div>
+                </td>
+            </tr>
             <tr>
                 <td style="text-align: right;  background-color: #FFFF00;">
                     <label for="untrackedFatherUsualResidence">Father Usual Residence (untracked) :&nbsp;</label>
@@ -317,7 +328,8 @@
                                th:field="*{untrackedFatherUsualResidence}" type="text">
                         <div th:if="${#fields.hasErrors('untrackedFatherUsualResidence')}">
                             <ul class="text-danger">
-                                <li th:each="err : ${#fields.errors('untrackedFatherUsualResidence')}" th:text="${err}"/>
+                                <li th:each="err : ${#fields.errors('untrackedFatherUsualResidence')}"
+                                    th:text="${err}"/>
                             </ul>
                         </div>
                     </div>
@@ -341,23 +353,22 @@
                     </div>
                 </td>
             </tr>
-            <!---------------------------->
             <tr>
-            <td style="text-align: right; background-color: #73ff00;">
-                <label for="motherUsualResidence">Mother Usual Residence :&nbsp;</label>
-            </td>
-            <td style="text-align: left;">
-                <select id="motherUsualResidence" name="motherUsualResidence" th:field="*{motherUsualResidence}">
-                    <option th:value="${''}" th:text="${''}"></option>
-                    <option th:each="place : ${places}"
-                            th:value="${place.id}" th:text="${place.toString()}"></option>
-                </select>
-                <div th:if="${#fields.hasErrors('motherUsualResidence')}">
-                    <ul class="text-danger">
-                        <li th:each="err : ${#fields.errors('motherUsualResidence')}" th:text="${err}"/>
-                    </ul>
-                </div>
-            </td>
+                <td style="text-align: right; background-color: #73ff00;">
+                    <label for="motherUsualResidence">Mother Usual Residence :&nbsp;</label>
+                </td>
+                <td style="text-align: left;">
+                    <select id="motherUsualResidence" name="motherUsualResidence" th:field="*{motherUsualResidence}">
+                        <option th:value="${''}" th:text="${''}"></option>
+                        <option th:each="place : ${places}"
+                                th:value="${place.id}" th:text="${place.toString()}"></option>
+                    </select>
+                    <div th:if="${#fields.hasErrors('motherUsualResidence')}">
+                        <ul class="text-danger">
+                            <li th:each="err : ${#fields.errors('motherUsualResidence')}" th:text="${err}"/>
+                        </ul>
+                    </div>
+                </td>
             </tr>
             <tr>
                 <td style="text-align: right;  background-color: #73ff00;">
@@ -369,13 +380,24 @@
                                th:field="*{untrackedMotherUsualResidence}" type="text">
                         <div th:if="${#fields.hasErrors('untrackedMotherUsualResidence')}">
                             <ul class="text-danger">
-                                <li th:each="err : ${#fields.errors('untrackedMotherUsualResidence')}" th:text="${err}"/>
+                                <li th:each="err : ${#fields.errors('untrackedMotherUsualResidence')}"
+                                    th:text="${err}"/>
                             </ul>
                         </div>
                     </div>
                 </td>
             </tr>
-            <!---------------------------->
+            <tr>
+                <td style="text-align: right;">
+                    <label for="motherPlaceOfBirth">Mother's Place of Birth :&nbsp;</label>
+                </td>
+                <td style="text-align: left; ">
+                    <div>
+                        <input class="motherPlaceOfBirth" id="motherPlaceOfBirth"
+                               th:field="*{motherPlaceOfBirth}" type="text">
+                    </div>
+                </td>
+            </tr>
             <tr>
                 <td style="text-align: right; border-bottom: 5px solid #ccc;">
                     <label for="dateAndPlaceOfMarriage">Date and Place Of Marriage :&nbsp;</label>

+ 2 - 2
src/test/java/scot/carricksoftware/grants/bootstrap/DataLoadCertificatesBirthCertificatesTest.java

@@ -114,8 +114,8 @@ public class DataLoadCertificatesBirthCertificatesTest {
         assertEquals(placeMock, captor.getValue().getFatherUsualResidence());
         assertEquals("92 Broughton Road, Edinburgh", captor.getValue().getUntrackedMotherUsualResidence());
         assertEquals(placeMock, captor.getValue().getMotherUsualResidence());
-        assertEquals("MPOB", captor.getValue().getMotherPlaceOfBirth());
-        assertEquals("FPOB", captor.getValue().getFatherPlaceOfBirth());
+        assertEquals("Drop", captor.getValue().getMotherPlaceOfBirth());
+        assertEquals("Drip", captor.getValue().getFatherPlaceOfBirth());
     }
 
 

+ 57 - 0
src/test/java/scot/carricksoftware/grants/capitalisation/certificates/birthcertificates/CapitaliseBirthCertificatesPartThreeTest.java

@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grants.capitalisation.certificates.birthcertificates;
+
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import scot.carricksoftware.grants.capitalisation.CapitaliseStringImpl;
+import scot.carricksoftware.grants.capitalisation.certificates.birthcertificate.CapitaliseBirthCertificate;
+import scot.carricksoftware.grants.capitalisation.certificates.birthcertificate.CapitaliseBirthCertificateImpl;
+import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
+import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+
+@ExtendWith(MockitoExtension.class)
+class CapitaliseBirthCertificatesPartThreeTest {
+
+    private CapitaliseBirthCertificate capitaliseBirthCertificate;
+
+    @Mock
+    private CapitaliseStringImpl capitaliseStringMock;
+
+    private BirthCertificateCommand birthCertificateCommand;
+
+    @BeforeEach
+    void setUp() {
+        capitaliseBirthCertificate = new CapitaliseBirthCertificateImpl(capitaliseStringMock);
+        birthCertificateCommand = new BirthCertificateCommandImpl();
+        when(capitaliseStringMock.capitalise(any())).thenReturn("Lower");
+    }
+
+    @Test
+    void motherPlaceOfBirthTest() {
+        birthCertificateCommand.setMotherPlaceOfBirth("lower");
+        capitaliseBirthCertificate.capitalise(birthCertificateCommand);
+        assertEquals("Lower", birthCertificateCommand.getMotherPlaceOfBirth());
+    }
+
+    @Test
+    void fatherPlaceOfBirthTest() {
+        birthCertificateCommand.setFatherPlaceOfBirth("lower");
+        capitaliseBirthCertificate.capitalise(birthCertificateCommand);
+        assertEquals("Lower", birthCertificateCommand.getFatherPlaceOfBirth());
+    }
+
+
+}