<?php
session_start();
$where 					= " WHERE 1=1 ";
$next_page_condition 	= "";
$paging ="";


if($_REQUEST['start']){
	$paging .="&start=".$_REQUEST['start'];
}
if(isset($_REQUEST["from"]) && $_REQUEST["from"] !=""){
	$_SESSION["from"] = $_REQUEST["from"];
}
if(isset($_REQUEST['id']) && $_REQUEST['id'] !=""){
	$where .= " AND id = ".$_REQUEST['id']." ";
}
###########################################  PAGING WITH PER PAGE  #####################################
$file_name		= "index"; // this is file name which is used during paging  , included at the bottom of the page
$table_name		= "celebrant_phone_conversation";
$paging_table_name	= $table_name;
$paging_query		= $where;
$join_query_for_paging = "SELECT * FROM $table_name  $where ";
include("paging/paging_query.inc.php");
############################################ END PAGING WITH PER PAGE  #######################################
$query = "SELECT * FROM $table_name $where ";
$rs = mysqli_query($conn,$query);
?>
<style>
.form-group .control-label{
	padding-top:0px;
}
.content{
	min-height: 0px;
}
.content-header h1{
	float:left;
	padding-bottom: 10px;
}
</style>
<section class="content-header">
  <div class="row">
  <?
		$query_string 	=  (isset($_POST['query_string'])) ? $_POST['query_string'] : $_SERVER['QUERY_STRING'];
		if(isset($_REQUEST["from"]) && $_REQUEST["from"] == "view_celebrant_phone_conversation"){ 
			$query_string = str_ireplace("page=view_celebrant_phone_conversation_detail", "page=view_celebrant_phone_conversation", $query_string);
			$page_header = "Phone Conversation Details";
		}
  ?>
	<div class="col-sm-5">
	  <h2 style="float:left;clear:right;margin:0px;">
		<?=$page_header;?>
	  </h2>
	</div>
  
  <div class="col-sm-3">

	<button type="button" id="back" name="back" value="back"  style="float:right;" class="btn btn-primary" onclick="window.location.href = 'index?<?=$query_string;?>'">Back</button>

  
  <? if(isset($_REQUEST["from"]) && $_REQUEST["from"] == "view_enquiry"){ ?>
   <a href="index?page=add&from=view_enquiry_progress&action=edit&id=<?=$_REQUEST['id'];?>" style="float:right;margin-right:5px;" class="btn btn-primary">Edit</a>
  <? }?>
  
  
  <?
	if(isset($_REQUEST["from"]) && $_REQUEST["from"] == "view_enquiry"){ 
		$query_string = str_ireplace("page=view", "page=view_enquiry_progress", $query_string);
	}
  ?>
	
  </div>
  </div>
</section>
<?
	$enq_row = mysqli_fetch_assoc($rs);
