This repository has been archived by the owner on Dec 31, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix_admin' into thuy_create_admin
- Loading branch information
Showing
21 changed files
with
1,421 additions
and
1 deletion.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/java/io/hardingadonis/miu/controller/admin/AdminServlet.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,33 @@ | ||
package io.hardingadonis.miu.controller.admin; | ||
|
||
import java.io.IOException; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
@WebServlet(name = "AdminServlet", urlPatterns = {"/admin"}) | ||
public class AdminServlet 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.getRequestDispatcher("/view/admin/admin.jsp").forward(request, response); | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
} | ||
|
||
|
||
@Override | ||
public String getServletInfo() { | ||
return "Short description"; | ||
}// </editor-fold> | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/io/hardingadonis/miu/controller/admin/ListCategoryServlet.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,35 @@ | ||
package io.hardingadonis.miu.controller.admin; | ||
|
||
import io.hardingadonis.miu.dao.impl.mysql.CategoryDAOMySQLImpl; | ||
import io.hardingadonis.miu.model.Category; | ||
import io.hardingadonis.miu.services.Singleton; | ||
import java.io.*; | ||
import java.util.*; | ||
import javax.servlet.*; | ||
import javax.servlet.annotation.MultipartConfig; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.*; | ||
|
||
@WebServlet(name = "ListCategoryServlet", urlPatterns = {"/listCategory"}) | ||
@MultipartConfig | ||
public class ListCategoryServlet 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.getRequestDispatcher("/view/admin/list_category.jsp").forward(request, response); | ||
|
||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
request.setCharacterEncoding("UTF-8"); | ||
response.setContentType("text/html; charset=UTF-8"); | ||
|
||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/io/hardingadonis/miu/controller/admin/ListOrderServlet.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,35 @@ | ||
|
||
package io.hardingadonis.miu.controller.admin; | ||
|
||
import java.io.IOException; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
@WebServlet(name = "ListOrderServlet", urlPatterns = {"/listOrder"}) | ||
public class ListOrderServlet 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.getRequestDispatcher("/view/admin/list_order.jsp").forward(request, response); | ||
} | ||
|
||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
} | ||
|
||
|
||
@Override | ||
public String getServletInfo() { | ||
return "Short description"; | ||
}// </editor-fold> | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/io/hardingadonis/miu/controller/admin/ListUserServlet.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,45 @@ | ||
package io.hardingadonis.miu.controller.admin; | ||
|
||
import io.hardingadonis.miu.services.Singleton; | ||
import java.io.IOException; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import org.json.simple.JSONObject; | ||
|
||
@WebServlet(name = "ListUserServlet", urlPatterns = {"/listUser"}) | ||
public class ListUserServlet 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.getRequestDispatcher("/view/admin/list_user.jsp").forward(request, response); | ||
} | ||
|
||
@Override | ||
protected void doDelete(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
try { | ||
int ID = Integer.parseInt(request.getParameter("id")); | ||
|
||
Singleton.userDAO.delete(ID); | ||
|
||
JSONObject jsonResponse = new JSONObject(); | ||
jsonResponse.put("status", "success"); | ||
jsonResponse.put("message", "User canceled successfully"); | ||
|
||
response.setContentType("application/json"); | ||
response.getWriter().write(jsonResponse.toString()); | ||
|
||
response.setStatus(HttpServletResponse.SC_OK); | ||
|
||
} catch (NumberFormatException ex) { | ||
System.err.println(ex.getMessage()); | ||
} | ||
} | ||
} |
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
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
Empty file.
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
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,48 @@ | ||
function deleteUser(id) { | ||
Swal.fire({ | ||
title: "Delete user?", | ||
text: "You really want to delete this user?", | ||
icon: "warning", | ||
showCancelButton: true, | ||
confirmButtonColor: "#3085d6", | ||
cancelButtonColor: "#d33", | ||
confirmButtonText: "Delete!", | ||
cancelButtonText: "No!" | ||
}).then((result) => { | ||
if (result.isConfirmed) { | ||
const url = "listUser?id=" + id; | ||
|
||
$.ajax({ | ||
url: url, | ||
type: "DELETE", | ||
dataType: "json", | ||
success: function (data) { | ||
if (data.status === "success") { | ||
Swal.fire({ | ||
title: "Success!", | ||
text: "You delete user success!", | ||
icon: "success" | ||
}).then((result) => { | ||
if (result.isConfirmed) { | ||
window.location.reload(); | ||
} | ||
}); | ||
} else { | ||
Swal.fire({ | ||
title: "Oops...", | ||
text: "Something was wrong!", | ||
icon: "error" | ||
}); | ||
} | ||
}, | ||
error: function () { | ||
Swal.fire({ | ||
title: "Oops...", | ||
text: "Something was wrong when send the request!", | ||
icon: "error" | ||
}); | ||
} | ||
}); | ||
} | ||
}); | ||
} |
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,54 @@ | ||
// Set new default font family and font color to mimic Bootstrap's default styling | ||
Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif'; | ||
Chart.defaults.global.defaultFontColor = '#292b2c'; | ||
|
||
// Area Chart Example | ||
var ctx = document.getElementById("myAreaChart"); | ||
var myLineChart = new Chart(ctx, { | ||
type: 'line', | ||
data: { | ||
labels: ["Mar 1", "Mar 2", "Mar 3", "Mar 4", "Mar 5", "Mar 6", "Mar 7", "Mar 8", "Mar 9", "Mar 10", "Mar 11", "Mar 12", "Mar 13"], | ||
datasets: [{ | ||
label: "Sessions", | ||
lineTension: 0.3, | ||
backgroundColor: "rgba(2,117,216,0.2)", | ||
borderColor: "rgba(2,117,216,1)", | ||
pointRadius: 5, | ||
pointBackgroundColor: "rgba(2,117,216,1)", | ||
pointBorderColor: "rgba(255,255,255,0.8)", | ||
pointHoverRadius: 5, | ||
pointHoverBackgroundColor: "rgba(2,117,216,1)", | ||
pointHitRadius: 50, | ||
pointBorderWidth: 2, | ||
data: [10000, 30162, 26263, 18394, 18287, 28682, 31274, 33259, 25849, 24159, 32651, 31984, 38451], | ||
}], | ||
}, | ||
options: { | ||
scales: { | ||
xAxes: [{ | ||
time: { | ||
unit: 'date' | ||
}, | ||
gridLines: { | ||
display: false | ||
}, | ||
ticks: { | ||
maxTicksLimit: 7 | ||
} | ||
}], | ||
yAxes: [{ | ||
ticks: { | ||
min: 0, | ||
max: 40000, | ||
maxTicksLimit: 5 | ||
}, | ||
gridLines: { | ||
color: "rgba(0, 0, 0, .125)", | ||
} | ||
}], | ||
}, | ||
legend: { | ||
display: false | ||
} | ||
} | ||
}); |
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,46 @@ | ||
// Set new default font family and font color to mimic Bootstrap's default styling | ||
Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif'; | ||
Chart.defaults.global.defaultFontColor = '#292b2c'; | ||
|
||
// Bar Chart Example | ||
var ctx = document.getElementById("myBarChart"); | ||
var myLineChart = new Chart(ctx, { | ||
type: 'bar', | ||
data: { | ||
labels: ["January", "February", "March", "April", "May", "June"], | ||
datasets: [{ | ||
label: "Revenue", | ||
backgroundColor: "rgba(2,117,216,1)", | ||
borderColor: "rgba(2,117,216,1)", | ||
data: [4215, 5312, 6251, 7841, 9821, 14984], | ||
}], | ||
}, | ||
options: { | ||
scales: { | ||
xAxes: [{ | ||
time: { | ||
unit: 'month' | ||
}, | ||
gridLines: { | ||
display: false | ||
}, | ||
ticks: { | ||
maxTicksLimit: 6 | ||
} | ||
}], | ||
yAxes: [{ | ||
ticks: { | ||
min: 0, | ||
max: 15000, | ||
maxTicksLimit: 5 | ||
}, | ||
gridLines: { | ||
display: true | ||
} | ||
}], | ||
}, | ||
legend: { | ||
display: false | ||
} | ||
} | ||
}); |
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,16 @@ | ||
// Set new default font family and font color to mimic Bootstrap's default styling | ||
Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif'; | ||
Chart.defaults.global.defaultFontColor = '#292b2c'; | ||
|
||
// Pie Chart Example | ||
var ctx = document.getElementById("myPieChart"); | ||
var myPieChart = new Chart(ctx, { | ||
type: 'pie', | ||
data: { | ||
labels: ["Blue", "Red", "Yellow", "Green"], | ||
datasets: [{ | ||
data: [12.21, 15.58, 11.25, 8.32], | ||
backgroundColor: ['#007bff', '#dc3545', '#ffc107', '#28a745'], | ||
}], | ||
}, | ||
}); |
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,4 @@ | ||
// Call the dataTables jQuery plugin | ||
$(document).ready(function() { | ||
$('#dataTable').DataTable(); | ||
}); |
10 changes: 10 additions & 0 deletions
10
src/main/webapp/assets/js/admin/demo/datatables-simple-demo.js
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,10 @@ | ||
|
||
window.addEventListener('DOMContentLoaded', event => { | ||
// Simple-DataTables | ||
// https://github.com/fiduswriter/Simple-DataTables/wiki | ||
|
||
const datatablesSimple = document.getElementById('datatablesSimple'); | ||
if (datatablesSimple) { | ||
new simpleDatatables.DataTable(datatablesSimple); | ||
} | ||
}); |
Oops, something went wrong.