Editing: home_doctor.php
Kembali
<?php //include 'includes/session.php'; ?> <?php //include 'includes/header.php'; include '../timezone.php'; $range_to = date('m/d/Y'); $range_from = date('m/d/Y', strtotime('-30 day', strtotime($range_to))); $userid=$_SESSION["userID"]; $id_login= $_SESSION["uc"]; ?> <body > <?php //include 'includes/navbar.php'; ?> <?php //include ?> <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> Error!</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> Success!</h4> ".$_SESSION['success']." </div> "; unset($_SESSION['success']); } ?> <div class="row"> <div class="col-xs-12"> <div class="box"> <div class="box-header with-border"> <div class="pull-right"> <form method="POST" class="form-inline" id="payForm" target="_blank"> <div class="input-group"> <div class="input-group-addon"> <i class="fa fa-calendar"></i> </div> <input type="text" class="form-control pull-right col-sm-8" id="iddoctor" name="iddoctor" placeholder="Type Name of Doctor Here!!"> </div> <button type="button" class="btn btn-primary btn-sm btn-flat" id="listdoctor" name="listdoctor"><span class="glyphicon glyphicon-print"></span> List of Doctor</button> </form> </div> </div> <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> New</a> </div> <div class="table-wrapper"> <table id="example1" class="fl-table"> <thead> <tr> <th >TOOLS</th> <th><strong>NO.</strong></th> <th><strong>Date</strong></th> <th><strong>First Name</strong></th> <th><strong>Last Name</strong></th> <th><strong>Hospital ID</strong></th> <th width="362"><strong>Address</strong></th> <th><strong>Contact No.</strong></th> <th>Email</th> <th>Department</th> <th>Speciality</th> <th>Designation</th> <?php $to = date('Y-m-d'); $from = date('Y-m-d', strtotime('-30 day', strtotime($to))); $tinan=$year = date('Y', strtotime($to)); if(isset($_GET['range'])){ $range = $_GET['range']; $ex = explode(' - ', $range); $from = date('Y-m-d', strtotime($ex[0])); $to = date('Y-m-d', strtotime($ex[1])); } if ($id_login == 2){ $sql = " Select d1.SSN, d1.F_Name, d1.L_Name, d1.Hospital_ID, d1.Address, d1.Contact_No, d1.Email, d1.Department, d1.Speciality, d1.Designation, d2.pass From doctor AS d1 Inner Join doctor_login AS d2 ON d2.d_ssn = d1.SSN where d1.SSN='$userid'"; }else{ $sql = " Select d1.SSN, d1.F_Name, d1.L_Name, d1.Hospital_ID, d1.Address, d1.Contact_No, d1.Email, d1.Department, d1.Speciality, d1.Designation, d2.pass From doctor AS d1 Inner Join doctor_login AS d2 ON d2.d_ssn = d1.SSN";} $query = $conn->query($sql); $i=0; while($row = $query->fetch_array()){ $i ++; echo " <tr> <td> <button class='btn btn-success btn-sm edit btn-flat' data-id='".$row[0]."'> <i class='fa fa-edit'></i>Edit</button> <button class='btn btn-danger btn-sm delete btn-flat' data-id='".$row[0]."'> <i class='fa fa-trash'></i> Delete</button> </td> <td>".$i."</td> <td>".$row[0]."</td> <td>".$row[1]."</td> <td>".$row[2]."</td> <td>".$row[3]."</td> <td>".$row[4]."</td> <td>".$row[5]."</td> <td>".$row[6]."</td> <td>".$row[7]."</td> <td>".$row[8]."</td> <td>".$row[9]."</td> </tr>";} ?> </tbody> <thead> </table> </div> </div> </div> </div> <?php //include 'includes/footer.php'; ?> <?php include 'includes/doctor_modal.php'; ?> </div> <?php include 'includes/scripts.php'; ?> <script> $(function(){ $('.edit').click(function(e){ e.preventDefault(); $('#edit').modal('show'); var id = $(this).data('id'); getRow(id); }); $('.delete').click(function(e){ e.preventDefault(); $('#delete').modal('show'); var id = $(this).data('id'); getRow(id); }); $('#treatment').click(function(e){ e.preventDefault(); var id1 = document.getElementById('idtreatment').value; var ir = document.getElementById('reservation').value; $('#payForm').attr('action', 'treatment_generate.php?ids='+ id1 +'&date_range='+ ir); $('#payForm').submit(); }); $('#listdoctor').click(function(e){ var id1 = document.getElementById('iddoctor').value; $('#payForm').attr('action', 'listdoctor_generate.php?ids='+ id1 ); $('#payForm').submit(); }); $('#generatetreatment').click(function(e){ e.preventDefault(); $('#payForm').attr('action', 'generatetreatment.php'); $('#payForm').submit(); }); }); function getRow(id){ $.ajax({ type: 'POST', url: 'doctor_row.php', data: {id:id}, dataType: 'json', success: function(response){ $('#posid').val(response.SSN); $('#ps').html(response.SSN); $('#fname').html(response.F_Name); $('#lname').val(response.L_Name); $('#adr').val(response.Address); $('#cont').val(response.Contact_No); $('#hosid').val(response.Hospital_ID); $('#desig').val(response.Designation); $('#dept').val(response.Department); $('#spec').val(response.Speciality); $('#passw').val(response.pass); $('#del_posid').val(response.SSN); $('#emel').val(response.Email); } }); } </script> <?php include 'includes/datatable_initializer.php'; ?> </body> </html>
SIMPAN PERUBAHAN