ok
Direktori : /home2/selectio/www/thedentalpark.com/admin/ |
Current File : /home2/selectio/www/thedentalpark.com/admin/doctor_add.php |
<?php include("header.php"); if(isset($_GET['id']) && $_GET['id']!=''){ $location_id = $_GET['id']; $statement = $pdo->prepare("SELECT * from tbl_doctor 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';} ?> Doctor's: </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="doctors_form" accept-charset="utf-8"> <div class="row"> <input type="hidden" name="id" id="id" value="<?php if ($reason) { echo $partner_result['id']; } ?>" placeholder="id" class="form-control" required/> <div class="col-md-6"> <div class="form-group"> <label class="required" for="doctor_name">Doctor's Name</label> <input type="text" name="doctor_name" id="doctor_name" value="<?php if ($reason) { echo $partner_result['doctor_name']; } ?>" placeholder="Enter Doctor's Name" class="form-control" /> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="doctor_degree">Doctor Degree</label> <input type="text" name="doctor_degree" id="doctor_degree" value="<?php if ($reason) { echo $partner_result['doctor_degree']; } ?>" placeholder="Enter Doctor Degree" class="form-control" /> </div> </div> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label class="required" for="doctor_address">Doctor's Address</label> <input type="text" name="doctor_address" id="doctor_address" value="<?php if ($reason) { echo $partner_result['doctor_address']; } ?>" placeholder="Enter Address" class="form-control" /> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="required" for="doctor_phone">Doctor's Phone No</label> <input type="text" name="doctor_phone" id="doctor_phone" value="<?php if ($reason) { echo $partner_result['doctor_phone']; } ?>" placeholder="Enter Phone Number" class="form-control" /> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label class="required" for="status">Status</label> <select name="status" class="form-control select2" style="width:100%" id="status"> <option value="Active" <?php if(!empty($reason) && $partner_result['status']=='Active'){ echo "selected";} ?>>Active</option> <option value="In-Active" <?php if(!empty($reason) && $partner_result['status']=='In-Active'){ echo "selected";} ?>>In-Active</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';} ?> Doctor</button> </div> </div> </form> <div class="form-group" style="text-align:center;"> <a href="doctor_add.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a> <a href="doctor_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;"> Doctors 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="doctor_add.php"><button class="btn btn-info btn-sm"><i class="fa fa-refresh"></i> View Updated Details</button></a> <a href="doctor_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() { $('#doctors_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/doctor.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){ $('#doctors_form').trigger("reset"); $("#submit").prop('disabled', false); $('#success-div').show(); $('#loading-div').hide(); } else { $("#submit").prop('disabled', false); $('#loading-div').hide(); $('#content-div').show(); } } }); }); }); </script>