

 
 <div class="row">
  
   	

   	<div class="col-md-12">
	
  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
						 <span class="pull-right"> Follow-up history</span>	
						 
<?php if($type=="Invoice"){?>
									
	                        <a  id="more" target="blank" class="btn btn-primary" href="<?php echo base_url();?>user/allcreditors">back  </a>

								<?php }else{?>
								                        <a  id="more" target="blank" class="btn btn-primary" href="<?php echo base_url();?>user/viedeals">back  </a>

								<?php
				
								}
	?>
				
            	</div>
            </div>
			<div class="panel-body">

				<div class="widget-content nopadding table_holder table-responsive" >				
	<?PHP
					$session_data = $this->session->userdata('logged_in');

		$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];

				echo $this->session->flashdata('msg'); 
								?>	
										
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	
									
			


	<?PHP
	  $mydate=date("Y-m-d");

	 
                  echo form_open('user/addfollowups' , array('role'=>'form', 'id' => 'signup','enctype' => 'multipart/form-data'));

		 if(validation_errors()):?>
<?php endif;?>
					<h2 style="margin:0px; padding:0px">Add new follow-up details.<small>  Enter correct and detailed information</small></h2>

			 <input type="hidden" id="followupid"name="followupid" class="followupid" placeholder="followupid" value="<?php  echo $itemid; ?>"><br>
			 <input type="hidden" id="type"name="type" class="type" placeholder="type" value="<?php  echo $type; ?>"><br>

						 <input type="hidden" id="type"name="currentid" class="currentid" placeholder="currentid" value="<?php  echo $currentid; ?>"><br>

			<div class="row">
				<div class="col-xs-12 col-sm-6 col-md-6">
					
				  <div class="form-group">
    <label for="inputlevel" class="col-md-4">Follow-up Level </label>
    <div class="col-sm-8">

<select class="form-control" name="level" required>

			<option value="" selected="selected" >..Select Follow-up Level...</option>
				<option value="Followup 1">Followup 1</option>
				<option value="Followup 2" >Followup 2 </option>
						<option value="Followup 3" >Followup 3 </option>
					<option value="Followup 4">Followup 4</option>
				<option value="Followup 5" >Followup 5 </option>
						<option value="Followup 6" >Followup 6 </option>
						<option value="Followup 7">Followup 7</option>
				<option value="Followup 8" >Followup 8 </option>
						<option value="Followup 9" >Followup 9 </option>
						<option value="Followup 10">Followup 10</option>
				<option value="Followup 11" >Followup 11 </option>
						<option value="Followup 12" >Followup 12 </option>
						<option value="Followup 13">Followup 13</option>
				<option value="Followup 14" >Followup 14 </option>
						<option value="Followup 15" >Followup 15 </option>
