#10 Added ability for users to be removed from the site.

This commit is contained in:
2024-02-13 22:48:23 +00:00
parent d6244223c4
commit 3dc7a1f861
11 changed files with 182 additions and 20 deletions

View File

@ -1,4 +1,6 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/admin.css') }}">
<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 %}
<p>Showing {{users|count}} users</p>
@ -6,20 +8,57 @@
<table class="table table-style">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Username</th>
<th scope="col">E-Mail</th>
<th scope="col">Phone Number</th>
<th>BUTTON</th>
<th scope="col">Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{user.id}}</td>
<td>{{user.username}}</td>
<td>{{user.email}}</td>
<td>{{user.phone}}</td>
<td>{{user.phone}}</td>
<td>{{user.role}}</td>
<td>
<div class="input-form-row">
<div class="button neutral">
<p class="btnText">Edit User</p>
<div class="btnTwo">
<p class="btnText2">{{user.id}}</p>
</div>
</div>
<label for="deleteModal{{user.id}}">
<div class="button error">
<p class="btnText">DELETE USER</p>
<div class="btnTwo">
<p class="btnText2">X</p>
</div>
</div>
</label>
</div>
</td>
</tr>
<!-- Modal -->
<input class="modal-state" id="deleteModal{{user.id}}" type="checkbox" />
<div class="modal">
<label class="modal__bg" for="deleteModal{{user.id}}"></label>
<div class="modal__inner">
<label class="modal__close" for="deleteModal{{user.id}}"></label>
<h2>Confirm Delete</h2>
<p>Are you sure you want to <b>delete</b> {{user.role}} <b>{{user.username}}</b></p>
<form method="POST" action="{{url_for('main.users.delete', id=user.id)}}">
<div class="input-form-row">
<input type="submit" class="modal-btn error" for="deleteModal{{user.id}}" value="Delete" />
</div>
</form>
</div>
</div>
<!-- <a href="/products/{{user.id}}" class="product product-link">
<div class="product-title">{{user.username}}</div>
<div class="product-content-container">

View File

@ -14,7 +14,14 @@
<div class="product-description hide-overflow ">{{product.description}}</div>
</div>
</div>
<input type="submit" class="product-add-to-cart" value="Add to Cart" />
<div class="product-selection">
<div class="button wmgzon">
<p class="btnText">ADD TO BASKET</p>
<div class="btnTwo">
<p class="btnText2">:)</p>
</div>
</div>
</div>
</a>
{% endfor %}
</div>

View File

@ -15,13 +15,21 @@
</div>
</nav>
{% if user != None and user.role == "Seller" %}
<div class="categories">
{# List all available seller tools #}
<a href="{{url_for('main.products.display_add_product')}}" class="category">Create Products</a>
<a href="{{url_for('main.products.display_own_products')}}" class="category">View My Products</a>
<a href="{{url_for('main.stats.index')}}" class="category">View Seller Stats</a>
</div>
{% if user != None %}
{% if user.role == "Seller" %}
<div class="categories">
{# List all available Seller tools #}
<a href="{{url_for('main.products.display_add_product')}}" class="category">Create Products</a>
<a href="{{url_for('main.products.display_own_products')}}" class="category">View My Products</a>
<a href="{{url_for('main.stats.index')}}" class="category">View Seller Stats</a>
</div>
{% elif user.role == "Admin" %}
<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>
</div>
{% endif %}
{% endif %}
<div class="categories">

View File

@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{url_for('static', filename='css/buttons.css')}}" />
<link rel="stylesheet" href="{{url_for('static', filename='css/style.css')}}" />
<link rel="stylesheet" href="{{url_for('static', filename='css/alerts.css')}}" />
<link href="http://fonts.cdnfonts.com/css/uk-number-plate" rel="stylesheet">

View File

@ -33,7 +33,15 @@
<div class="input-form-row">
<input type="submit" id="Create Product" value="Update Product">
</div>
<label class="modal-btn" for="deleteModal">Delete Product</label>
<label for="deleteModal">
<div class="button error">
<p class="btnText">DELETE PRODUCT</p>
<div class="btnTwo">
<p class="btnText2">X</p>
</div>
</div>
</label>
</div>
<div class="product-acquisition-pane">
<div class="input-form-row">
@ -46,11 +54,20 @@
<input type="number" id="quantity" name="quantity" placeholder="Quantity Available" min=0 value="{{product.quantityAvailable}}" required>
</div>
{% if product.quantityAvailable > 0 %}
<div class="product-instock">In Stock</div>
<div class="product-quantity">{{product.quantityAvailable}} Available</div>
<div class="input-form-row">
<div class="product-instock">In Stock</div>
<div class="product-quantity">{{product.quantityAvailable}} Available</div>
</div>
<div class="input-form-row">
<a href="{{url_for('main.stats.view_product_stats', id=product.id)}}">
<input type="button" class="product-add-to-cart" value="View Product Stats"/>
<div class="button success">
<p class="btnText">VIEW STATS</p>
<div class="btnTwo">
<p class="btnText2">!!!</p>
</div>
</div>
</a>
</div>
{% else %}
<div class="product-nostock">Out of Stock</div>
{% endif %}