Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harry web buttons #31

Open
wants to merge 80 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
87634ca
config changes: auto changes from importing project.
Gabriel-Hh Sep 22, 2023
4ff4b7d
Added SQL and java backend changes for WebAnalytics
Gabriel-Hh Nov 28, 2023
3b60d69
Update mysql_query.sql
Gabriel-Hh Nov 28, 2023
9978e18
Update mysql_query.sql
harryyang77 Nov 29, 2023
689343b
Update README.md
Gabriel-Hh Nov 29, 2023
928efb1
Merge branch 'main' of https://github.com/harryyang77/shopping-cart
harryyang77 Nov 29, 2023
0b34338
Merge pull request #1 from harryyang77/main
Gabriel-Hh Nov 29, 2023
cf6b801
Update userHome.jsp
harryyang77 Nov 29, 2023
52d5a7f
Update mysql_query.sql
WenbooSu Nov 29, 2023
856851a
Update ProductBean.java
WenbooSu Nov 29, 2023
ed51ee5
Update ProductService.java
WenbooSu Nov 29, 2023
a72d031
Update ProductServiceImpl.java
WenbooSu Nov 29, 2023
44ad63b
On low inv alert email + name change to "Concordia Shopping Cart App"
YuYingLiWen Nov 29, 2023
9a847af
Update ProductServiceImpl.java
WenbooSu Nov 29, 2023
4925914
Update ProductService.java
WenbooSu Nov 29, 2023
08e1ee9
Update mysql_query.sql
WenbooSu Nov 29, 2023
64d4773
Admin now receives email alerts instead of clients
YuYingLiWen Nov 29, 2023
d7b567a
Name change: Ellison Electro >> Concordia
YuYingLiWen Nov 29, 2023
cf8955a
Merge branch 'main' into YuDev
Gabriel-Hh Nov 29, 2023
a35569d
Merge pull request #2 from Gabriel-Hh/YuDev
Gabriel-Hh Nov 29, 2023
4944cc9
Create saleProduct.jsp
Pettiii Nov 29, 2023
27010d8
Update adminStock.jsp
Pettiii Nov 29, 2023
a10d982
Update ProductServiceImpl.java
WenbooSu Nov 29, 2023
e7bfec6
Update ProductService.java
WenbooSu Nov 29, 2023
e4b74c9
sale section and addptoduct
harryyang77 Nov 30, 2023
c5e1ae3
book
harryyang77 Nov 30, 2023
abb05c5
Merge pull request #4 from Gabriel-Hh/harry_web-buttons
YuYingLiWen Nov 30, 2023
a0b880d
Merge pull request #5 from Gabriel-Hh/harry_add-more-books
harryyang77 Nov 30, 2023
a6a560e
working on interaction, NOT WORKING YET
Gabriel-Hh Nov 30, 2023
e0d496d
Merge branch 'main' into harry_web-buttons
harryyang77 Nov 30, 2023
8cf3321
Create leaseSelling.jsp
Pettiii Nov 30, 2023
35187dd
Update adminViewProduct.jsp
Pettiii Nov 30, 2023
7152f69
Create bestSelling.jsp
Pettiii Nov 30, 2023
c3d7f85
Update ProductService.java
Pettiii Nov 30, 2023
fb6db01
Update ProductServiceImpl.java
Pettiii Nov 30, 2023
8567ac5
Update header.jsp
Pettiii Nov 30, 2023
b61fae1
Textbook category and updateProduct
harryyang77 Nov 30, 2023
7babc4a
Update CartServiceImpl.java, WebAnalyticsServiceImpl.java
Gabriel-Hh Nov 30, 2023
ed76c29
Update header.jsp
harryyang77 Nov 30, 2023
d0b32e9
Merge branch 'main' into harry_web-buttons
harryyang77 Nov 30, 2023
0f18d14
Fixed file naming typo
YuYingLiWen Nov 30, 2023
795eb23
Refactored Best/Least Selling code
YuYingLiWen Nov 30, 2023
c929641
Finalized : Interaction triggers WORKS
Gabriel-Hh Nov 30, 2023
14df8c7
Centered best/least selling text
YuYingLiWen Nov 30, 2023
83e0021
Merge pull request #7 from Gabriel-Hh/gabriel_frontend-analyitics-tri…
Gabriel-Hh Nov 30, 2023
8d8d5ca
Update userHome, remove 2 buttons
Gabriel-Hh Nov 30, 2023
cbb164c
Merge branch 'main' of https://github.com/Gabriel-Hh/shopping-cart
Gabriel-Hh Nov 30, 2023
fd8a890
Merge pull request #6 from Gabriel-Hh/harry_web-buttons
Gabriel-Hh Nov 30, 2023
6a372da
Update adminViewProduct.jsp
Pettiii Dec 1, 2023
0950bf0
updated mysql default values and Productbean
Gabriel-Hh Dec 1, 2023
d4022d8
change prduct table, from condition (reserved word) to quality)
Gabriel-Hh Dec 1, 2023
1cb9b7c
Change & Adding: Quality and Discount
YuYingLiWen Dec 1, 2023
4b471be
updateProduct.jsp WORKING
Gabriel-Hh Dec 1, 2023
e0e808f
Adding more: Quality and Discount
YuYingLiWen Dec 1, 2023
3efdac9
Merge branch 'main' of https://github.com/Gabriel-Hh/shopping-cart
YuYingLiWen Dec 1, 2023
5ce5158
Update adminViewProduct.jsp
Pettiii Dec 1, 2023
fa5dbf6
Update saleProduct.jsp
Pettiii Dec 1, 2023
b0bf828
Minor changes
harryyang77 Dec 1, 2023
2bcced1
Discount clamped between 0 and 100
YuYingLiWen Dec 1, 2023
b70da08
Merge branch 'main' of https://github.com/Gabriel-Hh/shopping-cart
YuYingLiWen Dec 1, 2023
38c6288
Change Title to Concordia Shopping Cart App
YuYingLiWen Dec 1, 2023
2210c28
Merge branch 'main' into harry_web-buttons
harryyang77 Dec 1, 2023
3cd1166
userHome.jsp IN PROGRESS
Gabriel-Hh Dec 1, 2023
bd3d526
Merge branch 'main' of https://github.com/Gabriel-Hh/shopping-cart
Gabriel-Hh Dec 1, 2023
3b48f88
Reverting 2 commits Read desc
YuYingLiWen Dec 1, 2023
85fc7a9
Discount works until payment but orders amount doesnt update
YuYingLiWen Dec 1, 2023
5b2f7b8
show sale items at home screen
harryyang77 Dec 1, 2023
ad22fab
Merge branch 'main' into harry_web-buttons
harryyang77 Dec 1, 2023
9a99307
userHome.,jsp Working
Gabriel-Hh Dec 1, 2023
e0b9932
Order discount price now saves to DB
YuYingLiWen Dec 1, 2023
638970a
Merge branch 'main' of https://github.com/Gabriel-Hh/shopping-cart
YuYingLiWen Dec 1, 2023
f84a137
made least selling availble to customer
harryyang77 Dec 1, 2023
4954180
Merge branch 'main' into harry_web-buttons
harryyang77 Dec 1, 2023
83cd848
Delete WebContent/bestSelling.jsp
YuYingLiWen Dec 1, 2023
5b2df3a
Delete WebContent/index.jsp
YuYingLiWen Dec 1, 2023
0bbde0f
Delete WebContent/leastSelling.jsp
YuYingLiWen Dec 1, 2023
d3c8908
Update addProduct.jsp
YuYingLiWen Dec 1, 2023
1b32673
Merge pull request #8 from Gabriel-Hh/harry_web-buttons
YuYingLiWen Dec 1, 2023
1cc6d99
Revert "Merge pull request #8 from Gabriel-Hh/harry_web-buttons"
YuYingLiWen Dec 1, 2023
a2d5a99
Update addProduct.jsp
harryyang77 Dec 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,22 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Expand Down
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,15 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
<filteredResources>
<filter>
<id>1695408778870</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.jdt.apt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false
1 change: 1 addition & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@ Step 10: Default Username And Password For Admin Is "[email protected]" And "admin

