CSR-1384: remove old copy of add-vaps-modal-buttons again... DIE! DIE
This commit is contained in:
parent
83099186e0
commit
4302dc0f43
1 changed files with 0 additions and 108 deletions
|
|
@ -1,108 +0,0 @@
|
||||||
<template>
|
|
||||||
<transition name="fade" mode="out-in">
|
|
||||||
<div class="add-vaps-buttons" aria-live="polite" v-if="isDisplayed">
|
|
||||||
<buttonQuestion
|
|
||||||
ref="buttonQuestion"
|
|
||||||
:answers="answersToDisplay"
|
|
||||||
groupName="addVaps"
|
|
||||||
v-model="selectedValues"
|
|
||||||
buttonTypeString="addVapsButton"
|
|
||||||
:buttonTypeObject="addVapsButton"
|
|
||||||
:isWide="answersToDisplay.length > 1 ? false : true" />
|
|
||||||
</div>
|
|
||||||
</transition>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import buttonQuestion from "@/digital-components/button-question/button-question";
|
|
||||||
import addVapsButton from "./add-vaps-button/add-vaps-button";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "add-vaps-modal-buttons",
|
|
||||||
props: {
|
|
||||||
cartItems: Object,
|
|
||||||
vapsTilesCmsName: String,
|
|
||||||
availableLineItems: Object,
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
addVapsButton: addVapsButton,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
selectedValues: {
|
|
||||||
get: function () {
|
|
||||||
return this.answersToDisplay;
|
|
||||||
},
|
|
||||||
set: function (newValue) {
|
|
||||||
// TODO - emit event to open modal
|
|
||||||
},
|
|
||||||
},
|
|
||||||
isDisplayed() {
|
|
||||||
return this.showAddRainDefense || this.showAddWipers;
|
|
||||||
},
|
|
||||||
showAddRainDefense() {
|
|
||||||
// if not found in the cart
|
|
||||||
return !this.cartItems.some((vap) => {
|
|
||||||
return vap?.partType === "RAIN DEFENSE";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
showAddWipers() {
|
|
||||||
// if not found in the cart
|
|
||||||
return !this.cartItems.some((vap) => {
|
|
||||||
return vap?.partType?.includes(" WIPER");
|
|
||||||
});
|
|
||||||
},
|
|
||||||
rainDefensePrice() {
|
|
||||||
// const lineItem = this.rainDefenseItem;
|
|
||||||
const lineItem = this.availableLineItems.find((item) => {
|
|
||||||
return item.partType === "RAIN DEFENSE";
|
|
||||||
});
|
|
||||||
|
|
||||||
const price = lineItem?.laborAmount + lineItem?.sellingPrice + lineItem?.kitPrice;
|
|
||||||
return parseFloat(price).toFixed(2);
|
|
||||||
},
|
|
||||||
wipersPrice() {
|
|
||||||
let price = 0;
|
|
||||||
const lineItems = this.availableLineItems.filter((item) => {
|
|
||||||
return item.partType.includes(" WIPER");
|
|
||||||
});
|
|
||||||
lineItems?.forEach((item) => {
|
|
||||||
price += item?.laborAmount + item?.sellingPrice + item?.kitPrice;
|
|
||||||
});
|
|
||||||
return parseFloat(price).toFixed(2);
|
|
||||||
},
|
|
||||||
answersCmsData() {
|
|
||||||
return this.getCmsContent(this.vapsTilesCmsName, "Answers");
|
|
||||||
},
|
|
||||||
answersToDisplay() {
|
|
||||||
const answers = [];
|
|
||||||
if (!this.answersCmsData) return answers;
|
|
||||||
|
|
||||||
const getAnswer = (name, answers) => {
|
|
||||||
const answerIndex = answers.findIndex((answer) => {
|
|
||||||
return answer.Name === name;
|
|
||||||
});
|
|
||||||
return answers[answerIndex];
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.showAddWipers) {
|
|
||||||
const answer = getAnswer("WipersModal", this.answersCmsData);
|
|
||||||
answer.SubText = "+$" + this.wipersPrice;
|
|
||||||
answers.push(answer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (this.showAddRainDefense) {
|
|
||||||
// const answer = getAnswer("RainDefenseModal", this.answersCmsData);
|
|
||||||
// answer.SubText = "+$" + this.rainDefensePrice;
|
|
||||||
// answers.push(answer);
|
|
||||||
// }
|
|
||||||
|
|
||||||
return answers;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
buttonQuestion,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
Loading…
Reference in a new issue