Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kishan0725 committed Feb 24, 2020
1 parent 337b45b commit f3ac299
Show file tree
Hide file tree
Showing 14 changed files with 379 additions and 140 deletions.
73 changes: 67 additions & 6 deletions admin-panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$username = $_SESSION['username'];
$email = $_SESSION['email'];
$fname = $_SESSION['fname'];
$gender = $_SESSION['gender'];
$lname = $_SESSION['lname'];
$contact = $_SESSION['contact'];

Expand All @@ -14,6 +15,7 @@
$email = $_SESSION['email'];
$fname = $_SESSION['fname'];
$lname = $_SESSION['lname'];
$gender = $_SESSION['gender'];
$contact = $_SESSION['contact'];
$doctor=$_POST['doctor'];
$email=$_SESSION['email'];
Expand All @@ -22,14 +24,40 @@

$appdate=$_POST['appdate'];
$apptime=$_POST['apptime'];


$query=mysqli_query($con,"insert into appointmenttb(fname,lname,email,contact,doctor,docFees,appdate,apptime) values('$fname','$lname','$email','$contact','$doctor','$docFees','$appdate','$apptime')");
$query=mysqli_query($con,"insert into appointmenttb(fname,lname,gender,email,contact,doctor,docFees,appdate,apptime,userStatus,doctorStatus) values('$fname','$lname','$gender','$email','$contact','$doctor','$docFees','$appdate','$apptime','1','1')");
if($query)
{
echo "<script>alert('Your appointment successfully booked');</script>";
}
}

if(isset($_GET['cancel']))
{
$query=mysqli_query($con,"update appointmenttb set userStatus='0' where ID = '".$_GET['ID']."'");
if($query)
{
echo "<script>alert('Your appointment successfully cancelled');</script>";
}
}

// if(isset($_POST['userAction'])){
// $userStatus = 0;
// $doctorStatus = 1;
// $doctor=$_POST['doctor'];
// $appdate=$_POST['appdate'];
// $apptime=$_POST['apptime'];
// if (($userStatus == 0) & ($doctorStatus == 1))
// $currentStatus = "Cancelled by you";
// $query="update appointmenttb set userStatus='$userStatus',doctorStatus='$doctorStatus',currentStatus='$currentStatus' where doctor='$doctor' and appdate='$appdate' and apptime='$apptime';";
// $result=mysqli_query($con,$query);
// if($result)
// echo("<script>alert('Appointment cancelled!');
// </script>");
// //window.location.href = 'admin-panel.php';
// }

?>
<html lang="en">
<head>
Expand All @@ -53,6 +81,9 @@


