Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #76 from hardingadonis/vuong-dashboard
Browse files Browse the repository at this point in the history
Update Dashboard Servlet
  • Loading branch information
hardingadonis authored Jan 23, 2024
2 parents 58099c4 + 5525ba2 commit edc1af9
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ public class DashboardServlet 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", "dashboard");

request.getRequestDispatcher("/view/jsp/others/dashboard/dashboard.jsp").forward(request, response);
}

@Override
Expand Down
14 changes: 7 additions & 7 deletions src/main/webapp/view/common/_sidenav.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@

<ul class="navbar-nav text-light" id="accordionSidebar">
<li class="nav-item">
<a class="nav-link" href="<%=request.getContextPath()%>/dashboard">
<a class="nav-link ${requestScope.page eq 'dashboard' ? 'active' : ''}" href="<%=request.getContextPath()%>/dashboard" data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="right" title="Bảng điều khiển">
<i class="fas fa-tachometer-alt"></i>
<span>Bảng điều khiển</span>
</a>
</li>

<li class="nav-item">
<a class="nav-link" href="<%=request.getContextPath()%>/customer" title="Quản lí khách hàng">
<a class="nav-link ${requestScope.page eq 'customer' ? 'active' : ''}" href="<%=request.getContextPath()%>/customer" data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="right" title="Quản lí khách hàng">
<i class="fas fa-table"></i>
<span data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="right" title="Quản lí sản phẩm">
<span>
Khách hàng
</span>
</a>

<a class="nav-link" href="<%=request.getContextPath()%>/product" title="Quản lí sản phẩm">
<a class="nav-link ${requestScope.page eq 'product' ? 'active' : ''}" href="<%=request.getContextPath()%>/product" data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="right" title="Quản lí sản phẩm">
<i class="fas fa-table"></i>
<span data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="right" title="Quản lí sản phẩm">
<span>
Sản phẩm
</span>
</a>

<a class="nav-link" href="<%=request.getContextPath()%>/order" title="Quản lí đơn hàng">
<a class="nav-link ${requestScope.page eq 'order' ? 'active' : ''}" href="<%=request.getContextPath()%>/order" data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="right" title="Quản lí đơn hàng">
<i class="fas fa-table"></i>
<span data-bs-toggle="tooltip" data-bss-tooltip="" data-bs-placement="right" title="Quản lí đơn hàng">
<span>
Đơn hàng
</span>
</a>
Expand Down
124 changes: 124 additions & 0 deletions src/main/webapp/view/jsp/others/dashboard/dashboard.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<%@ page contentType="text/html" pageEncoding="UTF-8" %>

<%@page import="io.hardingadonis.saledock.utils.Singleton" %>

<!DOCTYPE html>
<html data-bs-theme="light" lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>Sale Dock - Bảng điều khiển</title>
<link rel="icon" type="image/png" sizes="512x512" href="<%=request.getContextPath()%>/view/assets/images/favicon/favicon.png">
<link rel="stylesheet" href="<%=request.getContextPath()%>/view/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i&amp;display=swap">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/line-awesome/1.3.0/line-awesome/css/line-awesome.min.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/view/assets/css/animate.min.css">
</head>

<body id="page-top">
<div id="wrapper">

<%@include file="../../../common/_sidenav.jsp" %>

<div class="d-flex flex-column" id="content-wrapper">
<div id="content">
<%@include file="../../../common/_nav.jsp" %>

