<?php  

   session_start();
 //  error_reporting(0);
    include("../db.php");
    include("../all_query.php");
		
		
 
  if(isset($_SESSION['loan_crm_username']) && isset($_SESSION['loan_crm_password']))
  {
		 
     
	  $type = $_REQUEST['type'];
	  $account_holder_id = $_REQUEST['account_holder_id'];
	 
	   $customerQ = mysqli_query($conn,"select *from `customer` where account_holder_id = '$account_holder_id' ");
	  $customerData = mysqli_fetch_assoc($customerQ);
	  
	  
	  
	  ?>
	  
	   <div class="card-body" style="padding:0">
	   
	   <form action="" id="send_message_form" method="post" >
	   
	   
	   
	   
	   <input type="hidden" name="account_holder_id" value="<?php echo $account_holder_id; ?>"  />
	   
	   
	   <div class="row">
	   
	   <div class="col-md-4">
	   
	   <div class="form-group" >
	   
	    <select name="template_id" id="template_id" class="select2 form-select  " data-allow-clear="true" >
		
		<option value="0">Select Template</option>
		
		<?php  $templateQ = mysqli_query($conn,"select *from `compaign_templates`  "); 
		
		while($templateData = mysqli_fetch_assoc($templateQ))
		{

		?>
		<option value="<?php echo $templateData['id']; ?>"><?php echo $templateData['name']; ?></option>
		
		<?php } ?>
		
		</select>
	   
	   </div>
	   
	   </div>
	   
	   
	  
	  <div class="col-md-4">
		
		<textarea name="text_message" id="text_message" class="form-control" Placeholder="Enter Message Optional" style="height:100px;" ></textarea>
		
		
		
	  </div>
	    
		<div class="col-md-4">
		<input type="checkbox" onclick="generateStatement('<?php echo $account_holder_id; ?>');" name="attach_statement" id="attach_statement" /> Attach Statement&nbsp;
 		
		  <button type="submit"  class="btn btn-danger">Send Email</button>&nbsp;
		  <?php if($type='Single') { ?>
		  <a style="color:white;" onclick="sendWhatsapp('<?php echo $account_holder_id; ?>','<?php echo $customerData['mobile']; ?>');"  class="btn btn-success">Send Whatsapp</a>&nbsp;
		  <?php } ?>	 
			 
			 
		</div>
		
	   </div>
	   
	   
	  
	  <br/>
	  <br/>
		
		</form>
		
		
		
      </div>
	  
	  
	  
	  
	  <?php
	  
	  
	  
	  
	  
	  
	  
	  
	  
    		 
			
			
 }
		
		
		?>