<!DOCTYPE html>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1"
>
<
title
>Inventory Management System</
title
>
</
head
>
<
style
>
body {
font-weight: 600 !important;
overflow-x: hidden;
}
.navbar-brand {
font-family: 'Noto Serif', serif;
margin-left: 1rem;
color: white !important;
font-weight: 700;
font-size: x-large !important;
}
.nav-link {
font-weight: 600;
font-size: 16px !important;
}
.nav-link:active,
.nav-link.active {
background-color: #198754 !important;
color: white !important;
}
.nav-link:hover {
color: white !important;
background-color: #198754 !important;
}
.content {
padding: 15px;
}
::placeholder {
font-size: 14px;
font-weight: 400;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
td {
font-size: 13px;
}
label {
font-family: 'Noto Serif', serif;
}
</
style
>
<
body
>
<
nav
class
=
"navbar navbar-expand-md navbar-light bg-success"
>
<
div
class
=
"container-fluid"
>
<
a
class
=
"navbar-brand"
href
=
"#"
><
i
class
=
"fa fa-align-center"
aria-hidden
=
"true"
></
i
> Inventory</
a
>
</
div
>
</
nav
>
<
div
class
=
"container-fluid"
>
<
div
class
=
"row"
>
<
div
class
=
"col-md-2 bg-light"
>
<
div
class
=
"bg-light min-vh-100"
>
<
div
class
=
"sidebar-sticky"
>
<
ul
class
=
"nav flex-column nav-pills"
>
<
li
class
=
"nav-item p-2"
>
<
a
class
=
"nav-link text-success mt-5"
data-bs-toggle
=
"pill"
href
=
"#home"
><
i
class
=
"fa fa-home"
></
i
> Home</
a
>
</
li
>
<
li
class
=
"nav-item p-2"
>
<
a
class
=
"nav-link text-success mt-2"
data-bs-toggle
=
"pill"
href
=
"#products"
><
i
class
=
"fa fa-database"
></
i
> Products</
a
>
</
li
>
<
li
class
=
"nav-item p-2"
>
<
a
class
=
"nav-link text-success mt-2"
data-bs-toggle
=
"pill"
href
=
"#addProduct"
><
i
class
=
"fa fa-plus"
></
i
> Add Product</
a
>
</
li
>
<
li
class
=
"nav-item p-2"
>
<
a
class
=
"nav-link text-success mt-2"
data-bs-toggle
=
"pill"
href
=
"#searchProduct"
><
i
class
=
"fa fa-search"
></
i
> Search Product</
a
>
</
li
>
<
li
class
=
"nav-item p-2"
>
<
a
class
=
"nav-link text-success mt-2"
data-bs-toggle
=
"pill"
href
=
"#removeProduct"
><
i
class
=
"fa fa-trash"
></
i
> Remove Product</
a
>
</
li
>
</
ul
>
</
div
>
</
div
>
</
div
>
<
div
class
=
"col-md-10"
>
<
div
class
=
"content tab-content"
>
<
div
class
=
"tab-pane fade show active"
id
=
"home"
>
<
h5
class
=
"text-left text-success p-3"
>Welcome to the Inventory Management System ( Report )
</
h4
>
<
br
>
<
div
class
=
"row p-2"
>
<
div
class
=
"col-sm-6"
>
<
p
class
=
"p-2 text-left"
>Maximum Number of Products & Their Category
</
p
>
<
div
style
=
"margin: auto;"
>
<
canvas
id
=
"maxproductChart"
></
canvas
>
</
div
>
<
script
th:inline
=
"javascript"
>
var products = /*[[${products}]]*/[];
var data = {};
products.forEach(function (product) {
var key = product.productName;
data[key] = (data[key] || 0) + product.maximumProducts;
});
var labels = Object.keys(data);
var values = Object.values(data);
// Generate an array of dynamic colors
var dynamicColors = [];
for (var i = 0; i <
labels.length
; i++) {
var
r
=
Math
.floor(Math.random() * 255);
var
g
=
Math
.floor(Math.random() * 255);
var
b
=
Math
.floor(Math.random() * 255);
dynamicColors.push('rgba(' + r + ',' + g + ',' + b + ', 0.6)');
}
var
ctx
=
document
.getElementById('maxproductChart').getContext('2d');
var
productChart
=
new
Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Maximum Products Count',
data: values,
backgroundColor: dynamicColors,
borderColor: dynamicColors.map(color => color.replace(', 0.6)', ', 1)')),
borderWidth: 2
}]
},
options: {
scales: {
x: {
title: {
display: true,
text: 'Product Name'
}
},
y: {
beginAtZero: true,
title: {
display: true,
text: 'Maximum number of Products'
}
}
}
}
});
</
script
>
</
div
>
<
div
class
=
"col-sm-6"
>
<
p
class
=
"p-2 text-left"
>Minimum Number of Products & Their Category
</
p
>
<
div
style
=
"margin: auto;"
>
<
canvas
id
=
"minproductChart"
></
canvas
>
</
div
>
<
script
th:inline
=
"javascript"
>
var products = /*[[${products}]]*/[];
var data = {};
products.forEach(function (product) {
var key = product.productName;
data[key] = (data[key] || 0) + product.minimumProducts;
});
var labels = Object.keys(data);
var values = Object.values(data);
// Generate an array of dynamic colors
var dynamicColors = [];
for (var i = 0; i <
labels.length
; i++) {
var
r
=
Math
.floor(Math.random() * 255);
var
g
=
Math
.floor(Math.random() * 255);
var
b
=
Math
.floor(Math.random() * 255);
dynamicColors.push('rgba(' + r + ',' + g + ',' + b + ', 0.6)');
}
var
ctx
=
document
.getElementById('minproductChart').getContext('2d');
var
productChart
=
new
Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Minimum Products Count',
data: values,
backgroundColor: dynamicColors,
borderColor: dynamicColors.map(color => color.replace(', 0.6)', ', 1)')),
borderWidth: 2
}]
},
options: {
scales: {
x: {
title: {
display: true,
text: 'Product Name'
}
},
y: {
beginAtZero: true,
title: {
display: true,
text: 'Minimum number of Products'
}
}
}
}
});
</
script
>
</
div
>
</
div
>
</
div
>
<
div
class
=
"tab-pane fade"
id
=
"products"
>
<
h4
class
=
"text-success p-2"
>All Products Data</
h4
>
<
div
class
=
"table-responsive mt-5"
>
<
table
class
=
"table table-hover table-bordered"
>
<
thead
class
=
"bg-success text-light"
>
<
th
>SN</
th
>
<
th
>ID</
th
>
<
th
>Category</
th
>
<
th
>Name</
th
>
<
th
>Rating</
th
>
<
th
>Quality</
th
>
<
th
>Max Size</
th
>
<
th
>Min Size</
th
>
<
th
>User</
th
>
<
th
>Email</
th
>
<
th
>Phone</
th
>
</
thead
>
<
tbody
>
<
tr
th:each
=
"product, index : ${products}"
}>
<
td
th:text
=
"${index.index + 1}"
></
td
>
<
td
th:text
=
"${product.id}"
></
td
>
<
td
th:text
=
"${product.productCategory}"
></
td
>
<
td
th:text
=
"${product.productName}"
></
td
>
<
td
th:text
=
"${product.rating}"
></
td
>
<
td
th:text
=
"${product.quality}"
></
td
>
<
td
th:text
=
"${product.maximumProducts}"
></
td
>
<
td
th:text
=
"${product.minimumProducts}"
></
td
>
<
td
th:text
=
"${product.userName}"
></
td
>
<
td
th:text
=
"${product.emailAddress}"
></
td
>
<
td
th:text
=
"${product.phoneNumber}"
></
td
>
</
tr
>
</
tbody
>
</
table
>
</
div
>
</
div
>
<
div
class
=
"tab-pane fade"
id
=
"addProduct"
>
<
h4
class
=
"text-success p-2"
>Add New Product</
h4
>
<
br
>
<
div
class
=
"container"
>
<
form
class
=
"p-1"
th:action
=
"@{/newProduct}"
th:object
=
"${product}"
method
=
"post"
>
<
div
class
=
"row p-4 justify-content-center"
>
<
div
th:if
=
"${insertSuccess}"
>
<
div
class
=
"alert alert-success alert-dismissible fade show p-2 mt-1 mb-3"
role
=
"alert"
>
<
strong
>Product Added successfully!
<
button
type
=
"button"
class
=
"btn-close"
data-bs-dismiss
=
"alert"
aria-label
=
"Close"
></
button
>
</
strong
>
</
div
>
</
div
>
<
div
class
=
"col-sm-3 offset-sm-1 p-2"
>
<
label
>product Category</
label
>
<
select
th:field
=
"*{productCategory}"
class
=
"form-select mt-3"
required>
<
option
value
=
""
></
option
>
<
option
value
=
"Electronics"
>Electronics</
option
>
<
option
value
=
"Fashion"
>Fashion</
option
>
<
option
value
=
"Furniture"
>Furniture</
option
>
<
option
value
=
"Home&Kitchen"
>Home & Kitchen</
option
>
<
option
value
=
"Grocery"
>Grocery</
option
>
</
select
>
</
div
>
<
div
class
=
"col-sm-3 offset-sm-1 p-2"
>
<
label
>product Name</
label
>
<
input
type
=
"text"
th:field
=
"*{productName}"
class
=
"form-control mt-3"
required
placeholder
=
"name of the product"
>
</
div
>
<
div
class
=
"col-sm-3 offset-sm-1 p-2"
>
<
label
>product Rating</
label
>
<
select
th:field
=
"*{rating}"
class
=
"form-select mt-3"
required>
<
option
value
=
""
></
option
>
<
option
value
=
"1"
>1</
option
>
<
option
value
=
"2"
>2</
option
>
<
option
value
=
"3"
>3</
option
>
<
option
value
=
"4"
>4</
option
>
<
option
value
=
"5"
>5</
option
>
</
select
>
</
div
>
</
div
>
<
div
class
=
"row p-4 justify-content-center"
>
<
div
class
=
"col-sm-3 offset-sm-1 p-2"
>
<
label
>product Quality</
label
>
<
select
th:field
=
"*{quality}"
class
=
"form-select mt-3"
required>
<
option
value
=
""
></
option
>
<
option
value
=
"1"
>1</
option
>
<
option
value
=
"2"
>2</
option
>
<
option
value
=
"3"
>3</
option
>
<
option
value
=
"4"
>4</
option
>
<
option
value
=
"5"
>5</
option
>
</
select
>
</
div
>
<
div
class
=
"col-sm-3 offset-sm-1 p-2"
>
<
label
>Maximum Products</
label
>
<
input
type
=
"number"
th:field
=
"*{maximumProducts}"
class
=
"form-control mt-3"
required
placeholder
=
"maximum number of products"
>
</
div
>
<
div
class
=
"col-sm-3 offset-sm-1 p-2"
>
<
label
>Minimum Products</
label
>
<
input
type
=
"number"
th:field
=
"*{minimumProducts}"
class
=
"form-control mt-3"
required
placeholder
=
"minimum number of products"
>
</
div
>
</
div
>
<
div
class
=
"row p-4 justify-content-center"
>
<
div
class
=
"col-sm-3 offset-sm-1 p-2"
>
<
label
>Product Added By</
label
>
<
input
type
=
"text"
th:field
=
"*{userName}"
class
=
"form-control mt-3"
required
placeholder
=
"user name"
>
</
div
>
<
div
class
=
"col-sm-3 offset-sm-1 p-2"
>
<
label
>User Email Address</
label
>
<
input
type
=
"email"
th:field
=
"*{emailAddress}"
class
=
"form-control mt-3"
required
placeholder
=
"user email address"
>
</
div
>
<
div
class
=
"col-sm-3 offset-sm-1 p-2"
>
<
label
>Phone Number</
label
>
<
input
type
=
"tel"
th:field
=
"*{phoneNumber}"
class
=
"form-control mt-3"
required
placeholder
=
"phone number"
>
</
div
>
</
div
>
<
br
>
<
button
type
=
"submit"
class
=
"btn btn-success text-light"
style
=
"margin-left: 7rem;"
>Add
Product</
button
>
</
form
>
</
div
>
</
div
>
<
div
class
=
"tab-pane fade"
id
=
"searchProduct"
>
<
h4
class
=
"text-success p-2"
>Search Product Details</
h4
>
<
br
>
<
div
class
=
"container p-1"
>
<
form
th:action
=
"@{/searchProduct}"
th:object
=
"${product}"
method
=
"post"
class
=
"p-2"
>
<
div
class
=
"row"
>
<
div
class
=
"col-sm-9 offset-sm-1"
>
<
input
type
=
"text"
name
=
"id"
th:field
=
"*{id}"
class
=
"form-control"
required
placeholder
=
"Product ID"
style
=
"text-align: center; border-radius: 30px; border: 2px solid green;"
>
</
div
>
<
div
class
=
"col-sm-2"
>
<
button
type
=
"submit"
class
=
"btn btn-success"
style
=
"border-radius: 20px;"
>Search Product</
button
>
</
div
>
</
div
>
<
br
>
<
div
th:if
=
"${foundProduct}"
>
<
div
class
=
"table-responsive mt-4"
>
<
table
class
=
"table table-hover table-bordered"
>
<
thead
class
=
"bg-success text-light"
>
<
th
>ID</
th
>
<
th
>Category</
th
>
<
th
>Name</
th
>
<
th
>Rating</
th
>
<
th
>Quality</
th
>
<
th
>Max Size</
th
>
<
th
>Min Size</
th
>
<
th
>User</
th
>
<
th
>Email</
th
>
<
th
>Phone</
th
>
</
thead
>
<
tbody
>
<
tr
>
<
td
th:text
=
"${foundProduct.get().id}"
></
td
>
<
td
th:text
=
"${foundProduct.get().productCategory}"
></
td
>
<
td
th:text
=
"${foundProduct.get().productName}"
></
td
>
<
td
th:text
=
"${foundProduct.get().rating}"
></
td
>
<
td
th:text
=
"${foundProduct.get().quality}"
></
td
>
<
td
th:text
=
"${foundProduct.get().maximumProducts}"
></
td
>
<
td
th:text
=
"${foundProduct.get().minimumProducts}"
></
td
>
<
td
th:text
=
"${foundProduct.get().userName}"
></
td
>
<
td
th:text
=
"${foundProduct.get().emailAddress}"
></
td
>
<
td
th:text
=
"${foundProduct.get().phoneNumber}"
></
td
>
</
tr
>
</
tbody
>
</
table
>
</
div
>
</
div
>
<
div
th:if
=
"${notFound}"
class
=
"mt-3"
>
<
div
class
=
"alert alert-warning alert-dismissible fade show"
role
=
"alert"
>
<
strong
>Product Details Not Found!
<
button
type
=
"button"
class
=
"btn-close"
data-bs-dismiss
=
"alert"
aria-label
=
"Close"
></
button
>
</
div
>
</
div
>
</
form
>
</
div
>
</
div
>
<
div
class
=
"tab-pane fade"
id
=
"removeProduct"
>
<
h4
class
=
"text-success p-2"
>Remove Existing Product</
h4
>
<
br
>
<
div
class
=
"container p-1"
>
<
form
th:action
=
"@{/deleteProduct}"
method
=
"post"
class
=
"p-2"
>
<
div
class
=
"row"
>
<
div
class
=
"col-sm-9 offset-sm-1"
>
<
input
type
=
"text"
name
=
"id"
class
=
"form-control"
required
placeholder
=
"Product ID"
style
=
"text-align: center; border-radius: 30px; border: 2px solid green;"
>
</
div
>
<
div
class
=
"col-sm-2"
>
<
button
type
=
"submit"
class
=
"btn btn-success"
style
=
"border-radius: 20px;"
>Delete Product</
button
>
</
div
>
</
div
>
<
br
>
<
div
th:if
=
"${deleteSuccess}"
>
<
div
class
=
"alert alert-success alert-dismissible fade show"
role
=
"alert"
>
<
strong
>Product deleted successfully!
<
button
type
=
"button"
class
=
"btn-close"
data-bs-dismiss
=
"alert"
aria-label
=
"Close"
></
button
>
</
div
>
</
div
>
<
div
th:if
=
"${notFound}"
>
<
div
class
=
"alert alert-warning alert-dismissible fade show"
role
=
"alert"
>
<
strong
>Product not found. Please check the ID and try again.
<
button
type
=
"button"
class
=
"btn-close"
data-bs-dismiss
=
"alert"
aria-label
=
"Close"
></
button
>
</
div
>
</
div
>
</
form
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
body
>
</
html
>