Step 11: The default Username And Password For User Is "[email protected]" And "guest"

## ====== Minimum VSCode Setup ======

**System:**
- Java JDK
- Apache-Maven
- MySQL Server / Workbench (user: root pass: root)
- Git or Github Desktop

**VS Code extensions:**
- Community Server Connectors (w/ Apache-Tomcat deploying the .war file made by maven)
- At -> ```C:\Users\YOUR_USER_NAME\.rsp\redhat-community-server-connector\runtimes\installations\tomcat-9.0.30\apache-tomcat-9.0.30\conf\tomcat-users.xml```
- Add -> ```<user username="root" password="root" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>```
- Extension Pack for Java (by Microsoft, 6 extensions)

**Terminal Commands**
- Rebuild ```mvn clean package```
- Recompile Java files only ```mvn compile```

## FAQ
**Question:1** Unable to Connect to Database?

Expand Down
213 changes: 213 additions & 0 deletions WebContent/APP_STRUCTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# Application Overview

## JSP

### index.jsp
- **Landing Page** showcasing available products.
- Users can **add products to cart** or proceed to purchase.
- **Search functionality** to filter products.
- **Dynamic content** based on user's authentication and type (admin/customer).

### header.jsp
- **Common Header** for consistent branding and navigation.
- **Search Form** directing to `index.jsp`.
- **Dynamic Navigation** based on user's type (e.g., customer, admin).

