| Server IP : 104.21.73.108 / Your IP : 216.73.216.59 Web Server : Apache/2 System : Linux cat167-197.static.lnwhostname.com 5.10.0-20-amd64 #1 SMP Debian 5.10.158-2 (2022-12-13) x86_64 User : paphayomho ( 1042) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/paphayomho/domains/paphayomhospital.go.th/private_html/PCU2566/admin/ |
Upload File : |
<?php include 'includes/session.php'; ?>
<?php include 'includes/header.php'; ?>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<?php include 'includes/navbar.php'; ?>
<?php include 'includes/menubar.php'; ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
จัดการข้อมูลการคืนอุปกรณ์
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> หน้าหลัก</a></li>
<li>จัดการข้อมูลการยืม-คืน</li>
<li class="active">คืนอุปกรณ์</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<?php
if(isset($_SESSION['error'])){
?>
<div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-warning"></i> ข้อมูลมีข้อผิดพลาด!</h4>
<ul>
<?php
foreach($_SESSION['error'] as $error){
echo "
<li>".$error."</li>
";
}
?>
</ul>
</div>
<?php
unset($_SESSION['error']);
}
if(isset($_SESSION['success'])){
echo "
<div class='alert alert-success alert-dismissible'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-check'></i> ข้อมูลถูกบันทึกเรียบร้อย!</h4>
".$_SESSION['success']."
</div>
";
unset($_SESSION['success']);
}
?>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header with-border">
<a href="#addnew" data-toggle="modal" class="btn btn-primary btn-sm btn-flat"><i class="fa fa-plus"></i> คืนอุปกรณ์</a>
</div>
<div class="box-body">
<table id="example1" class="table table-bordered">
<thead>
<th class="hidden"></th>
<th>ลำดับ</th>
<th>วันที่คืนอุปกรณ์</th>
<th>ชื่อ-สกุลผู้ป่วย</th>
<th>ชื่อ-สกุลผู้ยืม</th>
<th>รหัสอุปกรณ์</th>
<th>ชื่ออุปกรณ์</th>
</thead>
<tbody>
<?php
$sql = "SELECT *, students.student_id AS stud FROM returns LEFT JOIN students ON students.id=returns.student_id LEFT JOIN books ON books.id=returns.book_id ORDER BY date_return DESC";
$query = $conn->query($sql);
$x=1;
while($row = $query->fetch_assoc()){
if($row['status']){
$status = '<span class="label label-danger">ถูกยืม</span>';
}
else{
$status = '<span class="label label-success">คืนแล้ว</span>';
}
echo "
<tr>
<td class='hidden'></td>
<td>$x</td>
<td>".$row['dater']."</td>
<td>".$row['firstname']."</td>
<td>".$row['lastname']."</td>
<td>".$row['isbn']."</td>
<td>".$row['title']."</td>
</tr>
";
$x++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<?php include 'includes/footer.php'; ?>
<?php include 'includes/return_modal.php'; ?>
</div>
<?php include 'includes/scripts.php'; ?>
<script>
function rem_select(){
$('[name="isbn[]"]').change(function(){
if($(this).val() == '<rem>'){
$(this).closest('.form-group').remove()
}
})
}
$(function(){
$(document).on('click', '#append', function(e){
e.preventDefault();
var books = '<?php echo json_encode($brows) ?>';
var _s = $('<select class="form-control" name="isbn[]"></select>')
var _tmp = $('<div></div>')
var option = '';
option += '<option value="" selected disabled>เลือกข้อมูลอุปกรณ์.</option>';
option += '<option value="<rem>" >< remove select></option>';
books = JSON.parse(books)
if(books.length > 0){
Object.keys(books).map(k=>{
option += '<option value="'+books[k].isbn+'">'+books[k].title+' ['+books[k].isbn+']'+'</option>'
})
}
_s.append(option)
_tmp.append(_s)
// $('#append-div').append(
// '<div class="form-group"><label for="" class="col-sm-3 control-label">ISBN</label><div class="col-sm-9"><input type="text" class="form-control" name="isbn[]"></div></div>'
// );
$('#append-div').append(
'<div class="form-group"><label for="" class="col-sm-3 control-label">ข้อมูลอุปกรณ์</label><div class="col-sm-9">'+_tmp.html()+'</div></div>'
);
rem_select()
});
});
</script>
</body>
</html>