<?php
session_start();

$_SESSION["redirect_query_string"] = $_SERVER["REDIRECT_QUERY_STRING"];
$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		= "ess";
$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);
$enq_row = mysqli_fetch_assoc($rs);

$ess_image_1 = $enq_row['ess_image_1'];
$ess_image_2 = $enq_row['ess_image_2'];
$ess_image_3 = $enq_row['ess_image_3'];
$ess_image_4 = $enq_row['ess_image_4'];

$iti_query = "SELECT * FROM ess_event_itinerary_mapping WHERE ess_id = ".$_REQUEST['id']." ORDER BY id ASC ";
$iti_sql=mysqli_query($conn,$iti_query);

$email_query = "SELECT * FROM ess_email_mapping WHERE ess_id = ".$_REQUEST['id']." ORDER BY id ASC ";
$email_sql=mysqli_query($conn,$email_query);
?>
<style>
.form-group .control-label{
	padding-top:0px;
}
.content{
	min-height: 0px;
}
.content-header h1{
	float:left;
	padding-bottom: 10px;
}
.active_deactive_class,.fa-close,.fa-check{
	color : #839b2e;
}

</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_ess_list"){ 
		$query_string = str_ireplace("page=view_ess_progress", "page=view_ess", $query_string);
		$page_header = "ESS Details";
	} 
  ?>
 
	<div class="col-sm-9">
	  <h1 style="float:left;clear:right;margin-top:0px;">
		<?=$page_header;?>
	  </h1>
	</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> 
	  </div>

		<div class="col-xs-12" style="min-height:100px;">
            <div class="box box-primary">
                <div class="box-body">
					
				<div class="col-sm-12" style="padding:0;">
							<div class="col-sm-3">
							    <? $dir = "../../ess_images/"; 
									if($ess_image_1 !=''){
										$img1=$ess_image_1;
									}else{
										$img1="blank_imag.png";
									   }
									?>
									<a href="<?= $dir.$img1;?>" target="_blank">
									<img id="frame1" src="<?= $dir.$img1;?>" width="100px" height="100px" style="" /></a>
									
							</div>
							<div class="col-sm-3">
							<? $dir = "../../ess_images/";								
								   if($ess_image_2 !=''){
									   $img2=$ess_image_2;
								   }else{
									   $img2="blank_imag.png";
								   }
									?>
									<a href="<?= $dir.$img2;?>" target="_blank">
									<img id="frame2" src="<?= $dir.$img2;?>" width="100px" height="100px" style="" /></a>	
							</div>
							<div class="col-sm-3">
							<? $dir = "../../ess_images/";								 
								if($ess_image_3 !=''){
									   $img3=$ess_image_3;
								   }else{
									   $img3="blank_imag.png";
								   }
									?>
									<a href="<?= $dir.$img3;?>" target="_blank">
									<img id="frame3" src="<?= $dir.$img3;?>" width="100px" height="100px" style="" /></a>
							</div>
							<div class="col-sm-3">
							<? $dir = "../../ess_images/";
									if($ess_image_4 !=''){
										 $img4=$ess_image_4;
									   }else{
										   $img4="blank_imag.png";
									   }
									?>
									<a href="<?= $dir.$img4;?>" target="_blank">
									<img id="frame4" src="<?= $dir.$img4;?>" width="100px" height="100px" style="" /></a>  
							</div>
						</div>		
                </div>
            </div>
        </div>	  
	  
  </div>
</section>