### login.jsp
- **User Authentication** interface.
- Fields for username, password, and user type.
- **Error messages** for failed login attempts or other notifications.

### register.jsp
- **User Registration** interface.
- Form to collect user details including email, name, password, and contact.
- After registration, likely redirects to `login.jsp` or `userHome.jsp`.

### userHome.jsp
- **User Dashboard** after successful login.
- Displays user-specific information, order history, and other relevant actions.

### userProfile.jsp
- **User Profile View**.
- Showcases user details like email, name, and contact.
- Potential options to update or modify these details.

### adminHome.jsp
- **Dashboard** for administrators.
- Links to various **product management functionalities**:
- View all products (`adminViewProduct.jsp`).
- Add new products (`addProduct.jsp`).
- Update or delete existing products using `updateProduct.jsp` or `removeProduct.jsp`.

### adminStock.jsp
- **Stock Management** interface for administrators.
- Displays products with options to **view or edit stock levels**.

### adminViewProduct.jsp
- **Detailed View** for admins to manage the inventory.
- Displays products in a table with options to **edit, delete, or view stock details**.

### cartDetails.jsp
- Displays products added to the **user's shopping cart**.
- Options to **modify quantities, remove items**, or proceed to checkout.

### orderDetails.jsp
- **Post-purchase View** of a specific order.
- Displays products, quantities, prices, and other **order-specific details**.

### payment.jsp
- Handles the **payment process** for cart products.
- Collects **payment details** and proceeds with the transaction.

### addProduct.jsp
- Allows administrators to **add new products** to the inventory.
- Collects product details and submits them for addition to the inventory.

### removeProduct.jsp
- **Product Removal** interface for administrators.
- Allows admins to remove products from the inventory based on product ID or other criteria.

### shippedItems.jsp
- **Shipped Orders View** for administrators or users.
- Lists out orders that have been marked as shipped.

### unshippedItems.jsp
- **Unshipped Orders View** for administrators or users.
- Showcases orders that haven't been shipped yet.