<div class="container-fluid">
<div class="d-sm-flex justify-content-between align-items-center mb-4">
<h3 class="text-dark mb-0">Bảng điều khiển</h3>
<a class="btn btn-primary btn-sm d-none d-sm-inline-block" role="button" href="#">
<i class="fas fa-download fa-sm text-white-50"></i>&nbsp;Tải báo cáo
</a>
</div>
<div class="row">
<div class="col-md-6 col-xl-4 mb-4" data-bss-hover-animate="pulse">
<div class="card shadow border-start-primary py-2">
<div class="card-body">
<div class="row align-items-center no-gutters">
<div class="col me-2">
<div class="text-uppercase text-primary fw-bold text-xs mb-1"><span>Tổng số khách hàng</span></div>
<div class="text-dark fw-bold h5 mb-0"><span>🤝 ${Singleton.customerDAO.count()} khách hàng</span></div>
</div>
<div class="col-auto"><i class="fas fa-table fa-2x text-gray-300"></i></div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-xl-4 mb-4" data-bss-hover-animate="pulse">
<div class="card shadow border-start-success py-2">
<div class="card-body">
<div class="row align-items-center no-gutters">
<div class="col me-2">
<div class="text-uppercase text-success fw-bold text-xs mb-1"><span>Tổng số sản phẩm</span></div>
<div class="text-dark fw-bold h5 mb-0"><span>📦 ${Singleton.productDAO.count()} sản phẩm</span></div>
</div>
<div class="col-auto"><i class="fas fa-table fa-2x text-gray-300"></i></div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-xl-4 mb-4" data-bss-hover-animate="pulse">
<div class="card shadow border-start-warning py-2">
<div class="card-body">
<div class="row align-items-center no-gutters">
<div class="col me-2">
<div class="text-uppercase text-warning fw-bold text-xs mb-1"><span>Tổng số đơn hàng</span></div>
<div class="text-dark fw-bold h5 mb-0"><span>🛒 ${Singleton.orderDAO.count()} đơn hàng</span></div>
</div>
<div class="col-auto"><i class="fas fa-table fa-2x text-gray-300"></i></div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-7 col-xl-8">
<div class="card shadow mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h6 class="text-primary fw-bold m-0">Earnings Overview</h6>
<div class="dropdown no-arrow"><button class="btn btn-link btn-sm dropdown-toggle" aria-expanded="false" data-bs-toggle="dropdown" type="button"><i class="fas fa-ellipsis-v text-gray-400"></i></button>
<div class="dropdown-menu shadow dropdown-menu-end animated--fade-in">
<p class="text-center dropdown-header">dropdown header:</p><a class="dropdown-item" href="#">&nbsp;Action</a><a class="dropdown-item" href="#">&nbsp;Another action</a>
<div class="dropdown-divider"></div><a class="dropdown-item" href="#">&nbsp;Something else here</a>
</div>
</div>
</div>
<div class="card-body">
<div class="chart-area"><canvas data-bss-chart="{&quot;type&quot;:&quot;line&quot;,&quot;data&quot;:{&quot;labels&quot;:[&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;,&quot;Jul&quot;,&quot;Aug&quot;],&quot;datasets&quot;:[{&quot;label&quot;:&quot;Earnings&quot;,&quot;fill&quot;:true,&quot;data&quot;:[&quot;0&quot;,&quot;10000&quot;,&quot;5000&quot;,&quot;15000&quot;,&quot;10000&quot;,&quot;20000&quot;,&quot;15000&quot;,&quot;25000&quot;],&quot;backgroundColor&quot;:&quot;rgba(78, 115, 223, 0.05)&quot;,&quot;borderColor&quot;:&quot;rgba(78, 115, 223, 1)&quot;}]},&quot;options&quot;:{&quot;maintainAspectRatio&quot;:false,&quot;legend&quot;:{&quot;display&quot;:false,&quot;labels&quot;:{&quot;fontStyle&quot;:&quot;normal&quot;}},&quot;title&quot;:{&quot;fontStyle&quot;:&quot;normal&quot;},&quot;scales&quot;:{&quot;xAxes&quot;:[{&quot;gridLines&quot;:{&quot;color&quot;:&quot;rgb(234, 236, 244)&quot;,&quot;zeroLineColor&quot;:&quot;rgb(234, 236, 244)&quot;,&quot;drawBorder&quot;:false,&quot;drawTicks&quot;:false,&quot;borderDash&quot;:[&quot;2&quot;],&quot;zeroLineBorderDash&quot;:[&quot;2&quot;],&quot;drawOnChartArea&quot;:false},&quot;ticks&quot;:{&quot;fontColor&quot;:&quot;#858796&quot;,&quot;fontStyle&quot;:&quot;normal&quot;,&quot;padding&quot;:20}}],&quot;yAxes&quot;:[{&quot;gridLines&quot;:{&quot;color&quot;:&quot;rgb(234, 236, 244)&quot;,&quot;zeroLineColor&quot;:&quot;rgb(234, 236, 244)&quot;,&quot;drawBorder&quot;:false,&quot;drawTicks&quot;:false,&quot;borderDash&quot;:[&quot;2&quot;],&quot;zeroLineBorderDash&quot;:[&quot;2&quot;]},&quot;ticks&quot;:{&quot;fontColor&quot;:&quot;#858796&quot;,&quot;fontStyle&quot;:&quot;normal&quot;,&quot;padding&quot;:20}}]}}}"></canvas></div>
</div>
</div>
</div>
<div class="col-lg-5 col-xl-4">
<div class="card shadow mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h6 class="text-primary fw-bold m-0">Revenue Sources</h6>
<div class="dropdown no-arrow"><button class="btn btn-link btn-sm dropdown-toggle" aria-expanded="false" data-bs-toggle="dropdown" type="button"><i class="fas fa-ellipsis-v text-gray-400"></i></button>
<div class="dropdown-menu shadow dropdown-menu-end animated--fade-in">
<p class="text-center dropdown-header">dropdown header:</p><a class="dropdown-item" href="#">&nbsp;Action</a><a class="dropdown-item" href="#">&nbsp;Another action</a>
<div class="dropdown-divider"></div><a class="dropdown-item" href="#">&nbsp;Something else here</a>
</div>
</div>
</div>
<div class="card-body">
<div class="chart-area"><canvas data-bss-chart="{&quot;type&quot;:&quot;doughnut&quot;,&quot;data&quot;:{&quot;labels&quot;:[&quot;Direct&quot;,&quot;Social&quot;,&quot;Referral&quot;],&quot;datasets&quot;:[{&quot;label&quot;:&quot;&quot;,&quot;backgroundColor&quot;:[&quot;#4e73df&quot;,&quot;#1cc88a&quot;,&quot;#36b9cc&quot;],&quot;borderColor&quot;:[&quot;#ffffff&quot;,&quot;#ffffff&quot;,&quot;#ffffff&quot;],&quot;data&quot;:[&quot;50&quot;,&quot;30&quot;,&quot;15&quot;]}]},&quot;options&quot;:{&quot;maintainAspectRatio&quot;:false,&quot;legend&quot;:{&quot;display&quot;:false,&quot;labels&quot;:{&quot;fontStyle&quot;:&quot;normal&quot;}},&quot;title&quot;:{&quot;fontStyle&quot;:&quot;normal&quot;}}}"></canvas></div>
<div class="text-center small mt-4"><span class="me-2"><i class="fas fa-circle text-primary"></i>&nbsp;Direct</span><span class="me-2"><i class="fas fa-circle text-success"></i>&nbsp;Social</span><span class="me-2"><i class="fas fa-circle text-info"></i>&nbsp;Refferal</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
<%@include file="../../../common/_footer.jsp" %>
</div>
<%@include file="../../../common/_goback.jsp" %>
</div>

<script src="<%=request.getContextPath()%>/view/assets/js/bootstrap.min.js"></script>
<script src="<%=request.getContextPath()%>/view/assets/js/bs-init.js"></script>
<script src="<%=request.getContextPath()%>/view/assets/js/theme.js"></script>
</body>

</html>

0 comments on commit edc1af9

Please sign in to comment.