<?
	$appointment_id = $_REQUEST["appointment_id"];
	$common_appointment_id = $_REQUEST["common_appointment_id"];
	
	//$mail_subject = utility::getTableFieldById("mail_format","mail_format_subject","mail_format_name","confermation_mail_send_by_fran");
	//$mail_body = strip_tags(utility::getTableFieldById("mail_format","mail_format_body","mail_format_name","confermation_mail_send_by_fran"));
?>
<!-------- Start Modal ---------->
<form class="form-horizontal1" method="post" name="form2" id="form-horizontal1" action="" enctype="multipart/form-data">
<div class="modal-dialog">
	<div class="modal-content">
	  <div class="modal-header">		
		<h4 class="modal-title" id="myModalLabel">Confirm</h4>
	  </div>
	  <div class="modal-body" style="height: 80px;">
		<div class="col-sm-12" style="margin-bottom:10px;">
		  <label for="Select All Surveyor" class="col-sm-12 control-label">Do you want to delete all corresponding appointment.</label>
		</div>	
	  </div>
	  <div class="modal-footer">
		<input type="hidden" name="appointment_id" id="appointment_id" value="<?php echo $appointment_id;?>" />
		<input type="hidden" name="common_appointment_id" id="common_appointment_id" value="<?php echo $common_appointment_id;?>" />
		<button type="button" class="btn btn-default delete_single" id="delete_single" >No</button>
		<button type="button" class="btn btn-primary delete_multiple" id="delete_multiple">Yes</button>
	  </div>
	</div>
</div>
</form>
<!---------- End Modal ---------->
<script type="text/javascript">		
$(document).ready(function(){	
	
	$(".delete_single").click(function(){
		var appointment_id = $("#appointment_id").val();
		var form_data   = {'appointment_id':appointment_id};       
		$.ajax({
			async: false,
			type: "POST",
			url: site_url+"/modules/appointment/index.php?page=ajax_actions&action=delete_single_appointment",
			data: form_data,
			success: function(result){
				var resultObj = jQuery.parseJSON(result);
				alert(resultObj.message);
				location.reload();
			}
		});
	});
	
	$(".delete_multiple").click(function(){
		var appointment_id = $("#appointment_id").val();
		var common_appointment_id = $("#common_appointment_id").val();
		var form_data   = {'appointment_id':appointment_id,'common_appointment_id':common_appointment_id};       
		$.ajax({
			async: false,
			type: "POST",
			url: site_url+"/modules/appointment/index.php?page=ajax_actions&action=delete_multiple_appointment",
			data: form_data,
			success: function(result){
				var resultObj = jQuery.parseJSON(result);
				alert(resultObj.message);
				location.reload();
			}
		});
	});
	
});
</script>