### updateProduct.jsp & updateProductById.jsp
- **Product Update** interfaces for administrators.
- Provides forms to modify details of existing products in the inventory, either in bulk or by specific product ID.

## Java Beans

### CartBean.java
- **Package**: `com.shashi.beans`
- **Purpose**: Represents a Java Bean for a shopping cart item.
- **Attributes**:
- `userId`: ID of the user who has added the item to their cart.
- `prodId`: ID of the product added to the cart.
- `quantity`: Number of units of the product in the cart.
- **Methods**: Getters and setters for each attribute and a constructor.

### DemandBean.java
- **Package**: `com.shashi.beans`
- **Purpose**: Represents a Java Bean for product demand.
- **Attributes**:
- `userName`: Name of the user showing interest in a product.
- `prodId`: ID of the product for which demand is recorded.
- `demandQty`: Quantity of the product in demand.
- **Methods**: Getters and setters for each attribute and a constructor.

### OrderBean.java
- **Package**: `com.shashi.beans`
- **Purpose**: Represents a Java Bean for an order.
- **Attributes**:
- `transactionId`: Unique ID for the transaction.
- `productId`: ID of the product being ordered.
- `quantity`: Quantity of the product ordered.
- `amount`: Total amount for the ordered product.
- `shipped`: Flag to indicate shipping status.
- **Methods**: Getters and setters for each attribute and two constructors.

### OrderDetails.java
- **Package**: `com.shashi.beans`
- **Purpose**: Represents a Java Bean for detailed order information.
- **Attributes**:
- `orderId`: Unique ID for the order.
- `productId`: ID of the product in the order.
- `prodName`: Product name.
- `qty`: Product quantity in the order.
- `amount`: Total amount for the product in the order.
- `shipped`: Flag to indicate shipping status.
- `time`: Timestamp for order placement.
- `prodImage`: Image of the product.
- **Methods**: Getters and setters for each attribute.

### ProductBean.java
- **Package**: `com.shashi.beans`
- **Purpose**: Represents a Java Bean for a product.
- **Attributes**:
- `prodId`: Unique ID for the product.
- `prodName`: Product name.
- `prodType`: Product type or category.
- `prodInfo`: Product description.
- `prodPrice`: Product price.
- `prodQuantity`: Stock quantity.
- `prodImage`: Product image.
- **Methods**: Getters and setters for each attribute and a constructor.

### TransactionBean.java
- **Package**: `com.shashi.beans`
- **Purpose**: Represents a Java Bean for a transaction.
- **Attributes**:
- `transactionId`: Unique ID for the transaction.
- `userName`: User name for the transaction.
- `transDateTime`: Transaction timestamp.
- `transAmount`: Total transaction amount.
- **Methods**: Getters and setters for each attribute and multiple constructors.

### UserBean.java
- **Package**: `com.shashi.beans`
- **Purpose**: Represents a Java Bean for a user.
- **Attributes**:
- `name`: User name.
- `mobile`: Mobile number.
- `email`: Email ID.
- `address`: Address.
- `pinCode`: Postal or ZIP code.
- `password`: Password.
- **Methods**: Getters and setters for each attribute and multiple constructors.

## Database
1. Table `product`:
- Attributes:
- `pid` (VARCHAR(45))
- `pname` (VARCHAR(100))
- `ptype` (VARCHAR(20))
- `pinfo` (VARCHAR(350))
- `pprice` (DECIMAL(12,2))
- `pquantity` (INT)
- `image` (LONGBLOB)
- `brand` /////TODO//////
-PRIMARY KEY (`pid`)

2. Table `orders`:
- Attributes:
- `orderid` (VARCHAR(45))
- `prodid` (VARCHAR(45))
- `quantity` (INT)
- `amount` (DECIMAL(10,2))
- `shipped` (INT)
- PRIMARY KEY (`orderid`, `prodid`)