<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans&display=swap" rel="stylesheet">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
<a class="navbar-brand" href="#"><i class="fa fa-user-plus" aria-hidden="true"></i> Global Hospital </a>
Expand Down Expand Up @@ -175,14 +206,11 @@ function clickDiv(id) {
<div class="col-md-4"><label for="doctor">Doctors:</label></div>
<div class="col-md-8">
<select name="doctor" class="form-control" id="doctor" required="required">
<!-- <option value="Dr. Punam Shaw">Dr. Punam Shaw</option>
<option value="Dr. Ashok Goyal">Dr. Ashok Goyal</option> -->
<option value="" disabled selected>Select Doctor</option>
<?php display_docs();?>
</select>
<script>
document.getElementById('doctor').onchange = function updateFees(e) {
console.log(e);
document.getElementById('docFees').value = document.querySelector(`[value=${this.value}]`).getAttribute('data-value');
};
</script>
Expand All @@ -194,7 +222,7 @@ function clickDiv(id) {
</label></div>
<div class="col-md-8">
<!-- <div id="docFees">Select a doctor</div> -->
<input class="form-control" type="text" name="docFees" id="docFees" readonly="readonly"></input>
<input class="form-control" type="text" name="docFees" id="docFees" readonly="readonly"/>
</div><br><br>

<div class="col-md-4"><label>Date</label></div>
Expand Down Expand Up @@ -226,6 +254,8 @@ function clickDiv(id) {
<th scope="col">Consultancy Fees</th>
<th scope="col">Appointment Date</th>
<th scope="col">Appointment Time</th>
<th scope="col">Current Status</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
Expand All @@ -234,7 +264,7 @@ function clickDiv(id) {
$con=mysqli_connect("localhost","root","","myhmsdb");
global $con;

$query = "select doctor,docFees,appdate,apptime from appointmenttb where fname ='$fname' and lname='$lname';";
$query = "select ID,doctor,docFees,appdate,apptime,userStatus,doctorStatus from appointmenttb where fname ='$fname' and lname='$lname';";
$result = mysqli_query($con,$query);
while ($row = mysqli_fetch_array($result)){

Expand All @@ -248,6 +278,37 @@ function clickDiv(id) {
<td><?php echo $row['docFees'];?></td>
<td><?php echo $row['appdate'];?></td>
<td><?php echo $row['apptime'];?></td>

<td>
<?php if(($row['userStatus']==1) && ($row['doctorStatus']==1))
{
echo "Active";
}
if(($row['userStatus']==0) && ($row['doctorStatus']==1))
{
echo "Cancelled by You";
}

if(($row['userStatus']==1) && ($row['doctorStatus']==0))
{
echo "Cancelled by Doctor";
}
?></td>

<td>
<?php if(($row['userStatus']==1) && ($row['doctorStatus']==1))
{ ?>


<a href="admin-panel.php?ID=<?php echo $row['ID']?>&cancel=update"
onClick="return confirm('Are you sure you want to cancel this appointment ?')"
title="Cancel Appointment" tooltip-placement="top" tooltip="Remove"><button class="btn btn-danger">Cancel</button></a>
<?php } else {

echo "Cancelled";
} ?>

</td>
</tr>
<?php } ?>
</tbody>
Expand Down
96 changes: 86 additions & 10 deletions admin-panel1.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@
}
}


if(isset($_POST['docsub1']))
{
$demail=$_POST['demail'];
$query="delete from doctb where email='$demail';";
$result=mysqli_query($con,$query);
if($result)
{
echo "<script>alert('Doctor removed successfully!');</script>";
}
else{
echo "<script>alert('Unable to delete!');</script>";
}
}


?>
<html lang="en">
<head>
Expand All @@ -34,6 +50,8 @@
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<a class="navbar-brand" href="#"><i class="fa fa-user-plus" aria-hidden="true"></i> Global Hospital </a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
Expand Down Expand Up @@ -61,6 +79,11 @@ function alphaOnly(event) {
.bg-primary {
background: -webkit-linear-gradient(left, #3931af, #00c6ff);
}

.col-md-4{
max-width:20% !important;
}

.list-group-item.active {
z-index: 2;
color: #fff;
Expand All @@ -71,6 +94,14 @@ function alphaOnly(event) {
color: #342ac1!important;
}

#cpass {
display: -webkit-box;
}

#list-app{
font-size:15px;
}

.btn-primary{
background-color: #3c50c1;
border-color: #3c50c1;
Expand Down Expand Up @@ -104,7 +135,8 @@ function alphaOnly(event) {
<a class="list-group-item list-group-item-action" href="#list-pat" id="list-pat-list" role="tab" data-toggle="list" aria-controls="home">Patient List</a>
<a class="list-group-item list-group-item-action" href="#list-app" id="list-app-list" role="tab" data-toggle="list" aria-controls="home">Appointment Details</a>
<a class="list-group-item list-group-item-action" href="#list-settings" id="list-adoc-list" role="tab" data-toggle="list" aria-controls="home">Add Doctor</a>
<a class="list-group-item list-group-item-action" href="#list-mes" id="list-mes-list" role="tab" data-toggle="list" aria-controls="home">Messages</a>
<a class="list-group-item list-group-item-action" href="#list-settings1" id="list-ddoc-list" role="tab" data-toggle="list" aria-controls="home">Delete Doctor</a>
<a class="list-group-item list-group-item-action" href="#list-mes" id="list-mes-list" role="tab" data-toggle="list" aria-controls="home">Queries</a>

</div><br>
</div>
Expand Down Expand Up @@ -174,8 +206,10 @@ function clickDiv(id) {
<h4 class="StepTitle" style="margin-top: 5%;">Manage Doctors</h4>

<p class="cl-effect-1">
<a href="#app-hist" onclick="clickDiv('#list-adoc-list')">
Add Doctors
<a href="#app-hist" onclick="clickDiv('#list-adoc-list')">Add Doctors</a>
&nbsp|
<a href="#app-hist" onclick="clickDiv('#list-ddoc-list')">
Delete Doctors
</a>
</p>
</div>
Expand Down Expand Up @@ -256,6 +290,7 @@ function clickDiv(id) {
<tr>
<th scope="col">First Name</th>
<th scope="col">Last Name</th>
<th scope="col">Gender</th>
<th scope="col">Email</th>
<th scope="col">Contact</th>
<th scope="col">Password</th>
Expand All @@ -270,13 +305,15 @@ function clickDiv(id) {
while ($row = mysqli_fetch_array($result)){
$fname = $row['fname'];
$lname = $row['lname'];
$gender = $row['gender'];
$email = $row['email'];
$contact = $row['contact'];
$password = $row['password'];

echo "<tr>
<td>$fname</td>
<td>$lname</td>
<td>$gender</td>
<td>$email</td>
<td>$contact</td>
<td>$password</td>
Expand Down Expand Up @@ -307,12 +344,14 @@ function clickDiv(id) {
<tr>
<th scope="col">First Name</th>
<th scope="col">Last Name</th>
<th scope="col">Gender</th>
<th scope="col">Email</th>
<th scope="col">Contact</th>
<th scope="col">Doctor Name</th>
<th scope="col">Consultancy Fees</th>
<th scope="col">Appointment Date</th>
<th scope="col">Appointment Time</th>
<th scope="col">Appointment Status</th>
</tr>
</thead>
<tbody>
Expand All @@ -333,42 +372,79 @@ function clickDiv(id) {
<tr>
<td><?php echo $row['fname'];?></td>
<td><?php echo $row['lname'];?></td>
<td><?php echo $row['gender'];?></td>
<td><?php echo $row['email'];?></td>
<td><?php echo $row['contact'];?></td>
<td><?php echo $row['doctor'];?></td>
<td><?php echo $row['docFees'];?></td>
<td><?php echo $row['appdate'];?></td>
<td><?php echo $row['apptime'];?></td>
<td>
<?php if(($row['userStatus']==1) && ($row['doctorStatus']==1))
{
echo "Active";
}
if(($row['userStatus']==0) && ($row['doctorStatus']==1))
{
echo "Cancelled by Patient";
}

if(($row['userStatus']==1) && ($row['doctorStatus']==0))
{
echo "Cancelled by Doctor";
}
?></td>
</tr>
<?php } ?>
</tbody>
</table>
<br>
</div>

<div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">...</div>




<div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">...</div>
<div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list">
<form class="form-group" method="post" action="admin-panel1.php">
<div class="row">
<div class="col-md-4"><label>Doctor Name:</label></div>
<div class="col-md-8"><input type="text" class="form-control" name="doctor" onkeydown="return alphaOnly(event);" required></div><br><br>
<div class="col-md-4"><label>Specialization:</label></div>
<div class="col-md-8">
<select name="special" class="form-control" id="special" required="required">
<option value="head" name="spec" disabled selected>Select Specialization</option>
<option value="heart" name="spec" selected>Heart</option>
<option value="homeo" name="spec" selected>Homeopathy</option>
<option value="accu" name="spec" selected>Accupuncture</option>
</select>
</div><br><br>
<div class="col-md-4"><label>Email ID:</label></div>
<div class="col-md-8"><input type="email" class="form-control" name="demail" required></div><br><br>
<div class="col-md-4"><label>Password:</label></div>
<div class="col-md-8"><input type="password" class="form-control" onkeyup='check();' name="dpassword" id="dpassword" required></div><br><br>
<div class="col-md-4"><label>Confirm Password:</label></div>
<div class="col-md-8"><input type="password" class="form-control" onkeyup='check();' name="cdpassword" id="cdpassword" required><span id='message'></span> </div><br><br>
<div class="col-md-8" id='cpass'><input type="password" class="form-control" onkeyup='check();' name="cdpassword" id="cdpassword" required>&nbsp &nbsp<span id='message'></span> </div><br><br>

<div class="col-md-4"><label>Email ID:</label></div>
<div class="col-md-8"><input type="email" class="form-control" name="demail" required></div><br><br>

<div class="col-md-4"><label>Consultancy Fees:</label></div>
<div class="col-md-8"><input type="text" class="form-control" name="docFees" required></div><br><br>
</div>
<input type="submit" name="docsub" value="Add Doctor" class="btn btn-primary">
</form>
</div>

<div class="tab-pane fade" id="list-settings1" role="tabpanel" aria-labelledby="list-settings1-list">
<form class="form-group" method="post" action="admin-panel1.php">
<div class="row">

<div class="col-md-4"><label>Email ID:</label></div>
<div class="col-md-8"><input type="email" class="form-control" name="demail" required></div><br><br>

</div>
<input type="submit" name="docsub1" value="Delete Doctor" class="btn btn-primary" onclick="confirm('do you really want to delete?')">
</form>
</div>


<div class="tab-pane fade" id="list-attend" role="tabpanel" aria-labelledby="list-attend-list">...</div>

<div class="tab-pane fade" id="list-mes" role="tabpanel" aria-labelledby="list-mes-list">
Expand Down
Loading

0 comments on commit f3ac299

Please sign in to comment.