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.
- Loading branch information
1 parent
83e7b95
commit ed77118
Showing
4 changed files
with
224 additions
and
62 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
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,30 @@ | ||
var selectedUserRowIndex; | ||
|
||
function openDeleteModal() { | ||
$('#deleteUserModal').modal('show'); | ||
// Lưu index của hàng được chọn | ||
selectedUserRowIndex = $(this).closest('tr').index(); | ||
} | ||
|
||
function closeDeleteModal() { | ||
$('#deleteUserModal').modal('hide'); | ||
} | ||
|
||
function deleteUser() { | ||
console.log("Deleting user..."); | ||
|
||
// Thực hiện các bước cần thiết để xóa user | ||
// ... | ||
|
||
// Xóa hàng trong bảng | ||
var rowToDelete = $('#datatablesSimple tbody tr').eq(selectedUserRowIndex); | ||
rowToDelete.remove(); | ||
|
||
// Đóng modal | ||
closeDeleteModal(); | ||
} | ||
|
||
// Event delegation to handle dynamically added elements | ||
$(document).on('click', '.btn-danger', function() { | ||
openDeleteModal(); | ||
}); |
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 |
---|---|---|
@@ -1,13 +1,189 @@ | ||
|
||
|
||
<%@page contentType="text/html" pageEncoding="UTF-8"%> | ||
<%@ page contentType="text/html" pageEncoding="UTF-8" %> | ||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | ||
<!DOCTYPE html> | ||
<html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<title>JSP Page</title> | ||
<link rel="icon" href="<%=request.getContextPath()%>/assets/images/favicon/favicon.png" type="image/ico"/> | ||
<title>User Management</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/style.min.css" rel="stylesheet" /> | ||
<link href="<%=request.getContextPath()%>/assets/css/admin/styles.css" rel="stylesheet" /> | ||
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script> | ||
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script> | ||
</head> | ||
<body> | ||
<h1>Hello World!</h1> | ||
|
||
<body class="sb-nav-fixed"> | ||
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark"> | ||
<!-- Navbar Brand--> | ||
<a class="navbar-brand ps-3" href="index.html">Welcome Admin</a> | ||
<!-- Sidebar Toggle--> | ||
<button class="btn btn-link btn-sm order-1 order-lg-0 me-4 me-lg-0" id="sidebarToggle" href="#!"><i class="fas fa-bars"></i></button> | ||
|
||
<!-- Navbar--> | ||
<ul class="navbar-nav d-none d-md-inline-block form-inline ms-auto me-0 me-md-3 my-2 my-md-0"> | ||
<li class="nav-item dropdown"> | ||
<a class="nav-link dropdown-toggle" id="navbarDropdown" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="fas fa-user fa-fw"></i></a> | ||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown"> | ||
<li><a class="dropdown-item" href="#!">Logout</a></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</nav> | ||
<div id="layoutSidenav"> | ||
<div id="layoutSidenav_nav"> | ||
<nav class="sb-sidenav accordion sb-sidenav-dark" id="sidenavAccordion"> | ||
<div class="sb-sidenav-menu"> | ||
<div class="nav"> | ||
<div class="sb-sidenav-menu-heading">Core</div> | ||
<a class="nav-link" href="index.html"> | ||
<div class="sb-nav-link-icon"><i class="fas fa-tachometer-alt"></i></div> | ||
Dashboard | ||
</a> | ||
<a class="nav-link" href="listUser"> | ||
<div class="sb-nav-link-icon"><i class="fas fa-table"></i></div> | ||
User Management | ||
</a> | ||
<a class="nav-link" href="listOrder"> | ||
<div class="sb-nav-link-icon"><i class="fas fa-table"></i></div> | ||
Order Management | ||
</a> | ||
<a class="nav-link" href="listCategory"> | ||
<div class="sb-nav-link-icon"><i class="fas fa-table"></i></div> | ||
Category Management | ||
</a> | ||
<a class="nav-link" href="listProduct"> | ||
<div class="sb-nav-link-icon"><i class="fas fa-table"></i></div> | ||
Product Management | ||
</a> | ||
</div> | ||
</div> | ||
<div class="sb-sidenav-footer"> | ||
<div class="small">Logged in as:</div> | ||
Admin | ||
</div> | ||
</nav> | ||
</div> | ||
<div id="layoutSidenav_content"> | ||
<main> | ||
<div class="container-fluid px-4"> | ||
<h1 class="mt-4">List User</h1> | ||
<ol class="breadcrumb mb-4"> | ||
<li class="breadcrumb-item active">Admin Role</li> | ||
</ol> | ||
<div class="card mb-4"> | ||
<div class="card-header"> | ||
<i class="fas fa-table me-1"></i> | ||
User Table | ||
</div> | ||
<div class="card-body"> | ||
<table id="datatablesSimple"> | ||
<thead> | ||
<tr> | ||
<th>ID</th> | ||
<th>Full Name</th> | ||
<th>Birth Year</th> | ||
<th>Gender</th> | ||
<th>Email</th> | ||
<th>Address</th> | ||
<th>Status</th> | ||
<th>Actions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>1</td> | ||
<td>Trần Huy Hoàng</td> | ||
<td>2003</td> | ||
<td>Male</td> | ||
<td>[email protected]</td> | ||
<td>Quy Nhon</td> | ||
<td>Active</td> | ||
<td> | ||
<a href="#" class="btn btn-danger btn-tiny" title="Delete"><i class="fa fa-trash"></i></a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>2</td> | ||
<td>Lê Minh Vương</td> | ||
<td>2003</td> | ||
<td>Male</td> | ||
<td>[email protected]</td> | ||
<td>Quy Nhon</td> | ||
<td>Active</td> | ||
<td> | ||
<a href="#" class="btn btn-danger btn-tiny" title="Delete"><i class="fa fa-trash"></i></a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>3</td> | ||
<td>Nguyễn Thị Thúy</td> | ||
<td>2003</td> | ||
<td>Male</td> | ||
<td>[email protected]</td> | ||
<td>Quy Nhon</td> | ||
<td>Active</td> | ||
<td> | ||
<a href="#" class="btn btn-danger btn-tiny" title="Delete"><i class="fa fa-trash"></i></a> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
<footer class="py-4 bg-light mt-auto"> | ||
<div class="container-fluid px-4"> | ||
<div class="d-flex align-items-center justify-content-between small"> | ||
<div class="text-muted">Copyright © Group1's Website 2023</div> | ||
<div> | ||
<a href="#">Privacy Policy</a> | ||
· | ||
<a href="#">Terms & Conditions</a> | ||
</div> | ||
</div> | ||
</div> | ||
</footer> | ||
</div> | ||
</div> | ||
|
||
|
||
<!-- Delete User Modal --> | ||
<div class="modal fade" id="deleteUserModal" tabindex="-1" role="dialog" aria-labelledby="deleteUserModalLabel" aria-hidden="true"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="deleteUserModalLabel">Delete User</h5> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="closeDeleteModal()"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<p>Are you sure you want to delete this user?</p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-danger" onclick="deleteUser()">Delete</button> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="closeDeleteModal()">Cancel</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | ||
<script src="<%=request.getContextPath()%>/assets/js/admin/scripts.js"></script> | ||
<script src="<%=request.getContextPath()%>/assets/js/admin/delete-user-modal.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js"></script> | ||
<script src="<%=request.getContextPath()%>/assets/js/admin/demo/chart-area-demo.js"></script> | ||
<script src="<%=request.getContextPath()%>/assets/js/admin/demo/chart-bar-demo.js"></script> | ||
<script src="<%=request.getContextPath()%>/assets/js/admin/demo/chart-pie-demo.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/simple-datatables.min.js"></script> | ||
<script src="<%=request.getContextPath()%>/assets/js/admin/demo/databases-simple-demo.js"></script> | ||
|
||
</body> | ||
</html> | ||
|
||
|
||
|