<option value="Followup 16">Followup 16</option>
				<option value="Followup 17" >Followup 17 </option>
						<option value="Followup 18" >Followup 18 </option>
						<option value="Followup 19">Followup 19</option>
				<option value="Followup 20" >Followup 20 </option>
						<option value="Others" >Others </option>
			
				</select>

   </div>
  </div>				 

					
				</div>
				
				
				
	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	Next step Date  </label>
    <div class="col-sm-4">
	
		  		<input type="date" name="todate" value="<?php echo set_value('todate', $mydate); ?>" class="form-control2" required placeholder="Enter date of next action/closed date">
		 	Time :<select class="form-control2" name="starttime" id="starttime" >

	<option value=""  >-time </option>
	
			<option value="06:00">06:00</option>
		<option value="06:15">06:15</option>
		<option value="06:30">06:30</option>
		<option value="06:45">06:45</option>
			<option value="07:00">07:00</option>
		<option value="07:15">07:15</option>
		<option value="07:30">07:30</option>
		<option value="07:45">07:45</option>
			<option value="08:00">08:00</option>
		<option value="08:15">08:15</option>
		<option value="08:30">08:30</option>
		<option value="08:45">08:45</option>
			<option value="09:00">09:00</option>
		<option value="09:15">09:15</option>
		<option value="09:30">09:30</option>
		<option value="09:45">09:45</option>
			<option value="10:00">10:00</option>
		<option value="10:15">10:15</option>
		<option value="10:30">10:30</option>
		<option value="10:45">10:45</option>
			<option value="11:00">11:00</option>
		<option value="11:15">11:15</option>
		<option value="11:30">11:30</option>
		<option value="11:45">11:45</option>
					<option selected="selected" value="12:00">12:00</option>

		<option value="12:15">12:15</option>
		<option value="12:30">12:30</option>
		<option value="12:30">12:45</option>
		
			<option value="13:00">13:00</option>
		<option value="13:15">13:15</option>
		<option value="13:30">13:30</option>
		<option value="13:45">13:45</option>
			<option value="14:00">14:00</option>
		<option value="14:15">14:15</option>
		<option value="14:30">14:30</option>
		<option value="14:45">14:45</option>
			
			<option value="15:00">15:00</option>
		<option value="15:15">15:15</option>
		<option value="15:30">15:30</option>
		<option value="15:45">15:45</option>
			<option value="16:00">16:00</option>
		<option value="16:15">16:15</option>
		<option value="16:30">16:30</option>
		<option value="16:45">16:45</option>
		
			<option value="17:00">17:00</option>
		<option value="17:15">17:15</option>
		<option value="17:30">17:30</option>
		<option value="17:45">17:45</option>
			<option value="18:00">18:00</option>
		<option value="18:15">18:15</option>
		<option value="18:30">18:30</option>
		<option value="18:45">18:45</option>
			
			<option value="19:00">19:00</option>
		<option value="19:15">19:15</option>
		<option value="19:30">19:30</option>
		<option value="19:45">19:45</option>
		
		
		
			<option value="20:00">20:00</option>
		<option value="20:15">20:15</option>
		<option value="20:30">20:30</option>
		<option value="20:45">20:45</option>
		<option value="21:00">21:00</option>
		<option value="21:15">21:15</option>
		<option value="21:30">21:30</option>
		<option value="21:45">21:45</option>
		<option value="22:00">22:00</option>
		<option value="22:15">22:15</option>
		<option value="22:30">22:30</option>
		<option value="22:45">22:45</option>
		<option value="23:00">23:00</option>
		<option value="23:15">23:15</option>
		<option value="23:30">23:30</option>
		<option value="23:45">23:45</option>
<option value="23:59">23:59</option>
<option value="00:00"  >00:00</option>
		<option value="00:15">00:15</option>
		<option value="00:30">00:30</option>
		<option value="00:45">00:45</option>
		<option value="01:00">01:00</option>
		<option value="01:15">01:15</option>
		<option value="01:30">01:30</option>
		<option value="01:45">01:45</option>
		<option value="02:00">02:00</option>
		<option value="02:15">02:15</option>
		<option value="02:30">02:30</option>
		<option value="02:45">02:45</option>
		
		
		
			<option value="03:00">03:00</option>
		<option value="03:15">03:15</option>
		<option value="03:30">03:30</option>
		<option value="03:45">03:45</option>
			<option value="04:00">04:00</option>
		<option value="04:15">04:15</option>
		<option value="04:30">04:30</option>
		<option value="04:45">04:45</option>
			<option value="05:00">05:00</option>
		<option value="05:15">05:15</option>
		<option value="05:30">05:30</option>
		<option value="05:45">05:45</option>
	</select>	
				
		Action :<select class="form-control2" name="action" id="action" required >

	<option value="" selected="selected" >---Select Action --</option>
	
	

	
	
	
	
	
	<?php 
					 
			$groups =  $this->usermodel->populateall('dealstatus','companyid',$companyid);
	

	
