ok
Mini Shell
<?php include("header.php");
if(isset($_GET['id']) && $_GET['id']!=''){
$location_id = $_GET['id'];
$statement = $pdo->prepare("SELECT * from tbl_appointment_booking where id=?");
$statement->execute(array($location_id));
$partner_result = $statement->fetch(PDO::FETCH_ASSOC);
$reason = $statement->rowCount();
}else{
$reason=0;
}
?>
<div class="content-wrapper" style="background-color: white;">
<div class="clearfix"></div>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div>
<div class="box-header">
<h3 class="box-title"><b><?php if(isset($_GET['id']) && $_GET['id']!=''){ echo 'Update';}else { echo 'Add';} ?> Appointment Call Report: </b></h3>
</div>
<div class="box box-info">
<div class="box-body" style="box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;">
<div class="col-lg-12">
<div id="content-div">
<form action="" enctype="multipart/form-data" method="post" id="appointment_form" accept-charset="utf-8">
<input type="hidden" name="id" id="id" value="<?php if ($reason) { echo $partner_result['id']; } ?>" placeholder="id" class="form-control" required readonly />
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label class="required" for="patient_name">Patient's Name</label>
<input type="text" name="patient_name" id="patient_name" value="<?php if ($reason) { echo $partner_result['patient_name']; } ?>" placeholder="Enter Patient's Name" class="form-control" required readonly/>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="required" for="patient_number1">Patient's Phone Number</label>
<input type="number" name="patient_number1" id="patient_number1" value="<?php if ($reason) { echo $partner_result['patient_number1']; } ?>" placeholder="Enter Patient's Phone Number" class="form-control" required readonly/>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="required" for="date">Appointment Date</label>
<input type="date" name="date" id="date" value="<?php if ($reason) { echo $partner_result['date']; } ?>" placeholder="Enter Appointment Date" class="form-control" required readonly/>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="required" for="time">Time Slot</label>
<select id="time" name="time" class="form-control" required readonly>
<option value="">Select Time Slot</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label class="required" for="call_report">Call Report</label>
<select id="call_report" name="call_report" class="form-control" required>
<option value="">Select Call Options</option>
<option value="Call Attended">Call Attended</option>
<option value="Call Decline">Call Decline</option>
<option value="Switch Off">Switch Off</option>
<option value="Not Reachable">Not Reachable</option>
<option value="Busy">Busy</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="form-group" style="text-align:center;margin-top:10px">
<button type="submit" id="submit" name="submit" class="btn btn-success"><?php if(isset($_GET['id']) && $_GET['id']!=''){ echo 'Update';}else { echo 'Add';} ?> Appointment Details</button>
</div>
</div>
</form>
<div class="form-group" style="text-align:center;">
<a href="booking_appointment.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a>
<a href="booking_appointment_list.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a>
</div>
</div>
<div class="container" id="loading-div" style="display: none; margin-top: 40px; margin-bottom: 40px;">
<center> <img src="img/loading.gif" style="width: 250px;"><br><b class="blinking">Processing Please Wait...</b></center>
</div>
<div class="container" id="success-div" style="display: none; margin-top: 40px; margin-bottom: 40px;">
<center><b class="blinking" style="font-size:16px;"> Appointment Details <?php if(isset($_GET['id']) && $_GET['id']!=''){ echo 'Updated';}else { echo 'Added';} ?> Successfully...</b><br>
<img src="img/success.gif" style="width: 250px;">
<br><br>
<a href="booking_appointment_list.php"><button class="btn btn-warning btn-sm"><i class="fa fa-chevron-left"></i> Back to List</button></a>
</center>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php include "footer.php";?>
<script type="text/javascript">
$(document).ready(function() {
$('#date').on('change', function() {
time_slot("");
});
$('#status').on('change', function() {
var status = $(this).val();
if(status=='delay' || status=='cancel'){
$('#status_option2').show();
}else{
$('#status_option2').hide();
}
});
$('#appointment_form').on('submit', function(e) {
e.preventDefault();
$('#loading-div').show();
$('#content-div').hide();
$("#submit").prop('disabled', true);
var formData = new FormData(this);
$.ajax({
url: 'apis/booking_appointment.php',
type: 'post',
dataType: 'json',
data: formData,
cache: false,
contentType: false,
processData: false,
enctype: 'multipart/form-data',
success: function (response) {
console.log(response);
if(response['status'] == 200){
$('#appointment_form').trigger("reset");
$("#submit").prop('disabled', false);
$('#success-div').show();
$('#loading-div').hide();
} else {
$("#submit").prop('disabled', false);
$('#loading-div').hide();
$('#content-div').show();
}
}
});
});
});
var time ='<?php if ($reason) { echo $partner_result['time']; } ?>';
if(time){
time_slot(time);
}
function time_slot(time=null) {
$('#time').empty();
var date = $('#date').val();
$.ajax({
url: 'apis/time_slot.php?date=' + date+'&time='+time,
type: 'get',
success: function(response) {
$('#time').append(response);
}
});
}
</script>
Zerion Mini Shell 1.0