		<?PHP

        
		 $userid = 1;

	 $countbranch=$this->usermodel->countbranches($companyid);

	
	$configuration= $this->usermodel->populateallarray('smsconfig','id',$companyid);


				 if( $countbranch >1){
										 $mybranches= $this->usermodel->populateallarray('branch','id',$branchid);
										$description=$mybranches[0]['description']; 
						
											
							


										}else{
 						$description=$configuration[0]['businessname']; 

											 
										 }
	
						
						
						?>
					

	
 <link href="<?php echo base_url(); ?>assets/select/chosen.min.css" rel="stylesheet" media="screen">
	
		   
		   		   <script src="<?php echo base_url(); ?>assets/select/chosen.jquery.min.js"></script>

				   
	
        <script>
      $(document).ready(function() { 
		
               $("#detailed").hide();
                            $("#bookedby").hide();
                            $("#officename").hide();
                             $("#courtesy").hide();

		$("#homeclub").hide();
		$("#homeclub2").hide();


					});
					
			 $(function () {
        $("#detaileddata").change(function () {
            if ($(this).val() == "Yes") {
            
			$("#detailed").show();




            } else {
			$("#detailed").hide();

            
			
            }
        });
    });
	
		
		
		
		
	
		
			 $(function () {
        $("#membership").change(function () {
            if ($(this).val() == "Visitor") {
            
			$("#bookedby").show();
          $("#officename").show();
		$("#homeclub").hide();
	$("#homeclub2").hide(); 
	$("#subject").hide(); 
$("#courtesy").hide();

            } else if ($(this).val() == "Courtesy") {

    
			$("#courtesy").show();
          $("#officename").show();
		$("#homeclub").hide();
	$("#homeclub2").hide(); 
	$("#subject").hide(); 


			}else if ($(this).val() == "Reciprocating Member") {

	$("#bookedby").hide();
         $("#officename").hide();
		$("#homeclub").show();
	$("#homeclubmain").hide();
	$("#homeclub2").hide();
	$("#courtesy").hide();
			}
			
			
			
			
			
			
			
			else {
			$("#bookedby").hide();
         $("#officename").hide();
		$("#homeclub").hide();
		$("#homeclubmain").hide();
           	$("#homeclub2").show(); 
           		$("#subject").show(); 
			$("#courtesy").hide();
            }
        });
    });
	
		
		
		   $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
	
		
          
	</script>
 
 <div class="row">

    <div class="col-md-12">
		<div class="panel panel-info" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>

				
<h1> <center style="color:red"> <?php if(isset($description)) {echo  " Welcome to ". $description; }?></center> </h1>
						<a href="<?php echo base_url();?>visitor" class="btn btn-info"> Click to Start again/Refresh</a>	 

				 	
				<a href="<?php echo base_url();?>box" class="btn btn-success"> Click here to give Feed Back </a>	 
							
		
			
            	</div>
            </div>
			<div class="panel-body">
					
				<div class="container" style="width:100%">
				

							<br/><div style="clear:both;"/>