if(is_array($groups)) {

   foreach($groups as $grouprowdeals){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $grouprowdeals->name;   ?>"><?=  $grouprowdeals->name; ?></option>



	<?php

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

			

			

 
			<div class="row">
				<div class="col-xs-12 col-sm-6 col-md-6">
				
				
					   <div class="form-group">
    <label for="inputfeedback" class="col-md-4">Customer Feedback/ Remarks </label>
    <div class="col-sm-8">
	
	
<textarea name="feedback" rows="2" cols="10" class="form-control"   placeholder="Enter customer feddback /Remarks/Datails"><?php echo set_value('feedback'); ?></textarea>	


   </div>
  </div>
				</div>
				<div class="col-xs-12 col-sm-6 col-md-6">
							   <div class="form-group">
    <label for="inputrecommendation" class="col-md-4">Challange/  Amount (If Closed)</label>
    <div class="col-sm-8">
	
				 <input type="text" id="challanges"name="challanges" class="form-control" placeholder="Enter Challange/  Amount (If Closed)" value=""><br>

</br>Recommendations /Invoice No(If closed) 
<textarea name="recommendation" rows="2" cols="10" class="form-control"   placeholder="Enter Recommendations /Invoice No(If closed)"><?php echo set_value('recommendation'); ?></textarea>	

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

  
 
  
  
			<div class="row">
				<div class="col-xs-12 col-sm-6 col-md-6">
				
				
				</div>
				<div class="col-xs-12 col-sm-6 col-md-6">
					
					
					  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-8">
     
	<button type="submit" name="btn_followups" class="btn btn-primary" value="followup">Add New Follow-up </button>

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

 

			<?PHP
		echo form_close();
		
		?>
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
		 	<th>Status</th>
 <th>Next  Date</th>
		          <th> Name</th>
         <th> Contact</th>
         <th> Route</th>

         <th> Date</th>

     <th> Level</th>
	    	     <th>Feedback</th>

	     <th>Recommendations / Invoice No</th>
		 	     <th>Challange / Amount</th>

		 
<th>Added by:</th>
<th> Branch</th>

                 </tr>
             </thead>
<?php

 if(!is_array($mytask)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='1'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($mytask as $c): 

		 

             ?>



             <tr>
                
            <?php 
$id=$c->id;
 $followupid=$c->followupid;


?>
   
			    <td><?php echo $c->status ; ?></td> 
			    <td><?php echo $c->nextdate ; ?></td>

    <td><?php 
	
		if($type=="Customer"){
			$customers= $this->usermodel->populateallarray('people','id',$followupid);

				$MYcustomer=$customers[0]["firstname"];
					
				echo$company=$customers[0]["company"]."-".$MYcustomer;
	
		}else if($type=="Invoice"){
		$sales= $this->usermodel->populateallarray('sales','invoice',$followupid);

				$customer=$sales[0]["customer"];
						$people= $this->usermodel->populateallarray('people','id',$customer);
				echo$company=$people[0]["company"];



		
	}else{
		
	          		$details= $this->usermodel->populateallarray('deals','id',$followupid);

				$owner=$details[0]["owner"];

				$contactname=$details[0]["contactname"];
				if($owner==""){
									echo $contactname;

				}else{
					
					echo $owner;

				}
	}

	?></td>
	
	 <td><?php 
   
							
								if($type=="Customer"){
									
												echo$phone=$customers[0]["phone"];
	
								}	else if($type=="Invoice"){
									
												echo$phone=$people[0]["phone"];
	
								}else{
				echo$contact=$details[0]["contact"];
				
								}
	?></td>

    <td><?php
	
						if($type=="Customer"){
									
												
					//echo$contact=$customers[0]["probability"];

	
								}else{
									echo$contact=$details[0]["probability"];

				
								}



	?></td>

    <td><?php echo $c->date ; ?></td>

    <td><?php echo $c->level ; ?></td>


    <td><?php echo $c->feedback ; ?></td>
	    <td><?php echo $c->recommendation ; ?></td>
			    <td><?php echo $c->challanges ; ?></td>



 <td><?php 
	$owner=$c->userid;
			$myowner = $this->usermodel->populateall('people', 'id',$owner);


	


if(is_array($myowner)) {

   foreach($myowner as $myowneryrow){
		echo $myowneryrow->firstname;


}} else {
    echo 'No User .';
}
	
?>
</td>


				<td>

<?php
	 $Branchdetails = $this->usermodel->populateallarray('branch','id',$c->branchid);

   echo $Branchdetails[0]['name'];

?>







</td>		
	 
             </tr>

	<?php endforeach;} ?>

              

        </table>

									
									
									
					</div>	

								
<div id="addModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Add new Category</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addcategory' , 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;?>
				  		
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Name </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>" class="form-control" required placeholder="Enter name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="category" name="btn_addcategory" class="btn btn-primary"> Add Category   </button>

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

    

				</div>

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





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

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

 
</div>


















