-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcrud_options.html
More file actions
93 lines (84 loc) · 2.96 KB
/
crud_options.html
File metadata and controls
93 lines (84 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html>
<head>
<title>EMS Main Page</title>
<!-- Use Bootstrap for styling -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<style>
.search-container {
position: fixed;
top: 20px;
right: 10px;
display: flex;
align-items: center;
}
.search-container .search-icon {
cursor: pointer;
}
.search-container .search-input {
display: none;
margin-right: 20px;
transition: width 0.5s ease-in-out;
}
.search-container .search-input.visible {
display: block;
width: 300px;
}
</style>
<script>
function updateEmployee() {
var id = prompt("Enter ID:");
if (id != null) {
window.location.href = "/api/update_employee/" + id;
}
}
function deleteEmployee() {
var id = prompt("Enter ID:");
if (id != null) {
window.location.href = "/api/delete_employee/" + id;
}
}
function toggleSearchBar() {
var searchBar = document.querySelector('.search-input');
searchBar.classList.toggle('visible');
searchBar.focus();
}
function searchEmployee() {
var search_query = document.querySelector('.search-input').value;
if (search_query) {
window.location.href = "/api/search_employee?search_query=" + encodeURIComponent(search_query);
}
}
</script>
</head>
<body>
<div class="search-container">
<span class="search-icon" onclick="toggleSearchBar()">
<img src="https://img.icons8.com/small/16/000000/search.png" alt="Search">
</span>
<input type="text" class="search-input" onkeydown="if (event.key === 'Enter') searchEmployee()" placeholder="Search (ID, Name, Email, or Department)">
</div>
<!-- Create a banner -->
<div class="jumbotron">
<h1 class="display-4">Employee Management System</h1>
<p class="lead">Select an Employee Operation to Perform</p>
</div>
<!-- Use a container to center the form -->
<div class="container">
<div class="row">
<div class="col-md-3">
<a href="{{ url_for('add_employee_form') }}" class="btn btn-primary btn-block">Create</a>
</div>
<div class="col-md-3">
<a href="{{ url_for('get_all') }}" class="btn btn-primary btn-block">Read</a>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block" onclick="updateEmployee()">Update</button>
</div>
<div class="col-md-3">
<button class="btn btn-primary btn-block" onclick="deleteEmployee()">Delete</button>
</div>
</div>
</div>
</body>
</html>