<section class="content">
	<div class="row">
		<div class="col-xs-12">
			<!----------------------- Message ------------------------------->
			<!--<? //if(isset($_SESSION['info_message'])){ ?>
			  <div class="alert alert-success 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 -->
			<div class="col-xs-6" style="min-height:400px;">
              <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="unique_reference" class="col-sm-4 control-label">Unique Reference</label>
					  <div class="col-sm-8">
						<? echo $enq_row["unique_reference"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="title" class="col-sm-4 control-label">Title</label>
					  <div class="col-sm-8">
						<? echo $enq_row["title"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="url" class="col-sm-4 control-label">URL</label>
					  <div class="col-sm-8">
						<? echo $enq_row["url"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="url" class="col-sm-4 control-label">Category</label>
					  <div class="col-sm-8">
						<?php echo Keycode::getkeycodeById($enq_row['category']); ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="url" class="col-sm-4 control-label">Two Page PDF</label>
					  <div class="col-sm-8">
						<? echo ($enq_row['two_page_pdf'] == 1) ? "YES" : "NO"; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="created_by" class="col-sm-4 control-label">Created By</label>
					  <div class="col-sm-8">
						<? echo ucfirst($enq_row["ess_created_by"]); ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="" class="col-sm-4 control-label">Event Duration</label>
					  <label for="" class="col-sm-1 control-label">From</label>
					  <div class="col-sm-3">
						<? echo utility::getFormatedDateReturn($enq_row["event_duration_from"]); ?>
					  </div>
					  <label for="" class="col-sm-1 control-label">To</label>
					  <div class="col-sm-3">
						<? echo utility::getFormatedDateReturn($enq_row["event_duration_to"]); ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="" class="col-sm-4 control-label">Booking Duration</label>
					  <label for="" class="col-sm-1 control-label">From</label>
					  <div class="col-sm-3">
						<? echo utility::getFormatedDateReturn($enq_row["booking_duration_from"]); ?>
					  </div>
					  <label for="" class="col-sm-1 control-label">To</label>
					  <div class="col-sm-3">
						<? echo utility::getFormatedDateReturn($enq_row["booking_duration_to"]); ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="page_title" class="col-sm-4 control-label">Page Title</label>
					  <div class="col-sm-8">
						<? echo $enq_row["page_title"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="description" class="col-sm-4 control-label">Description</label>
					  <div class="col-sm-8">
						<? echo $enq_row["description"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="package_content" class="col-sm-4 control-label"><? echo $enq_row["label_box_1"]; ?></label>
					  <div class="col-sm-8">
						<? echo $enq_row["detail_box_1"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="extra_information" class="col-sm-4 control-label"><? echo $enq_row["label_box_2"]; ?></label>
					  <div class="col-sm-8">
						<? echo $enq_row["detail_box_2"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="travel" class="col-sm-4 control-label"><? echo $enq_row["label_box_3"]; ?></label>
					  <div class="col-sm-8">
						<? echo $enq_row["detail_box_3"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="your_role" class="col-sm-4 control-label"><? echo $enq_row["label_box_4"]; ?></label>
					  <div class="col-sm-8">
						<? echo $enq_row["detail_box_4"]; ?>
					  </div>
					</div>
					<div class="form-group">
					  <label for="" class="col-sm-4 control-label"></label>
					  <div class="col-sm-8">
						<? echo $enq_row[""]; ?>
					  </div>
					</div>
					
                  </div><!-- /.box-body -->
                </form>
              </div><!-- /.box -->
            </div><!-- /.box -->
			<div class="col-xs-6" style="min-height:400px;">
              <div class="box box-primary">
                <form class="form-horizontal" method="post" name="form1" id="form1" action="index?page=add_placement&action=<? echo $form_action; ?>" onsubmit="return validateForm(this)" enctype="multipart/form-data">
                  <div class="box-body">
					
					<div class="form-group">
                      <label for="" class="col-sm-3 control-label"><? echo $enq_row["label_time_details"]; ?></label><br/>
					  <? 
					    while($iti_row = mysqli_fetch_assoc($iti_sql)){ 
					  ?>
					  <label for="" class="col-sm-3 control-label"></label>
					  <label for="" class="col-sm-1 control-label">Time</label>
                      <div class="col-sm-2" >
						<? echo $iti_row["time"]; ?>
                      </div>
					  <label for="" class="col-sm-1 control-label">Details</label>
                      <div class="col-sm-5" >
						<? echo $iti_row["details"]; ?>
                      </div>
					  <? }?>
                    </div><hr>
					<div class="form-group">
                      <label for="" class="col-sm-4 control-label">ICE Event Admin Manager</label><br/>
					  <? 
					    while($email_row = mysqli_fetch_assoc($email_sql)){
							$email_row = utility::validate_crypt_data($email_row);	
					  ?>
					  <label for="" class="col-sm-4 control-label"></label>
					  <label for="" class="col-sm-1 control-label">Email</label>
                      <div class="col-sm-7" >
						<? echo $email_row["email"]; ?>
                      </div>
					  <? }?>
                    </div>
					
					
                  </div><!-- /.box-body -->
                </form>
              </div><!-- /.box -->
            </div>
		</div>
	</div>
</section>	
<div class="other_items">




</div>

<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: #839b2e;
    }
	#overflow_div{
		height:450px;
		overflow-y: auto;
	}
</style>
<div class="modal fade" id="myModalForSendMail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"></div>
<script type="text/javascript">
$(function () {
	//////////////// Copy To Clipboard /////////////////
	$(".close_button").click(function(){
		var model_label_text  = $("#myModalLabel").text();
		var res = model_label_text.split(" ");
		if(res[0]=='Notes'){
			if(confirm("Please save changes you have done before closing. Are you sure you want to close? ")){
				$(".modal_iframe").attr("src","");
				location.reload();
			}else{
				return false;
			}
		}else if(res[0]=='Person'){
			
				$(".modal_iframe").attr("src","");
				location.reload();
			
		}else{
			$(".modal_iframe").attr("src","");
			location.reload();
		}
	});
});
</script>