Check for windshield damage before adding section to block
This commit is contained in:
parent
b5c5fa2a6c
commit
8451523a24
1 changed files with 24 additions and 7 deletions
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
<script>
|
||||
import reviewBlock from "@/layouts/review/review-block/review-block";
|
||||
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
||||
|
||||
export default {
|
||||
name: "damage-review",
|
||||
|
|
@ -24,13 +25,29 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
displayContent() {
|
||||
return [
|
||||
this.damage.isRepair
|
||||
? `Windshield repair - ${this.damage.numberOfChips} chip${
|
||||
this.damage.numberOfChips !== 1 ? "s" : ""
|
||||
}`
|
||||
: "Windshield crack",
|
||||
];
|
||||
let linesToDisplay = [];
|
||||
if (this.hasWindshieldDamage) {
|
||||
linesToDisplay.push(this.windshieldString);
|
||||
}
|
||||
|
||||
return linesToDisplay;
|
||||
},
|
||||
hasWindshieldDamage() {
|
||||
return (
|
||||
this.damage.isRepair ||
|
||||
this.damage.glassToReplace?.some(
|
||||
(glass) => glass.glassLocation === damageLocationsSelected.WINDSHIELD
|
||||
)
|
||||
);
|
||||
},
|
||||
windshieldString() {
|
||||
if (this.damage.isRepair) {
|
||||
return `Windshield repair - ${this.damage.numberOfChips} chip${
|
||||
this.damage.numberOfChips !== 1 ? "s" : ""
|
||||
}`;
|
||||
} else {
|
||||
return "Windshield crack";
|
||||
}
|
||||
},
|
||||
},
|
||||
components: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue