<html lang="en">
<head>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<!-- <link rel="stylesheet" href="/css/styles.css"> -->
<title>Calculator (v2.9)</title>
</head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
@font-face{
font-family: Hamlin-Regular;
src: url(/assets/Hamlin-Regular.ttf);
}
@font-face{
font-family: Hamlin-Bold;
src: url(/assets/Hamlin-Bold.ttf);
}
:root {
--btn-shadow:
0px 3px 4px -2px rgba(30, 30, 60, 0.10),
0px 4px 15px -4px rgba(30,30,60,0.10),
0px 6px 50px -4px rgba(30,30,60,0.10);
}
.embed-nav {
display: none;
}
.embed-footer {
display: none;
}
body {
display: flex;
align-items: center;
justify-content: center;
background-size: cover;
background-position: 40%;
margin: 5px;
/* background-image: url('https://images.pexels.com/photos/6850486/pexels-photo-6850486.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260');*/
background-color: rgb(44, 50, 63);
}
#calculatorForm {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
.darkOverlay {
position: absolute;
width: 100%;
height: 150%;
background-color: rgba(0, 0, 0, 0.1);
}
.calculator {
display: flex;
align-items: center;
width: 95%;
max-width: 450px;
justify-content: center;
flex-direction: column;
padding: 0.3em 0em 1.5em 0em;
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 20px;
background: rgba(255, 255, 255, 0.692);
backdrop-filter: blur(100px) saturate(250%) brightness(100%);
font-family: 'Hamlin-Regular', 'Segoe UI', 'Tahoma';
box-shadow:
2px 2px 10px -4px rgba(30,30,60,0.2),
2px 4px 25px -4px rgba(30,30,60,0.25),
4px 4px 50px -4px rgba(30,30,60,0.25);
}
.separators {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.calculator label {
font-size: 16px;
}
input[type=number]::inner-spin-button,
input[type=number]::outer-spin-button, input[type=text]::inner-spin-button,
input[type=text]::outer-spin-button {
appearance: none;
margin: 0;
}
input[type="radio"] {
display: none;
}
.logoDiv {
display: flex;
align-items: center;
justify-content: center;
top: 0px;
width: 100%;
}
#logo {
display: none;
width: 64px;
margin: 0px 0px 10px 0px;
}
h1 {
letter-spacing: 0.7rem;
font-weight: 300;
font-size: 0.9rem;
text-align: center;
margin: 0.5em 1.2em -0.3em 1.2em;
}
h3 {
letter-spacing: 0.3rem;
font-size: 1.0rem;
font-weight: 700;
margin-top: 0;
background-color: #212538d5;
color: transparent;
text-shadow: 0px 0.6px 0px rgba(255, 255, 255, 0.178);
background-clip: text;
background-clip: text;
background-clip: text;
}
h4 {
margin: 2px;
color: rgb(53, 53, 53);
letter-spacing: 0.08rem;
font-size: 0.9rem;
font-weight: 900;
background-color: #212538;
color: transparent;
text-shadow: 0px 0.6px 0px rgba(255, 255, 255, 0.116);
background-clip: text;
background-clip: text;
background-clip: text;
}
hr {
width: 90%;
height: 1px;
border-radius: 50px;
background: #00000021;
box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.287);
border: none;
margin: 1rem 0rem;
}
.containerh3 {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
}
/* ------------------ QUOTE TYPE ------------------ */
.quoteType {
box-sizing: border-box;
display: flex;
flex: row;
justify-content: center;
align-items: center;
}
.quoteType img {
display: none;
}
.quoteType label {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 0.65rem;
cursor: pointer;
width: 6.5rem;
height: 32px;
margin: 0px 6px;
border-radius: 20px;
border: 1px solid rgba(255, 255, 255, 0.2);
background: #ffffff4f;
color: rgb(46, 46, 46);
letter-spacing: 0.1rem;
font-weight: 600;
text-align: center;
line-height: 1.3rem;
padding: 0.4em 0.8em;
transition: 0.15s ease-in-out;
box-shadow: var(--btn-shadow);
user-select: none;
}
/* ------------------ SHAPE TYPE ------------------ */
.shapeDims {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.shapeTypeContainer {
display: flex;
align-items: center;
justify-content: space-evenly;
flex-direction: column;
width: 22%;
}
.shapeType /*buttons*/ {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
user-select: none;
}
.measurementType /*buttons*/ {
display: flex;
align-items: center;
justify-content: center;
flex-direction: row;
user-select: none;
}
.shapeType > label {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 0.65rem;
cursor: pointer;
width: 100px;
height: 20px;
margin: 8px;
border-radius: 50px;
border: 1px solid rgba(255, 255, 255, 0.2);
background: #ffffff4f;
color: rgb(46, 46, 46);
letter-spacing: 0.12rem;
font-weight: 600;
padding: 0.5rem 0rem;
transition: 0.15s;
box-shadow: var(--btn-shadow);
}
/* ------------------ MEASUREMENT TYPE ------------------ */
.dimensionsContainer {
display: flex;
align-items: center;
justify-content: center;
}
.measurementType > label {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0px 8px;
font-size: 0.65rem;
cursor: pointer;
width: 100px;
height: 20px;
border-radius: 50px;
border: 1px solid rgba(255, 255, 255, 0.2);
background: #ffffff4f;
color: rgb(46, 46, 46);
letter-spacing: 0.12rem;
font-weight: 600;
padding: 0.5rem 0rem;
transition: 0.15s;
box-shadow: var(--btn-shadow);
}
.measurementInput {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-top: 20px;
gap: 12px;
}
/* ------------------ METERAGE ------------------ */
#meterageContainer {
display: flex;
align-items: center;
justify-content: center;
}
/* ------------------ EXTRAS ------------------ */
.checkboxesContainer {
display: flex;
align-items: center;
justify-content: center;
}
.extrasInput {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr);
align-items: center;
justify-items: center;
gap: 12px;
}
.extrasInput div label {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.extrasInput div label input[type="checkbox"]{
display: none;
}
.extrasInput div label span {
display: flex;
align-items: center;
justify-content: center;
position: relative;
background: #ffffff4f;
width: 100px;
height: 20px;
font-size: 0.7rem;
letter-spacing: 0.07rem;
font-weight: 700;
text-align: center;
line-height: 0.8rem;
padding: 1.25em 0.5rem;
border: 1px solid rgba(255, 255, 255, 0.2);
background: #ffffff4f;
color: rgb(46, 46, 46);
border-radius: 20px;
user-select: none;
overflow: hidden;
box-shadow: var(--btn-shadow);
transition: 0.15s
}
.extrasInput div label input[type="checkbox"]:checked ~ span{
background: linear-gradient(65deg, #252d3a 0%, #2c3351 50%, #2e3b58 100%);
color: white;
border: 1px solid #8e9ee79d;
}
#freeStockinette {
display: none;
align-items: center;
justify-content: center;
font-style: italic;
font-size: 0.8rem;
font-weight: 500;
letter-spacing: 0.3rem;
margin: 24px;
background-color: #212538;
color: transparent;
text-shadow: 0px 0.6px 0px rgba(255, 255, 255, 0.205);
background-clip: text;
background-clip: text;
background-clip: text;
}
/* ------------------ VIEWS --------------------- */
.views {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 100%;
margin-bottom: 16px;
}
/* ------------------ FINAL TOTAL ------------------ */
.price {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.priceItems {
display: flex;
flex-direction: row;
justify-content: center;
gap: 1.5rem;
font-size: 0.8rem;
text-shadow:
0px 2px 6px rgba(0, 0, 0, 0.1),
0px 4px 20px rgba(0, 0, 0, 0.1);
width: 100%;
}
#summaryLeft, #summaryRight {
display: flex;
flex-direction: column;
padding: 0.6rem;
width: 10rem;
text-align: center;
background: rgba(36, 47, 70, 0.226);
align-items: center;
justify-content: center;
border: 2px solid rgba(56, 65, 81, 0.26);
border: none;
border-radius: 20px;
box-shadow:
inset 0px 1px 0px 0px rgba(30, 30, 60, 0.1),
inset 0px 2px 2px 0px rgba(30, 30, 60, 0.23),
inset 0px 3px 5px 1px rgba(30, 30, 60, 0.18),
0px 1px 0px 0px rgba(255, 255, 255, 0.3);
}
.finalTotal {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.finalTotal h3 {
font-size: 1.3rem;
color: #ffffff;
text-shadow:
0px 1px 2px rgba(0, 0, 0, 0.5),
0px 2px 6px rgba(0, 0, 0, 0.3),
0px 4px 20px rgba(0, 0, 0, 0.240);
}
/* ------------------ FINAL TOTAL ------------------ */
.extrasInput div label span:hover, .shapeType label:hover, .measurementType label:hover, .quoteType label:hover {
transform: scale(110%);
background: rgba(255, 255, 255, 0.514);
}
input[type="radio"]:checked + label {
background: linear-gradient(65deg, #252d3a 0%, #2c3351 50%, #2e3b58 100%);
color: white;
border: 1px solid #8e9ee79d;
}
#disclaimer {
font-size: 0.9rem;
padding: 1.5em 2em;
}
input[type="number"]::placeholder {
color: rgb(53, 53, 53);
letter-spacing: 0.08rem;
font-size: 0.6rem;
font-weight: 900;
background-color: #212538;
color: transparent;
text-shadow: 0px 0.6px 0px rgba(255, 255, 255, 0.116);
background-clip: text;
background-clip: text;
background-clip: text;
transform: translateY(-3px);
}
input[type="number"], input[type="text"] {
width: 72px;
height: 36px;
text-align: center;
text-align: white;
background: rgba(36, 47, 70, 0.226);
align-items: center;
justify-content: center;
border: 2px solid rgba(56, 65, 81, 0.26);
border: none;
border-radius: 20px;
/* padding: 0.8em 1.2em 0.8em 1.2em; */
box-shadow:
inset 0px 1px 0px 0px rgba(30, 30, 60, 0.1),
inset 0px 2px 2px 0px rgba(30, 30, 60, 0.23),
inset 0px 3px 5px 1px rgba(30, 30, 60, 0.18),
0px 1px 0px 0px rgba(255, 255, 255, 0.3);
}
input, select, textarea{
height: 100%;
color: #ffffff;
font-family: 'Montserrat';
font-size: 1.1rem;
letter-spacing: 0.12rem;
text-shadow:
0px 0.5px 2px rgba(0, 0, 0, 0.2),
0px 1.5px 3px rgba(0, 0, 0, 0.25),
0px 2.5px 6px rgba(0, 0, 0, 0.346);
}
.typeBtn img {
width: 85%;
}
.summary {
letter-spacing: 0.1rem;
}
/* MOBILE VIEW */
@media only screen and (min-width:320px) and (max-width:519px) {
body {
margin: 0px;
}
.calculator {
border-radius: 0px;
}
.quoteType{
flex-direction: column;
margin: 0px;
}
.quoteType label {
width: 100%;
font-size: 1rem;
margin: 8px;
}
.shapeDims {
flex-direction: column;
gap: 0px;
}
input[type="number"], input[type="text"] {
width: 12rem;
height: 2.5rem;
text-align: center;
text-align: white;
background: rgba(36, 47, 70, 0.226);
align-items: center;
justify-content: center;
border: 2px solid rgba(56, 65, 81, 0.26);
border: none;
box-shadow:
inset 0px 1px 0px 0px rgba(30, 30, 60, 0.1),
inset 0px 2px 2px 0px rgba(30, 30, 60, 0.23),
inset 0px 3px 5px 1px rgba(30, 30, 60, 0.18),
0px 1px 0px 0px rgba(255, 255, 255, 0.3);
}
input[type="number"]::placeholder {
color: rgb(53, 53, 53);
font-size: 1rem;
background-color: #212538;
color: transparent;
text-shadow: 0px 0.6px 0px rgba(255, 255, 255, 0.205);
background-clip: text;
background-clip: text;
background-clip: text;
}
hr {
position: relative;
width: 90%;
}
.priceItems {
gap: 0.9rem;
}
.measurementInput {
flex-direction: column;
gap: 14px;
margin-bottom: 8px;
}
.measurementType > label {
width: 104px;
font-size: 0.8rem;
margin: 8px;
}
.shapeType > label {
width: 200px;
height: 32px;
border-radius: 20px;
font-size: 1rem;
padding: 0.4rem 0.8rem;
margin: 8px;
}
.extrasInput {
grid-template-columns: repeat(2, 1fr);
gap: 14px;
margin: 8px;
}
.extrasInput div label span {
font-size: 0.9rem;
width: 7.5rem;
height: 1rem;
line-height: 1rem;
}
.priceItems {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 8px;
}
}
</style>
<body>
<div class="calculator">
<div class="calcSplit">
<div id="calcLeft">
<div class="priceCalculator">
<h1>PRICE CALCULATOR</h1>
</div>
<div class="separators">
<hr/>
</div>
<form id="calculatorForm" onChange="costCalc()">
<div class="quoteType">
<input type="radio" id="foamAndCover" name="quoteType" value="foamAndCover" checked="checked"/>
<label for="foamAndCover">
FOAM & COVER
</label>
<input type="radio" id="foamOnly" name="quoteType" value="foamOnly"/>
<label for="foamOnly">
FOAM ONLY
</label>
<input type="radio" id="coverOnly" name="quoteType" value="coverOnly"/>
<label for="coverOnly">
COVER ONLY
</label>
</div>
<hr/>
<div class="shapeDims">
<div class="shapeTypeContainer">
<!-- <div class="containerh3">
<h3>Shape</h3>
</div> -->
<div class="shapeType float-right">
<input type="radio" id="boxShape" name="shapeType" value="boxShape" checked="checked" />
<label for="boxShape">BOX</label>
<input type="radio" id="shapedShape" name="shapeType" value="shapedShape" />
<label for="shapedShape">SHAPED</label>
</div>
</div>
<div class="dimensionsContainer">
<div class="measurementTypeContainer">
<!-- <div class="containerh3">
<h3>Dimensions</h3>
</div> -->
<div class="measurementType">
<input type="radio" id="cmMeasurement" name="measurementType" value="cmMeasurement" checked="checked" />
<label for="cmMeasurement">CM</label>
<input type="radio" id="inchesMeasurement" name="measurementType" value="inchesMeasurement" />
<label for="inchesMeasurement">INCHES</label>
</div>
<div class="measurementInput">
<input type="number" id="lengthInput" name="measurementInput" value="" placeholder="Length" step="0.01" onKeyup="costCalc()" />
<input type="number" id="widthInput" name="measurementInput" value="" placeholder="Width" step="0.01" onKeyup="costCalc()" />
<input type="number" id="depthInput" name="measurementInput" value="" placeholder="Thickness" step="0.01" onKeyup="costCalc()" />
</div>
<div id="meterageContainer">
<h4 id="meterageOutput">1m</h4>
</div>
</div>
</div>
</div>
<hr id="wideSeparator" />
<div class="containerh3">
<!-- <h3>Extras</h3> -->
</div>
<div class="checkboxesContainer">
<div class="extrasInput">
<!-- <div class="extraCheckbox" id="pipingDisplay">
<label for="pipingExtra">
<input type="checkbox" id="pipingExtra" name="extrasInput" value="pipingExtra" />
<span>Piping</span>
</label>
</div> -->
<div class="extraCheckbox" id="buttonsDisplay">
<label for="buttonsExtra">
<input type="checkbox" id="buttonsExtra" name="extrasInput" value="buttonsExtra" />
<span>Buttons</span>
</label>
</div>
<div class="extraCheckbox" id="waddingDisplay">
<label for="waddingExtra">
<input type="checkbox" id="waddingExtra" name="extrasInput" value="waddingExtra" />
<span>Polyester Wadding</span>
</label>
</div>
<div class="extraCheckbox" id="tiesDisplay">
<label for="tiesExtra">
<input type="checkbox" id="tiesExtra" name="extrasInput" value="tiesExtra" />
<span>Fabric Ties</span>
</label>
</div>
<div class="extraCheckbox" id="velcroDisplay">
<label for="velcroExtra">
<input type="checkbox" id="velcroExtra" name="extrasInput" value="velcroExtra" />
<span>Velcro</span>
</label>
</div>
<div class="extraCheckbox" id="antislipDisplay">
<label for="antislipExtra">
<input type="checkbox" id="antislipExtra" name="extrasInput" value="antislipExtra" />
<span>Anti-Slip Rubber</span>
</label>
</div>
<div class="extraCheckbox" id="plywoodDisplay">
<label for="plywoodExtra">
<input type="checkbox" id="plywoodExtra" name="extrasInput" value="plywoodExtra" />
<span>Plywood</span>
</label>
</div>
</div>
</div>
<div id="freeStockinette">
<p1>Free stockinette included</p1>
</div>
<hr id="wideSeparator" />
<div class="measurementTypeContainer">
<!-- <div class="containerh3">
<h3>Dimensions</h3>
</div> -->
<!-- <div class="viewsContainer">
<div class="views">
<input type="radio" id="smpView" name="views" value="smpView" checked="checked" />
<label for="smpView">Simple</label>
<input type="radio" id="advView" name="views" value="advView" />
<label for="smpView">Advanced</label>
</div>
</div> -->
<!-- <hr>
<div class="finalTotal">
<h3>TOTAL: £<span id="finalPrice"></span></h3>
</div>
</div>
<div id="disclaimer" style="display: none">
<p1>*Price is based on any of our low range fabrics, medium or high range fabric cost will differ</p1>
</div> -->
</form>
</div>
</div>
<div id="calcRight">
<div class="price">
<div class="priceItems" id="calcRight">
<div id="summaryLeft">
<div class="summary priceTotal">
<h4>Price: £<span id="totalPrice"></span></h4>
</div>
<div class="summary" id="pipedDisplay">
<h4>Piped: £<span id="pipedPrice"></span></h4>
</div>
<div class="summary deliveryTotal">
<h4>Delivery: £<span id="totalDeliveryPrice"></span></h4>
</div>
<!-- <div class="summary unpipedTotal">
<h4>Total: £<span id="totalUnpipedPrice"></span></h4>
</div>
<div class="summary pipedTotal">
<h4>Total Piped: £<span id="totalPipedPrice"></span></h4>
</div> -->
</div>
<div id="summaryRight">
<div class="foamTypes summary">
<h4>Reflex: £<span id="greyFoamPrice"></span></h4>
<h4>Topper: £<span id="topperPrice"></span></h4>
<h4>Quick-Dry: £<span id="quickFoamPrice"></span></h4>
</div>
</div>
</div>
</div>
</div>
<script>
const piping = document.getElementById("pipingDisplay");
const buttons = document.getElementById("buttonsDisplay");
const wadding = document.getElementById("waddingDisplay");
const ties = document.getElementById("tiesDisplay");
const velcro = document.getElementById("velcroDisplay");
const antislip = document.getElementById("antislipDisplay");
const plywood = document.getElementById("plywoodDisplay");
const foamPrices = document.getElementById("summaryRight");
const meterageOutput = document.getElementById("meterageOutput");
// const pipedDisplay = document.getElementById("pipedDisplay");
let totalPrice = document.getElementById("totalPrice");
let totalDeliveryPrice = document.getElementById("totalDeliveryPrice");
let finalPrice = document.getElementById("finalPrice");
let pipedPrice = document.getElementById("pipedPrice");
let greyPrice = document.getElementById("greyFoamPrice");
let topperPrice = document.getElementById("topperPrice");
let quickPrice = document.getElementById("quickFoamPrice");
let foamPrice = 0;
let coverPrice = 0;
let length = 0.0;
let width = 0.0;
let depth = 0.0;
////////////////////////////////////////////
let lengthCalc = document
.getElementById("lengthInput")
.addEventListener("keyup", (e) => {
lengthCalc = parseFloat(e.target.value);
length = lengthCalc;
lengthMetreage = lengthCalc
});
let widthCalc = document
.getElementById("widthInput")
.addEventListener("keyup", (e) => {
widthCalc = parseFloat(e.target.value);
width = widthCalc;
});
let depthCalc = document
.getElementById("depthInput")
.addEventListener("keyup", (e) => {
depthCalc = parseFloat(e.target.value);
depth = depthCalc;
});
let currentPrice = 0;
totalPrice.textContent = 0;
totalDeliveryPrice.textContent = 0;
greyPrice.textContent = 0;
topperPrice.textContent = 0;
quickPrice.textContent = 0;
pipedPrice.textContent = 0;
finalPrice.textContent = 0;
function quoteTypeImage() {
const foamAndCoverImage = document.getElementById("foamAndCover");
const foamImage = document.getElementById("foamOnly");
const CoverImage = document.getElementById("coverOnly");
// let typeImages = document.getElementById('typeImages');
// if (foamAndCoverImage.checked) {
// typeImages.src = "https://static.wixstatic.com/media/0eaffa_be74d96f40394d50ae6d320882fbcc76~mv2.png";
// }
// if (foamImage.checked) {
// typeImages.src = "https://static.wixstatic.com/media/0eaffa_97375db50a504235b3a8370be0151ed8~mv2.png";
// }
// if (CoverImage.checked) {
// typeImages.src = "https://static.wixstatic.com/media/0eaffa_165a97420cd84693907fb24cc461f991~mv2.png";
// }
};
function costCalc() {
meterageCalc()
if (cmMeasurement.checked) {
foamPrice = ((length / 2.54) * (width / 2.54) * (depth / 2.54)) * 0.009;
} else if (inchesMeasurement.checked) {
foamPrice = ((length * width * depth)) * 0.009;
}
if (foamPrice < 10) {
foamPrice = 10;
}
if (cmMeasurement.checked) {
if (width < 66.04) {
coverPrice = (length / 2.54) + 5;
} else if (width >= 66.04 && width < 91.44) {
coverPrice = (length / 2.54) + 15;
} else if (width >= 91.44 && width < 116.84) {
coverPrice = (length / 2.54) + 25;
} else if (width >= 116.84 && width < 142.24) {
coverPrice = (length / 2.54) + 35;
}
} else if (inchesMeasurement.checked) {
if (width < 26) {
coverPrice = length + 5;
} else if (width >= 26 && width < 36) {
coverPrice = length + 15;
} else if (width >= 36 && width < 46) {
coverPrice = length + 25;
} else if (width >= 46 && width < 56) {
coverPrice = length + 35;
}
}
if (coverPrice < 25) {
coverPrice = 25;
}
if (foamOnly.checked) {
currentPrice = foamPrice + (foamPrice * 0.06);
console.log(currentPrice);
} else if (coverOnly.checked) {
currentPrice = coverPrice;
console.log(currentPrice);
} else {
currentPrice = (foamPrice + coverPrice + (foamPrice * 0.06));
console.log(currentPrice);
}
if (shapedShape.checked && (foamOnly.checked || coverOnly.checked)) {
currentPrice = currentPrice + 20;
} else if (shapedShape.checked && foamAndCover.checked && cmMeasurement.checked && length < 100) {
currentPrice = currentPrice + 20;
} else if (shapedShape.checked && foamAndCover.checked && cmMeasurement.checked && length >= 100) {
currentPrice = currentPrice + 40;
} else if (shapedShape.checked && foamAndCover.checked && inchesMeasurement.checked && length < 39) {
currentPrice = currentPrice + 20;
} else if (shapedShape.checked && foamAndCover.checked && inchesMeasurement.checked && length >= 39) {
currentPrice = currentPrice + 40;
}
if (foamOnly.checked) {
buttonsExtra.checked = false;
tiesExtra.checked = false;
velcroExtra.checked = false;
buttons.style.display = "none";
wadding.style.display = "block";
ties.style.display = "none";
velcro.style.display = "none";
foamPrices.style.display = "flex";
plywood.style.display = "none";
} else if (coverOnly.checked) {
buttonsExtra.checked = false;
waddingExtra.checked = false;
buttons.style.display = "none";
wadding.style.display = "none";
ties.style.display = "block";
velcro.style.display = "block";
foamPrices.style.display = "none";
plywood.style.display = "none";
} else {
buttons.style.display = "block";
wadding.style.display = "block";
ties.style.display = "block";
velcro.style.display = "block";
foamPrices.style.display = "flex";
plywood.style.display = "block";
}
// WADDING
if (cmMeasurement.checked) {
if (waddingExtra.checked && length < 100) {
currentPrice = currentPrice + 12;
} else if (waddingExtra.checked && length >= 100 && length < 120) {
currentPrice = currentPrice + 14;
} else if (waddingExtra.checked && length >= 120 && length < 180) {
currentPrice = currentPrice + 16;
} else if (waddingExtra.checked && length > 180) {
currentPrice = currentPrice + 18;
}
} else if (inchesMeasurement.checked) {
if (waddingExtra.checked && length < 40) {
currentPrice = currentPrice + 12;
} else if (waddingExtra.checked && length >= 40 && length < 50) {
currentPrice = currentPrice + 14;
} else if (waddingExtra.checked && length >= 50 && length < 70) {
currentPrice = currentPrice + 16;
} else if (waddingExtra.checked && length >= 70) {
currentPrice = currentPrice + 18;
}
}
// PIPING
// if (pipingExtra.checked && boxShape.checked) {
// currentPrice = currentPrice + (coverPrice * 0.55);
// } else if ((shapedShape.checked && (coverOnly.checked || foamAndCover.checked) && pipingExtra.checked)) {
// currentPrice = currentPrice + ((coverPrice + 20) * 0.55);
// }
// BUTTONS
if (cmMeasurement.checked) {
if (buttonsExtra.checked && length < 100) {
currentPrice = currentPrice + 35;
} else if (buttonsExtra.checked && length >= 100) {
currentPrice = currentPrice + 45;
}
} else if (inchesMeasurement.checked) {
if (buttonsExtra.checked && length < 39) {
currentPrice = currentPrice + 35;
} else if (buttonsExtra.checked && length >= 39) {
currentPrice = currentPrice + 45;
}
}
// VELCRO
if (cmMeasurement.checked) {
if (velcroExtra.checked && length < 110) {
currentPrice = currentPrice + 10;
} else if (velcroExtra.checked && length >= 110 && length < 160) {
currentPrice = currentPrice + 15;
} else if (velcroExtra.checked && length >= 160 && length < 210) {
currentPrice = currentPrice + 20;
} else if (velcroExtra.checked && length > 210 ) {
currentPrice = currentPrice + 25;
}
} else if (inchesMeasurement.checked) {
if (velcroExtra.checked && length < 43) {
currentPrice = currentPrice + 10;
} else if (velcroExtra.checked && length >= 43 && length < 63) {
currentPrice = currentPrice + 15;
} else if (velcroExtra.checked && length >= 63 && length < 82) {
currentPrice = currentPrice + 20;
} else if (velcroExtra.checked && length >= 82) {
currentPrice = currentPrice + 25;
}
}
// ANTISLIP
if (cmMeasurement.checked) {
if (antislipExtra.checked && length < 110) {
currentPrice = currentPrice + 10;
} else if (antislipExtra.checked && length >= 110 && length < 160) {
currentPrice = currentPrice + 15;
} else if (antislipExtra.checked && length >= 160 && length < 210) {
currentPrice = currentPrice + 20;
} else if (antislipExtra.checked && length > 210 ) {
currentPrice = currentPrice + 25;
}
} else if (inchesMeasurement.checked) {
if (antislipExtra.checked && length < 43) {
currentPrice = currentPrice + 10;
} else if (antislipExtra.checked && length >= 43 && length < 63) {
currentPrice = currentPrice + 15;
} else if (antislipExtra.checked && length >= 63 && length < 82) {
currentPrice = currentPrice + 20;
} else if (antislipExtra.checked && length >= 82) {
currentPrice = currentPrice + 25;
}
}
// PLYWOOD
if (plywoodExtra.checked) {
currentPrice = currentPrice + 110;
}
// TIES
if (tiesExtra.checked) {
currentPrice = currentPrice + 10;
}
// DELIVERY
if (coverOnly.checked) {
totalDeliveryPrice.textContent = 12;
totalDelivery = 12;
}
if (cmMeasurement.checked) {
if (length < 180 && (foamOnly.checked || foamAndCover.checked)) {
totalDeliveryPrice.textContent = 15;
totalDelivery = 15;
} else if (length >= 180 && (foamOnly.checked || foamAndCover.checked)) {
totalDeliveryPrice.textContent = 20;
totalDelivery = 20;
}
} else if (inchesMeasurement.checked) {
if (length < 70 && (foamOnly.checked || foamAndCover.checked)) {
totalDeliveryPrice.textContent = 15;
totalDelivery = 15;
} else if (length >= 70 && (foamOnly.checked || foamAndCover.checked)) {
totalDeliveryPrice.textContent = 20;
totalDelivery = 20;
}
}
// PRICES
// REFLEX
if (foamOnly.checked) {
greyPrice.textContent = parseInt(foamPrice + (foamPrice * 0.63));
} else if (foamAndCover.checked) {
greyPrice.textContent = parseInt(foamPrice * 0.47);
}
if (greyPrice.textContent < 20) {
greyPrice.textContent = 20;
}
//TOPPER
if (cmMeasurement.checked) {
if (length < 100) {
topperPrice.textContent = 10;
} else if (length >= 100 && length < 200) {
topperPrice.textContent = 20;
} else if (length >= 200) {
topperPrice.textContent = 30;
}
} else if (inchesMeasurement.checked) {
if (length < 39) {
topperPrice.textContent = 10;
} else if (length >= 39 && length < 78) {
topperPrice.textContent = 20;
} else if (length >= 78) {
topperPrice.textContent = 30;
}
}
//QUICK-DRY
quickPrice.textContent = parseInt(foamPrice + (foamPrice * 0.96));
if (quickPrice.textContent < 20) {
quickPrice.textContent = 20;
}
//CURRENT PRICE
currentPrice = currentPrice + (currentPrice * 0.1);
//PIPED
if (foamAndCover.checked) {
pipedPrice.textContent = parseInt(currentPrice + (coverPrice * 0.82));
} else if (coverOnly.checked) {
pipedPrice.textContent = parseInt(currentPrice + (currentPrice * 0.75));
}
//TOTAL PRICE
totalPrice.textContent = parseInt(currentPrice);
finalPrice.textContent = parseInt(totalDelivery + currentPrice);
}
function meterageCalc() {
lengthMetreage = lengthCalc;
widthCheck();
lengthMetreage = lengthMetreage * widthMulti;
fabricMeterage();
meterageOutput.textContent = `${meterage}m`;
console.log(
`calculating..., ${meterage}m, ${length} x ${width}, ${widthMulti}`
);
}
function widthCheck() {
if (cmMeasurement.checked) {
if (width <= 57) {
widthMulti = 1;
} else if (width >= 58) {
widthMulti = 2;
} else {
widthMulti = 1;
}
} else if (inchesMeasurement.checked) {
if (width <= 22) {
widthMulti = 1;
} else if (width >= 23) {
widthMulti = 2;
} else {
widthMulti = 1;
}
}
return widthMulti
}
function fabricMeterage() {
if (cmMeasurement.checked) {
if (lengthMetreage >= 494) {
meterage = 5.5;
} else if (lengthMetreage >= 444) {
meterage = 5;
} else if (lengthMetreage >= 394) {
meterage = 4.5;
} else if (lengthMetreage >= 344) {
meterage = 4;
} else if (lengthMetreage >= 294) {
meterage = 3.5;
} else if (lengthMetreage >= 244) {
meterage = 3;
} else if (lengthMetreage >= 194) {
meterage = 2.5;
} else if (lengthMetreage >= 144) {
meterage = 2;
} else if (lengthMetreage >= 94) {
meterage = 1.5;
} else {
meterage = 1;
}
} else if (inchesMeasurement.checked) {
if (lengthMetreage >= 194) {
meterage = 5.5;
} else if (lengthMetreage >= 174) {
meterage = 5;
} else if (lengthMetreage >= 135) {
meterage = 4.5;
} else if (lengthMetreage >= 344) {
meterage = 4;
} else if (lengthMetreage >= 115) {
meterage = 3.5;
} else if (lengthMetreage >= 96) {
meterage = 3;
} else if (lengthMetreage >= 76) {
meterage = 2.5;
} else if (lengthMetreage >= 56) {
meterage = 2;
} else if (lengthMetreage >= 37) {
meterage = 1.5;
} else {
meterage = 1;
}
}
return meterage;
}
$("input[type=number]").on("mousewheel", function (e) {
$(e.target).blur();
});
</script>
</body>
<!-- <script src="/js/javascript.js"></script> -->
</html>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.