<style>

.form-group-default
{
	margin:5px;
}

.form-check-input:checked {
    background-color: #23df23 !important;
    border-color: #23df23 !important;
	cursor:pointer;
}
.form-check-input
{
	cursor:pointer;
}
   
.bootstrap-select.btn-group .dropdown-menu.inner {
	
	display:block !important;
	max-height: 250px !important;
	
}
 .hidden
 {
	 display:none !important;
 }
 .bootstrap-select.btn-group .dropdown-menu li {
    position: relative;
       padding: 6px;
}
.bootstrap-select.btn-group .dropdown-menu li a {
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    color: black;
    padding: 15px;
}
.btn-default {
      background-color: white !important;  
	  border:1px gray;
}
.bootstrap-select > .dropdown-toggle {
    width: 100%;
    padding-right: 25px;
    z-index: 1;
    color: black;
}

  .dt-buttons {
    display: inline-block;
    margin-bottom: 15px;
    padding-top: 5px;
}
.dt-buttons .dt-button {
    background: #e5edfc none repeat scroll 0 0;
    border-radius: 4px;
    color: #5a8dee;
    margin-right: 3px;
    padding: 5px 4px;
	border: 1px solid #e5edfc !important;
}   
  
  .customizer .service-panel-toggle {
     display:none;	  
  }
  
  
  .dataTables_filter
  {
	      display: inline-table !important;
    float: right !important;
  }


 
table.loading tbody:after {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.1);
    background-image: url("https://media1.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.gif");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 50px 50px;
    content: "";
}




</style> 

 
 
	
	 <style>
      .blink {
      animation: blinker 0.6s linear infinite;
 
      }
      @keyframes blinker {  
      50% { opacity: 0; }
      }
      .blink-one {
      animation: blinker-one 1s linear infinite;
      }
      @keyframes blinker-one {  
      0% { opacity: 0; }
      }
      .blink-two {
      animation: blinker-two 1.4s linear infinite;
      }
      @keyframes blinker-two {  
      100% { opacity: 0; }
      }
    </style>
	
<script>
// A $( document ).ready() block.
$( document ).ready(function() {
   
$("input[type='text'] , input[type='number']  ").on("focus", function () {
   $(this).select();
});
});




</script>	

 
 
 
 
 
  
  <script>
  
  function sendWhatsapp(account_holder_id,mobile)
  {
	  
	  
	  var text_message = document.getElementById('text_message').value;
	  var template_id = document.getElementById('template_id').value;
	  
	 var mobile1 =  '91'+ $('input[name=mobile]:checked').val();
 
	  
	  	$.ajax({
      type: "GET",
      url: 'get_template_ajax.php',
      data: ({account_holder_id:account_holder_id,template_id:template_id,text_message:text_message}),
      success: function(data) {
		
		
		    var URL = 'https://api.whatsapp.com/send?phone='+mobile1+'&text='+data;
	        window.open(URL, '_blank');
			
		 }
		  // <- this turns it into synchronous

		  }
	   );
	   
	  
	 
	  
	  
  }
  
  </script>
 
 
 
 
 
	
	


<script>



function getIdbyName(name,table,input_id)
{
	
	$.ajax({
      type: "GET",
      url: 'get_id_by_name.php',
      data: ({name:name,table:table}),
      success: function(data) {
		
		  // alert(data);
			document.getElementById(input_id).value=data;
			showHardwareSection(data);
			showEmployeeSection(data);
			
		 }
		  // <- this turns it into synchronous

		  }
	   );
	
}
</script>

<script>


  $(function() {
	  
	  
	  $('form').on('keydown', 'input, select', function(e) {
    var self = $(this)
      , form = self.parents('form:eq(0)')
      , focusable
      , next
      ;
    if (e.keyCode == 13) {
        focusable = form.find('input:not(:disabled):not([readonly]):not([type="checkbox"]),a,select,button,textarea').filter(':visible');
        next = focusable.eq(focusable.index(this)+1);
		
        if (next.length) {
            next.focus();
        } else {
            form.submit();
			
        }
        return false;
    }
	
 
	
	
});
	
  });


  
  
 


