<?php 
 $cc=0;
      
  require_once "labClass.php";
  $con = new labClass();
 $chkp= $con->getAgent(); 
        
if ($chkp->rowCount()>0) {
  $chp=$chkp->fetchAll();
  ?>
  <table class="table"> 
  <th>
        <small><h6>S/N</h6></small>
      </th>

      <th>
        <small><h6>NAME CUSTOMER</h6></small>
      </th>
       <th>
        <small><h6>STREET</h6></small>
      </th>
       <th>
        <small><h6>WARD</h6></small>
      </th>
       <th>
        <small><h6>DISTRICT</h6></small>
      </th>
       <th>
        <small><h6>REGION</h6></small>
      </th>
      <th>
        <small><h6>PHONE NO</h6></small>
      </th>
     

      
<?php
 foreach ($chp as $key => $p) {
    $recID=$p['recID'];
      $cc++; 
     
        ?>
 <tr>
     <td colspan="8">
       <sup id="rdn<?php echo $cc;?>" class="text-danger" ></sup>
     </td>
   </tr> 
  <tr>
   <td width="5%">
       <input type="hidden" name="recID<?php echo $cc;?>" id="recID<?php echo $cc;?>" value="<?php echo $p['recID'];?>"/>
    <!--<div class="input-group">
    <span class="input-group-text">-->

      <?php
          echo $cc;
       ?>  
      </td>
       <td width="30%">
         <textarea style="background-color:white; height:30px; width:95%;" disabled="true" name="cname<?php echo $cc;?>" id="cname<?php echo $cc;?>"><?php echo $p['cname'];?></textarea> 
  </td>
  <td>
  <input type="text" style="background-color:white;border-radius:12px; width:100%;" disabled="true" name="add<?php echo $cc;?>" id="add<?php echo $cc;?>"  value="<?php echo $p['address'];?>" />
  </td> 
   <td>
   <input type="text" style="background-color:white;border-radius:12px; width:100%;" disabled="true" name="ward<?php echo $cc;?>" id="ward<?php echo $cc;?>"  value="<?php echo $p['ward'];?>" />  
  </td>
   <td>
   <input type="text" style="background-color:white;border-radius:12px; width:100%;" disabled="true" name="district<?php echo $cc;?>" id="district<?php echo $cc;?>"  value="<?php echo $p['district'];?>" />  
  </td>
   <td>
   <input type="text" style="background-color:white;border-radius:12px; width:100%;" disabled="true" name="region<?php echo $cc;?>" id="region<?php echo $cc;?>"  value="<?php echo $p['region'];?>" />  
  </td>
  <td>
    <input type="number" style="background-color:white;border-radius:12px; width:100%;" disabled="true" name="phone<?php echo $cc;?>" id="phone<?php echo $cc;?>"  value="<?php echo $p['phone'];?>" />   
  </td>
 
  
  <td> 
        <input type="submit" name="adds<?php echo $cc;?>" style="display:none;" id="adds<?php echo $cc;?>" value="Save" id="submit" onclick="var sdate=$('#sdate').val(); var user=$('#user').val();recID=$('#recID<?php echo $cc;?>').val();var district=$('#district<?php echo $cc;?>').val();var region=$('#region<?php echo $cc;?>').val(); var cname=$('#cname<?php echo $cc;?>').val();add=$('#add<?php echo $cc;?>').val(); var phone=$('#phone<?php echo $cc;?>').val(); var ward=$('#ward<?php echo $cc;?>').val();  if(recID!=''&& sdate!=''&& phone!='' && cname!=''&& user!='' && region !='' && district !=''&& ward!='' && add!='') { $.post('pharmAgentEdtProLPO.php',{user:user,recID:recID,phone:phone,add:add,cname:cname,ward:ward,district:district,region:region,sdate:sdate},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});$('#adds<?php echo $cc;?>').hide();$('#postEdit<?php echo $cc;?>').show();} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide item detail required!..';}" />
   
     <input type="submit"  name="postEdit<?php echo $cc;?>" id="postEdit<?php echo $cc;?>" value="Edit" id="submit" onclick="document.getElementById('ward<?php echo $cc;?>').disabled=false;document.getElementById('district<?php echo $cc;?>').disabled=false;document.getElementById('region<?php echo $cc;?>').disabled=false;document.getElementById('cname<?php echo $cc;?>').disabled=false;document.getElementById('add<?php echo $cc;?>').disabled=false;document.getElementById('phone<?php echo $cc;?>').disabled=false; $('#adds<?php echo $cc;?>').show();$('#postEdit<?php echo $cc;?>').hide();" />
  </td>
</tr> 
  <?php
}
$cc=0;
 ?> 
 <?php
}
  
  ?>