<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Employee/Volunteer Details</title>
<style>
/* General Styling */
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #667eea, #764ba2);
color: #fff;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background: rgba(255, 255, 255, 0.1);
padding: 2rem;
border-radius: 15px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
width: 400px;
text-align: center;
}
h1 {
margin-bottom: 1.5rem;
font-size: 1.8rem;
}
input {
width: 100%;
padding: 0.8rem;
margin: 0.5rem 0;
border: none;
border-radius: 8px;
background: rgba(255, 255, 255, 0.2);
color: #fff;
font-size: 1rem;
}
input::placeholder {
color: rgba(255, 255, 255, 0.7);
}
button {
width: 100%;
padding: 0.8rem;
margin-top: 1rem;
border: none;
border-radius: 8px;
background: #667eea;
color: #fff;
font-size: 1rem;
cursor: pointer;
transition: background 0.3s ease;
}
button:hover {
background: #764ba2;
}
.output-table {
margin-top: 2rem;
width: 100%;
border-collapse: collapse;
display: none;
}
.output-table th,
.output-table td {
padding: 0.8rem;
border: 1px solid rgba(255, 255, 255, 0.2);
text-align: left;
}
.output-table th {
background: rgba(255, 255, 255, 0.1);
}
</style>
</head>
<body>
<div class="container">
<h1>Employee/Volunteer Details</h1>
<input type="text" id="code" placeholder="Enter Employee/Volunteer Code">
<input type="text" id="birthYear" placeholder="Enter Birth Year">
<button onclick="fetchDetails()">Get Details</button>
<!-- Output Table -->
<table class="output-table" id="outputTable">
<thead>
<tr>
<th>Name</th>
<th>Post Held</th>
<th>Date of Joining</th>
<th>Date of Leaving</th>
</tr>
</thead>
<tbody>
<tr>
<td id="name">-</td>
<td id="post">-</td>
<td id="joiningDate">-</td>
<td id="leavingDate">-</td>
</tr>
</tbody>
</table>
</div>
<script>
// Inbuilt Database Simulation (Replace with WordPress Database Query)
const employees = [
{ code: "E001", birthYear: "1990", name: "John Doe", post: "Manager", joiningDate: "2015-05-10", leavingDate: "-" },
{ code: "V001", birthYear: "1985", name: "Jane Smith", post: "Volunteer", joiningDate: "2018-08-15", leavingDate: "2022-12-01" },
];
function fetchDetails() {
const code = document.getElementById("code").value.trim();
const birthYear = document.getElementById("birthYear").value.trim();
const outputTable = document.getElementById("outputTable");
const nameCell = document.getElementById("name");
const postCell = document.getElementById("post");
const joiningDateCell = document.getElementById("joiningDate");
const leavingDateCell = document.getElementById("leavingDate");
// Find employee/volunteer
const person = employees.find(
(emp) => emp.code === code && emp.birthYear === birthYear
);
if (person) {
nameCell.textContent = person.name;
postCell.textContent = person.post;
joiningDateCell.textContent = person.joiningDate;
leavingDateCell.textContent = person.leavingDate;
outputTable.style.display = "table";
} else {
alert("No matching record found!");
outputTable.style.display = "none";
}
}
</script>
</body>
</html>