#10 Added Product section to admin page
This commit is contained in:
@ -2,7 +2,8 @@
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/loginform.css') }}" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/modal.css') }}">
|
||||
|
||||
{% if users != None %}
|
||||
<!-- USER MANAGEMENT-->
|
||||
{% if users is defined and users != None %}
|
||||
<p>Showing {{users|count}} users</p>
|
||||
<div class="user-container">
|
||||
<table class="table table-style">
|
||||
@ -63,6 +64,76 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- PRODUCT MANAGEMENT-->
|
||||
{% elif products is defined and products != None %}
|
||||
<p>Showing {{products|count}} products</p>
|
||||
<div class="user-container">
|
||||
<table class="table table-style">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">SellerID</th>
|
||||
<th scope="col">Price</th>
|
||||
<th scope="col">Category</th>
|
||||
<th scope="col">Quantity</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for product in products %}
|
||||
<tr>
|
||||
<td>{{product.id}}</td>
|
||||
<td>{{product.name}}</td>
|
||||
<td>{{product.sellerID}}</td>
|
||||
<td>{{product.cost}}</td>
|
||||
<td>{{product.category}}</td>
|
||||
<td>{{product.quantityAvailable}}</td>
|
||||
<td>
|
||||
<div class="input-form-row">
|
||||
<a href="{{url_for('main.products.product', id=product.id)}}">
|
||||
<div class="button neutral">
|
||||
<p class="btnText">Edit Product</p>
|
||||
<div class="btnTwo">
|
||||
<p class="btnText2">{{product.id}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<label for="deleteModal{{product.id}}">
|
||||
<div class="button error">
|
||||
<p class="btnText">DELETE PRODUCT</p>
|
||||
<div class="btnTwo">
|
||||
<p class="btnText2">X</p>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Modal -->
|
||||
<input class="modal-state" id="deleteModal{{product.id}}" type="checkbox" />
|
||||
<div class="modal">
|
||||
<label class="modal__bg" for="deleteModal{{product.id}}"></label>
|
||||
<div class="modal__inner">
|
||||
<label class="modal__close" for="deleteModal{{product.id}}"></label>
|
||||
<h2>Confirm Delete</h2>
|
||||
<p>Are you sure you want to <b>delete</b> <b>{{product.name}}</b></p>
|
||||
<form method="POST" action="{{ url_for('main.seller.delete', id=product.id) }}">
|
||||
<div class="input-form-row">
|
||||
<input type="submit" class="modal-btn error" for="deleteModal{{product.id}}" value="Delete" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
{% else %}
|
||||
<p>Sorry... We have nothing to show here!</p>
|
||||
{% endif %}
|
||||
|
@ -27,7 +27,7 @@
|
||||
<div class="categories">
|
||||
{# List all available Admin tools #}
|
||||
<a href="{{ url_for('main.admin.users') }}" class="category">Manage Users</a>
|
||||
<a href="{{ url_for('main.admin.main') }}" class="category">Manage Products</a>
|
||||
<a href="{{ url_for('main.admin.products') }}" class="category">Manage Products</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/loginform.css') }}">
|
||||
|
||||
{% if product != None %}
|
||||
{% if user.id == product.sellerID %}
|
||||
{% if user.id == product.sellerID or user.role == "Admin" %}
|
||||
<!-- Form -->
|
||||
<form class="product-fs" method="POST" action="{{ url_for('main.seller.update', id=product.id) }}" enctype="multipart/form-data">
|
||||
<img class="product-image" src="{{ url_for('static', filename='assets/img/products/' + product.image) }}" alt="Brake Disks"/>
|
||||
|
Reference in New Issue
Block a user