<div class="row">
				
	   	<div class="col-md-12">
		
		
	<div>
  <div>

  
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title"><b style="color:blue">ROBISEARCH LTD VISITOR MANAGEMENT SYSTEM (RobiDigiVisitor)</b></h4>
        
      </div>
      <div class="modal-body">
      
	  	

		<?php

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('addnewgatepass' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
		  			<input type="hidden" name="action" value="insert" class="form-control" required placeholder="Enter action">
		  		<input type="hidden" name="userid" value="1" class="form-control" required placeholder="Enter action">

		  		<input type="hidden" name="mycategoryid" value="" class="form-control" required placeholder="Enter mycategoryid">

		  		<input type="hidden" autofocus name="companyid"  value="<?php echo set_value('companyid',$companyid); ?>"  class="form-control"  placeholder="Enter companyid">
		  		<input type="hidden" autofocus name="branchid"  value="<?php echo set_value('branchid',$branchid); ?>"  class="form-control"  placeholder="Enter branchid">


  
	<div class="form-group">
    <label for="inputmembership" class="col-sm-2 control-label">Select Your Category? </label>
    <div class="col-sm-10">
	
		<select class="form-control" id="membership"  name="membership" required>
	
	<option value="" selected >-Select your category-</option>
	<option  value="Visitor"  >Visitor</option>
				<option value="Member"  >Member</option>
				<option  value="Reciprocating Member"  > Reciprocating Member
					<option  value="Courtesy"  >Courtesy</option>
						<option value="Green Fee"  >Green Fee</option>
</option>
	
	
	
	
</select>
				

	
	</div>
  </div>

    <div class="form-group">
    <label for="inputcategory" class="col-sm-2 control-label">Purpose of Visit</label>
    <div class="col-sm-10">
	<select class="form-control2" name="category" required>
	

		<?php 
		
		
							$viewmyclubvisit= $this->usermodel->populatealldatanoarray('assignservices','companyid',$companyid,'name','Yes');

		
if(is_array($viewmyclubvisit)) {

   foreach($viewmyclubvisit as $viewmyclubvisitrow){

   //echo $courserow->coursename;
   
   $configuration = $this->usermodel->populateallarray('services','id',$viewmyclubvisitrow->code);
	 	///echo$configuration[0]['name'];	

    ?>
					<option select value="<?=  $viewmyclubvisitrow->code;   ?>"><?=  $configuration[0]['name'] ; ?></option>



	<?php

}} else {
	?>
	
		<option value=""  >Select Purpose first </option>
  <?php
}
	
?>
		
		
		
		
		
		
		
		
			<?php 
					 
					//$viewmyclubs= $this->usermodel->populateall('assignservices','companyid',$companyid);
							$viewmyclubs= $this->usermodel->populatealldatanoarray('assignservices','companyid',$companyid,'name','No');

					 


if(is_array($viewmyclubs)) {

   foreach($viewmyclubs as $maincategoryrow){

   //echo $courserow->coursename;
   
   $configuration = $this->usermodel->populateallarray('services','id',$maincategoryrow->code);
	 	///echo$configuration[0]['name'];	

    ?>
					<option value="<?=  $maincategoryrow->code;   ?>"><?=  $configuration[0]['name'] ; ?></option>



	<?php

}} else {
    echo 'No main category available.';
}
	
?>
	
	
	
</select>
Display Detailed Info?
		<select class="form-control2" id="detaileddata"  name="detaileddata" required>
	
	<option value=""  >Display more details?</option>
				<option value="Yes"  >Yes</option>
				<option selected value="No"  >No</option>

	
	
	
</select>
						<span class="text-danger"><?php echo form_error('category'); ?>

	</div>
  </div>
  
   <div id="visitors" style="display:none3">
  	<div class="form-group"  id="bookedby">
    <label for="inputbookedby" class="col-sm-2 control-label">Booked By(Membership No): </label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="bookedby" value="<?php echo set_value('bookedby'); ?>" class="form-control"  placeholder="Enter Membership Number of the person who booked/invited you">
		 
				
		<span class="text-danger">  <?php echo form_error('bookedby'); ?>
		
		</span>
	</div>
  </div>
  </div>
	<div class="form-group"  id="courtesy">
    <label for="inputcourtesy" class="col-sm-2 control-label">Courtesy Of? </label>
    <div class="col-sm-10">
	
		<select class="form-control"  name="courtesy" >
	
	<option value="" selected >-Select one -</option>
	<option  value="Chairman"  >Chairman</option>
				<option value="Captain"  >Captain</option>
				<option  value="Senior"  > Senior<option  value="Courtesy"  >Courtesy</option>
								<option value="KGU"  >KGU</option>
								
									<option value="Non Member"  >Non Member</option>
</option>
	
	
	
	
</select>
				

	
	</div>
  </div>



  	<div class="form-group" id="subject">
    <label for="inputsubject" class="col-sm-2 control-label">Your Membership/Employee No: </label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="subject" value="<?php echo set_value('subject',$gatepass[0]["subject"]); ?>" class="form-control"  placeholder="Enter your Membership number if any">
		 
				
		<span class="text-danger">  <?php echo form_error('subject'); ?>
		
		</span>
	</div>
  </div>

  	<div class="form-group" id="homeclub2">
    <label for="inputmembership" class="col-sm-2 control-label">Your Home Club </label>
    <div class="col-sm-10">
	
	
	
		<select class1="chzn-select" name="homeclub2"  class="form-control" style="width:100%"  >
			<option value=""  >-Select your home club-</option>


			<?php 
					 
					$viewmyclubsavailablehome= $this->usermodel->populatealldatanoarray('assignclubs','companyid',$companyid,'name','Yes');

					 


if(is_array($viewmyclubsavailablehome)) {

   foreach($viewmyclubsavailablehome as $viewmyclubsavailablehomerow){

   //echo $courserow->coursename;
   
   $clubshome = $this->usermodel->populateallarray('clubs','id',$viewmyclubsavailablehomerow->code);
	 	///echo$configuration[0]['name'];	

    ?>
					<option selected value="<?=  $viewmyclubsavailablehomerow->code;   ?>"><?=  $clubshome[0]['name'] ; ?></option>



	<?php

}} else {
    echo 'No main category available.';
}
	
?>
	
	
	
		
		
		
		
		
		
		
		
		
		
		

		
</select>
			
  </div>
  </div>
  
  
  
  
  
  	<div class="form-group" id="homeclub">
    <label for="inputmembership" class="col-sm-2 control-label">Your Home Club </label>
    <div class="col-sm-10">
	
	
	
	
	
	
	
	
	
		<select name="homeclub"  class="form-control" style="width:100%"  >

  
	
	<option value="" selected >-Select your home club-</option>
	
	
	
		<?php 
					 
					$viewmyclubsavailable= $this->usermodel->populateall('assignclubs','companyid',$companyid);

					 


if(is_array($viewmyclubsavailable)) {

   foreach($viewmyclubsavailable as $viewmyclubsavailablerow){

   //echo $courserow->coursename;
   
   $clubs = $this->usermodel->populateallarray('clubs','id',$viewmyclubsavailablerow->code);
	 	///echo$configuration[0]['name'];	

    ?>
					<option value="<?=  $viewmyclubsavailablerow->code;   ?>"><?=  $clubs[0]['name'] ; ?></option>



	<?php

}} else {
    echo 'No main category available.';
}
	
?>
	
	
	
	
	
	
	
	
	
	
</select>
			
  </div>
  </div>
  
  
  
  
  
  
  
  

	<div class="form-group">
    <label for="inputcallername" class="col-sm-2 control-label">Visitor Name </label>
    <div class="col-sm-10">
	
	<?PHP
	if($gatepass!=false){
	?>
		  		<input type="text" autofocus name="name"readonly  required  value="<?php echo set_value('name',$gatepass[0]["name"]); ?>"  class="form-control"  placeholder="Enter Visitor name">
	<?PHP
	}else{
	?>
		
	<input type="text" autofocus name="name"  required  value="<?php echo set_value('name',$gatepass[0]["name"]); ?>"  class="form-control"  placeholder="Enter Visitor name">


	<?PHP
	}
	?>		
		<span class="text-danger">Name of the visitor or customer  <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
  


<?PHP
$finalidno="";


if(trim($gatepass[0]["idno"])==""){
	$finalidno=$idno;
	}else{
		$finalidno=$gatepass[0]["idno"];
		
		}


?>
  	<div class="form-group" >
    <label for="inputcallername" class="col-sm-2 control-label">Visitor ID No: </label>
    <div class="col-sm-10">
	
		 
		 
		 
		 
		 	
	<?PHP
	if($gatepass!=false){
	?>
		  		<input type="text" minlength="8" readonly name="idno" value="<?php echo set_value('idno',$finalidno); ?>"  required class="form-control"  placeholder="Enter ID NO">
	<?PHP
	}else{
	?>
		
		  		<input type="text" minlength="8"  name="idno" value="<?php echo set_value('idno',$finalidno); ?>"  required class="form-control"  placeholder="Enter ID NO">


	<?PHP
	}
	?>	
		 
		 
		 
		 
		 
		 
				
		<span class="text-danger">Visitor ID No.  <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
    	<div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">Visitor Phone </label>
    <div class="col-sm-10">
	
		 		 
		 
		 	
	<?PHP
	if($gatepass!=false){
	?>
			  		<input type="text" name="phone" readonly value="<?php echo set_value('phone',$gatepass[0]["phone"]); ?>"  required class="form-control" required placeholder="Enter phone  number e.g 2547xxxxxx">

	<?PHP
	}else{
	?>
		
		  		<input type="text" name="phone" value="<?php echo set_value('phone',$gatepass[0]["phone"]); ?>"  required class="form-control" required placeholder="Enter phone  number e.g 2547xxxxxx">


	<?PHP
	}
	?>	
		
				
		<span class="text-danger"> <?php echo form_error('phone'); ?>
		
		</span>
	</div>
  </div>
  


  	<div class="form-group" id="homeclubmain">
    <label for="inputdescription" class="col-sm-2 control-label">Club/Company (FROM)</label>
    <div class="col-sm-10">
		  		<input type="text" name="business"  value="<?php echo set_value('business'); ?>"  class="form-control"  placeholder="Enter Club/ business name">

			
		<span class="text-danger"> <?php echo form_error('business'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  

  
  
  
  
  
  
  
  
  	<div class="form-group" id="officename">
    <label for="inputdofficename" class="col-sm-2 control-label">	Office Name /Location(To)</label>
    <div class="col-sm-10">
		  		<input type="text" name="officename"  value="<?php echo set_value('officename'); ?>"  class="form-control"  placeholder="Enter Office Name /Location">

			
		<span class="text-danger"> <?php echo form_error('officename'); ?>
		
		</span>
	</div>
  </div>
  

   <div class="form-group">
    <label for="inputvehicleno" class="col-sm-2 control-label">Vehicle No </label>
    <div class="col-sm-10">
	 <div class="col-sm-3">
		  		<input type="text"  name="vehicleno" autofocus value="<?php echo set_value('vehicleno',$gatepass[0]["vehicleno"]); ?>" class="form-control"  placeholder="Enter vehicle Registration No">
		 </div>	 <div class="col-sm-3">
						  		<input type="text"  name="vehiclecolor" value="<?php echo set_value('vehiclecolor',$gatepass[0]["vehiclecolor"]); ?>" class="form-control"  placeholder="Enter vehicle Color e.g White">
							 </div>	 <div class="col-sm-3">  		
								
								<input type="text"  name="vehiclemodel" value="<?php echo set_value('vehiclemodel',$gatepass[0]["vehiclemodel"]); ?>" class="form-control"  placeholder="Enter vehicle Model e.g Nissan">
 </div>
		<span class="text-danger">  <?php echo form_error('vehiclemodel'); ?>
		
		</span>
	</div>
  </div>
	
  

  <div id="detailed" style="display:none3">
  
   
  
  
    <div class="form-group">
    <label for="inputemail" class="col-sm-2 control-label">Visitor Email </label>
    <div class="col-sm-10">
	
		  		<input type="email" name="email"  value="<?php echo set_value('email',$gatepass[0]["email"]); ?>" class="form-control"  placeholder="Enter Visitor email">
		 
				
		<span class="text-danger">  <?php echo form_error('email'); ?>
		
		</span>
	</div>
  </div>
  
	<div class="form-group">
    <label for="inputsubject" class="col-sm-2 control-label"> Remarks  </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="description" value="<?php echo set_value('description'); ?>"   class="form-control"  placeholder="Enter any  comment / remarks">
		 
				
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>


 
  	<div class="form-group" >
    <label for="inputmessageid" class="col-sm-2 control-label">No of Visitors(Occupants) </label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="messageid" value="<?php echo set_value('messageid',1); ?>" class="form-control"  placeholder="Enter No of visitors (Occuants)">
		 
				
		<span class="text-danger">  <?php echo form_error('messageid'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  
  
 <div class="form-group">
    <label for="inputreceiver" class="col-sm-2 control-label">Checked-in By?</label>
    <div class="col-sm-10">
	<select class="form-control" name="receiver" required>
	
	<option value=""  >---Prepared By?--</option>

		
	<?php 
				
				
	
			$allusers = $this->usermodel->populatealldatanoarray('people', 'id',$userid,'id >',0);

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $userrow->id;   ?>"><?=  $userrow->firstname ."- ".$userrow->surname ."(". $userrow->email.")"; ?></option>



	<?php

}} else {
   // echo 'No user available.';
}
	
?>

	<?php 
				
				
		if($usertype=="admin"){
			$allusers = $this->usermodel->populatealldatanoarray('people', 'companyid',$companyid,'id >',0);

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $userrow->id;   ?>"><?=  $userrow->firstname ."- ".$userrow->surname ."(". $userrow->email.")"; ?></option>



	<?php

}} else {
    echo 'No user available.';
}
		}
