Files
shop-ejs-expressjs/views/product.ejs
2022-03-29 14:38:40 +02:00

93 lines
3.6 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<%- include('partials/head'); %>
<link rel="stylesheet" href="/css/product.css">
</head>
<body>
<header>
<%- include('partials/header'); %>
</header>
<div class="content">
<section class="product-header">
<div id="product-image">
<img src="/images/examples.jpg" alt="">
</div>
<div id="product-info">
<h2><%= product.productName %></h2><br>
<p class="badge">Nr.:<%= product.id %></p><br>
<p class="seller">Verkäufer: <%= product.sellerName%></p><br>
<p class="product-detail"><b>Preis:</b> <%= product.price %> € / Stück</h2>
<p class="product-detail"><b>Kategorie:</b> <%= category.name %></h2>
<div>
<% if(product.quantity > 0){%>
<label style="margin-right: 30px; margin-left: 0px;color: green;">
Lieferbar in <%= product.delivery_time %> - <%= product.delivery_time + 1 %> Tagen
</label><br><br>
<div style=" float:right;">
<span><input type="number" id="quantity" min="1" max="<%= product.quantity %>" style="width: 30px; margin-left: 20px" value="1" ></span>
<label>/<%= product.quantity %></label><br>
<button class ="order-button"onclick="window.open('/order/<%= product.id %>/' + document.getElementById('quantity').value, '_self')">Bestellen</button>
</div>
<% } else { %>
<label style="margin-right: 30px; margin-left: 0px;color: red; font-weight:bold;">
Aktuell nicht lieferbar!
</label>
<% } %>
</div>
</div>
</section>
<section>
<h2>Beschreibung</h2>
<p><%= product.productDescription %> </p>
</section>
<% if(user){ %>
<section>
<h2 style="padding-left: 30px;">Rezensionen</h2>
<form class="product-form" action="/review/create/<%= product.id %>" method="post">
<label for="title">
<p>Titel: </p>
<input type="text" name="title">
</label>
<label for="rating">
<p>Bewertung (0-10): </p>
<input type="number" name="rating" max="10" min="0">
</label>
<label for="content">
<textarea name="content" id="" max="500" cols="30" rows="10"></textarea>
</label>
<input style="width: 150px" type="submit" value="Senden">
</form>
</section>
<% } %>
<section>
<% if(reviews.length > 0){ %>
<% for(let i = 0; i < reviews.length; i++){ %>
<div class="review-container">
<div class="review-header">
<p>(<%= reviews[i].rating %>) <b><%= reviews[i].name %>: </b> <%= reviews[i].title %></p>
</div>
<div class="review-content">
<p><%= reviews[i].content %></p>
</div>
</div>
<% } %>
<% }else{ %>
<h2 style="color:rgb(158, 51, 51);">Leider hat dieses Produkt noch keine Bewertung. :(</h2>
<% } %>
</section>
</div>
<%- include('partials/footer'); %>
</body>
</html>