csrtechnew.ohctech.in/add_mobile_vet_appointment.php
2025-08-29 16:30:39 +05:30

145 lines
6.0 KiB
PHP

<!-- Modal Structure -->
<div class="modal fade" id="modal-add-city" role="dialog" aria-hidden="true">
<form role="form" id="city_form" name="city_form" action="#" method="post">
<div class="modal-dialog">
<div class="modal-content">
<div class="widget-header">
<h5 class="widget-title">Add Vetnerinary Appointment</h5>
<div class="widget-toolbar">
<div class="widget-menu">
<a href="#" class="close" data-action="close" data-dismiss="modal">
<i class="ace-icon fa fa-times"></i>
</a>
</div>
</div>
</div>
<div class="modal-body">
<input type="hidden" class="form-control" name="city_id" id="city_id" value="" />
<div class="form-group">
<label for="bene_name">Beneficiary Name <span style="color: red;">*</span></label>
<input type="text" class="form-control" name="bene_name" id="bene_name" />
</div>
<div class="form-group">
<label for="mobile_no">Mobile Number <span style="color: red;">*</span></label>
<input type="number" class="form-control" name="mobile_no" id="mobile_no" />
</div>
<div class="form-group">
<label for="date_time">Appointment Date and Time <span style="color: red;">*</span></label>
<input type="datetime-local" class="form-control" name="date_time" id="date_time" />
</div>
<div class="form-group">
<label for="Location">Location <span style="color: red;">*</span></label>
<input type="text" class="form-control" name="Location" id="Location" />
</div>
<div class="form-group">
<label for="status">Status</label>
<select name="status" id="status" class="form-control">
<option value="open">Open </option>
<option value="close">Close</option>
<option value="cancle">Cancle</option>
</select>
</div>
<?php
$ohc_type_ids = $_SESSION['current_ohcttype'];
$village_query = "SELECT id, village, tehsil FROM village WHERE find_in_set($ohc_type_ids,ohc_type_id)";
$result = mysqli_query($conn, $village_query);
$options = '';
while ($vill = mysqli_fetch_assoc($result)) {
$tehsil = getFieldFromTable('name', 'tehsils', 'id', $vill['tehsil']);
$options .= '<option value="' . $vill['id'] . '">' . $vill['village'] . ' / ' . $tehsil . '</option>';
}
?>
<div class="form-group">
<label for="address" style="font-size: 1.1rem;">Village <span style="color:red">*</span></label>
<!-- <input type="text" class="form-control" id="address" name="address" placeholder="Enter Village.."> -->
<select class="form-control select2" id="village" name="village" onchange="getAddress(this.value)">
<option value="">Select Village</option>
<?php echo $options; ?>
</select>
</div>
</div>
<div class="widget-toolbox padding-8 clearfix">
<button type="button" class="btn btn-info btn-sm save_button" onclick="validate();">
<i class="ace-icon fa fa-floppy-o bigger-110"></i> Save
</button>
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">
<i class="ace-icon fa fa-times bigger-110"></i> Cancel
</button>
</div>
</div>
</div>
</form>
</div>
<!-- Styling for Modal Scroll -->
<style>
#modal-add-city {
overflow-y: scroll;
}
</style>
<!-- jQuery + Validation + AJAX Save -->
<script>
function validate() {
if ($('#bene_name').val().trim() == '') {
BootstrapDialog.alert('Please Enter Beneficiary Name!');
return false;
}
if ($('#vet_type').val() == '') {
BootstrapDialog.alert('Please Select Veterinary Type!');
return false;
}
if ($('#mobile_no').val().trim() == '') {
BootstrapDialog.alert('Please Enter Mobile Number!');
return false;
}
if ($('#date_time').val().trim() == '') {
BootstrapDialog.alert('Please Select Appointment Date and Time!');
return false;
}
if ($('#Location').val().trim() == '') {
BootstrapDialog.alert('Please Enter Location!');
return false;
}
save_section();
}
function save_section() {
var formData = $("#city_form").serialize();
$.ajax({
url: "save_vet_appointment.php",
type: "POST",
data: formData,
success: function(response) {
BootstrapDialog.alert({
message: response,
callback: function () {
location.reload(); // Refresh the page after OK
}
});
$('#modal-add-city').modal('hide');
$('#city_form')[0].reset();
},
error: function() {
BootstrapDialog.alert("Error saving data.");
}
});
}
</script>