This commit is contained in:
Max Hunt 2020-04-24 23:24:25 +01:00
parent f0f2bb239d
commit 9c105c7904
5 changed files with 41 additions and 7 deletions

View File

@ -69,7 +69,7 @@
<div class="npf-short"> <div class="npf-short">
<input required type="text" id="pPrice" placeholder="Price £"> <input required type="text" id="pPrice" placeholder="Price £">
</div> </div>
<button id="pSend" onclick={productSubmutEventHandler()}>Submit</button> <button id="pSend" onclick={productSubmitEventHandler()}>Submit</button>
</div> </div>

View File

@ -384,7 +384,7 @@ footer a {
.new-product-field button { .new-product-field button {
height: 40px; height: 40px;
width: 100px; width: 120px;
display: block; display: block;
font-size: 19px; font-size: 19px;
font-family: osl; font-family: osl;
@ -406,6 +406,10 @@ footer a {
background-color: #ffaf69; background-color: #ffaf69;
} }
.new-product-field button:disabled {
background-color: #b9b9b9;
}
.npf-long input { .npf-long input {
width: 600px; width: 600px;
} }
@ -473,7 +477,9 @@ footer a {
transition: 0.1s; transition: 0.1s;
background-color: #ffaf69; background-color: #ffaf69;
} }
.product-page-info button:disabled {
background-color: #b9b9b9;
}
.product-page-info h2 { .product-page-info h2 {
font-size: 30px; font-size: 30px;
} }

View File

@ -73,7 +73,7 @@
<% keys.forEach(function(key){ %> <% keys.forEach(function(key){ %>
<div class="product-container"> <div class="product-container">
<a href="product?productid=<%=key%>"> <a href="product?productid=<%=key%>">
<img class="dyn-img" title="<%= products[key].img %>" alt="img"> <img class="dyn-img" title="<%= products[key].img %>" alt="img" src="media/var.png">
</a> </a>
<p class="l"><%= products[key].name%></p> <p class="l"><%= products[key].name%></p>
<p class="r">£ <%= products[key].price%></p> <p class="r">£ <%= products[key].price%></p>
@ -101,6 +101,16 @@
<p class="l"><%= "Item name"%></p> <p class="l"><%= "Item name"%></p>
<p class="r">£ <%= "20.99"%></p> <p class="r">£ <%= "20.99"%></p>
</div> </div>
<div class="product-container">
<a href="#"><img src="media/var.png" alt="img"></a>
<p class="l"><%= "Item name"%></p>
<p class="r">£ <%= "20.99"%></p>
</div>
<div class="product-container">
<a href="#"><img src="media/var.png" alt="img"></a>
<p class="l"><%= "Item name"%></p>
<p class="r">£ <%= "20.99"%></p>
</div>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@ function leavePage(){
} }
} }
function productSubmutEventHandler(){ function productSubmitEventHandler(){
data = { data = {
id: 1, id: 1,
name: "", name: "",
@ -49,6 +49,11 @@ function productSubmutEventHandler(){
var image = imgBtn.files[0] var image = imgBtn.files[0]
var imgPath = productKey + '/' + image.name var imgPath = productKey + '/' + image.name
var storageRef = firebase.storage().ref('/product-img/' + imgPath) var storageRef = firebase.storage().ref('/product-img/' + imgPath)
const submitBtn = document.getElementById('pSend')
submitBtn.innerHTML = "Uploading..."
submitBtn.disabled = true
updateDBImg(productKey, imgPath) updateDBImg(productKey, imgPath)
storageRef.put(image).then(function(){ storageRef.put(image).then(function(){
@ -87,4 +92,17 @@ function updateImgs() {
pathReference.getDownloadURL().then(function(url) {image.src = url}) pathReference.getDownloadURL().then(function(url) {image.src = url})
}) })
} }
updateImgs();
updateImgs();
function purchaseItem() {
const purchaseBtn = document.getElementById('remember-to-add-auth-verificartion-to-js-handler')
if (purchaseBtn.innerHTML == "Buy!") {
purchaseBtn.innerHTML = "Functionality not yet implemented 😢"
purchaseBtn.setAttribute("style", "width: 500px;");
}
else {
purchaseBtn.disabled = true
}
}

View File

@ -69,7 +69,7 @@
<p>Location: <%= item.location %></p> <p>Location: <%= item.location %></p>
<p>In stock: <%= item.stock %></p> <p>In stock: <%= item.stock %></p>
<p>Price: £<%= item.price %></p> <p>Price: £<%= item.price %></p>
<button onclick={purchaseItem()} id="REMEMBER TO ADD AUTH VERIFICATION TO JS SCRIPT">Buy!</button> <button onclick={purchaseItem()} id="remember-to-add-auth-verificartion-to-js-handler">Buy!</button>
</div> </div>
</div> </div>
<div class="product-page-description"><p><%= item.desc %></p></div> <div class="product-page-description"><p><%= item.desc %></p></div>