<?php  

  session_start();
   error_reporting(0);
		include("../db.php");
		include("../all_query.php");
		

 if(isset($_SESSION['loan_crm_username']) && isset($_SESSION['loan_crm_password']))
{
	
	   $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);
	   
	   
		$table_fieldsQ= mysqli_query($conn,"select *from `table_fields` where `table_name` = 'leads' ");
		$table_fieldsData = mysqli_fetch_assoc($table_fieldsQ);
		
		 $leadQ=mysqli_query($conn,"select *from leads  where  account_holder_id = $account_holder_id order by id desc ");
		 
		 $total_loan = mysqli_num_rows($leadQ);
		 
		 $total_loan_amount = 0;
		 $total_tos = 0;
		 
		 
		while($leadData = mysqli_fetch_assoc($leadQ))
		{
			$total_loan_amount = $total_loan_amount + $leadData['loan_amount'];
			$total_tos = $total_tos + $leadData['tos'];
		}
	
		  			 
		
		?>
		
		
		
  
    <style>
	
#loan_row_table thead:not(.table-dark) th {
    color: white !important;
}

.col-xl-3
{
	padding:0;
}
	
	.timeline .timeline-item {
    position: relative;
    padding-left: 1rem;
}


	.timeline::-webkit-scrollbar{ width :5px;   background:gray; }
	</style>
			
		
		
		
		
 <div class="row gy-4" style="zoom:85%;"  >
  <!-- User Sidebar -->
  <div class="col-xl-3 col-lg-3 col-md-3 order-1 order-md-0">
    <!-- User Card -->
    <div class="card mb-4">
      <div class="card-body" style="padding:0;">
        
        
        <h4 class="bg-primary text-white" style="    padding: 5px;text-align: center;" >Details <a target="_Blank" href="mini_statement_pdf.php?account_holder_id=<?php echo $account_holder_id; ?>" style="color:#ddff54;font-size:16px;float:right;" ><i class="fa fa-download"></i> Mini Statement</a></h4>
        <div class="info-container" style="padding:10px;">
          <ul class="list-unstyled" style="    text-align: left;">
            <li class="mb-3">
              <span class="fw-bold me-2">Account Holder Id:</span>
              <span><?php echo $customerData['account_holder_id']; ?></span>
            </li>
            <li class="mb-3">
              <span class="fw-bold me-2">Customer name:</span>
              <span style="    font-size: 18px;" class=""><?php echo $customerData['name']; ?></span>
            </li>
            <li class="mb-3">
              <span class="fw-bold me-2">Father Name:</span>
              <span ><?php echo $customerData['father_name']; ?></span>
            </li>
            <li class="mb-3">
              <span class="fw-bold me-2">Advisor:</span>
              <span><?php echo $customerData['advisor']; ?></span>
            </li>
            <li class="mb-3">
              <span class="fw-bold me-2">Total Loan:</span>
              <span><?php echo $total_loan; ?></span>
            </li>
            <li class="mb-3">
              <span class="fw-bold me-2">Total Loan Amt:</span>
              <span><?php echo number_format($total_loan_amount); ?></span>
            </li>
            <li class="mb-3">
              <span class="fw-bold me-2">TOS:</span>
              <span><?php echo number_format($total_tos); ?></span>
            </li>
			
			
		   <li class="mb-3"> 
			   
			<input type="hidden" id="tos_amount" value="<?php echo $total_tos; ?>" />
			   
		  <div class="input-group" style="margin-left: -4px;" >
          <span style="width: 150px;"  class="input-group-text fw-bold">Enter Settlement:</span>
          <input type="number" id="settlement_percentage" onKeyup="calSettlement();" class="form-control"  >
          <span class="input-group-text">%</span>
           </div>
		   
            </li>
			
			
			 <li class="mb-3"> 
			   
		  <div class="input-group" style="margin-left: -4px;" >
          <span style="width: 150px;"  class="input-group-text fw-bold">Settlement Amt:</span>
          <input type="text" readonly  id="settlement_amount"  class="form-control"  >
            </div>
		   
            </li>
			
			
			 <li class="mb-3"> 
			   
		   <div class="input-group" style="margin-left: -4px;" >
           <span style="width: 150px;"   class="input-group-text fw-bold">Enter No.EMI:</span>
          	<div style="width:45%;">
			<select onchange="calEMI();"   name="settlement_no_of_emi" id="settlement_no_of_emi"     class="select2 form-select" data-allow-clear="true"     >
			  <option value="">Select EMI</option>
			 <?php $catQ= mysqli_query($conn,"select *from `no_of_emi`   ");
			  while($catData=mysqli_fetch_assoc($catQ))
		       {  ?>
				 <option  value="<?php echo $catData['name']; ?>"><?php echo $catData['name']; ?></option>
				 <?php
			   }
            	 ?>
			  </select>
			</div>
			
            </div>
			
			<div id="emi_details_here" ></div>
		   
            </li>
			
			
			
			
			 <li class="mb-3">
              <span class="fw-bold me-2">Cibile Score:</span>
              <span><?php echo $customerData['cibil_score']; ?></span>
            </li>
			
			
			 <li class="mb-3">
              <span class="fw-bold me-2">Mobile:</span>
              <span><?php echo $customerData['mobile']; ?></span>
            </li>
			
			<li class="mb-3">
              <span class="fw-bold me-2">Email:</span>
              <span><?php echo $customerData['email']; ?></span>
            </li>
			
            
          </ul>
           
        </div>
      </div>
    </div>
    <!-- /User Card -->
    
  </div>
  <!--/ User Sidebar -->


  <!-- User Content -->
  <div class="col-xl-6 col-lg-6 col-md-6 order-0 order-md-1">
  
  
  
     <div class="row">
	 
     <div class="col-md-12">

  
	<div class="card " style="padding: 10px;" >
         <!-- Account Details -->
          
            <div class="content-header mb-3">
              <h6 class="mb-0">Update</h6>
              <small>Choose phone number.</small>
			  <a href="#" onclick="addNewPhone();"  >+Add New</a>
			  
			  
			  
			  
			  <?php 
				  
				    $paymentQ = mysqli_query($conn,"select *from `payments` where account_holder_id = '$account_holder_id' order by id asc  ");
					
					$total_paid = 0;
					$payment_date = '';
					
					while($paymentData = mysqli_fetch_assoc($paymentQ))
					{
						$total_paid = $total_paid + $paymentData['afterallocation_totalpaid'];
						
						$payment_date = date('d-M',strtotime($paymentData['afterallocation_lastpaiddate']));
					}
					

				  ?>
			    <div style="display: inline-flex;     margin-left: 4%; height: 40px;">
			 
			  <div class="form-check">
            <input class="form-check-input"   onchange="paymentClick();"  id="payment_check" name="payment_check" type="checkbox"    >
            <label class="form-check-label" for="retained">
              Payment  <?php  if(mysqli_num_rows($paymentQ) > 0 ) {   echo "Paid - "; echo $total_paid; echo " - "; echo $payment_date;  }  ?>
            </label>
			</div>
			  &nbsp; &nbsp;
			  <input style="display:none;" type="text" id="payment_account_id" placeholder="Enter Loan/Acc Id"   class="form-control" />&nbsp;
			  <input style="display:none;" type="text" id="payment_amount" placeholder="Enter Amount"   class="form-control" />&nbsp;
			  <button  style="display:none;"  onclick="savePayment(this,'<?php echo $account_holder_id; ?>');"  id="payment_submit" class="btn btn-outline-success">Submit</button>
			  </div>
			  
			 
			  
			   
			  
			  <div style="display: inline-flex;float: right;">
			 
			  <div class="form-check">
            <input class="form-check-input" onchange="retainClick();" id="retained" name="retained" type="checkbox" <?php   if($customerData['retained'] == 'yes') { echo "checked"; } ?>   >
            <label class="form-check-label" for="retained">
              Retain
            </label>
			</div>
			  &nbsp; &nbsp;
			  <input style="display:none;" type="text" id="retain_remark" placeholder="Enter Retain Remark" value="<?php echo $customerData['retain_remark']; ?>" class="form-control" />&nbsp;
			  <button  style="display:none;"  onclick="saveRetain(this,'<?php echo $account_holder_id; ?>');"  id="retain_submit" class="btn btn-outline-success">Submit</button>
			  </div>
			  
            </div>
			
			
			
			<div  id="add_new_phone_section" style="display:none;" >
			
			<form id="add_phone_form" onsubmit="return false">
			
			<div class="row">
			
			<div class="col-md-4"   ><input class="form-control" placeholder="Enter phone label."  type="text" name="phone_label" id="phone_label"> </div>
			
			<div class="col-md-4"   ><input class="form-control" placeholder="Enter phone number."  type="text" name="phone" id="phone"> </div>
            <div class="col-md-4"><button type="submit"  onclick="saveNewPhone(this,'<?php echo $account_holder_id; ?>');" class="btn btn-outline-success">Save</button>
			<button type="reset" onclick="resetAddNew();" class="btn btn-outline-danger">Cancel</button></div>
			</div>
			
			</form>

			
			</div>
			
		  
		  <form id="update_form" method="post" action="" >
          <input type="hidden" name="account_holder_id" id="account_holder_id" value="<?php echo $account_holder_id; ?>" />
          <input type="hidden" name="customer_id" id="customer_id" value="<?php echo $customerData['id']; ?>" />
		   
           <div class="row" id="phone_number_section">
		   
		   <?php
		   
		   
		   function searchForPhone($id, $array) {
		   foreach ($array as $key => $val) {
			   if ($val['phone'] === $id) {
				   return $key;
			   }
		   }
		   return null;
		}




		    $extra_phone_json = $customerData['extra_phone_json'];
		   
		   $extra_phone_jsonArray = array();
		   if($extra_phone_json!='')
		   {
			   $extra_phone_jsonArray = json_decode($extra_phone_json,TRUE);
		   }
		   
		   
		   
		   
		   
		   
		   $phone_cibil = $customerData['phone_cibil'];
		   $phone_db = $customerData['mobile'];
		   $phoneArrayDb = explode(' || ',$phone_db);
		   $phoneArray = explode(' || ',$phone_cibil);
		   
		   $phoneArray1 = array();
		   
		   
		   foreach($phoneArrayDb as $phone_no)
		   {
			  
			   $phone = substr($phone_no, -10);
			   
			   if(!in_array($phone,$phoneArray1))
			   {
				$phoneArray1[] = $phone;
			   }
		   }
		   
		   
		    $phoneArrayDb = $phoneArray1;
		    
		   
		    foreach($phoneArray as $phone_no)
		   {
			  
			   $phone = substr($phone_no, -10);
			   
			   if(strlen($phone) == 10)
			   {
			   if(is_numeric($phone))
			   {
			   if(!in_array($phone,$phoneArray1))
			   {
				$phoneArray1[] = $phone;
			   }
			   }
			   
			   }
		   
		   }
		   
		   
		   
		     foreach($extra_phone_jsonArray as $extra_row)
		   {
			  
			   $phone = $extra_row['phone'];
			   
			   if(!in_array($phone,$phoneArray1))
			   {
				$phoneArray1[] = $phone;
			   }
		   }
		    
		   
		   
		   
		   foreach($phoneArray1 as $phone_no)
		   {
			   
			   
			   // check if scrap no
			   $is_scrap = false;
			   
			   $scrapCheckQ = mysqli_query($conn,"select *from `updates` where account_holder_id = '$account_holder_id' and mobile = '$phone_no' and disposition in (select name from `disposition` where is_scrap_phone='on' ) ");
			   
			   if(mysqli_num_rows($scrapCheckQ) > 0)
			   {
				   $is_scrap = true;
			   }
			   
			   
			   
			       $is_extra = false;
				   $phone_label = '';
			   
			       $key = array_search($phone_no, array_column($extra_phone_jsonArray, 'phone'));  
              
					if (!empty($key) || $key === 0) {  
						$is_extra  = true;
						$phone_label = $extra_phone_jsonArray[$key]['label'];  
						 
					}  
			   

		   ?>
		   
          <div class="col-md-4" >
            <div class="form-check custom-option custom-option-basic  " >
			<?php if($is_scrap) { ?><i onclick="removeWrongNumber(this,'<?php echo $account_holder_id; ?>','<?php echo $phone_no; ?>');" style="    color: green;  position: absolute; padding: 2px;" class="fa fa-times"></i><?php } ?>
              <label style="    padding: 10px;padding-left: 2.7em;" class="form-check-labelcustom custom-option-content" for="mobile_<?php echo $phone_no; ?>">
                <input <?php if($is_scrap) { echo "disabled"; } ?> onchange="showUpdateForm('manual');" name="mobile" class="form-check-input" type="radio" value="<?php echo $phone_no; ?>" id="mobile_<?php echo $phone_no; ?>" >
                <span class="custom-option-header">
                  <span class="h6 mb-0" style="  <?php if($is_scrap) { ?> text-decoration: line-through;   color: red; <?php } ?>" ><?php echo $phone_no; ?></span><?php if($is_extra) { ?><sup class=" bg-label-primary"><?php echo $phone_label; ?></sup><?php } ?>
				  <?php   if(in_array($phone_no,$phoneArrayDb)) { ?><sup class=" bg-label-info">DB</sup> <?php } ?>
                   
                </span>
                 
              </label>
            </div>
          </div>
		  <?php } ?>
        </div>
		
		
		<br/>
		
		 <div style="display:none;" id="update_form_section" >
		 
		 <div class="row">
		 
			<div class="col-md-4" >
		    <select   name="attempt_type" id="attempt_type"    class="select2 form-select" data-allow-clear="true"   required  >
			  <option value="">Select Attempt Type</option>
			 <?php $catQ= mysqli_query($conn,"select *from `attempt_type`   ");
			  while($catData=mysqli_fetch_assoc($catQ))
		       {  ?>
				 <option  value="<?php echo $catData['name']; ?>"><?php echo $catData['name']; ?></option>
				 <?php
			   }
            	 ?>
			  </select>
			</div>	

			<div class="col-md-4" >
		    <select onchange="getDispositionSelect('disposition');"  name="attempt_status" id="attempt_status"    class="select2 form-select" data-allow-clear="true"   required  >
			  <option value="">Select Attempt Status</option>
			 <?php $catQ= mysqli_query($conn,"select *from `attempt_status`   ");
			  while($catData=mysqli_fetch_assoc($catQ))
		       {  ?>
				 <option  value="<?php echo $catData['name']; ?>"><?php echo $catData['name']; ?></option>
				 <?php
			   }
            	 ?>
			  </select>
			</div>
			
			
			<div class="col-md-4" id="disposition_select_section" > </div>
			
			 
			</div>		
			
			<div class="row" style="margin-top:3px;">
			
			<div class="col-md-4" style="display:none;" id="sub_disposition_select_section" > </div>
			
			
			<div class="col-md-4"  style="display:none;" id="rfd_select_section"  >
		    <select    name="reason_for_default" id="reason_for_default"    class="select2 form-select" data-allow-clear="true"     >
			  <option value="">Select RFD</option>
			 <?php $catQ= mysqli_query($conn,"select *from `reason_for_default`   ");
			  while($catData=mysqli_fetch_assoc($catQ))
		       {  ?>
				 <option  value="<?php echo $catData['name']; ?>"><?php echo $catData['name']; ?></option>
				 <?php
			   }
            	 ?>
			  </select>
			</div>
			
			
			
			
			</div>
			
			<div id="date_amount_payment_section" class="row" style="margin-top:3px;"  ></div>
			
			<div class="row" style="margin-top:3px;">
			
			<div class="col-md-7" id="remark_section" style="display:none;" >
			 
		   <textarea class="form-control" id="remark" name="remark" placeholder="Enter Remark" rows="3"></textarea>
		    
			</div>	 
			 
			 
			 
			<div class="col-md-5" style="margin-top:2%;">
			
			 <input type="hidden" id="uniqueid" name="uniqueid" value="<?php echo $uniqueid = uniqid(); ?>"  />
 
			<button type="submit" class="btn btn-primary">Save</button>
			<button type="reset" onclick="document.getElementById('update_form_section').style.display='none';" class="btn btn-outline-danger">Cancel</button>
				
			<button class="btn btn-success" type="button" onclick="callInit(this);" >Call</button>
			
			
			</div>
			</div>
			
			
			







	
										 
		 
		 
		 </div>
		
		
		
		
		
		
		
		
		
		
		
		
		
		
             
			
			
           
           </form>
      </div>
  
  
      </div>
  
  
    
  <br/>
     
  

	
	      <div class="card-datatable table-responsive text-nowrap" style="height:350px;margin-top:20px;">
    		 
			 
			                <table id="loan_row_table" class=" table border-top" cellspacing="0" width="100%" role="grid"  style="width: 100%;">
                                        <thead class="bg-primary text-white" >
                                            
									  	 <tr>
										 <th><input type="checkbox" class="form-check-input"  onchange="selectAllLoan();"  name="select_all_loans"></th>
										 <th >Account ID</th>
										 <th>disbursaldate</th>
										 <th>lastduedatenotpaid</th>
										 <th>EMI</th>
										 <th>Tenure</th>
										 <th>EMI Paid</th>
										 <th>EMI Missed</th>
										 <th>Merchant</th>
										 <th>Category</th>
										 <th>DPD</th>
										 <th>Bucket</th>
										 <th>Loan Amt</th>
										 <th>Principal</th>
										 <th>Interest</th>
										 <th>feesdue</th>
										 <th>Penalty</th>
										 <th>TOS</th>
										 <th>Amount_missed</th>
										 <th>failure_reason</th>
										 <th>Settlement (%)</th>
										 <th>Settlement Amt</th>
										 <th>Enter EMI</th>
										 <th>EMI Breakup</th>
										 
										</tr>
                                        </thead>
                                      <tbody>
											
											<?php
											 	 $leadQ=mysqli_query($conn,"select *from leads  where  account_holder_id = $account_holder_id order by id desc ");
												 
										  
										
											 
											$i=$page;

											while($row=mysqli_fetch_assoc($leadQ))
											 {  
										 
											$lead_data = $row['lead_data'];
											$leadDataArray = json_decode(stripslashes($lead_data),TRUE); 
                       
											 
											 $i++; ?>
   											
											<tr class="text-nowrap">
											
											<td><input class="form-check-input"   type="checkbox" name="loan_ids_checkbox" value="<?php echo $row['account_id']; ?>"  /></td>
											
											<td><a href="#" style="text-decoration:underline;"  data-bs-toggle="offcanvas" data-bs-target="#offcanvasLeadInfo"  onclick="getLeadInfo('<?php echo $row['account_id']; ?>');" ><?php echo $row['account_id']; ?></a></td>
											
											<td><?php echo $leadDataArray['disbursaldate']; ?></td>
											<td><?php echo $leadDataArray['lastduedatenotpaid']; ?></td>
											<td><?php echo $leadDataArray['emi']; ?></td>
											<td><?php echo $leadDataArray['tenure']; ?></td>
											<td><?php echo $leadDataArray['noofemispaid']; ?></td>
											<td><?php echo $leadDataArray['noofemismissed']; ?></td>
											<td><?php echo $leadDataArray['genericmerchantname']; ?></td>
											<td><?php echo $leadDataArray['merchant_category']; ?></td>
											<td><?php echo $leadDataArray['monthenddpd']; ?></td>
											<td><?php echo $leadDataArray['dpdbucket']; ?></td>
											<td><?php echo $leadDataArray['loanamount']; ?></td>
											<td><?php echo $leadDataArray['principaldue']; ?></td>
											<td><?php echo $leadDataArray['interestdue']; ?></td>
											<td><?php echo $leadDataArray['feesdue']; ?></td>
											<td><?php echo $leadDataArray['penaltydue']; ?></td>
											<td><?php echo $leadDataArray['tos']; ?></td>
											<td><?php echo $leadDataArray['total_amount_missed']; ?></td>
											<td><?php echo $leadDataArray['failure_reason']; ?></td>
											
											
											
											<td>
										 
										  <input type="hidden" class="tos_amount_ " id="tos_amount_<?php echo $row['id']; ?>" value="<?php echo $leadDataArray['tos']; ?>" />
										  
										   <input type="number"  class="form-control settlement_percentage_"  onKeyup="calSettlementRow('<?php echo $row['id']; ?>');"  id="settlement_percentage_<?php echo $row['id']; ?>" />
										  </td>
										  
										  
											<td>
											
   										    <input type="number" readonly class="form-control settlement_amount_" id="settlement_amount_<?php echo $row['id']; ?>" />
										   
											</td>
											
											<td>
											 
											<select onchange="calEMIRow('<?php echo $row['id']; ?>');"  id="settlement_no_of_emi_<?php echo $row['id']; ?>"   class="select2 form-select settlement_no_of_emi_ " data-allow-clear="true"     >
											  <option value="">Select EMI</option>
											 <?php $catQ= mysqli_query($conn,"select *from `no_of_emi`   ");
											  while($catData=mysqli_fetch_assoc($catQ))
											   {  ?>
												 <option  value="<?php echo $catData['name']; ?>"><?php echo $catData['name']; ?></option>
												 <?php
											   }
												 ?>
											  </select>
											
											</td>
											
											
											<td>
											<div id="emi_details_here_<?php echo $row['id']; ?>" style="display:flex;"></div>
											</td>
											
											
 													
								                </tr>
																		<?php }  ?>


												</tbody>
									
									
									</table>
									
									
									
									
									
									</div>
									
			
				  
				  
			 
			<div class="row" style="margin-top: 10px;">
			
			<div class="col-md-2">
			 <button onclick="settlementView('Settlement','<?php echo $account_holder_id; ?>');" class="btn btn-warning">Settlement</button>
			 </div>
			 <div class="col-md-2">
			 <button onclick="settlementView('Waiver','<?php echo $account_holder_id; ?>');" class="btn btn-info">Waiver</button>
			</div>
			
			 <div class="col-md-8" style="    text-align: right;">
			 
			 <button onclick="sendCaseForwardView('Forward Case','<?php echo $account_holder_id; ?>');" class="btn btn-secondary"><i class="fa fa-paper-plane"></i> Forward Case</button>
			
			
			 <button onclick="sendMessageView('Single Message','<?php echo $account_holder_id; ?>');" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Send Message</button>
			</div>
			
			
			</div>
									
				  
	</div>
  
  
  </div>
   
  
    <div class="col-xl-3 col-lg-3 col-md-3 order-0 order-md-1">
  
  
				   <div class="col-md-12 card" style="padding:0;">
				   
	 <h4 class="bg bg-primary text-white" style="padding:5px;text-align: center;" >Update History <button style="color: #e7fbe7; font-size: 14px;float: right;text-decoration: underline;background: none;"  onclick="showAllUpdates(this,'<?php echo $account_holder_id; ?>','all','1');" href="#">Show All</button> </h4>
				  
 
	 
				     <div id="show_all_updates_here" class="" style="padding:5px !important;">
       
				<ul class="timeline timeline-dashed " style="height:600px;overflow: auto;    padding: 10px;">
		
		
					<?php
					
					
					$timeline_background = array('primary','success','info','warning');


				 $updatesQ = mysqli_query($conn,"select *from `updates` where account_holder_id = '$account_holder_id' order by id desc  limit 1 ");
					
					while($updatesData = mysqli_fetch_assoc($updatesQ))
					{
						
						$random_keys=rand(0,3);
						$bakground = $timeline_background[$random_keys];

					?>
					
					
          <li class="timeline-item timeline-item-<?php echo $bakground; ?> mb-4">
            <span class="timeline-indicator timeline-indicator-<?php echo $bakground; ?>" >
              <i class="bx bx-phone"></i>
            </span>
            <div class="timeline-event">
              <div class="timeline-header border-bottom mb-3">
                <h6 class="mb-0"><?php echo $updatesData['attempt_type']; ?> - <?php echo $updatesData['attempt_status']; ?></h6>
                <small class="text-muted"><?php echo  date('d-M',strtotime($updatesData['update_date'])); echo " ".$updatesData['update_time']; ?></small>
              </div>
              <div class="d-flex justify-content-between flex-wrap mb-2">
			   <div><h6 class="badge bg-label-primary"><?php echo $updatesData['mobile']; ?></h6><br>
               
                  <span class="badge bg-label-success"><?php echo $updatesData['disposition']; ?> </span> - <span><?php echo $updatesData['sub_disposition']; ?></span><br/>
				  
				   <?php if($updatesData['reason_for_default']!='') { ?>
                  <span>RFD: <?php echo $updatesData['reason_for_default']; ?></span><br/>
				   <?php } ?>
				  
				  <?php if($updatesData['amount']!='') { ?><span class="fw-semibold">Amount:</span> <span><?php echo   $updatesData['amount']; ?> - <?php echo   $updatesData['payment_mode']; ?></span><?php } ?>
                  
				   <?php if($updatesData['remark']!='') { ?>
					<br/>
				 <span>Remark: <?php echo $updatesData['remark']; ?></span><br/>
				   <?php } ?>
                </div>
                <div>
                  <?php if($updatesData['next_update_date']!='') { ?><span class="fw-semibold">Followup : <?php echo  date('d-M-y',strtotime($updatesData['next_update_date'])); ?> <?php echo date('h:i A',strtotime($updatesData['next_update_time'])); ?></span>
				  <?php } ?>
				  
				  
				   <?php if($updatesData['uniqueid']!='') {
					   
					   $uniqueid = $updatesData['uniqueid'];
					   
					    $cdrQ = mysqli_query($conn,"select *from `call_reponse` where uniqueid = '$uniqueid' ");
						if(mysqli_num_rows($cdrQ) > 0)
						{
							
							$cdrData = mysqli_fetch_assoc($cdrQ);


					   ?>
					<br/>
				 <span>Recording: <a href="<?php echo $cdrData['resource_url']; ?>" target="_blank">Play</a></span><br/>
						<?php } } ?>
				   
				   
                </div>
				
				 
				 
              </div>
               
            </div>
          </li>
		  
					<?php } ?>
		  
          </ul>
		  
		   
    </div>
	
				   <!--   Show updat histroy -->
					
				   
				   
				   
				   </div>
				  
   
  </div>
  <!--/ User Content -->
</div>
		
		
		
		
		
<?php } ?>