Viewing file: add-schedule_adm.php (9.09 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include('conn.php');
require_once "auth-adm.php";
$doc = mysqli_query($con,"SELECT * FROM schedule ORDER BY id DESC");
?>
<?php $query1 = "SELECT * FROM doctor";
$result1 = mysqli_query($con, $query1);
$doctor1 = array();
if ($result1) {
while ($row1 = mysqli_fetch_assoc($result1)) {
$doctor = array(
'id' => $row1['id'],
'name' => $row1['name']
);
$doctor1[] = $doctor;
}
mysqli_free_result($result1);
}
mysqli_close($con);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php include('title.php') ?></title>
<link rel="shortcut icon" type="image/png" href="images/fav.png">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/themify-icons.css">
<!-- Animations CSS -->
<link rel="stylesheet" href="css/animate.css">
<!-- Main CSS -->
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/red.css" id="style_theme">
<link rel="stylesheet" href="css/responsive.css">
<!-- morris charts -->
<link rel="stylesheet" href="charts/css/morris.css">
<!-- jvectormap -->
<link rel="stylesheet" href="css/jquery-jvectormap.css">
<link rel="stylesheet" href="datatable/dataTables.bootstrap4.min.css">
<link href="../assets/Content/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../assets/Content/bootstrap-theme.min.css" />
<link rel="stylesheet" href="../assets/Content/MdBootstrapPersianDateTimePicker/jquery.Bootstrap-PersianDateTimePicker.css" />
<script src="../assets/Scripts/jquery-2.1.4.js" type="text/javascript"></script>
<script src="../assets/Scripts/bootstrap.min.js" type="text/javascript"></script>
<style type="text/css">
body, table {
font-family: 'Segoe UI', Tahoma;
font-size: 14px;
}
</style>
<style>
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
td span.date-from,
td span.date-to {
font-weight: bold;
}
td span.date-separator {
margin: 0 5px;
}
button {
padding: 5px 10px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"], select {
width: 200px;
}
input[type="submit"] {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
.add-schedule-form {
display: none;
margin-top: 20px;
}
</style>
<script src="js/modernizr.min.js"></script>
</head>
<?php
// Check if the form is submitted
if (isset($_POST['publish'])) {
include('conn.php');
$newStartValue = 1;
$query = "ALTER TABLE schedule AUTO_INCREMENT = $newStartValue";
$result = mysqli_query($con, $query);
$d_name = $_POST['d_name'];
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
$end_date_fa = $_POST['end_date_fa'];
$start_date_fa = $_POST['start_date_fa'];
$status = $_POST['status'];
$insertdata = mysqli_query($con, "INSERT INTO schedule(d_name,date_start,date_end,date_start_fa,date_end_fa,status)VALUES('$d_name','$start_date','$end_date','$start_date_fa','$end_date_fa','$status')");
if ($insertdata) {
echo "<script>alert('Schedule added successfully');</script>";
echo '<script>window.location.href = "add-schedule_adm.php";</script>';
exit();
} else {
echo "<script>alert('Failed to add schedule');</script>";
}
}
?>
<div class="wrapper">
<?php include('sidbare-adm.php'); ?>
<div id="content">
<?php include('topbar_adm.php'); ?>
<?php
include('conn.php');
date_default_timezone_set('Asia/Kabul');
?>
<div class="row no-margin-padding">
<div class="col-md-6">
<h3 class="block-title">Add Doctor Schedule / اضافه کردن تقسیم اوقات داکتران</h3>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="admission.php">
<span class="ti-home"></span>
</a>
</li>
<li class="breadcrumb-item">Schedule</li>
<li class="breadcrumb-item active">Add Schedule</li>
</ol>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="widget-area-2 proclinic-box-shadow">
<div>
<table>
<thead>
<tr>
<th>ID</th>
<th>D-name</th>
<th>Date</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php while($roww = mysqli_fetch_array($doc)) {?>
<tr>
<td><?php echo $roww['id']; ?></td>
<td><?php echo $roww['d_name']; ?></td>
<td>
<span class="date-from"><?php echo $roww['date_start']; ?></span>
<span class="date-separator">to</span>
<span class="date-to"><?php echo $roww['date_end']; ?></span>
</td>
<td><?php echo $roww['status']; ?></td>
<td>
<button class="btn btn-success">
<a style="color:white;" href="edit-schedule-adm.php?id=<?php echo $roww['id']; ?>">Edit</a>
</button>
<button class="btn btn-danger">
<a href="edit-schedule-adm.php?delete_id=<?php echo $roww['id']; ?>">Delete</a>
</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<button class="add-schedule-button">Add Schedule</button>
<div class="add-schedule-form" style="padding-bottom: 100px;">
<h1>Add Schedule</h1>
<form action="" method="post" enctype="multipart/form-data">
<div class="col-lg-6 col-12">
<label for="doctor-name">Doctor Name:</label>
<div class="form-group">
<select name="d_name">
<option value="" selected disabled>Doctor</option>
<?php
foreach ($doctor1 as $doctor) {
$doctorId = $doctor['id'];
$doctorName = $doctor['name'];
echo '<option value="' . $doctorName . '">' . $doctorName . '</option>';
}
?>
</select>
</div>
</div>
<label for="date-from">Date From: تاریخ آغاز</label>
<input type="date" id="date-from" name="start_date" required>
<input type="text" name="start_date_fa" class="form-control" id="exampleInput3" placeholder="تاریخ" data-mddatetimepicker="true" data-placement="right" data-englishnumber="true" />
<label for="date-to">Date To: تاریخ اتمام</label>
<input type="date" id="date-to" name="end_date" required>
<input type="text" name="end_date_fa" class="form-control" id="exampleInput3" placeholder="تاریخ" data-mddatetimepicker="true" data-placement="right" data-englishnumber="true" />
<label for="status">Status:</label>
<select id="status" name="status" required>
<option value="available">Available</option>
<option value="not-available">Not Available</option>
</select>
<button type="submit" name="publish">Add</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<a id="back-to-top" href="#" class="back-to-top">
<span class="ti-angle-up"></span>
</a>
<script type="text/javascript">
$('#input1').change(function() {
var $this = $(this),
value = $this.val();
alert(value);
});
$('#textbox1').change(function () {
var $this = $(this),
value = $this.val();
alert(value);
});
</script>
<script src="../assets/Scripts/MdBootstrapPersianDateTimePicker/calendar.js" type="text/javascript"></script>
<script src="../assets/Scripts/MdBootstrapPersianDateTimePicker/jquery.Bootstrap-PersianDateTimePicker.js" type="text/javascript"></script>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="datatable/jquery.dataTables.min.js"></script>
<script src="datatable/dataTables.bootstrap4.min.js"></script>
<script src="js/custom.js"></script>
<script>
$(document).ready(function() {
$(".add-schedule-button").click(function() {
$(".add-schedule-form").toggle();
});
});
</script>
</body>
</html>
|