Skip to content

Commit

Permalink
fix(cb2-10755): fix cat J logic for ADR cert (#100)
Browse files Browse the repository at this point in the history
* fix(cb2-10755): update compatibilty J logic

* fix(cb2-10755): create compatibility J logic

* fix(cb2-10755): create compatibility J logic
  • Loading branch information
naathanbrown authored Feb 7, 2024
1 parent 948a629 commit c813381
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public class AdrPassCertificateData {
@JsonProperty("m145Statement")
private boolean m145Statement;

@JsonProperty("compatibilityGroupJ")
private boolean compatibilityGroupJ;

public String getVin() {
return vin;
}
Expand Down Expand Up @@ -277,6 +280,13 @@ public boolean getPermittedDangerousGoodsHasEXIII() {
return false;
};

public boolean getShowCatJInclusion() {
return (this.getPermittedDangerousGoodsHasEXIII() || this.getPermittedDangerousGoodsHasEXII()) && this.compatibilityGroupJ;
}

public boolean getShowCatJExclusion() {
return (this.getPermittedDangerousGoodsHasEXIII() || this.getPermittedDangerousGoodsHasEXII()) && !this.compatibilityGroupJ;
}

public boolean getFormattedSubstancesPermitted() { // returns true for the first value that tankStatement can have and false for the other one so it can be processed in view
return this.tankStatement != null && tankStatement.getSubstancesPermitted() != null && this.tankStatement.getSubstancesPermitted().equals(SUBSTANCES_PERMITTED_OPTION_1);
Expand All @@ -302,31 +312,6 @@ public boolean getIsVehicleTypeNull() {
return this.adrVehicleType == null;
}

public boolean getIsExplosivesType2() {
if(this.permittedDangerousGoods == null){
return false;
}
for (String permittedDangerousGood : this.permittedDangerousGoods) {
if(permittedDangerousGood.equals(PERMITTED_DANGEROUS_GOODS_EXPLOSIVES_2)){
return true;
}
}
return false;
}

public boolean getIsExplosivesType3() {
if(this.permittedDangerousGoods == null){
return false;
}
for (String permittedDangerousGood : this.permittedDangerousGoods) {
if(permittedDangerousGood.equals(PERMITTED_DANGEROUS_GOODS_EXPLOSIVES_3)){
return true;
}

}
return false;
}

public boolean isReplacement() {
return replacement;
}
Expand All @@ -350,4 +335,12 @@ public boolean isM145Statement() {
public void setM145Statement(boolean m145Statement) {
this.m145Statement = m145Statement;
}

public boolean isCompatibilityGroupJ() {
return compatibilityGroupJ;
}

public void setCompatibilityGroupJ(boolean compatibilityGroupJ) {
this.compatibilityGroupJ = compatibilityGroupJ;
}
}
4 changes: 2 additions & 2 deletions src/main/resources/views/CommercialVehicles/ADR_PASS.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@
<p>10.2 In the case of a tank-vehicle/battery vehicle</p>
</div>
<div class= "floatValues">
{{#if adrData.isExplosivesType2}}
{{#if adrData.showCatJInclusion}}
<p>(<img src="{{root}}/assets/images/tick.png" alt="tick" class="tick" id="tick"/>) goods of Class 1 including compatibility group J</p>
{{else}}
<p>( ) goods of Class 1 including compatibility group J</p>
{{/if}}
{{#if adrData.isExplosivesType3}}
{{#if adrData.showCatJExclusion}}
<p>(<img src="{{root}}/assets/images/tick.png" alt="tick" class="tick" id="tick"/>) goods of Class 1 excluding compatibility group J</p>
{{else}}
<p>( ) goods of Class 1 excluding compatibility group J</p>
Expand Down

0 comments on commit c813381

Please sign in to comment.