| Server IP : 172.67.189.169 / 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'])){
echo "
<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>
".$_SESSION['error']."
</div>
";
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>ลำดับ</th>
<th>รหัสผู้ยืม</th>
<th>ชื่อ-สกุลผู้ป่วย</th>
<th>ชื่อ-สกุลผู้ยืม</th>
<th>โรค</th>
<th>ภาพประกอบ</th>
<th>จัดการข้อมูล</th>
</thead>
<tbody>
<?php
$sql = "SELECT *, students.id AS studid FROM students LEFT JOIN course ON course.id=students.course_id";
$query = $conn->query($sql);
$x=1;
while($row = $query->fetch_assoc()){
$photo = (!empty($row['photo'])) ? '../images/'.$row['photo'] : '../images/profile.jpg';
echo "
<tr>
<td>$x</td>
<td>".$row['student_id']."</td>
<td>".$row['firstname']."</td>
<td>".$row['lastname']."</td>
<td>".$row['code']."</td>
<td>
<img src='".$photo."' width='30px' height='30px'>
<a href='#edit_photo' data-toggle='modal' class='pull-right photo' data-id='".$row['studid']."'><span class='fa fa-edit'></span></a>
</td>
<td>
<button class='btn btn-success btn-sm edit btn-flat' data-id='".$row['studid']."'><i class='fa fa-edit'></i> แก้ไข</button>
<button class='btn btn-danger btn-sm delete btn-flat' data-id='".$row['studid']."'><i class='fa fa-trash'></i> ลบ</button>
</td>
</tr>
";
$x++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<?php include 'includes/footer.php'; ?>
<?php include 'includes/student_modal.php'; ?>
</div>
<?php include 'includes/scripts.php'; ?>
<script>
$(function(){
$(document).on('click', '.edit', function(e){
e.preventDefault();
$('#edit').modal('show');
var id = $(this).data('id');
getRow(id);
});
$(document).on('click', '.delete', function(e){
e.preventDefault();
$('#delete').modal('show');
var id = $(this).data('id');
getRow(id);
});
$(document).on('click', '.photo', function(e){
e.preventDefault();
var id = $(this).data('id');
getRow(id);
});
});
function getRow(id){
$.ajax({
type: 'POST',
url: 'student_row.php',
data: {id:id},
dataType: 'json',
success: function(response){
$('.studid').val(response.studid);
$('#edit_firstname').val(response.firstname);
$('#edit_lastname').val(response.lastname);
$('#edit_address').val(response.address);
$('#selcourse').val(response.course_id);
$('#selcourse').html(response.code);
$('.del_stu').html(response.firstname+' '+response.lastname);
}
});
}
</script>
</body>
</html>