?>

</select>





		

	</div>
  </div>
  
  
  

  
  
  <div class="form-group">
    <label for="inputmedia" class="col-sm-2 control-label">Gate Name/ Service Area</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="location" value="<?php echo set_value('location',"Main Gate"); ?>" class="form-control" required placeholder="Enter Gate Name">
		 
				
		<span class="text-danger">Location / Gate Name <?php echo form_error('location'); ?>
		
		</span>
	</div>
  </div>
    	
	 <div class="form-group" style="display:none">
    <label for="inputcategory" class="col-sm-2 control-label">Send Sms?</label>
    <div class="col-sm-10">
	<select class="form-control" name="sendsms" required>
	
	<option value=""  >Do you want Send thank you Sms?</option>
				<option  value="yes"   >Yes</option>
				<option   value="no" selected="selected"   >No</option>


	
	
</select>
		

	</div>
  </div>
  
  <?php
  
   $getmessage= $this->usermodel->populateallarray('smstemplate','status',"gatepass");
	 $currentmessage=$getmessage[0]['description'];
  if(isset($currentmessage)) { $currentmessage; }
  
  ?>
  
  
  
  
  
		<div class="form-group" >
    <label for="inputsms" class="col-sm-2 control-label">Text sms </label>
    <div class="col-sm-10">
	<textarea name="sms"   value="<?php echo set_value('sms'); ?>"   class="form-control"  placeholder="Enter sms "><?php if(isset($currentmessage)) {echo$currentmessage; }  ?></textarea>
			
		<span class="text-danger"> <?php echo form_error('sms'); ?>
		
		</span>
	</div>
  </div>
  

		
  <div class="form-group" style="display:none">
    <label for="inputstatus" class="col-sm-2 control-label">Status?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status" required>
	
	<option value=""  >Select status</option>
			<option value="Active" selected >Active</option>
						<option value="intrested"  >intrested</option>
						<option value="Not Intrested"  > Not intrested</option>
			<option value="General Visitor"  >General Visitor</option>

			<option value="attended"  >attended</option>

	<option value="pending"  >pending</option>
		<option value="solved"  >solved</option>

	<option value="completed"  >Completed</option>
	<option value="Other"  >Other</option>

	
	