?>
<section class="content">
	<div class="row">
		<div class="col-xs-12">
			<!----------------------- Message ------------------------------->
			<? if(isset($_SESSION['info_message'])){ ?>
			  <div class="alert alert-info alert-dismissable">
				<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
				<? echo $_SESSION['info_message']; unset($_SESSION['info_message']);?>
			  </div>
			  <? } ?>
			<!----------------------- End Message ------------------------------->
			<!-- general form elements -->
			<? 
				$col_width = 12;
			?>
			<div class="col-xs-<?=$col_width;?>" style="min-height:700px;">
              <div class="box box-primary">
                <form class="form-horizontal" method="post" name="form1" id="form1" action="" onsubmit="return validateForm(this)" enctype="multipart/form-data">
                  <div class="box-body">
					<div class="form-group">
                      <label for="" class="col-sm-4 control-label">Aware of new structure/role?</label>
                      <div class="col-sm-8">
						<? echo $enq_row["aware_of_new_structure_or_role"]; ?>
                      </div>
                    </div>					
					<div class="form-group">
					  <label for="" class="col-sm-4 control-label">Happy with celebrant group access - actual or virtual?</label>
					  <div class="col-sm-8">
						<?php echo $enq_row["happy_with_celebrant_group"]; ?>
					  </div>
					</div>
					<div class="form-group">
                      <label for="" class="col-sm-4 control-label">Any ideas regarding CPD?</label>
                      <div class="col-sm-8">
						<? echo $enq_row["any_ideas_regarding_CPD"]; ?>
                      </div>
                    </div>
					<div class="form-group">
                      <label for="" class="col-sm-4 control-label">Mentoring - happy with mentoring work or would consider mentor training?</label>
                      <div class="col-sm-8">
						<? echo $enq_row["happy_with_mentoring_work"]; ?>
                      </div>
                    </div>
					<div class="form-group">
					  <label for="" class="col-sm-4 control-label">Interested in attending conference?</label>
					  <div class="col-sm-8">
						<? echo $enq_row["interested_in_attending_conference"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="" class="col-sm-4 control-label">Local media work?</label>
					  <div class="col-sm-8">
						<? echo $enq_row["local_media_work"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="" class="col-sm-4 control-label">Concerns with celebrant work?</label>
					  <div class="col-sm-8">
						<?php echo $enq_row["concerns_with_celebrant_work"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="" class="col-sm-4 control-label">Ideas regardingyour relationship with with Humanists UK?</label>
					  <div class="col-sm-8">
						<?php echo $enq_row["ideas_regarding_relationship_with_humanists"]; ?>
					  </div>
					</div>
					
					<div class="form-group">
                      <label for="Date" class="col-sm-4 control-label">Date</label>
                      <div class="col-sm-8">
						<? echo utility::getFormatedDateReturn($enq_row["phone_conversation_date"]); ?>
                      </div>
                    </div>
					<div class="form-group">
                      <label for="Consultant" class="col-sm-4 control-label">Consultant</label>
                      <div class="col-sm-8" id="introducer_div">
						<?php echo Admin::getAdminById($enq_row['admin_id']); ?>
                      </div>
                    </div>
					
                  </div><!-- /.box-body -->
                </form>
              </div><!-- /.box -->
            </div><!-- /.box -->
		</div>
	</div>
</section>


<style>
	#overflow_div::-webkit-scrollbar
    {
      width: 5px;  /* for vertical scrollbars */
      height: 5px; /* for horizontal scrollbars */
    }
 
    #overflow_div::-webkit-scrollbar-track
    {
      background:#E7E8E9;
    }
 
    #overflow_div::-webkit-scrollbar-thumb
    {
      background: #3c8dbc;
    }
	#overflow_div{
		height:150px;
		overflow-y: auto;
	}
</style>
<div class="modal fade" id="myModalForSendMail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"></div>
<script type="text/javascript">
$(function () {
	$('#export_to_xero').click(function(){
		if ($(".checkbox:checked").length == 0){
			alert("Please check at least one invoice to export.");
			return false;
		}
	});

	$('#check_all').click(function(){
        if($("#check_all:checked").length == 1){
            $('.checkbox').prop( "checked", true );
        }else{
            $('.checkbox').prop( "checked", false );
        }
    });
	$(".download_span").click(function(){
		//alert($(this).parent().attr("id"));
		var form_id = $(this).parent().attr("id");
		$("#"+form_id).submit();
	});
	$(".download_instruction_to_proceed").click(function(){
		//alert($(this).parent().attr("id"));
		var form_id = $(this).parent().attr("id");
		$("#"+form_id).submit();
	});
	$(".download_client_care_letter").click(function(){
		//alert($(this).parent().attr("id"));
		var form_id = $(this).parent().attr("id");
		$("#"+form_id).submit();
	});
	
	$(".invoice1").click(function(){	
		$("#myModalLabel").text("Invoice Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/payment_management/index?page=view_invoice&source=e&job_id="+job_id+hide_top_left);
	});
	$(".payment").click(function(){	
		$("#myModalLabel").text("Payment Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/payment_management/index?page=view_payment&source=e&job_id="+job_id+hide_top_left);
	});
	$(".one_to_one").click(function(){	
		$("#myModalLabel").text("One to One Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/one_to_one_management/index?page=view&source=j&job_id="+job_id+hide_top_left);
	});
	$(".referral").click(function(){	
		$("#myModalLabel").text("Referral Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/referrals_management/index?page=view&source=j&job_id="+job_id+hide_top_left);
	});
	$(".timesheet").click(function(){	
		$("#myModalLabel").text("Timesheet Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/timesheet_management/index?page=view&source=j&job_id="+job_id+hide_top_left);
	});
	$(".mileage").click(function(){	
		$("#myModalLabel").text("Mileage Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/mileage/index?page=view&source=j&job_id="+job_id+hide_top_left);
	});
	$(".notes").click(function(){	
		$("#myModalLabel").text("Notes");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/notes/index?page=view&source=j&job_id="+job_id+hide_top_left);
	});
	$(".reminders").click(function(){	
		$("#myModalLabel").text("Reminders Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/notes/index?page=view_reminder&source=j&job_id="+job_id+hide_top_left);
	});
	$(".appointment").click(function(){	
		$("#myModalLabel").text("Appointment Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/appointment/index?page=view&source=j&job_id="+job_id+hide_top_left);
	});
	$(".sales").click(function(){	
		$("#myModalLabel").text("Sales Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/sales/index?page=view&source=j&job_id="+job_id+hide_top_left);
	});
	$(".document").click(function(){	
		$("#myModalLabel").text("Documents Management");
		var hide_top_left = "&hide_top=1&hide_left=1";
		var job_id = $(this).attr("alt");		
		$(".modal_iframe").attr("src","<?=$config->frontEndURL?>/admin/document_management/index?page=view&source=j&job_id="+job_id+hide_top_left);
	});
	$(".close_button").click(function(){
		$(".modal_iframe").attr("src","");
		location.reload();
	});
	$(".send_mail").click(function(){
		//if(confirm("Are you want to send mail.")){
			//alert($(this).attr('alt'));
			var job_id = $(this).attr('alt');
			var form_data   = {'job_id':job_id};       
			$.ajax({
				async: false,
				type: "POST",
				url: site_url+"/modules/enquiry_management/index.php?page=ajax_actions&action=send_mail",
				data: form_data,
				success: function(r){    
					//alert(r);
					//location.reload();
					$('#myModalForSendMail').show().html(r);  // put your modal id 
				}
			});
			//return false;
		//}
	});
});
</script>