</script>

  
  
						
					
		 

  
  <nav class="layout-navbar navbar navbar-expand-xl align-items-center bg-navbar-theme" id="layout-navbar">
    <div class="container-fluid">
      

      
      

      
      
      <div class="layout-menu-toggle navbar-nav align-items-xl-center me-3 me-xl-0   d-xl-none ">
        <a class="nav-item nav-link px-0 me-xl-4" href="javascript:void(0)">
          <i class="bx bx-menu bx-sm"></i>
        </a>
      </div>
      

      <div class="navbar-nav-right d-flex align-items-center" id="navbar-collapse">

        
		
        <!-- Search -->
        <div class="navbar-nav align-items-center">
           
		   <?php if($_SESSION['login_as'] == 'advisor') {
			   
			    $advisor_id = $_SESSION['loan_crm_userid'];
			 
			   $selfadvisorQ  = mysqli_query($conn,"select *from `advisors` where id='$advisor_id'  ");
			   $selfadvisorData = mysqli_fetch_assoc($selfadvisorQ);
			    
		   
			   
			   $login_statusQ = mysqli_query($conn,"select *from `advisor_login_status` where advisor_id = $advisor_id order by id desc limit 1 ");
			     $loginStatusData = mysqli_fetch_assoc($login_statusQ);


			   ?> 
	
<script>


 function getLoginStatusType(login_status)
 {
	 
	   
	  $.ajax({
      type: "GET",
      url: 'get_login_status_type_select_ajax.php',
      data: ({login_status:login_status}),
      success: function(data) {
		
		 
			document.getElementById('login_status_type_section').innerHTML=data;
			  
		 }
		   

		  }
	   );
	 
	 
 }
 
 
 
 
 
 function getAutoDialType(login_status_type)
 {
	 
	 if(login_status_type == 'auto')
	 {
	    
	  $.ajax({
      type: "GET",
      url: 'get_auto_dial_type_select_ajax.php',
      data: ({login_status_type:login_status_type}),
      success: function(data) {
		
		 
			document.getElementById('auto_dial_type_section').innerHTML=data;
			  
		 }
		   

		  }
	   );
	   
	 }
	 else
	  {
		  
		
	  document.getElementById('auto_dial_type_section').innerHTML='';
			  
			 
	  }
	 
	 
 }
 
 
 
 
 
 
 


</script>


<script>


 function saveLoginStatus()
 {
	 
	 if(confirm('Are you sure?'))
	 {
		 
		 var login_status = document.getElementById('login_status').value;
		 var login_status_type = document.getElementById('login_status_type').value;
		 
		 var auto_dial_type = '';
		 
		 if(document.getElementById('auto_dial_type'))
		 {
			 auto_dial_type = document.getElementById('auto_dial_type').value;
		 }
		 
		 
	   
	  $.ajax({
      type: "POST",
      url: 'save_login_status_ajax.php',
      data: ({login_status:login_status,login_status_type:login_status_type,auto_dial_type:auto_dial_type}),
      success: function(data) {
		  
		  toastr.success(data);
		  
		  window.location='';
		
		    
		 }
		   

		  }
	   );
	   
	 }
	 
	 
 }


</script>



	<script>
	
	function freeFromCall()
	{
		
		if(confirm('Are you sure?'))
		{
			 	   
	  $.ajax({
      type: "POST",
      url: 'free_from_call_ajax.php',
      data: ({id:0}),
      success: function(data) {
		  
		  toastr.success(data);
		   
		 }
		   

		  }
	   );
			
		}
		
	}
	
	
	
	
	function pauseFromCall(obj)
	{
		
		if(confirm('Are you sure?'))
		{
			
		
			
			 	   
	  $.ajax({
      type: "POST",
      url: 'pause_from_call_ajax.php',
      data: ({id:0}),
      success: function(data) {
		  
		  if(data.trim() == '1')
		  {
		  
		  $('.pause_button').html('Paused | Start Now');
		  
		  toastr.success("You have paused on call");
		  }
		  else
		  {
			    $('.pause_button').html('Pause');
		 
		  
		     toastr.success("You have started on call");
		  }
		  
		  
		  
		   
		 }
		   

		  }
	   );
			
		}
		
	}
	
	
	
	
	


	</script>




	
		    
		   <div style="    margin: 5px;" >
		   <select   onchange="getLoginStatusType(this.value);"  class="form-select form-select-sm" id="login_status" name="login_status" >
		   <option <?php if($loginStatusData['login_status'] == 'logged_in') { echo "selected";  } ?> value="logged_in">Logged In</option>
		   <option <?php if($loginStatusData['login_status'] == 'break') { echo "selected";  } ?>  value="break">Break</option>
		   </select>
		  </div> 
		  
		  
		   
		   <div id="login_status_type_section" style="    margin: 5px;" >
		  <select  onchange="getAutoDialType(this.value);"  class="form-select form-select-sm" id="login_status_type" name="login_status_type" >
		  
		  <?php if($loginStatusData['login_status'] == 'logged_in') {  ?>
		  
		   <option <?php if($loginStatusData['login_status_type'] == 'manual') { echo "selected";  } ?> value="manual">Manual</option>
		   <option <?php if($loginStatusData['login_status_type'] == 'auto') { echo "selected";  } ?>  value="auto">Auto Dial</option>
		   <option <?php if($loginStatusData['login_status_type'] == 'tracing') { echo "selected";  } ?>  value="tracing">Tracing</option>
		
    		<?php } ?>
			
			
		   <?php if($loginStatusData['login_status'] == 'break') {  ?>
		  
		   <option <?php if($loginStatusData['login_status_type'] == 'lunch') { echo "selected";  } ?> value="lunch">Lunch Break</option>
		   <option <?php if($loginStatusData['login_status_type'] == 'tea') { echo "selected";  } ?>  value="tea">Tea Break</option>
		   <option <?php if($loginStatusData['login_status_type'] == 'washroom') { echo "selected";  } ?>  value="washroom">Wash Room</option>
		   <option <?php if($loginStatusData['login_status_type'] == 'training') { echo "selected";  } ?>  value="training">Training</option>
		
    		<?php } ?>
			 
		   
		   </select>
		     </div>
			 
			
			
		  <div id="auto_dial_type_section" style="    margin: 5px;" >
		  <?php if($loginStatusData['login_status_type'] == 'auto') {
			  ?>
		  <select class="form-select form-select-sm" id="auto_dial_type" name="auto_dial_type" >
		  
		  <?php 
		  
		  $auto_dial_type_ids = $selfadvisorData['auto_dial_type_ids'];
  
			$audQ = mysqli_query($conn,"select *from `auto_dial_type` where id in ($auto_dial_type_ids) ");
			
			while($audData = mysqli_fetch_assoc($audQ))
			{
  
			?>
  
		  
		  
		  <option <?php if($loginStatusData['auto_dial_type'] == $audData['name']) { echo "selected";  } ?> value="<?php echo $audData['name']; ?>"><?php echo ucfirst(str_replace('_',' ',$audData['name'])); ?></option>
		  
			<?php } ?>
		  
		  
		   </select>
		  <?php } ?>
		     </div>
		


			
			 <div style="    margin: 5px;" >
			 <button onclick="saveLoginStatus();" style="    margin: 5px;" class="btn btn-sm btn-primary">Submit</button>
			
 			<a onclick="freeFromCall();" style=" color:white;   margin: 5px;" class="btn btn-sm btn-warning">Free</a>
			
 			<a onclick="pauseFromCall(this);"   style=" color:white;   margin: 5px;" class="btn btn-sm btn-danger pause_button"><?php    if($selfadvisorData['is_paused'] == 'on') { echo "Paused | Start Now"; } else { echo "Pause"; } ?></a>
			
		    </div>
		   
		    <?php if($loginStatusData['login_status'] == 'break') { ?>

		   <label class="btn btn-info" style="    font-size: 30px;
    background: black;
    font-weight: bold;"	id="timer_count"></label> <?php } ?>
	
	
	
	
	
	
	
	
	
 <?php if($loginStatusData['login_status'] == 'break') {

       $current_time = time();
	   
	   $break_time =  strtotime($loginStatusData['date_time']);
	   
	   $duration_time = $current_time - $break_time;
    

	 ?>	
	<script type="text/javascript">
    var millis = <?php echo $duration_time*1000; ?>;
	
    function displaytimer(){
        var hours = Math.floor(millis / 36e5),
            mins = Math.floor((millis % 36e5) / 6e4),
            secs = Math.floor((millis % 6e4) / 1000);
            //Here, the DOM that the timer will appear using jQuery
            $('#timer_count').html(hours+':'+mins+':'+secs);  
    }

    setInterval(function(){
        millis += 1000;
        displaytimer();
    }, 1000);

</script>
	
	
 <?php } ?>
	

<style>
 <?php if($loginStatusData['login_status'] == 'break') {  ?>
	
 .content-wrapper
 {
	 display:none;
 }	 
		  
 <?php } ?>

</style>	


	
		   	<?php } ?>
			
			
        </div>
	


 
 
 
 
 
  
	
        <!-- /Search -->
        

        <ul class="navbar-nav flex-row align-items-center ms-auto">
          
		
	 <li class="nav-item dropdown-notifications navbar-dropdown dropdown me-3 me-xl-2">
		  
		  	
	  <a target="_BLANK" class="btn btn-info" href="save_admin_dashboard.php">Refresh Dashboard</a>
	   <?php if($_SESSION['login_as']=='admin') { ?> 
		 
	  <a target="_BLANK"  class="btn btn-warning"  href="repeat_non_contact.php">Repeat Call</a>
	  	 <?php } ?>
	  </li>
	
	
       
		<?php if($_SESSION['login_as']=='advisor') { ?>
          <!-- Notification -->
          <li class="nav-item dropdown-notifications navbar-dropdown dropdown me-3 me-xl-2">
		  
            <a href="chat.php" class="nav-link dropdown-toggle hide-arrow" >
              <i class="fa fa-comment" style="font-size:24px;"></i>
              <span id="message_badge_1" style="display:none;"  class="badge bg-danger rounded-pill badge-notifications">0</span>
            </a>
            
          </li>
		<?php } ?>
          <!--/ Notification -->

          <!-- User -->
          <li class="nav-item navbar-dropdown dropdown-user dropdown">
            <a class="nav-link dropdown-toggle hide-arrow" href="javascript:void(0);" data-bs-toggle="dropdown">
              <div class="avatar avatar-online">
                <img src="../images/<?php echo $_SESSION['image']; ?>" alt class="rounded-circle">
              </div>
            </a>
            <ul class="dropdown-menu dropdown-menu-end">
              <li>
                <a class="dropdown-item" href="profile.php">
                  <div class="d-flex">
                    <div class="flex-shrink-0 me-3">
                      <div class="avatar avatar-online">
                        <img src="../images/<?php echo $_SESSION['image']; ?>" alt class="rounded-circle">
                      </div>
                    </div>
                    <div class="flex-grow-1">
                      <span class="fw-semibold d-block lh-1"><?php echo $_SESSION['login_name']; ?></span>
                      <small><?php echo $_SESSION['login_as']; ?></small>
                    </div>
                  </div>
                </a>
              </li>
              <li>
                <div class="dropdown-divider"></div>
              </li>
              <li>
                <a class="dropdown-item" href="profile.php">
                  <i class="bx bx-user me-2"></i>
                  <span class="align-middle">My Profile</span>
                </a>
              </li>
              
              <li>
                <a class="dropdown-item" href="logout.php"  >
                  <i class="bx bx-power-off me-2"></i>
                  <span class="align-middle">Log Out</span>
                </a>
              </li>
			  
			  
            </ul>
          </li>
          <!--/ User -->
          

        </ul>
      </div>

      
      <!-- Search Small Screens -->
      <div class="navbar-search-wrapper search-input-wrapper  d-none">
        <input type="text" class="form-control search-input container-fluid border-0" placeholder="Search..." aria-label="Search...">
        <i class="bx bx-x bx-sm search-toggler cursor-pointer"></i>
      </div>
      
      
    </div>
  </nav>
  

 <script>
 
 
 var current_account_holder_id = '';
 
 
 
 
 
 
 
 
 
 
 
  function getAccountHolderView(account_holder_id)
  {
	  
	  current_account_holder_id = account_holder_id;
	  
	  document.getElementById('account_holder_view_loader').style.display = 'block';
	  document.getElementById('account_holder_view_data_here').innerHTML = '';
	  
	  $.ajax({
      type: "GET",
      url: 'get_account_holder_view_ajax.php',
      data: ({account_holder_id:account_holder_id}),
      success: function(data) {
		
			 document.getElementById('account_holder_view_data_here').innerHTML=data;
			 document.getElementById('account_holder_view_loader').style.display = 'none';

			initSelect2();
  
  
			formUpdate();
			
			 
			
		 }
		  // <- this turns it into synchronous

		  }
	   );
	  
  }
 
 </script>
 
 
 <script>
 
 
  function getAccountHolderViewNextPrev(type)
  {
	  
	   
	  $.ajax({
      type: "GET",
      url: 'get_next_id_for_button.php',
      data: ({current_account_holder_id:current_account_holder_id,type:type}),
      success: function(data) {
		  //alert(data);
		 getAccountHolderView(data.trim());
			
		 }
		  // <- this turns it into synchronous

		  }
	   );
  }
 
 </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 <script>
 
  function getLeadInfo(account_id)
  {
	  
 	  document.getElementById('lead_info_label').innerHTML = 'Account ID:'+account_id;
 	  document.getElementById('lead_info_data_here').innerHTML = '';
	  
	  $.ajax({
      type: "GET",
      url: 'get_lead_info_ajax.php',
      data: ({account_id:account_id}),
      success: function(data) {
		
			document.getElementById('lead_info_data_here').innerHTML=data;
			 
			
		 }
		  // <- this turns it into synchronous

		  }
	   );
	  
  }
 
 </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 <script>
 
 function showUpdateForm(call_type)
 {
	 if(call_type == 'manual')
	 {

	 
	     $.ajax({
      type: "GET",
      url: 'generate_uniqueid_ajax.php',
      data: ({id:1}),
      success: function(data) {
		  
		  
		  document.getElementById('uniqueid').value = data.trim();
		
		  
	 document.getElementById('update_form_section').style.display = 'block';
	 
	 
	 document.getElementById('disposition_select_section').innerHTML = '';	 
	 document.getElementById('sub_disposition_select_section').innerHTML = '';	 
	 document.getElementById('date_amount_payment_section').innerHTML = '';	 
	 document.getElementById('rfd_select_section').style.display = 'none';	 
	 document.getElementById('remark_section').style.display = 'none';	 
	 
	 
	    $('#attempt_status').val('');
	    $('#attempt_status').val('').trigger("change");

		 $('#attempt_type').val('');
	     $('#attempt_type').val('').trigger("change");
			
		 }
		   

		  }
	   );
	   
	   
	   
	 }
	 
	 else
	 {
		 
		 		  
	 document.getElementById('update_form_section').style.display = 'block';
	 
	 
	 document.getElementById('disposition_select_section').innerHTML = '';	 
	 document.getElementById('sub_disposition_select_section').innerHTML = '';	 
	 document.getElementById('date_amount_payment_section').innerHTML = '';	 
	 document.getElementById('rfd_select_section').style.display = 'none';	 
	 document.getElementById('remark_section').style.display = 'none';	 
	 
	 
	    $('#attempt_status').val('');
	    $('#attempt_status').val('').trigger("change");

		 $('#attempt_type').val('');
	     $('#attempt_type').val('').trigger("change");
		 
		 
	 }
	   
	 
	

	 
 }
 
 </script>
 
 
 
 <script>
 
 
   function addNewPhone()
   {
	   document.getElementById('add_new_phone_section').style.display = 'block';
	   document.getElementById('update_form_section').style.display = 'none';
	   document.getElementById('phone_number_section').style.display = 'none';
	  
   }
   
   
   function resetAddNew()
   {
	   
	    document.getElementById('add_new_phone_section').style.display = 'none';
 	   document.getElementById('phone_number_section').style.display = 'flex';
	   
   }
   
   
   
   
   
   function saveNewPhone(obj,account_holder_id)
   {
	   
     var phone = document.getElementById('phone').value;
     var phone_label = document.getElementById('phone_label').value;
	       
	 if(phone.trim() == '')
	 {
		 
		 toastr.warning('Please enter phone');
		 return false;
	 }
	 
	 
       obj.disabled = true;


	    $.ajax({
      type: "GET",
      url: 'save_new_phone_ajax.php',
      data: ({phone:phone,account_holder_id:account_holder_id,phone_label:phone_label}),
      success: function(data) {
		
		
		    toastr.success(data);
			 obj.disabled = false;
		  
			getAccountHolderView(account_holder_id);
			 
			
		 }
		   

		  }
	   );
	   
	   
   }
   
   
 
 </script>
 
 
 
 
 <script>
 
  function retainClick()
  {
	  if(document.getElementById('retain_remark').style.display == 'none')
	  {
		  document.getElementById('retain_remark').style.display = 'block';
		  document.getElementById('retain_submit').style.display = 'block';
	  }
	  else
	  {
		   document.getElementById('retain_remark').style.display = 'none';
		  document.getElementById('retain_submit').style.display = 'none';
	  }
	  
	  
  }
 
 </script>
 
 
 
 <script>
 
 function saveRetain(obj,account_holder_id)
 {
	 if(confirm('Are you sure?'))
	 {
	 
	 var retained = 'no';
    var retain_remark = document.getElementById('retain_remark').value;
	       
	 
	 
		if(document.getElementById('retained').checked)
		{
			retained = 'yes';
			
	 if(retain_remark.trim() == '')
	 {
		 
		 toastr.warning('Please enter retain remark');
		 return false;
	 }
	 
	 
	 
		}
	 
	
	 
       obj.disabled = true;


	    $.ajax({
      type: "POST",
      url: 'save_retain_ajax.php',
      data: ({retained:retained,retain_remark:retain_remark,account_holder_id:account_holder_id}),
      success: function(data) {
		
		
		    toastr.success(data);
			 obj.disabled = false;
		  
			getAccountHolderView(account_holder_id);
			 
			
		 }
		   

		  }
	   );
	  
	  
	  
	 }
	 
 }
 
 </script>
 
 
 
 
 
 
 
 
 
 
  
 <script>
 
  function paymentClick()
  {
	  if(document.getElementById('payment_account_id').style.display == 'none')
	  {
		  document.getElementById('payment_account_id').style.display = 'block';
		  document.getElementById('payment_amount').style.display = 'block';
		  document.getElementById('payment_submit').style.display = 'block';
	  }
	  else
	  {
		   document.getElementById('payment_account_id').style.display = 'none';
		  document.getElementById('payment_amount').style.display = 'none';
		  document.getElementById('payment_submit').style.display = 'none';
	  }
	  
	  
  }
 
 </script>
 
 
 
 <script>
 
 function savePayment(obj,account_holder_id)
 {
	 if(confirm('Are you sure?'))
	 {
	 
	 
    var payment_account_id = document.getElementById('payment_account_id').value;
    var payment_amount = document.getElementById('payment_amount').value;
            
	 if(payment_account_id.trim() == '')
	 {
		 
		 toastr.warning('Please Enter Loan/Account id');
		 return false;
	 }
	 
	  if(payment_amount.trim() == '')
	 {
		 
		 toastr.warning('Please Enter Amount');
		 return false;
	 }
	 
	 
	 
       obj.disabled = true;


	    $.ajax({
      type: "POST",
      url: 'save_payment_loan_ajax.php',
      data: ({payment_account_id:payment_account_id,payment_amount:payment_amount,account_holder_id:account_holder_id}),
      success: function(data) {
		
		
		    toastr.success(data);
			 obj.disabled = false;
		  
			getAccountHolderView(account_holder_id);
			 
			
		 }
		   

		  }
	   );
	  
	  
	  
	 }
	 
 }
 
 </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 <script>
 
  function paymentClickC()
  {
	  if(document.getElementById('c_payment_account_id').style.display == 'none')
	  {
		  document.getElementById('c_payment_account_id').style.display = 'block';
		  document.getElementById('c_payment_amount').style.display = 'block';
		  document.getElementById('commitment_submit').style.display = 'block';
	  }
	  else
	  {
		   document.getElementById('c_payment_account_id').style.display = 'none';
		  document.getElementById('c_payment_amount').style.display = 'none';
		  document.getElementById('commitment_submit').style.display = 'none';
	  }
	  
	  
  }
 
 </script>
 
 
 
 <script>
 
 function saveCommitment(obj,account_holder_id)
 {
	 if(confirm('Are you sure?'))
	 {
	 
	 
    var payment_account_id = document.getElementById('c_payment_account_id').value;
    var payment_amount = document.getElementById('c_payment_amount').value;
            
	 if(payment_account_id.trim() == '')
	 {
		 
		 toastr.warning('Please Enter Loan/Account id');
		 return false;
	 }
	 
	  if(payment_amount.trim() == '')
	 {
		 
		 toastr.warning('Please Enter Amount');
		 return false;
	 }
	 
	 
	 
       obj.disabled = true;


	    $.ajax({
      type: "POST",
      url: 'save_commitment_loan_ajax.php',
      data: ({payment_account_id:payment_account_id,payment_amount:payment_amount,account_holder_id:account_holder_id}),
      success: function(data) {
		
		
		    toastr.success(data);
			 obj.disabled = false;
		  
			getAccountHolderView(account_holder_id);
			 
			
		 }
		   

		  }
	   );
	  
	  
	  
	 }
	 
 }
 
 </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 <script>
 
  
   function removeWrongNumber(obj,account_holder_id,phone_no)
   {
	    if(confirm('Are you sure?'))
	 {
	 

	    $.ajax({
      type: "GET",
      url: 'remove_wrong_number_tag_ajax.php',
      data: ({phone_no:phone_no,account_holder_id:account_holder_id}),
      success: function(data) {
		
		
		    toastr.success(data);
		  getAccountHolderView(account_holder_id);
			 
			
		 }
		   

		  }
	   );
	   
	 }
	   
	   
   }
   
 
 
 </script>
 
 
 
 
 
 
 
 
 
 
 
  
 <script>
 
  
   function showAllUpdates(obj,account_holder_id,type,page_start)
   { 
     
	  obj.disabled = true;
	  
	 document.getElementById('show_all_updates_here').innerHTML = 'Loading...';
		 
	    $.ajax({
      type: "GET",
      url: 'get_show_all_updates_ajax.php',
      data: ({account_holder_id:account_holder_id,type:type,page_start:page_start}),
      success: function(data) {
		 
	    document.getElementById('show_all_updates_here').innerHTML = data;
		// $('#show_all_updates_here').append(data);
			 
			 
		 obj.disabled = false;
	 
	 
			
		 }
		   

		  }
	   );
	 
	   
   }
   
   
   
   
    function loadMoreUpdates(obj,account_holder_id,type,page_start)
   { 
     
	  obj.innerHTML = 'Loading...';
	    
		
	    $.ajax({
      type: "GET",
      url: 'get_show_all_updates_ajax.php',
      data: ({account_holder_id:account_holder_id,type:type,page_start:page_start,hidetotal:'1'}),
      success: function(data) {
		 
	     $('#show_all_updates_here').append(data);
			 
			 
		 obj.innerHTML = 'Loaded.';
	 
	 
			
		 }
		   

		  }
	   );
	 
	   
   }
   
 
 
 
 
 </script>
 
 
 
 
 
 
 
 
 
 
 
  <script>
  
  
  function saveUpdate(obj,account_holder_id)
  {
	 
	  
	  
  }
  
  </script>
 
 
 
 
   <script>
   
   function callInit(obj)
   {
	   
	   if(confirm('Are you sure?'))
	   {
		   
	  
	    var mobile =  $('input[name=mobile]:checked').val();
		var account_holder_id = document.getElementById('account_holder_id').value;
		var uniqueid = document.getElementById('uniqueid').value;
		
		
		obj.disabled = true;
		
		
		  $.ajax({
      type: "GET",
      url: 'save_call_init_ajax.php',
      data: ({mobile:mobile,account_holder_id:account_holder_id,uniqueid:uniqueid}),
      success: function(data) {
		
		
		     toastr.success(data);
			 
			 obj.disabled = false;
			  
			
		 }
		   

		  }
	   );
		
		
		
	 
	   }

   }
   
   
   </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 <script>
 
 function getDispositionSelect(view_type)
 {
	 
	 var attempt_status = document.getElementById('attempt_status').value;
	  
	  if(attempt_status=='')
	  {
		  return false;
	  }
 	  
	  var disposition = '';
	  
	  if(view_type == 'sub_disposition')
	  {
		  disposition = document.getElementById('disposition').value;
	  }
	  
	  
	  
	  $.ajax({
      type: "GET",
      url: 'get_disposition_select_ajax.php',
      data: ({attempt_status:attempt_status,view_type:view_type,disposition:disposition}),
      success: function(data) {
		
			document.getElementById(view_type+'_select_section').innerHTML=data;
			
			if(view_type=='sub_disposition')
			{
				document.getElementById(view_type+'_select_section').style.display='block';
				document.getElementById('rfd_select_section').style.display='block';
				document.getElementById('remark_section').style.display='block';
			}
			
			
			  initSelect2();
  
			
			 
			
		 }
		   

		  }
	   );
 }
 
 </script>
 
 
 <script>
 
 function getDateAmountSection()
 {
	  var attempt_status = document.getElementById('attempt_status').value;
	  
 	   var disposition = document.getElementById('disposition').value;
	 
	
	  
	  $.ajax({
      type: "GET",
      url: 'get_date_amount_payment_section_ajax.php',
      data: ({attempt_status:attempt_status,disposition:disposition}),
      success: function(data) {
		
		 
			document.getElementById('date_amount_payment_section').innerHTML=data;
			 
			 initSelect2();
	
			 
			
		 }
		   

		  }
	   );
 }
 </script>
 
 
 <script>
 
 function initSelect2()
 {
	 		 
			  const select2 = $('.select2');

			  // Select2 Country
			  if (select2.length) {
				select2.each(function () {
				  var $this = $(this);
				  $this.wrap('<div class="position-relative"></div>').select2({
					dropdownParent: $this.parent()
				  });
				});
			  }
  
  
			
 }
 </script>
 
 
 
 
 
 		
	<script>
	
	function calSettlement()
	{
		
		
		var settlement_percentage = document.getElementById('settlement_percentage').value;
		var tos_amount = document.getElementById('tos_amount').value;
		
		 
		var settlement_amount = 0;
		
		settlement_amount =  parseFloat(tos_amount)  - (parseFloat(tos_amount) * (parseFloat(settlement_percentage) / 100));
		
		
		document.getElementById('settlement_amount').value = settlement_amount.toFixed(0);
		
		calEMI();
		
		
		
		// row wise breakup
		
		$(".settlement_percentage_").each(function(){
			
			//alert($(this).attr('id'));
			var id = $(this).attr('id');
			var row_id = id.replace('settlement_percentage_','');
			
			 $('#settlement_percentage_'+row_id).val(settlement_percentage);
			 
			 calSettlementRow(row_id);
			
			
		});
		
		
		
		
		
		
	}
	
	
	
	
		function calSettlementRow(row_id)
	{
		
		
		var settlement_percentage = document.getElementById('settlement_percentage_'+row_id).value;
		var tos_amount = document.getElementById('tos_amount_'+row_id).value;
		
		
		var settlement_amount = 0;
		
		settlement_amount =  parseFloat(tos_amount)  - (parseFloat(tos_amount) * (parseFloat(settlement_percentage) / 100));
		
		
		document.getElementById('settlement_amount_'+row_id).value = settlement_amount.toFixed(0);
		
		calEMIRow(row_id);
	}

	</script>	
		
		
		
   <script>
   
   function calEMI()
   {
	   var settlement_no_of_emi =  document.getElementById('settlement_no_of_emi').value;
	   var settlement_amount =  document.getElementById('settlement_amount').value;
	   
	   if(settlement_no_of_emi!='')
	   {
	   
	     $.ajax({
      type: "GET",
      url: 'get_emi_cal_ajax.php',
      data: ({settlement_no_of_emi:settlement_no_of_emi,settlement_amount:settlement_amount,view_type:'horizontal'}),
      success: function(data) {
		
		 document.getElementById('emi_details_here').innerHTML = data;
			
			
		 }
		  

		  }
	   );
	   
	   
	   // Breaku emi calculate
	   $(".settlement_no_of_emi_").each(function(){
			
			//alert($(this).attr('id'));
			var id = $(this).attr('id');
			var row_id = id.replace('settlement_no_of_emi_','');
			
			 $('#settlement_no_of_emi_'+row_id).val(settlement_no_of_emi);
			 
			$('#settlement_no_of_emi_'+row_id).val(settlement_no_of_emi).trigger("change");

			 
			 calEMIRow(row_id);
			
			
		});
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   }
	   else
	   {
		 document.getElementById('emi_details_here').innerHTML = '';
			  
	   }
	   
	   
	   
	   
   }
   
   
    
   function calEMIRow(row_id)
   {
	   var settlement_no_of_emi =  document.getElementById('settlement_no_of_emi_'+row_id).value;
	   var settlement_amount =  document.getElementById('settlement_amount_'+row_id).value;
	   
	   if(settlement_no_of_emi!='')
	   {
	   
	     $.ajax({
      type: "GET",
      url: 'get_emi_cal_ajax.php',
      data: ({settlement_no_of_emi:settlement_no_of_emi,settlement_amount:settlement_amount,view_type:'vertical'}),
      success: function(data) {
		
		 document.getElementById('emi_details_here_'+row_id).innerHTML = data;
			
			
		 }
		  

		  }
	   );
	   
	  
	    }
	   else
	   {
		 document.getElementById('emi_details_here_'+row_id).innerHTML = '';
			  
	   }
	   
	   
	   
	   
   }
   
   
   </script>
 
 
 
 
 
 
 
 
 
 
 



   <!-- horizontal slider modal -->
        <div class="modal-onboarding modal fade animate__animated" id="viewModal" tabindex="-1" aria-hidden="true">
          <div class="modal-dialog modal-xl" role="document">
            <div class="modal-content text-center">
              <div class="modal-header">
                 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
                </button>
              </div>
			   
			   
			   <!-- modal content here -->
			   
			   
                  </div>
          </div>
        </div>
        <!--/ horizontal slider modal -->





			<div class="modal fade" id="accountHolderView" tabindex="-1" aria-hidden="true">
            <div class="modal-dialog modal-fullscreen" role="document">
              <div class="modal-content">
                <div class="modal-header">
				
				<?php if($_SESSION['login_as'] == 'advisor') {   ?>
                 <a onclick="pauseFromCall(this);"   style=" color:white;   margin: 5px;" class="btn btn-sm btn-danger pause_button"><?php if($selfadvisorData['is_paused'] == 'on') { echo "Paused | Start Now"; } else { echo "Pause"; } ?></a>
				 
				 <a onclick="freeFromCall();" style=" color:white;   margin: 5px;" class="btn btn-sm btn-warning">Free</a>
			
			
				<?php } ?>
				
				
                   <button type="button" class="btn-close" data-bs-dismiss="modal"  data-bs-toggle="modal" data-bs-target="#dashboardBreakupModal"  aria-label="Close"></button>
                </div>
                <div class="modal-body">
                 
				 <center>
				<div id="account_holder_view_loader" style="display:none;" class="spinner-border spinner-border-lg text-primary" role="status">
				<span class="visually-hidden">Loading...</span>
				</div>
				  </center>
				
			    <div id="account_holder_view_data_here"></div>
			  
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#dashboardBreakupModal" >Close</button>
               
				  <button type="button" class="btn btn-warning"  onclick="getAccountHolderViewNextPrev('next');"  >Next ></button>
				  <button type="button" class="btn btn-danger"  onclick="getAccountHolderViewNextPrev('prev');"  >< Prev </button>
                </div>
              </div>
            </div>
          </div>
		  
		  
		  
		  
		 
		  
		  
		  
		  <!-- Send Invoice Sidebar -->
				<div style="width:500px;" class="offcanvas offcanvas-start" id="offcanvasLeadInfo" aria-hidden="true">
				  <div class="offcanvas-header border-bottom">
					<h5 id="lead_info_label" class="offcanvas-title"></h5>
					<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
				  </div>
				  <div class="offcanvas-body flex-grow-1">

				 <div id="lead_info_data_here" ></div>
							  
							  
				   </div>
				</div>
				<!-- /Send Invoice Sidebar -->
		  
		  
		  
		  
		  
		  
		   
		  
		  
			
<script>
	 
				 function formUpdate(){
					 
					 
					 
					 
$('#update_form').submit(function() {
	
	 $(':button[type="submit"]').prop('disabled', true);
	var form=$("#update_form");
 
    var vcfData = new FormData($('#update_form')[0]); 
	
	//alert(rem);
	 //alert("hello");
        $.ajax({ 
            
            type:"post",
            url:"save_update_ajax.php",
			data:vcfData,
			 contentType: false,
            cache: false,
            processData:false,
            success: function(data) {
				//alert(data);
           		 
				 toastr.success('Update added successfully!');
				 
				 getAccountHolderView(data.trim());
			
			   
            }
        });
        return false; 
    });
				 }
		 
</script>	







   
 	<script>
	
	
	(function worker() {
		
		
		
		
		
  $.get('get_new_cdr_ajax.php' , function(data) {
	  
	
    // Now that we've completed the request schedule the next one.
	if (!$.trim(data)){   
     //alert("What follows is blank: " + data);
}
else{   


   if(data!='0')
   {
	   
	  
      Swal.fire({
        icon: 'info',
        html: data,
        showCloseButton: true,
        showCancelButton: false,
        focusConfirm: false,
        confirmButtonText: '<i class="fa fa-thumbs-up"></i> Ok!',
        confirmButtonAriaLabel: 'Thumbs up, OK!',
        cancelButtonText: '<i class="fa fa-thumbs-down"></i>',
        cancelButtonAriaLabel: 'Thumbs down',
        customClass: {
          confirmButton: 'btn btn-primary me-3',
          cancelButton: 'btn btn-label-secondary'
        },
        buttonsStyling: false
      });
 
	
	
	 //swal(data);
	 
     //document.getElementById('new_ticket_section').innerHTML=data;
   
   
    // setTimeout(function(){ $("#alert_popup_button").click();}, 200);
 
   
   }
   
    //    alert(data);
	
	   
}
	
 setTimeout(worker, 4000);
	
	
	
  });
  
  
  
  
})();
	
	
	
	</script>
	
		
	<button  	data-bs-toggle="modal" data-bs-target="#newTicketModal"   style="display:none;" id="alert_popup_button" class="btn btn-primary">notification</button>
	
			  <!-- Modal -->
  <div class="modal fade" id="newTicketModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
	  
	  <div class="modal-header">
	  <button type="button" class="btn-close" data-bs-dismiss="modal"    aria-label="Close"></button>
	  
      
      </div>
	  
        
        <div class="modal-body">
         <div id="new_ticket_section"></div>
		  
		  
        </div>
        <div class="modal-footer">
         <button data-bs-dismiss="modal"  class="btn btn-primary">OK</button>
        </div>
      </div>
      
    </div>
  </div>
  
  
  
  
  
  
  
  
  
  <?php if($_SESSION['login_as'] == 'advisor') { ?>
  
   
 	<script>
	
	
	(function worker() {
		
	
		
  $.get('auto_call_init.php' , function(data) {
	  
	
    // Now that we've completed the request schedule the next one.
	if (!$.trim(data)){   
     //alert("What follows is blank: " + data);
}
else{   
 // alert(data);

   if(data!='0')
   {
	   
       
	   
	    var info = JSON.parse(data);
	   
	   
	   if($('#accountHolderView:visible').length == 0)
		{
	     document.getElementById('modal_view_button').click();
		}
		 
	     getAccountHolderView(info.account_holder_id);
		 
		 
		   setTimeout(function(){

			   $("#mobile_"+info.mobile).prop('checked', true);
		   
		       document.getElementById('uniqueid').value=info.uniqueid;
			   
			   showUpdateForm('auto');
 

		   }, 2500);

	   
	    
	   
	   
	  
	 
      Swal.fire({
        icon: 'info',
        title: 'Call Inititated - Call Type:'+info.call_type_label+' | Customer:'+info.customer_name+' , Phone: '+info.mobile,
        showCloseButton: true,
        showCancelButton: false,
        focusConfirm: false,
        confirmButtonText: '<i class="fa fa-thumbs-up"></i> Ok!',
        confirmButtonAriaLabel: 'Thumbs up, OK!',
        cancelButtonText: '<i class="fa fa-thumbs-down"></i>',
        cancelButtonAriaLabel: 'Thumbs down',
        customClass: {
          confirmButton: 'btn btn-primary me-3',
          cancelButton: 'btn btn-label-secondary'
        },
        buttonsStyling: false
      });
	  
	  
	 
 
	
	
	  
   }
    
}
	
 setTimeout(worker,18000);
	
	
	
  });
})();
	
	
	
	</script>
	
	 
<?php } ?>


<button style="display:none;" id="modal_view_button" data-bs-toggle="modal" data-bs-target="#accountHolderView" style="text-decoration:underline" >View Button</button>













<script>



 function selectAllLoan()
 {
	 
	 if($("input:checkbox[name=loan_ids_checkbox]").prop('checked') == true)
	 {
		  $("input:checkbox[name=loan_ids_checkbox]").prop('checked', false);
	 }
	 
	 else{
	 $("input:checkbox[name=loan_ids_checkbox]").prop('checked', true);
	 }
 }


</script>	




<script>


	function settlementView(type,account_holder_id)
	{
		
		   var loanArr = [];
		   
		 $("input:checkbox[name=loan_ids_checkbox]:checked").each(function(){
         loanArr.push($(this).val());
           });
		 
		 
		  var loanjsonString = JSON.stringify(loanArr);
		  
		  if(loanArr.length == 0)
		  {
			   toastr.warning("Please Select Loan Ids!"); 
			  return false;
		  }
		  
		  
		  document.getElementById('settlement_popup_button').click();
		  
		  
		  
		  	  
 	  document.getElementById('settlement_info_label').innerHTML = type.toUpperCase()+' : '+account_holder_id;
 	  document.getElementById('settlement_info_data_here').innerHTML = '';
	  
	  $.ajax({
      type: "GET",
      url: 'get_settlement_info_ajax.php',
      data: ({type:type,account_holder_id:account_holder_id,loan_ids:loanjsonString}),
      success: function(data) {
		
	   document.getElementById('settlement_info_data_here').innerHTML=data;
	   
	   
	   
			initSelect2();
  
  
			formSettlement();
			
			
			
			 
			
		 }
		  // <- this turns it into synchronous

		  }
	   );
		  

		
		
	}

</script>




 <button id="settlement_popup_button" href="#" style="display:none;"  data-bs-toggle="offcanvas" data-bs-target="#offcanvasSettleInfo" ></button>
 
 
 
 
   <!-- Send Info Sidebar -->
				<div style="width:550px;" class="offcanvas offcanvas-end" id="offcanvasSettleInfo" aria-hidden="true">
				  <div class="offcanvas-header border-bottom">
					<h5 id="settlement_info_label" class="offcanvas-title"></h5>
					<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
				  </div>
				  <div class="offcanvas-body flex-grow-1">

				 <div id="settlement_info_data_here" ></div>
							  
							  
				   </div>
				</div>
				<!-- /Send Info Sidebar -->
				

 <script>
 
 function getMaxPer(type)
 {
	 var select_emi_no =  document.getElementById('select_emi_no').value; 
	 
	  $.ajax({
      type: "GET",
      url: 'get_max_per_ajax.php',
      data: ({select_emi_no:select_emi_no}),
      success: function(data) {
		
		var info = JSON.parse(data);
		document.getElementById('dis_per').value = info.max_per;
		
		if(type == 'Waiver')
		{
			document.getElementById('dis_per').value = 0;
			document.getElementById('dis_per').readOnly  = true; 
		}
		
		
			calDisPer();
			
		 }
		  

		  }
	   );
	   
 }
 
 </script>
 
 
 
 <script>
 
  function calDisPer()
  {
	  var sett_amount = 0;
	 
	  var dis_per  = document.getElementById('dis_per').value;
	  var max_per  = document.getElementById('max_per').value;
	  
	   
	  if(dis_per == '')
	  {
		  dis_per = 0;
	  }
	  
	  
	   
	  if(parseFloat(max_per) < parseFloat(dis_per))
	  {
		 document.getElementById('dis_per').value = max_per;
		 dis_per = max_per;
		 
		 Swal.fire({
        icon: 'info',
		 title:'Sorry Max Percentage for this DPD bucket is '+max_per 
		 });
		 
		  
	  }
	   
	  
	  
	  
	  
	  
	  
	  
	  
		
	  var consider_amount =  document.getElementById('consider_amount').value; 
	
	
	   sett_amount =  parseFloat(consider_amount)  - (parseFloat(consider_amount) * (parseFloat(dis_per) / 100));
		
		
	    document.getElementById('sett_amount').value = sett_amount.toFixed(0);
		
		calEMISettlement();
		
  }
 
 </script>
 
 <script>
 
  function calConsiderAmt()
  {
	  
	   
	   var total_principal = document.getElementById('total_principal').value;
	   
	   var selected_total = 0;
	   
	   
	    $("input:checkbox[name=waiver_select]:checked").each(function() {
			
			 current_type = $(this).val();
			 
			 
			 current_amt = document.getElementById(current_type).value;
			 
			 selected_total = selected_total + parseFloat(current_amt);
			  
			 
	    });
	   
	   
	   var consider_amount = parseFloat(total_principal) + parseFloat(selected_total);
	   
	   
	   document.getElementById('consider_amount').value  = consider_amount;
	   document.getElementById('sett_amount').value  = consider_amount;
	    
	   calDisPer();
	   
  }
 
 </script>
				
				
 <script>
 
 
    
   function calEMISettlement()
   {
	   var select_emi_no =  document.getElementById('select_emi_no').value;
	   var dis_per =  document.getElementById('dis_per').value;
	   var consider_amount =  document.getElementById('consider_amount').value;
	   var sett_amount =  document.getElementById('sett_amount').value;
	   var max_per =  document.getElementById('max_per').value;
	   var emi_type =  document.getElementById('emi_type').value;
	   var s_start_date =  document.getElementById('s_start_date').value;
	   
	   if(select_emi_no!='')
	   {
	    var myDate = new Date(s_start_date);
	    var newDate = new Date(myDate.setMonth(myDate.getMonth()+parseInt(select_emi_no)));
 
	    document.getElementById('s_end_date').value =  newDate.toISOString().substring(0,10);
	   }
	  
	  
        var per = (  (parseFloat(consider_amount) - parseFloat(sett_amount))  / parseFloat(consider_amount) ) *  100;
		
		/*
		if(parseFloat(max_per) < per)
		{
			per = parseFloat(max_per);
			document.getElementById('dis_per').value = per.toFixed(0);
			 
		}
		*/
		

		document.getElementById('dis_per').value = per.toFixed(0);
		
	 
	   
	   
	   
	   if(select_emi_no!='')
	   {
	   
	     $.ajax({
      type: "GET",
      url: 'get_settlement_emi_cal_ajax.php',
      data: ({select_emi_no:select_emi_no,sett_amount:sett_amount,emi_type:emi_type}),
      success: function(data) {
		
		 document.getElementById('settlemnt_emi_details_here').innerHTML = data;
			
			
		 }
		  

		  }
	   );
	   
	     
	   
	   
	   
	   
	   
	   }
	   else
	   {
		 document.getElementById('settlemnt_emi_details_here').innerHTML = '';
			  
	   }
	   
	   
	   
	   
   }
 
 
 
 </script>
 
 
 
 
 
 		  
			
<script>
	 
				 function formSettlement(){
					 
					 
					 
					 
$('#settlement_form').submit(function() {
	
	 $(':button[type="submit"]').prop('disabled', true);
	var form=$("#settlement_form");
 
    var vcfData = new FormData($('#settlement_form')[0]); 
	
	//alert(rem);
	 //alert("hello");
        $.ajax({ 
            
            type:"post",
            url:"save_settlement_ajax.php",
			data:vcfData,
			 contentType: false,
            cache: false,
            processData:false,
            success: function(data) {
				 //alert(data);
           		 
				 toastr.success('settlement saved successfully!');
				 
				 document.getElementById('settlement_popup_button').click();
				 
				 getAccountHolderView(data.trim());
			
			   
            }
        });
        return false; 
    });
				 }
		 
</script>	








	
<script>
	 
				 function formSendMessage(){
					 
					 
					 
					 
$('#send_message_form').submit(function() {
	
	 $(':button[type="submit"]').prop('disabled', true);
	var form=$("#send_message_form");
 
    var vcfData = new FormData($('#send_message_form')[0]); 
	
	//alert(rem);
	 //alert("hello");
        $.ajax({ 
            
            type:"post",
            url:"send_message_ajax.php",
			data:vcfData,
			 contentType: false,
            cache: false,
            processData:false,
            success: function(data) {
				 // alert(data);
           		 
				 toastr.success('Message sent successfully!');
				 
				 document.getElementById('send_message_popup_button').click();
				 
				 
			   
            }
        });
        return false; 
    });
				 }
		 
</script>	







 
<script>


	function sendMessageView(type,account_holder_id)
	{
		
		 
		  
		  document.getElementById('send_message_popup_button').click();
		  
		   
  	  document.getElementById('send_message_info_label').innerHTML = type;
  	  document.getElementById('send_message_info_data_here').innerHTML = '';
	  
	  $.ajax({
      type: "GET",
      url: 'get_send_message_info_ajax.php',
      data: ({type:type,account_holder_id:account_holder_id}),
      success: function(data) {
		  
	   document.getElementById('send_message_info_data_here').innerHTML=data;
	    
			initSelect2();
			
            formSendMessage();
			 
			 
			
		 }
		  // <- this turns it into synchronous

		  }
	   );
		  

		
		
	}

</script>



 <script>
 
  function markForwarDone(id)
  {
	  
	  if(confirm('Are you sure?'))
	  {
		  
	  
	    $.ajax({
      type: "GET",
      url: 'mark_forward_done_ajax.php',
      data: ({id:id}),
      success: function(data) {
			 
	 toastr.success(data);
	 window.location='';
				 
					
		 }
		  // <- this turns it into synchronous

		  }
	   );
	   
	  }
	  
  }
 
 </script>





<script>
	 
				 function formcase_forward(){
					 
					 
					 
					 
$('#case_forward_form').submit(function() {
	
	 $(':button[type="submit"]').prop('disabled', true);
	var form=$("#case_forward_form");
 
    var vcfData = new FormData($('#case_forward_form')[0]); 
	
	//alert(rem);
	 //alert("hello");
        $.ajax({ 
            
            type:"post",
            url:"save_case_forward_ajax.php",
			data:vcfData,
			 contentType: false,
            cache: false,
            processData:false,
            success: function(data) {
				 // alert(data);
           		 
				 toastr.success('Case Forwarded successfully!');
				 
				 document.getElementById('case_forward_popup_button').click();
				 
				 
			   
            }
        });
        return false; 
    });
				 }
		 
</script>	







 
<script>


	function sendCaseForwardView(type,account_holder_id)
	{
		
		 
		  
		  document.getElementById('case_forward_popup_button').click();
		  
		   
  	  document.getElementById('case_forward_info_label').innerHTML = type;
  	  document.getElementById('case_forward_info_data_here').innerHTML = '';
	  
	  $.ajax({
      type: "GET",
      url: 'get_case_forward_info_ajax.php',
      data: ({type:type,account_holder_id:account_holder_id}),
      success: function(data) {
		  
	   document.getElementById('case_forward_info_data_here').innerHTML=data;
	    
			initSelect2();
			
            formcase_forward();
			 
			 
			
		 }
		  // <- this turns it into synchronous

		  }
	   );
		  

		
		
	}

</script>





















<script>
	
	function generateStatement(account_holder_id)
	{
		 
	   $.ajax({
      url: 'generate_statement_ajax.php',
      type: "GET",
      data: ({account_holder_id:account_holder_id}),
      success: function(data) {
		  
 
		 }
		  // <- this turns it into synchronous

		  }
	   );
		
	}
	
	</script>
	



  
 <button id="send_message_popup_button" href="#" style="display:none;"  data-bs-toggle="offcanvas" data-bs-target="#offcanvasSendMessage" ></button>
 
 
 
 
   <!-- Send Info Sidebar -->
				<div  style="height:400px;z-index: +999999;"  class="offcanvas offcanvas-bottom" id="offcanvasSendMessage" aria-hidden="true">
				  <div class="offcanvas-header border-bottom">
				    <h5 id="send_message_info_label" class="offcanvas-title"></h5>
 					<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
				  </div>
				  <div class="offcanvas-body flex-grow-1">

				   <div id="send_message_info_data_here" ></div>
							  
							  
				   </div>
				</div>
				<!-- /Send Info Sidebar -->
				
				
				
				
				
  
 <button id="case_forward_popup_button" href="#" style="display:none;"  data-bs-toggle="offcanvas" data-bs-target="#offcanvascase_forward" ></button>
 
 
 
 
   <!-- Send Info Sidebar -->
				<div  style="height:400px;z-index: +999999;"  class="offcanvas offcanvas-bottom" id="offcanvascase_forward" aria-hidden="true">
				  <div class="offcanvas-header border-bottom">
				    <h5 id="case_forward_info_label" class="offcanvas-title"></h5>
 					<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
				  </div>
				  <div class="offcanvas-body flex-grow-1">

				   <div id="case_forward_info_data_here" ></div>
							  
							  
				   </div>
				</div>
				<!-- /Send Info Sidebar -->
				