<?php
include "include/db.php";
include "include/auth.php";

if(isset($_REQUEST["cl_id"])){
    $client_id = $_REQUEST["cl_id"];    
if(strlen($client_id)!=0) {  ?>
  

  <?php       
       $query001 = "SELECT * FROM prop_assign WHERE client_id = $client_id AND is_delete IS NULL AND is_approve = 1";
       $run001 = mysqli_query($conn,$query001);
       if(mysqli_num_rows($run001)>0){ ?>
         <label for="new_bid_prop_id">Choose Property Address</label>          
  <select class='form-control' name="new_bid_prop_id" id="new_bid_prop_id" onChange="getNewBidWOValue();"  required> 
          
   <option value="" disabled="disabled" selected="selected">Select Property </option>
   <option value='new'>Add New Address</option>

       <?php


           while($row001 = mysqli_fetch_array($run001)){

             $prop_id = $row001['prop_id'];

             $query00 = "SELECT * FROM property WHERE prop_id = $prop_id AND is_delete IS NULL AND is_approve = 1";

             $run00 = mysqli_query($conn,$query00);

       if(mysqli_num_rows($run00)>0){?>
      
       <?php 
       
       while($row00 = mysqli_fetch_array($run00)){                     
            echo "<option value='".$row00['prop_id']."'>".$row00['prop_full_add'].", ".$row00['prop_city'] . ", ". $row00['prop_state']." ".$row00['prop_zip']." - ".$row00['prop_county'] ." - "."#". $row00['prop_loan_num']."</option>";              
        }/* while property */
        
       
    }
    }/* while prop_assign */

    echo '</select>';   
    }else{/* check prop_assign */      
      
        echo '<br><b>That Client has no Properties Assigned. Add new Address</b>';
        echo "<script> 
        addAddress();
        var elemxxx = document.querySelector('#new_bid_wo');
        
        elemxxx.style.display = 'block';
        </script>";
       }  
       ?>




<?php

 } }/* isset &strlen*/ 

 
?>

