WMGZON/templates/product.html

58 lines
3.1 KiB
HTML
Raw Normal View History

<link rel="stylesheet" href="{{ url_for('static', filename='css/products.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/loginform.css') }}">
<div class="product-fs">
{% if product != None %}
{% if user.id == product.sellerID%}
<form class="input-form" method="POST" action="/products/update/{{product.id}}" enctype="multipart/form-data">
<div class="product-title">
<input type="text" id="name" name="name" placeholder="Product Name" value="{{product.name}}" required>
</div>
<div class="product-information">
<div class="product-image">
<img src="{{url_for('static', filename='assets/img/products/' + product.image)}}" alt="Brake Disks" height="auto" width="150px" />
<input type="file" id="image" name="image" accept="image/x">
</div>
<div>
<div class="input-form-row">
<input type="number" id="cost" name="cost" placeholder=10.99 min=0 step=any value="{{product.cost}}"required>
<input type="textarea" id="description" name="description" placeholder="Product Description" value="{{product.description}}" required>
</div>
<div class="input-form-row">
<select name="category" id="category">
{% for category in categories %}
{% if category.id == product.category %}
<option value="{{category.id}}" selected>{{category.name}}</option>
{% else %}
<option value="{{category.id}}">{{category.name}}</option>
{% endif%}
{% endfor %}
</select>
</div>
<div class="input-form-row">
<input type="number" id="quantity" name="quantity" placeholder=0 min=0 value="{{product.quantityAvailable}}" required>
</div>
</div>
</div>
<input type="submit" id="Create Product" value="Create Product">
</form>
<div class="product-add-to-cart"></div>
{% else %}
<div class="product-title">{{product.name}}</div>
<div class="product-information">
<div class="product-image">
<img src="{{url_for('static', filename='assets/img/products/' + product.image)}}" alt="Brake Disks" height="auto" width="150px" />
</div>
<div class="product-details">
<div class="product-price">£{{product.cost}}</div>
<div class="product-description">{{product.description}}</div>
</div>
</div>
<div class="product-add-to-cart"></div>
{% endif %}
{% endif %}
</div>