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


include "header.php";
?>
<div id="page-wrapper">
<div id="page-wrapper">

<h3>Empty Bids<a class='btn btn-warning' style = 'float:right;' href='index.php' id = ''>Cancel</a></h3>
<div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
            <div class="panel-body">

                            <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-bidwiz12333">
                                    <thead>
                                        <tr>
                                        <th>
                                                 Date
                                                </th>
                                                <th>
                                                   WO#
                                                </th>
                                                <th>
                                                  Client Name
                                                </th>
                                                <th>
                                                    Property                                               </th>
                                                    
                                                <th>
                                              Complete
                                                </th>
                                              
                                               
                                            </tr>
                                        </thead>
                                        <tbody>
<?php
$query_bid_item = "SELECT * FROM bid WHERE bid_type = 1 AND is_delete IS NULL ORDER BY create_time DESC";
$run_bid_item = mysqli_query($conn, $query_bid_item);
if(mysqli_num_rows($run_bid_item) >0){
    

    while($row_bid_item = mysqli_fetch_array($run_bid_item)){
        $wo_no =  $row_bid_item['bid_id'];
        $bid_wo_no = $row_bid_item['bid_wo_no'];
        $prop_id = $row_bid_item['prop_id'];
        $bid_amount = $row_bid_item['bid_amount'];
        $date = $row_bid_item['create_time'];
        $timestamp = strtotime($date);
        $date= date('m-d-Y', $timestamp);
        $client_id = $row_bid_item['client_id'];
        $query_maps = "SELECT * FROM client WHERE client_id = $client_id";
        $run_maps = mysqli_query($conn, $query_maps);
        $row_maps = mysqli_fetch_array($run_maps);
        $client_name = $row_maps['client_name'];

        $query_prop = "SELECT * FROM property WHERE prop_id = $prop_id";
        $run_prop = mysqli_query($conn, $query_prop);
        $row_prop = mysqli_fetch_array($run_prop);
        $prop_case_num = $row_prop['prop_case_num'];
        $prop_full_add = $row_prop['prop_full_add'];
        $prop_county = $row_prop['prop_county'];
        $prop_state = $row_prop['prop_state'];
        $prop_city = $row_prop['prop_city'];
        $prop_zip = $row_prop['prop_zip'];
        
        $property_details ="# " .$prop_case_num. " - ".$prop_full_add .", ". $prop_county. ", ". $prop_city. " - ". $prop_state." ". $prop_zip;

       
       
        echo '<tr class="odd gradeX">';
        echo '<td>' .$date. '</td>';
            echo '<td>' .$bid_wo_no. '</td>';
            echo '<td>' .$client_name. '</td>';
            echo '<td>' .$property_details. '</td>';
           
            echo "<td><a class='btn btn-success' href='add-items.php?wo_no=$wo_no&state=1&bid_wo_no=$bid_wo_no&client_id=$client_id' id = ''>Continue</a></td>";
        echo '</tr>';
        $bid_item_amount_total = $bid_item_amount_total + $bid_item_amount;
        /* #dataTables-bidwiz2 */
    }

}
?>
</tbody>
                         
                                    </table>
                                    
                                    </div><!-- panel-body  -->
                 </div> <!-- panel panel-default -->
            </div> <!--  col lg 12-->
        </div> <!-- row -->

</div> <!--  page wrapper -->
<?php include "footer.php"; ?>