#10 Started to create a table for administrating users

This commit is contained in:
Luke Else 2024-02-13 11:59:14 +00:00
parent b6721cc777
commit 0ace3273b4
5 changed files with 102 additions and 88 deletions

View File

@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS Views (
ON DELETE CASCADE
ON UPDATE NO ACTION,
productID INTEGER NOT NULL
REFERENCES Users (id)
REFERENCES Products (id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
viewDate TIMESTAMP NOT NULL

View File

@ -1,37 +1,61 @@
INSERT INTO Users (first_name, last_name, username, email, phone, password, role) VALUES ("Luke", "Else", "lukejelse04", "test@test.com", "07498 289321", "test213", "Customer");
INSERT INTO Users (first_name, last_name, username, email, phone, password, role) VALUES ("Luke", "Else", "luke-else", "test@test.com", "07498 289321", "cbe0cd68cbca3868250c0ba545c48032f43eb0e8a5e6bab603d109251486f77a91e46a3146d887e37416c6bdb6cbe701bd514de778573c9b0068483c1c626aec", "Seller");
INSERT INTO Users (first_name, last_name, username, email, phone, password, role) VALUES ("Luke", "Else", "test-customer", "test@test.net", "07498 289322", "cbe0cd68cbca3868250c0ba545c48032f43eb0e8a5e6bab603d109251486f77a91e46a3146d887e37416c6bdb6cbe701bd514de778573c9b0068483c1c626aec", "Customer");
INSERT INTO Users (first_name, last_name, username, email, phone, password, role) VALUES ("Luke", "Else", "test-seller", "test@test.not", "07498 289323", "cbe0cd68cbca3868250c0ba545c48032f43eb0e8a5e6bab603d109251486f77a91e46a3146d887e37416c6bdb6cbe701bd514de778573c9b0068483c1c626aec", "Seller");
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 1, 10);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 1, 9);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 1, 0);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 2, 4);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 2, 3);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 3, 9);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 4, 3);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 4, 2);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 4, 1);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 6, 7);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 6, 1232);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 1, 10, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 1, 9, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 1, 0, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 2, 4, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 2, 3, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 3, 9, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 4, 3, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 4, 2, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 4, 1, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 6, 7, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, quantityAvailable, postedDate) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 6, 1232, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 1);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 1);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 1);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 2);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 2);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 3);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 4);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 4);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 4);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 6);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 6);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 1, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 1, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 1, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 2, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 2, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 3, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 4, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 4, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 4, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 6, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 6, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 1);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 1);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 1);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 2);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 2);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 3);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 4);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 4);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 4);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 6);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 6);
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 1, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 1, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 1, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 2, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 2, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 3, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("12' Brake Disks", "brake-disks.bmp", "this is a product", 20.99, 1, 4, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 4, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("Single Turbo", "turbo.bmp", "this is a product", 20.99, 1, 4, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("Exhaust Manifold", "manifold.bmp", "This is a super cool product that can be installed into your car to take the gasses from the inside all the way to the outside. Mad I know.", 20.99, 1, 6, datetime());
INSERT INTO Products (name, image, description, cost, sellerID, categoryID, postedDate) VALUES ("17' Alloy Wheels", "alloy.bmp", "These super stylish alloys offer a fresh trendy look for your car. Whether a brand new Mercedes or a niffty little banger, it will uplift the vehicle 10-fold", 20.99, 1, 6, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 1, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 2, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 2, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 2, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 2, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 2, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 2, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 2, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 2, datetime());
INSERT INTO Views (userID, productID, viewDate) VALUES (1, 2, datetime());

View File

@ -1,50 +1,38 @@
/* Resetting default table styles */
.user-container {
display: flex;
justify-content: center;
width: 80%;
}
table {
border-collapse: collapse;
width: 100%;
margin-bottom: 20px;
}
width: 80%;
}
/* Styling table headers */
th {
background-color: #f2f2f2;
color: #333;
font-weight: bold;
padding: 10px;
text-align: left;
}
/****** table style ******/
table tbody>tr>td:last-child{
text-align: center;
}
/* Styling table rows */
tr:nth-child(even) {
background-color: #f9f9f9;
}
.table.table-style {
tr:hover {
background-color: #f2f2f2;
}
}
/* Styling table data cells */
td {
padding: 10px;
}
.table.table-style tr td:last-child {
/* Add a border to the bottom of the header row */
th {
border-bottom: 2px solid #ddd;
}
}
/* Add a border to all other rows and cells */
tr:not(:first-child) {
border-top: 1px solid #ddd;
}
.table.table-style > thead > tr > td,
.table.table-style > tbody > tr > td,
.table.table-style > tfoot > tr > td {
padding-left: 10px;
}
td {
border-bottom: 1px solid #ddd;
}
.table.table-style tr {
}
/* Responsive table */
@media (max-width: 768px) {
table {
overflow-x: auto;
}
}
.table.table-style tbody > tr {
background-color: var(--bg-secondary);
}
.table.table-style tbody > tr:nth-child(even) {
background-color: var(--bg-grad-1);
}

View File

@ -1,8 +1,8 @@
:root {
--bg: #282c34;
--bg-secondary: #474d57;
--bg-grad-1: #484e58;
--bg-grad-2: #4e5560;
--bg-grad-1: rgb(55, 57, 62);
--bg-grad-2: #3b3e42;
--bg-grad-3: #59616d;
--bg-grad-4: #606a7b;
--bg-grad-5: #606978;

View File

@ -3,12 +3,13 @@
{% if users != None %}
<p>Showing {{users|count}} users</p>
<div class="user-container">
<table>
<table class="table table-style">
<thead>
<tr>
<th>Username</th>
<th>E-Mail</th>
<th>Phone Number</th>
<th scope="col">Username</th>
<th scope="col">E-Mail</th>
<th scope="col">Phone Number</th>
<th>BUTTON</th>
</tr>
</thead>
<tbody>
@ -17,6 +18,7 @@
<td>{{user.username}}</td>
<td>{{user.email}}</td>
<td>{{user.phone}}</td>
<td>{{user.phone}}</td>
</tr>
<!-- <a href="/products/{{user.id}}" class="product product-link">
<div class="product-title">{{user.username}}</div>