</select>
		
						<span class="text-danger"><?php echo form_error('status'); ?>

	</div>
  </div>

  
  <div class="form-group" >
    <label for="inputcheckindate" class="col-sm-2 control-label">Visitor Check-in Date </label>
    <div class="col-sm-10">
	
		  		<input type="date-TIME" readonly name="checkindate" value="<?php echo  date("Y-m-d H:i:s"); ?>" class="form-control" required placeholder="Enter Visitor date">
		 
				
		<span class="text-danger"> <?php echo form_error('checkindate'); ?>
		
		</span>
	</div>
  </div>
  
    </div>
  <div class="form-group" >
    <label for="inputprintgatepass" class="col-sm-2 control-label">Print Gate Pass?</label>
    <div class="col-sm-10">
	<select class="form-control" name="printgatepass" required>
	
	<option value=""  >Do you want Print Gate Pass?</option>
				<option  value="yes"   >Yes</option>
				<option   value="no" selected="selected"   >No</option>


	
	
</select>
		

	</div>
  </div>
  
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="gatepass" name="btn_addgatepass" class="btn btn-primary"> Check-in </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>	
		
		
		
		
		
		
		
		
	
		</DIV>		
		   </div>		
				
				
				
				
		
				
				
				
		
 
</div>				
									



</div>
</div>














































