TKK_E32210823/cari_rfid.php

118 lines
3.8 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<title>Cari RFID</title>
<link rel="stylesheet" type="text/css" href="css/userslog.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css" />
<style>
/* Custom CSS for form */
.form-style-5 form input[type="text"],
.form-style-5 form input[type="date"],
.form-style-5 form button {
width: 100%;
height: 40px;
}
.form-style-5 form a#download_data {
display: inline-block;
width: 100%;
height: 40px;
line-height: 40px;
text-align: center;
background-color: #007bff;
color: white;
text-decoration: none;
margin-top: 10px; /* Add some space between buttons */
}
</style>
<script src="js/jquery-2.2.3.min.js"></script>
<script>
$(document).ready(function(){
$('#search_rfid').on('click', function(){
var rfid = $('#rfid_input').val();
var start_date = $('#start_date').val();
var end_date = $('#end_date').val();
if(rfid && start_date && end_date) {
$.ajax({
url: "cari_rfid_up.php",
type: 'POST',
data: {
'rfid': rfid,
'start_date': start_date,
'end_date': end_date
}
}).done(function(data) {
$('#rfid_result').html(data);
$('#hidden_rfid').val(rfid);
});
} else {
alert("Masukkan RFID, Tanggal Awal, dan Tanggal Akhir");
}
});
// Add event listener to download_data to include the RFID and dates in the query string
$('#download_data').on('click', function() {
var rfid = $('#hidden_rfid').val();
var start_date = $('#start_date').val();
var end_date = $('#end_date').val();
if(rfid && start_date && end_date) {
window.location.href = 'excel.php?rfid=' + rfid + '&start_date=' + start_date + '&end_date=' + end_date;
} else {
alert("Cari RFID, Tanggal Awal, dan Tanggal Akhir terlebih dahulu");
}
});
});
</script>
</head>
<body>
<?php include 'header.php'; ?>
<header>
<nav>
<ul>
<li><a href="userslog.php">Users Logs</a></li>
<li><a href="cari_rfid.php">Cari RFID</a></li>
</ul>
</nav>
</header>
<main>
<section>
<!--RFID search-->
<h1 class="slideInDown animated">Cari RFID</h1>
<div class="form-style-5 slideInDown animated">
<form>
<input type="text" name="rfid_input" id="rfid_input" placeholder="Masukkan RFID">
<input type="date" name="start_date" id="start_date" placeholder="Tanggal Awal">
<input type="date" name="end_date" id="end_date" placeholder="Tanggal Akhir">
<button type="button" id="search_rfid">Cari</button>
<input type="hidden" id="hidden_rfid" name="hidden_rfid">
<a href="#" id="download_data">Ambil Data</a>
</form>
</div>
<div class="tbl-header slideInRight animated">
<table cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th class="text-center">Tanggal</th>
<th class="text-center">Rfid</th>
<th class="text-center">Waktu Masuk</th>
<th class="text-center">Photo Masuk</th>
<th class="text-center">Waktu Keluar</th>
<th class="text-center">Photo Keluar</th>
</tr>
</thead>
</table>
</div>
<div class="tbl-content slideInRight animated">
<table cellpadding="0" cellspacing="0" border="0">
<tbody id="rfid_result">
<!-- Results will be appended here -->
</tbody>
</table>
</div>
</section>
</main>
</body>
</html>