<?php                        
	include_once("../view/header-footer/header.php");  
?>  
 
 <script>
 
            
  
                    function callDt(val,billerName)
                    {
                        
                             
                            resultDa = billerName.split("-");    
                            var lh;  
                            for(var i=0;i<resultDa.length;i++)
                            {    
                                lh +=resultDa[i]+" ";
                            } 
                            lh = lh.replace("undefined", "");
                            $("#NextOpt").val(lh); 
                            $('.loader').css('display','block');
                            $.ajax({	
                            type: "POST",
                            url: URL+"/recharges/recharge_api.php",
                            data: {userproviderBill:1,provider:val},
                            beforeSend: function(){ 
                            },
                            success: function(data)
                                {       
                                     $('.loader').css('display','none');
                                     $("#forCharge").hide();    
                                     var obj = jQuery.parseJSON(data);  
                                    $("#provider").val(val);     
                                    if(Array.isArray(obj)==0) 
                                    {  
                                        source_list = "<label class='form-label' >"+obj.paramName+"</label> <input type='hidden'  name='nm0' id='nm0' value='"+obj.paramName+"' />  <input type='text' class='form-control' name='val0' id='val0'  />  "; 
                                        $("#totalParas").val(1);
                                    }
                                    else
                                    {     
                                        source_list = '';
                                        for(i=0;i<obj.length;i++)	
                                        source_list += "<label class='form-label' >"+obj[i].paramName+"</label> <input type='hidden'  name='nm"+i+"' id='nm"+i+"' value='"+obj[i].paramName+"' />  <input type='text' class='form-control' name='val"+i+"'  id='val"+i+"'  />  ";    
                                        
                                        $("#totalParas").val(obj.length);
                                    }
                                   
                                     
                                     $("#NextOpt1").show(300);   
                                     $("#recharge_params1").html(source_list); 
                                     $("#submitNext").show(300);
                                    
                                     
                                }
                            });   
                    }

        $(document).ready(function()
        {        
            
             $(".PaySound").click(function()
                {
                    $('.loader').css('display','block');
                });
                
            var URL = "<?php echo ROOTPATH;?>";  
            $("#submitNext").hide();
            $("#BillAmt").hide();  
         
            $("#txnPin").hide();  
            $("#NextOpt1").hide();
              
              
                        
                            
                            $("#NextOpt").keyup(function()
                            {        
                                
                                    var Urlslug = "<?php echo $_REQUEST['Urlslug']?>"; 
                                    $.ajax({	
                                    type: "POST",
                                    url: URL+"/ajax/validation.php",
                                    data: {userproviderBillFetch_2:1,Urlslug:Urlslug,keyword:$("#NextOpt").val()},
                                    beforeSend: function(){ 
                                    },
                                    success: function(data)
                                    {     
                                        
                                          
                                         if($("#NextOpt").val()=='')
                                         { 
                                                $("#forCharge").html('');    
                                                $("#forCharge").hide();    
                                         }else {
                                            $("#forCharge").show();
                                            $("#forCharge").html(data);   
                                            
                                         }
                                    }
                                    });
                                    
                            });       
            
                    
                    $( "#submitNext" ).click(function() 
                    {      
                           
                         if($("#val0").val()!='') 
                         {
                               $('.loader').css('display','block');
                               Total = $("#totalParas").val(); 
                               strng1 = '';
                               strng2 = '';
                               
                                for(var i=0;i<Total;i++)
                                {    
                                    strng1 +=  $("#nm"+i).val()+",";
                                    strng2 +=  $("#val"+i).val()+","; 
                                }  
                               
                                $.ajax({	
                                type: "POST",
                                url: URL+"/recharges/recharge_api.php",
                                data: {userproviderBill_2:1,provider:$("#provider").val(),strng1:strng1,strng2:strng2,Total:Total},
                                beforeSend: function(){ 
                                },
                                success: function(data)
                                    {        
                                          $('.loader').css('display','none');
                                          var obj = jQuery.parseJSON(data);   
                                         source_list = "<label class='form-label' >Name</label>  <input type='text' class='form-control' name='cust_name'  value='"+obj.name+"' readonly  />   <label class='form-label' >Amount</label>  <input type='text' class='form-control'  name='famt' id='famt' value="+obj.amount+"  />   "; 
                                         
                                         
                                       
                                         $("#fref").val(obj.reference_id);
                                         $("#NextOpt2").show(300);    
                                         $("#recharge_params2").html(source_list); 
                                         $("#submitNext").hide(300);
                                         $("#payBill").show(300);  
                                         
                                    }
                                });
                         }     
                            
                    });   
                    
                    

            
             
    
        });    
    
     
    </script> 
    <script type="text/javascript" src="<?php echo ROOTPATH;?>/view/js/tab/profile.js"> </script>
    <script>
        //Function To Display Popup
    function div_show() {
    
    document.getElementById('abc').style.display = "block";
    }
    //Function to Hide Popup
    function div_hide(){
    document.getElementById('abc').style.display = "none";
    }
        
    </script>
   
 <!-- Features -->
 
<div class="loader">
    <div class="loaderInn">
        <img src="<?php echo ROOTPATH;?>/images/loader.gif" alt="loading" />
    </div>
</div>

   <div class="innerDeader">
      <div class="container">
          
          
          <a href="javascript:void(0);" id="go-back" class="goBack PaySound">
           <img src="<?php echo ROOTPATH;?>/images/Arrow 1.svg" alt="back">
       </a>  
       
          <h4><?php echo $_REQUEST['nm'];?></h4> 
          <span>
           <?php  
                if(isset($_SESSION['Regis']))  
                    echo $_SESSION['Regis'];     
            ?>
          </span>
     </div>    
   </div>
   <div class="innerBody">
       <div class="container">
        <div class="formBox">
            <form method="post" autocomplete="off">
             
		  
		  
		    
	       <input type="hidden"       name="Urlslug"  id="Urlslug" value="<?php echo $_REQUEST['Urlslug'];?>"   />  
           <input type="hidden"       name="UrlslugnM"  id="UrlslugnM" value="<?php echo $_REQUEST['nm'];?>"   />  
           <input type="hidden"       name="provider"  id="provider" value=""   />  
           <input type="hidden"       name="totalParas"  id="totalParas" value=""   />  
           <input type="hidden"       name="fref"  id="fref" value=""   />  
    
             
             
            <div class="form-outline">
             
            <input type="text"   class="form-control"    name="NextOpt"  id="NextOpt"   placeholder="Search your <?php echo $_REQUEST['Urlslug'];?> details"   /> 
                <ul id="forCharge"> 
                   
                </ul> 
            </div>  

		      
          
          
          <div class="form-outline" id="NextOpt1"> 
            <span id="recharge_params1"></span>
          </div>  
          
             
          <div class="form-outline" id="NextOpt2"> 
            <span id="recharge_params2"></span>
          </div>   
          
		  
		  <a class="btn btn-primary bigBtn mb-2"   href="javascript:void(0);"  id="submitNext" style="display:none;"     /> Fetch Data </a> 
		  <input type="submit" class="btn btn-primary bigBtn PaySound mb-3"    style="display:none;" name="payBill" id="payBill" value="Proceed"/>  
		  
		  
		  
          </form>

        </div>  
       </div>
   </div>  
   
     
</div>
 
<?php 
  include_once("../view/header-footer/footer.php");  
unset($_SESSION['Regis']);  
unset($_SESSION['topSuc']); 
unset($_SESSION['QRSET']); 