3. Table `user`:
- Attributes:
- `email` (VARCHAR(60))
- `name` (VARCHAR(30))
- `mobile` (BIGINT)
- `address` (VARCHAR(250))
- `pincode` (INT)
- `password` (VARCHAR(20))
- PRIMARY KEY (`email`)

4. Table `transactions`:
- Attributes:
- `transid` (VARCHAR(45))
- `username` (VARCHAR(60))
- `time` (DATETIME)
- `amount` (DECIMAL(10,2))
- PRIMARY KEY (`transid`)

5. Table `user_demand`:
- Attributes:
- `username` (VARCHAR(60))
- `prodid` (VARCHAR(45))
- `quantity` (INT)
- PRIMARY KEY (`username`, `prodid`)

6. Table `usercart`:
- Attributes:
- `username` (VARCHAR(60))
- `prodid` (VARCHAR(45))
- `quantity` (INT)
14 changes: 14 additions & 0 deletions WebContent/addProduct.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@
class="form-control" id="last_name" required>
</div>
</div>
<div class="row">
<div class="col-md-6 form-group">
<label for="producttype">Product Quality</label> <select name="type"
id="producttype" class="form-control" required>
<option value="new">New</option>
<option value="used">Used</option>
</select>
</div>
<div class="col-md-6 form-group">
<label for="last_name">Discount</label> <input type="number"
placeholder="Enter discount" name="discount"
class="form-control" id="last_name" required>
</div>
</div>
<div>
<div class="col-md-12 form-group">
<label for="last_name">Product Image</label> <input type="file"
Expand Down
8 changes: 7 additions & 1 deletion WebContent/adminStock.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
class="btn btn-danger">Remove</button>
</form>
</td>
<td>
<form method="post" action="saleProduct.jsp">
<input type="hidden" name="prodid" value="<%=product.getProdId()%>">
<button type="submit" class="btn btn-danger">Sale</button>
</form>
</td>

</tr>

Expand All @@ -120,4 +126,4 @@

<%@ include file="footer.html"%>
</body>
</html>
</html>
36 changes: 31 additions & 5 deletions WebContent/adminViewProduct.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@
products = prodDao.searchAllProducts(search);
message = "Showing Results for '" + search + "'";
} else if (type != null) {
products = prodDao.getAllProductsByType(type);
message = "Showing Results for '" + type + "'";
} else {
if ("used".equalsIgnoreCase(type)) {
//Handle "Used items" separately
products = prodDao.getProductsByQuality(type, "used");
} else {
products = prodDao.getAllProductsByType(type);
}
message = "Showing Results for '" + type + "'";
} else {
products = prodDao.getAllProducts();
}
if (products.isEmpty()) {
Expand All @@ -65,7 +70,22 @@
<!-- Start of Product Items List -->
<div class="container" style="background-color: #E6F9E6;">
<div class="row text-center">
<div class="col-sm-12">
<form>
<div class="btn-group" role="group">
<button type="submit" formaction="bestSelling.jsp">Best Selling</button>
<button type="submit" formaction="leastSelling.jsp">Least Selling</button>
</div>
</form>
</div>
</div>

<%
//Retrieve the updated price from the saleProduct
//double updatedPrice = Double.parseDouble(request.getParameter("updatedPrice"));
%>

<div class="row text-center">
<%
for (ProductBean product : products) {
%>
Expand All @@ -79,10 +99,16 @@
)
</p>
<p class="productinfo"><%=product.getProdInfo()%></p>

<!-- Display the original price -->
<p class="price">
Rs
Original price: Rs
<%=product.getProdPrice()%>
</p>

<!-- Display the updated price -->
<!--<p class="price">Sale price: Rs <%= request.getParameter("updatedPrice") %></p>-->

<form method="post">
<button type="submit"
formaction="./RemoveProductSrv?prodid=<%=product.getProdId()%>"
Expand All @@ -106,4 +132,4 @@
<%@ include file="footer.html"%>

</body>
</html>
</html>
Loading