REFACTOR: Changed blueprints to allow for preprocessing of requests

This commit is contained in:
2024-02-14 14:56:58 +00:00
parent 2f7ba0d963
commit 45d2773f9a
6 changed files with 61 additions and 48 deletions

View File

@ -19,8 +19,8 @@
{% if user.role == "Seller" %}
<div class="categories">
{# List all available Seller tools #}
<a href="{{ url_for('main.products.display_add') }}" class="category">Create Products</a>
<a href="{{ url_for('main.products.display_own') }}" class="category">View My Products</a>
<a href="{{ url_for('main.seller.display_add') }}" class="category">Create Products</a>
<a href="{{ url_for('main.seller.display_own') }}" class="category">View My Products</a>
<a href="{{ url_for('main.stats.index') }}" class="category">View Seller Stats</a>
</div>
{% elif user.role == "Admin" %}

View File

@ -2,7 +2,7 @@
<div id="input-form-wrap">
<h2>Create New Product</h2>
<form class="input-form" method="POST" action="{{ url_for('main.products.add') }}" enctype="multipart/form-data">
<form class="input-form" method="POST" action="{{ url_for('main.seller.add') }}" enctype="multipart/form-data">
<div class="input-form-row">
<input type="text" id="name" name="name" placeholder="Product Name" required>
<input type="file" id="image" name="image" accept="image/x" required>
@ -31,6 +31,6 @@
</form>
<div id="create-account-wrap">
<p>Want to view all of your products? <a href="{{ url_for('main.products.display_own') }}">Click Here</a><p>
<p>Want to view all of your products? <a href="{{ url_for('main.seller.display_own') }}">Click Here</a><p>
</div>
</div>

View File

@ -4,7 +4,7 @@
{% if product != None %}
{% if user.id == product.sellerID %}
<!-- Form -->
<form class="product-fs" method="POST" action="{{ url_for('main.products.update', id=product.id) }}" enctype="multipart/form-data">
<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"/>
<div class="product-details">
<div class="input-form-row">
@ -83,7 +83,7 @@
<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', id=product.id) }}">
<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" value="Delete" />
</div>