Browse Source

Death Certificate add base certificate attributes

Andrew Grant 4 months ago
parent
commit
9e43153cd9

+ 30 - 0
src/main/java/scot/carricksoftware/grants/commands/certificates/deathcertificates/DeathCertificateCommand.java

@@ -6,7 +6,9 @@
 package scot.carricksoftware.grants.commands.certificates.deathcertificates;
 
 import scot.carricksoftware.grants.domains.people.Person;
+import scot.carricksoftware.grants.domains.places.Organisation;
 import scot.carricksoftware.grants.domains.places.Place;
+import scot.carricksoftware.grants.enums.certificates.CertificateType;
 import scot.carricksoftware.grants.enums.general.Sex;
 
 public interface DeathCertificateCommand {
@@ -68,4 +70,32 @@ public interface DeathCertificateCommand {
     void setWhenRegistered(String whenRegistered);
     void setWhereDied(Place whereDied);
     void setWhereRegistered(String whereRegistered);
+
+    String getCertificateNumber();
+
+    void setCertificateNumber(String certificateNumber);
+
+    Organisation getCertificateSource();
+
+    void setCertificateSource(Organisation certificateSource);
+
+    String getCertificateDate();
+
+    void setCertificateDate(String certificateDate);
+
+    CertificateType getCertificateType();
+
+    void setCertificateType(CertificateType certificateType);
+
+    Organisation getRegistrationAuthority();
+
+    void setRegistrationAuthority(Organisation registrationAuthority);
+
+    String getVolume();
+
+    void setVolume(String volume);
+
+    String getNumber();
+
+    void setNumber(String number);
 }

+ 79 - 0
src/main/java/scot/carricksoftware/grants/commands/certificates/deathcertificates/DeathCertificateCommandImpl.java

@@ -6,12 +6,21 @@
 package scot.carricksoftware.grants.commands.certificates.deathcertificates;
 
 import scot.carricksoftware.grants.domains.people.Person;
+import scot.carricksoftware.grants.domains.places.Organisation;
 import scot.carricksoftware.grants.domains.places.Place;
+import scot.carricksoftware.grants.enums.certificates.CertificateType;
 import scot.carricksoftware.grants.enums.general.Sex;
 
 public class DeathCertificateCommandImpl implements DeathCertificateCommand {
 
     Long Id;
+    private String certificateNumber;
+    private Organisation certificateSource;
+    private String certificateDate;
+    private CertificateType certificateType;
+    private Organisation registrationAuthority;
+    private String volume;
+    private String number;
     private Person deceased;
     private Person father;
     private Person informant;
@@ -319,4 +328,74 @@ public class DeathCertificateCommandImpl implements DeathCertificateCommand {
     public void setWhereRegistered(String whereRegistered) {
         this.whereRegistered = whereRegistered;
     }
+
+    @Override
+    public String getCertificateNumber() {
+        return certificateNumber;
+    }
+
+    @Override
+    public void setCertificateNumber(String certificateNumber) {
+        this.certificateNumber = certificateNumber;
+    }
+
+    @Override
+    public Organisation getCertificateSource() {
+        return certificateSource;
+    }
+
+    @Override
+    public void setCertificateSource(Organisation certificateSource) {
+        this.certificateSource = certificateSource;
+    }
+
+    @Override
+    public String getCertificateDate() {
+        return certificateDate;
+    }
+
+    @Override
+    public void setCertificateDate(String certificateDate) {
+        this.certificateDate = certificateDate;
+    }
+
+    @Override
+    public CertificateType getCertificateType() {
+        return certificateType;
+    }
+
+    @Override
+    public void setCertificateType(CertificateType certificateType) {
+        this.certificateType = certificateType;
+    }
+
+    @Override
+    public Organisation getRegistrationAuthority() {
+        return registrationAuthority;
+    }
+
+    @Override
+    public void setRegistrationAuthority(Organisation registrationAuthority) {
+        this.registrationAuthority = registrationAuthority;
+    }
+
+    @Override
+    public String getVolume() {
+        return volume;
+    }
+
+    @Override
+    public void setVolume(String volume) {
+        this.volume = volume;
+    }
+
+    @Override
+    public String getNumber() {
+        return number;
+    }
+
+    @Override
+    public void setNumber(String number) {
+        this.number = number;
+    }
 }

+ 7 - 1
src/main/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateCommandConverterImpl.java

@@ -18,7 +18,13 @@ public class DeathCertificateCommandConverterImpl implements DeathCertificateCom
 
         DeathCertificate target = new DeathCertificate();
 
-        target.setId(source.getId());
+        target.setId(source.getId());target.setCertificateNumber(source.getCertificateNumber());
+        target.setCertificateDate(source.getCertificateDate());
+        target.setCertificateSource(source.getCertificateSource());
+        target.setCertificateType(source.getCertificateType());
+        target.setRegistrationAuthority(source.getRegistrationAuthority());
+        target.setVolume(source.getVolume());
+        target.setNumber(source.getNumber());
         target.setDeceased(source.getDeceased());
         target.setFather(source.getFather());
         target.setInformant(source.getInformant());

+ 7 - 0
src/main/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateConverterImpl.java

@@ -20,6 +20,13 @@ public class DeathCertificateConverterImpl implements DeathCertificateConverter
         DeathCertificateCommand target = new DeathCertificateCommandImpl();
 
         target.setId(source.getId());
+        target.setCertificateNumber(source.getCertificateNumber());
+        target.setCertificateDate(source.getCertificateDate());
+        target.setCertificateSource(source.getCertificateSource());
+        target.setCertificateType(source.getCertificateType());
+        target.setRegistrationAuthority(source.getRegistrationAuthority());
+        target.setVolume(source.getVolume());
+        target.setNumber(source.getNumber());
         target.setDeceased(source.getDeceased());
         target.setFather(source.getFather());
         target.setInformant(source.getInformant());

+ 1 - 2
src/main/java/scot/carricksoftware/grants/domains/certificates/DeathCertificate.java

@@ -13,14 +13,13 @@ import jakarta.persistence.JoinColumn;
 import jakarta.persistence.Lob;
 import jakarta.persistence.ManyToOne;
 import org.springframework.format.annotation.DateTimeFormat;
-import scot.carricksoftware.grants.BaseEntity;
 import scot.carricksoftware.grants.constants.ApplicationConstants;
 import scot.carricksoftware.grants.domains.people.Person;
 import scot.carricksoftware.grants.domains.places.Place;
 import scot.carricksoftware.grants.enums.general.Sex;
 
 @Entity
-public class DeathCertificate extends BaseEntity {
+public class DeathCertificate extends BaseCertificate {
 
     @SuppressWarnings("JpaDataSourceORMInspection")
     @ManyToOne

+ 24 - 20
src/main/resources/templates/certificates/deathCertificate/form.html

@@ -19,37 +19,41 @@
 </head>
 <body>
 <!--/*@thymesVar id="deathCertificateCommand" type="scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand"*/-->
-<!--/*@thymesVar id="person" type="scot.carricksoftware.grants.domains.people.Person"*/-->
 <div th:insert="~{fragments/layout::banner}"></div>
 
 <div class="container border border-info rounded-3 text-center p-4">
+    <h3>Death Certificate Details</h3>
     <form th:object="${deathCertificateCommand}" th:action="@{/deathCertificate}" method="post">
         <div th:if="${#fields.hasErrors('*')}" class="alert alert-danger">
             <p>Please Correct The Errors Below</p>
         </div>
 
-        <div class="form-group row justify-content-center">
-            <div class="col-xs-4" style="margin-right:20px;">
-                <label for="deceased">Deceased</label>
-                <div>
-                    <select id="deceased" style="width: 300px;" name="deceased" th:field="*{deceased}">
-                        <option th:value="${''}" th:text="${''}"></option>
-                        <option th:each="person : ${people}"
-                                th:value="${person.id}" th:text="${person.toString()}"></option>
-                    </select>
-                    <div th:if="${#fields.hasErrors('deceased')}">
+        <table style="width:100%;">
+            <tr>
+                <td>
+                <td style="text-align: right;">
+                    <label for="id"><span style="color: rgb(255,0,0);">*</span>Database Id :&nbsp;</label>
+                </td>
+                <td>
+                    <input class="form-control" id="id"
+                           th:field="*{id}" type="text" readonly>
+                </td>
+            </tr>
+            <tr>
+                <td style="text-align: right;">
+                    <label for="certificateNumber">Certificate Number :&nbsp;</label>
+                </td>
+                <td style="text-align: left;">
+                    <input class="form-control" id="certificateNumber"
+                           th:field="*{certificateNumber}" type="text">
+                    <div th:if="${#fields.hasErrors('certificateNumber')}">
                         <ul class="text-danger">
-                            <li th:each="err : ${#fields.errors('deceased')}" th:text="${err}"/>
+                            <li th:each="err : ${#fields.errors('certificateNumber')}" th:text="${err}"/>
                         </ul>
                     </div>
-                </div>
-                </div>
-                <div class="col-xs-2">
-                    <label for="id">Database Id<span style="color: rgb(255,0,0);">*</span></label>
-                    <input class="form-control" id="id"
-                           th:field="*{id}" type="text" readonly>
-                </div>
-            </div>
+                </td>
+            </tr>
+        </table>
             <button type="submit" class="btn btn-primary">Commit</button>
             <a class="btn btn-secondary" th:href="@{/deathCertificates}" th:text="${'List all'}">List all</a>
             <a class="btn btn-success" th:href="@{/static}" th:text="${'Home'}">Home</a>