2024-01-28 11:59:04 +00:00
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/products.css') }}">
|
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/loginform.css') }}">
|
|
|
|
|
2024-01-30 19:05:09 +00:00
|
|
|
{% if product != None %}
|
|
|
|
{% if user.id == product.sellerID %}
|
2024-02-08 19:58:49 +00:00
|
|
|
<!-- Form -->
|
|
|
|
<form class="product-fs" method="POST" action="{{url_for('main.products.update_product', id=product.id)}}" enctype="multipart/form-data">
|
2024-01-30 19:05:09 +00:00
|
|
|
<img class="product-image" src="{{url_for('static', filename='assets/img/products/' + product.image)}}" alt="Brake Disks"/>
|
|
|
|
<div class="product-details">
|
|
|
|
<div class="input-form-row">
|
2024-01-28 11:59:04 +00:00
|
|
|
<input type="text" id="name" name="name" placeholder="Product Name" value="{{product.name}}" required>
|
|
|
|
</div>
|
2024-01-30 19:05:09 +00:00
|
|
|
<div class="input-form-row">
|
|
|
|
<textarea id="description" name="description" placeholder="Product Description" required>{{product.description}}</textarea>
|
|
|
|
</div>
|
2024-01-28 11:59:04 +00:00
|
|
|
|
2024-01-30 19:05:09 +00:00
|
|
|
<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>
|
2024-01-28 11:59:04 +00:00
|
|
|
|
2024-01-30 19:05:09 +00:00
|
|
|
<div class="input-form-row">
|
|
|
|
<input type="file" id="image" name="image" accept="image/x">
|
|
|
|
</div>
|
2024-01-28 11:59:04 +00:00
|
|
|
|
2024-01-30 19:05:09 +00:00
|
|
|
<div class="input-form-row">
|
|
|
|
<input type="submit" id="Create Product" value="Update Product">
|
|
|
|
</div>
|
2024-02-08 19:58:49 +00:00
|
|
|
<label class="modal-btn" for="deleteModal">Delete Product</label>
|
2024-01-30 19:05:09 +00:00
|
|
|
</div>
|
|
|
|
<div class="product-acquisition-pane">
|
|
|
|
<div class="input-form-row">
|
|
|
|
<input type="number" id="cost" name="cost" placeholder="Cost" min=0 step=0.01 value="{{product.cost}}"required>
|
|
|
|
</div>
|
|
|
|
<div class="product-delivery">Earliest Delivery Friday 24th December</div>
|
|
|
|
<div class="product-postage">+£{{product.cost}} P&P</div>
|
|
|
|
<div class="product-stock">
|
|
|
|
<div class="input-form-row">
|
|
|
|
<input type="number" id="quantity" name="quantity" placeholder="Quantity Available" min=0 value="{{product.quantityAvailable}}" required>
|
2024-01-28 11:59:04 +00:00
|
|
|
</div>
|
2024-01-30 19:05:09 +00:00
|
|
|
{% if product.quantityAvailable > 0 %}
|
|
|
|
<div class="product-instock">In Stock</div>
|
|
|
|
<div class="product-quantity">{{product.quantityAvailable}} Available</div>
|
2024-02-08 19:58:49 +00:00
|
|
|
<a href="{{url_for('main.stats.view_product_stats', id=product.id)}}">
|
|
|
|
<input type="button" class="product-add-to-cart" value="View Product Stats"/>
|
|
|
|
</a>
|
2024-01-30 19:05:09 +00:00
|
|
|
{% else %}
|
|
|
|
<div class="product-nostock">Out of Stock</div>
|
|
|
|
{% endif %}
|
2024-01-28 11:59:04 +00:00
|
|
|
</div>
|
2024-01-30 19:05:09 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
2024-02-08 19:58:49 +00:00
|
|
|
|
|
|
|
<!-- Modal -->
|
|
|
|
<input class="modal-state" id="deleteModal" type="checkbox" />
|
|
|
|
<div class="modal">
|
|
|
|
<label class="modal__bg" for="deleteModal"></label>
|
|
|
|
<div class="modal__inner">
|
|
|
|
<label class="modal__close" for="deleteModal"></label>
|
|
|
|
<h2>Confirm Delete</h2>
|
|
|
|
<p>Are you sure you want to <b>delete {{product.name}}</b> from your products</p>
|
|
|
|
<form method="POST" action="{{url_for('main.products.delete_product', id=product.id)}}">
|
|
|
|
<div class="input-form-row">
|
|
|
|
<input type="submit" class="modal-btn error" for="deleteModal" value="Delete" />
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-30 19:05:09 +00:00
|
|
|
{% else %}
|
|
|
|
<div class="product-fs">
|
2024-01-28 11:59:04 +00:00
|
|
|
<img class="product-image" src="{{url_for('static', filename='assets/img/products/' + product.image)}}" alt="Brake Disks"/>
|
|
|
|
<div class="product-details">
|
|
|
|
<div class="product-title">{{product.name}}</div>
|
|
|
|
<div class="product-description">{{product.description}}</div>
|
|
|
|
</div>
|
|
|
|
<div class="product-acquisition-pane">
|
|
|
|
<div class="product-price">£{{product.cost}}</div>
|
|
|
|
<div class="product-delivery">Earliest Delivery Friday 24th December</div>
|
|
|
|
<div class="product-postage">+£{{product.cost}} P&P</div>
|
|
|
|
<div class="product-stock">
|
|
|
|
{% if product.quantityAvailable > 0 %}
|
|
|
|
<div class="product-instock">In Stock</div>
|
|
|
|
<div class="product-quantity">{{product.quantityAvailable}} Available</div>
|
|
|
|
<input type="submit" class="product-add-to-cart" value="Add to Cart" />
|
|
|
|
{% else %}
|
|
|
|
<div class="product-nostock">Out of Stock</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-01-30 19:05:09 +00:00
|
|
|
</div>
|
2024-01-28 11:59:04 +00:00
|
|
|
{% endif %}
|
2024-01-30 19:05:09 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|