This repository has been archived by the owner on May 31, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from hardingadonis/dev
Sale Dock - Release v0.7.0
- Loading branch information
Showing
38 changed files
with
1,502 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,6 @@ server/*.war | |
# IntelliJ IDEA | ||
.idea/ | ||
|
||
.history/ | ||
.history/ | ||
|
||
*.xlsx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
|
||
major_version=0 | ||
minor_version=6 | ||
minor_version=7 | ||
path_version=0 | ||
|
||
echo "$major_version.$minor_version.$path_version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/io/hardingadonis/saledock/controller/error/ErrorPageServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
package io.hardingadonis.saledock.controller.error; | ||
|
||
import jakarta.servlet.*; | ||
import jakarta.servlet.annotation.*; | ||
import jakarta.servlet.http.*; | ||
import java.io.*; | ||
|
||
@WebServlet(name = "ErrorPageServlet", urlPatterns = {"/error-404"}) | ||
public class ErrorPageServlet extends HttpServlet { | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.getRequestDispatcher("/view/jsp/error/404.jsp").forward(request, response); | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
.../java/io/hardingadonis/saledock/controller/management/customer/UpdateCustomerServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,70 @@ | ||
package io.hardingadonis.saledock.controller.management.customer; | ||
|
||
import io.hardingadonis.saledock.model.Customer; | ||
import io.hardingadonis.saledock.utils.Singleton; | ||
import jakarta.servlet.*; | ||
import jakarta.servlet.annotation.*; | ||
import jakarta.servlet.http.*; | ||
|
||
import java.io.*; | ||
import java.util.Optional; | ||
|
||
@WebServlet(name = "UpdateCustomerServlet", urlPatterns = {"/update-customer"}) | ||
public class UpdateCustomerServlet extends HttpServlet { | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
|
||
request.setAttribute("page", "customer"); | ||
|
||
String id = request.getParameter("id"); | ||
if (id == null) { | ||
response.sendError(404); | ||
return; | ||
} | ||
|
||
Integer id_customer = Integer.valueOf(id); | ||
Optional<Customer> customer = Singleton.customerDAO.getByID(id_customer); | ||
|
||
if (customer.isPresent()) { | ||
var cus = customer.get(); | ||
|
||
request.setAttribute("cus", cus); | ||
request.getRequestDispatcher("/view/jsp/management/customer/update-customer.jsp").forward(request, response); | ||
} else { | ||
response.sendRedirect(request.getContextPath() + "/customer"); | ||
} | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
|
||
System.out.println("hhhh"); | ||
String name = request.getParameter("nameCus"); | ||
String address = request.getParameter("addressCus"); | ||
|
||
String id = request.getParameter("id"); | ||
if (id == null) { | ||
response.sendError(404); | ||
return; | ||
} | ||
|
||
|
||
Integer id_customer = Integer.valueOf(id); | ||
Customer customer = Singleton.customerDAO.getByID(id_customer).get(); | ||
if (!name.isEmpty()) { | ||
customer.setName(name); | ||
} | ||
if (!address.isEmpty()) { | ||
customer.setAddress(address); | ||
} | ||
Singleton.customerDAO.save(customer); | ||
response.sendRedirect(request.getContextPath() + "/customer-detail?id="+id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.