</div>

    <!-- /#wrapper -->
    <script>
var deleteLinks = document.querySelectorAll('.delete');

for (var i = 0; i < deleteLinks.length; i++) {
deleteLinks[i].addEventListener('click', function(event) {
  event.preventDefault();

  var choice = confirm(this.getAttribute('data-confirm'));

  if (choice) {
    window.location.href = this.getAttribute('href');
  }
});
}
</script>
<script>
function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();

            reader.onload = function (e) {
                $('#upload')
                    .attr('src', e.target.result)
                    .width(300)
                    .height(150);
            };

            reader.readAsDataURL(input.files[0]);
        }
    }
</script>
    <!-- jQuery -->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')</script>
    
    <script src="js/tabby.min.js"></script>
    <script>
		var tabs = new Tabby('[data-tabs]');
	</script>
 <script>
		var tabsx = new Tabby('[data-tabsx]');

	</script>


<script type="text/javascript">
function fetchClientData(d){
    var a = document.getElementById(d);
    if(typeof(a) != 'undefined' || a != null){ 
    a.onclick = function() {
        var n = d.substr(10);
        n1 = "new" +n+n;
        n2 = "old" +n+n;  

        if(typeof(n) != 'undefined' || n != null){   
        $.ajax({
        type: "POST",
        url: "client_price_list_adata.php",
        data:'cl_id='+n,
        success: function(data){
            $("#"+n1).html(data);
            $("#"+n2).hide();

       
        $('#dataTables-bidwiz'+n1).DataTable({
            responsive: true,
           
        
        });


       

       
        $('#dataTables-bidwiz'+n2).DataTable({
            responsive: true,
            "order": [[ 0, "desc" ]],
            dom: 'Bfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ]
        });

        }
        });
    }

          return true;
    }   
}
}
</script> 

 <?php

$query12 = "SELECT * FROM client WHERE is_approve = 1 AND client_is_delete IS NULL AND is_list = 1";

$run12 = mysqli_query($conn, $query12);

if(mysqli_num_rows($run12)>0){
    echo "<script>";
    $c = 1;
    while($row12 = mysqli_fetch_array($run12)){
    $client_id = $row12['client_id'];
    $c++;
    $s = 'var c'.$c;

    echo $s . ' = "client_id_'. $client_id .'";';
    

    echo 'fetchClientData(c' .$c. ');';

   }

   
   echo 'var cxx0 = "client_id_0";';
    echo 'fetchClientData(cxx0);';
  
  echo "</script>"; 

}


?> 


<!-- priceCat-->
<script type="text/javascript">
function fetchClientItemCatData(d){

    var a = document.getElementById(d);
    if(typeof(a) != 'undefined' || a != null){ 
    a.onclick = function() {

/* continue here */
        var client_id = d.split('-')[1];
        var str = d;
        var cat = str.substring(
            str.lastIndexOf("_") + 1, 
            str.lastIndexOf("-")
        );

        var n = cat;
        n1 = "ncew" +n+n+client_id;
        n2 = "ocld" +n+n+client_id;  
        /* check here datatables*/
        no1 = "ncew" +n+n;
        no2 = "ocld" +n+n;  

        if(typeof(n) != 'undefined' || n != null){ 

        $.ajax({
        type: "POST",
        url: "cat_item_list_adata.php",
        data:'cat_id='+n+ '&cl_id='+client_id ,
        success: function(data){
            $("#"+n1).html(data);
            $("#"+n2).hide();
       
        $('#dataTables-bidwiz'+no1).DataTable({
            responsive: true,           
        
        });
         /* do here */

        /* '[data-tabsx]' */
        /* var qwe = '[data-tabsx'+ n + ']';
		var tabsx= new Tabby(qwe);   */     

       
        $('#dataTables-bidwiz'+no2).DataTable({
            responsive: true,
            "order": [[ 0, "desc" ]],
            dom: 'Bfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ]
        });

        }
        });
    }

          return true;
    }   
}
}
</script> 

 <?php

    echo "<script>";
    $s = 1;
   
        $client_id = 2;        
        $s = $s + 1;
        $fetch_cater = "SELECT * FROM category WHERE cat_is_delete IS NULL AND cat_approved =1";
        $run_fetch_cater = mysqli_query($conn, $fetch_cater);

        if(mysqli_num_rows($run_fetch_cater)>0){   
            $k = 1;
            while($row_fetch_cater = mysqli_fetch_array($run_fetch_cater)){
                $cater_id = $row_fetch_cater['cat_id'];
                $k = $k + 1;
                $query_cater_search = "SELECT * FROM maps WHERE client_id = $client_id AND cat_id = $cater_id AND maps_approved = 1 AND maps_is_delete IS NULL";

                $run_cater_search = mysqli_query($conn, $query_cater_search);
            
                if(mysqli_num_rows($run_cater_search)>0){  

                    $c = 'var zx'.$s.$k;

                    echo $c . ' = "catid_'. $cater_id .'-'.$client_id .'";';
                    

                    echo 'fetchClientItemCatData(zx' .$s. $k.');';
                }
            }
        }        

  
   
    
   echo "</script>"; 


?> 

<!-- /  pricecat1 -->
    <script>
    function hideRowUOM() {
        var val3 = document.getElementById("maps_uom").value;
        if(val3 == ''){
            var elemxxx = document.querySelector('#UOMsetDeleteRow');
elemxxx.style.display = 'block';
        }else{
    var elemxxx = document.querySelector('#UOMsetDeleteRow');
elemxxx.style.display = 'none';}
 
}

function getUOMvalue() {
  var val1 = document.getElementById("maps_uom");
  val1 = val1.value;    
  var val2 = document.getElementById("maps_id");  
  if(typeof(val2) == 'undefined' || val2 == null){
        val2 = '';
    }else{
        val2 = val2.value;
    }
  $.ajax({
  type: "POST",
  url: "get_uom_value.php",
  data:'maps_uom_id='+val1+'&maps_id='+val2,
  success: function(data){
    $("#displayUOMvalueForm").html(data);
  }
  });

  hideRowUOM();
}
function getUOMvalue3() {
  var val1 = document.getElementById("maps_uom").value;
 
  
  $.ajax({
  type: "POST",
  url: "get_uom_value.php",
  data:'maps_uom_id='+val1+'&maps_id=',
  success: function(data){
    $("#displayUOMvalueForm").html(data);
  }
  });

  hideRowUOM();
}



function getUOMvalue1() {
  var val1 = document.getElementById("maps_uom");
  val1 = val1.value;    
  var val2 = document.getElementById("maps_id").value;  
  if(typeof(val2) == 'undefined' || val2 == null){
        val2 = '';
    }
  $.ajax({
  type: "POST",
  url: "get_uom_value.php",
  data:'maps_uom_id='+val1+'&maps_id='+val2,
  success: function(data){
    $("#displayUOMvalueForm").html(data);
  }
  });
  
}
getUOMvalue1();
hideRowUOM();
function showChildCat(){
    var elemxxx = document.querySelector('#hiddenCatInput');
elemxxx.style.display = 'block';


}

function showSubmitGroup(){
    var elemxxx1 = document.querySelector('#hiddenSubmitGroup');
elemxxx1.style.display = 'block';


}
<?php 
if(!isset($url_client_id)){
    $url_client_id = 0;
    
}

?>
function getParentItemValue(){
  var val1 = document.getElementById("cat_name_parent");
  val1 = val1.value; 
  if(typeof(val1) != 'undefined' || val2 != null){   
        $.ajax({
        type: "POST",
        url: "get_maps_name_parent.php",
        data:'cat_id='+val1+ '&cl_id=<?php echo $url_client_id; ?>',
        success: function(data){
            $("#maps_group_parent_name").html(data);
        }
        });
    }
  
}
function getChildItemValue(){
  var val1 = document.getElementById("cat_name_child");
  val1 = val1.value; 
  if(typeof(val1) != 'undefined' || val2 != null){   
        $.ajax({
        type: "POST",
        url: "get_maps_name_child.php",
        data:'cat_id='+val1+ '&cl_id=<?php echo $url_client_id; ?>',
        success: function(data){
            $("#maps_group_child_name").html(data);
        }
        });
    }
  
}

function getNewBidPropValue(){
  var val1 = document.getElementById("new_bid_client_name");
  val1 = val1.value; 
  if(typeof(val1) != 'undefined' || val1 != null){ 
    var elemxxxq = document.querySelector('#new_bid_wo');
        
        elemxxxq.style.display = 'none';
      
    var data33 = '';
         $("#new_bid_if_add").html(data33);   
        $.ajax({
        type: "POST",
        url: "get_new_bid_client_prop.php",
        data:'cl_id='+val1,
        success: function(data){
            $("#new_bid_prop_column").html(data);
        }
        });
    }  
}

function getNewBidWOValue(){
  var val1 = document.getElementById("new_bid_prop_id");
  val1 = val1.value; 
  if(typeof(val1) != 'undefined' || val1 != null){ 
    
      if(val1 == 'new'){
        var data91231 = '';
      
      $("#new_bid_wo_add").html(data91231);  
        var data3 = '';
         $("#new_bid_if_set").html(data3);
      var data2 = '<div class = "row">'+
        
        '<div class = "form-group col-lg-6">'+
        '<label for="prop_case_num">Case/Loan Number</label>'+
        '<input type="text" class="form-control" name="prop_case_num" id="prop_case_num" value="<?php $prop_case_num =time().mt_rand (10,99); echo $prop_case_num; ?>" required="required" autofocus>'+
        '</div>'+
        '<div class = "form-group col-lg-6">  '+'<label for="bid_wo_no">Work Order Number </label><input type="text" class="form-control" name="bid_wo_no" id="bid_wo_no" value="<?php $wo_num =mt_rand (10,99).time(); echo $wo_num; ?>" required="required" autofocus>'+
        '</div>'+
        ' </div>  '+      

      '  <div class = "row">      '+
    
         '<div class = "form-group col-lg-6">'+
         '  <div class="row">'+
    ' <div class="form-group col-lg-6">'+
    '<label for="prop_zip">Zipcode</label>'+
    '   <input type="text" class="form-control" maxlength="5" minlength="5" name="prop_zip" id="prop_zip" required="required">  '+                    

                     '   </div>'+
         '    <div class="form-group col-lg-6">'+
         '          <label for="prop_city">City</label>'+
                    

                        '    <input type="text" class="form-control" name="prop_city" id="prop_city" required="required">   '+ 

                      '  </div>'+
                     
                       
                    
                          ' </div>'+

                  '  <div class="row">'+ '   <div class="form-group col-lg-6">'+
                      '  <label for="prop_county">County</label>'+
                    

                          '  <input type="text" class="form-control" name="prop_county" id="prop_county">  '+
                        
                          '</div>'+

                       ' <div class="form-group col-lg-6">'+
                       '  <label for="prop_state">State</label>'+

                      '  <select class="form-control" name="prop_state"  id="prop_state" required="required">'+
                      ' <option value="" disabled="disabled" selected="selected">Select State</option>'+

	'<option value="AL">Alabama</option>'+
	'<option value="AK">Alaska</option>'+
	'<option value="AZ">Arizona</option>'+
	'<option value="AR">Arkansas</option>'+
	'<option value="CA">California</option>'+
	'<option value="CO">Colorado</option>'+
	'<option value="CT">Connecticut</option>'+
	'<option value="DE">Delaware</option>'+
	'<option value="DC">District of Columbia</option>'+
	'<option value="FL">Florida</option>'+
	'<option value="GA">Georgia</option>'+
	'<option value="HI">Hawaii</option>'+
	'<option value="ID">Idaho</option>'+
	'<option value="IL">Illinois</option>'+
	'<option value="IN">Indiana</option>'+
	'<option value="IA">Iowa</option>'+
	'<option value="KS">Kansas</option>'+
	'<option value="KY">Kentucky</option>'+
	'<option value="LA">Louisiana</option>'+
	'<option value="ME">Maine</option>'+
	'<option value="MD">Maryland</option>'+
	'<option value="MA">Massachusetts</option>'+
	'<option value="MI">Michigan</option>'+
	'<option value="MN">Minnesota</option>'+
	'<option value="MS">Mississippi</option>'+
	'<option value="MO">Missouri</option>'+
	'<option value="MT">Montana</option>'+
	'<option value="NE">Nebraska</option>'+
	'<option value="NV">Nevada</option>'+
	'<option value="NH">New Hampshire</option>'+
	'<option value="NJ">New Jersey</option>'+
	'<option value="NM">New Mexico</option>'+
	'<option value="NY">New York</option>'+
	'<option value="NC">North Carolina</option>'+
	'<option value="ND">North Dakota</option>'+
	'<option value="OH">Ohio</option>'+
	'<option value="OK">Oklahoma</option>'+
	'<option value="OR">Oregon</option>'+
	'<option value="PA">Pennsylvania</option>'+
	'<option value="RI">Rhode Island</option>'+
	'<option value="SC">South Carolina</option>'+
	'<option value="SD">South Dakota</option>'+
	'<option value="TN">Tennessee</option>'+
	'<option value="TX">Texas</option>'+
	'<option value="UT">Utah</option>'+
	'<option value="VT">Vermont</option>'+
	'<option value="VA">Virginia</option>'+
	'<option value="WA">Washington</option>'+
	'<option value="WV">West Virginia</option>'+
	'<option value="WI">Wisconsin</option>'+
	'<option value="WY">Wyoming</option>'+
    '</select>'+
    '</div>'+

                   ' </div>'+
                
                
                   ' </div>    '+  
 ' <div class = "form-group col-lg-6">'+

    '   </div>   '+ ' </div>'+' <div class = "row">'+  
 ' <div class = "form-group col-lg-6">'+
 '     <label for="prop_full_add">Address</label> '+         
 '     <textarea rows="4" name="prop_full_add" class = "form-control" id="prop_full_add" placeholder=""  maxlength="5000"></textarea>  '+

    '   </div>   '+  
 ' <div class = "form-group col-lg-6">'+

    '   </div>   '+' </div>'; 


      $("#new_bid_if_add").html(data2); 
      var elemxxx = document.querySelector('#new_bid_wo');
        
        elemxxx.style.display = 'block';
      }else{
          var data3 = '';
         $("#new_bid_if_add").html(data3);
         var val11 = document.getElementById("new_bid_prop_id");
         val11 = val11.value;
         if(typeof(val11) != 'undefined' || val11 != null){   
       
        var data9 = '<input type = "hidden" name ="prop_id" value="'+val11 +'">';
      
        $("#new_bid_if_set").html(data9);

        var elemxxx = document.querySelector('#new_bid_wo');

        elemxxx.style.display = 'block';

        var data9123 = '<label for="bid_wo_no">Work Order Number </label><input type="text" class="form-control" name="bid_wo_no" id="bid_wo_no" value="<?php $wo_num =mt_rand (10,99).time(); echo $wo_num; ?>" required="required" autofocus>';
      
        $("#new_bid_wo_add").html(data9123);
        
    }

      }     


    }

    $(document).ready(function() {
  // Restrict input to digits by using a regular expression filter.
  $("#prop_zip").inputFilter(function(value) {
    return /^\d*$/.test(value);
  });
});

$("#prop_zip").keyup(function() {
    if($(this).val().length == 5) {
        $("#prop_zip").prop('disabled', true);
        $("#prop_city").prop('disabled', true);
        $("#prop_county").prop('disabled', true);
        $("#prop_state").prop('disabled', true);

        var n = $(this).val(); 
        $.ajax({
        type: "POST",
        url: "prop_zip_search_adata.php",
        data:'data='+n,
        success: function(data){
            data = data.trim(); 
            if(data == 'no'){
                $("#prop_zip").prop('disabled', false);
                $("#prop_city").prop('disabled', false);
                $("#prop_county").prop('disabled', false);
                $("#prop_state").prop('disabled', false);
                $('#prop_zip').trigger("reset");                
                $('#prop_city').trigger("reset");                
                $('#prop_county').trigger("reset");
                $('#prop_state').trigger("reset");                

            }else{                
                var data_response = JSON.parse(data);

                var state = data_response.state;
                var state_id = data_response.s_id;
                var city = data_response.city;
                var country = data_response.country;
                var status_res = data_response.status; 
                var county = data_response.county;

                if(status_res = 'yes'){
                    $("#prop_zip").prop('disabled', false);

                    if(city.length >1){
                        $('input[name="prop_city"]').val(city);
                        $("#prop_city").prop('disabled', false);

                    }else{
                        $('input[name="prop_city"]').val(state);
                        $("#prop_city").prop('disabled', false);
                        $('#prop_city').trigger("reset"); 
                    }

                    if(county.length >1){
                        $('input[name="prop_county"]').val(county);
                        $("#prop_county").prop('disabled', false);

                    }else{
                        $('input[name="prop_county"]').val(county);
                        $("#prop_county").prop('disabled', false);
                        $('#prop_county').trigger("reset"); 
                    }

                    if(state_id.length >1){
                        $("#prop_state").val(state_id);
                        $("#prop_state").prop('disabled', false);
                    }else{
                        $("#prop_state").prop('disabled', false);
                        $('#prop_state').trigger("reset"); 
                    }
                   

                }else{
                    $("#prop_zip").prop('disabled', false);
                    $("#prop_city").prop('disabled', false);
                    $("#prop_county").prop('disabled', false);
                    $("#prop_state").prop('disabled', false);
                    $('#prop_zip').trigger("reset");                
                    $('#prop_city').trigger("reset");                
                    $('#prop_county').trigger("reset");
                    $('#prop_state').trigger("reset");   
                }

            }
        }
    });
         
    }
});
  
}


function addAddress(){
    var data91234 = '';
      
      $("#new_bid_wo_add").html(data91234);  
    var data2 = '<div class = "row">'+
        
        '<div class = "form-group col-lg-6">'+
        '<label for="prop_case_num">Case/Loan Number</label>'+
        '<input type="text" class="form-control" name="prop_case_num" id="prop_case_num" value="<?php $prop_case_num =time().mt_rand (10,99); echo $prop_case_num; ?>" required="required" autofocus>'+
        '</div>'+
        '<div class = "form-group col-lg-6">  '+'<label for="bid_wo_no">Work Order Number </label><input type="text" class="form-control" name="bid_wo_no" id="bid_wo_no" value="<?php $wo_num =mt_rand (10,99).time(); echo $wo_num; ?>" required="required" autofocus>'+
        '</div>'+
        ' </div>  '+      

       '  <div class = "row">      '+
    
    '<div class = "form-group col-lg-6">'+
    '  <div class="row">'+
' <div class="form-group col-lg-6">'+
'<label for="prop_zip">Zipcode</label>'+
'   <input type="text" class="form-control" maxlength="5" minlength="5" name="prop_zip" id="prop_zip" required="required">  '+                    

                '   </div>'+
    '    <div class="form-group col-lg-6">'+
    '          <label for="prop_city">City</label>'+
               

                   '    <input type="text" class="form-control" name="prop_city" id="prop_city" required="required">   '+ 

                 '  </div>'+
                
                  
               
                     ' </div>'+

             '  <div class="row">'+ '   <div class="form-group col-lg-6">'+
                 '  <label for="prop_county">County</label>'+
               

                     '  <input type="text" class="form-control" name="prop_county" id="prop_county">  '+
                   
                     '</div>'+

                  ' <div class="form-group col-lg-6">'+
                  '  <label for="prop_state">State</label>'+

                 '  <select class="form-control" name="prop_state"  id="prop_state" required="required">'+
                 ' <option value="" disabled="disabled" selected="selected">Select State</option>'+

'<option value="AL">Alabama</option>'+
'<option value="AK">Alaska</option>'+
'<option value="AZ">Arizona</option>'+
'<option value="AR">Arkansas</option>'+
'<option value="CA">California</option>'+
'<option value="CO">Colorado</option>'+
'<option value="CT">Connecticut</option>'+
'<option value="DE">Delaware</option>'+
'<option value="DC">District of Columbia</option>'+
'<option value="FL">Florida</option>'+
'<option value="GA">Georgia</option>'+
'<option value="HI">Hawaii</option>'+
'<option value="ID">Idaho</option>'+
'<option value="IL">Illinois</option>'+
'<option value="IN">Indiana</option>'+
'<option value="IA">Iowa</option>'+
'<option value="KS">Kansas</option>'+
'<option value="KY">Kentucky</option>'+
'<option value="LA">Louisiana</option>'+
'<option value="ME">Maine</option>'+
'<option value="MD">Maryland</option>'+
'<option value="MA">Massachusetts</option>'+
'<option value="MI">Michigan</option>'+
'<option value="MN">Minnesota</option>'+
'<option value="MS">Mississippi</option>'+
'<option value="MO">Missouri</option>'+
'<option value="MT">Montana</option>'+
'<option value="NE">Nebraska</option>'+
'<option value="NV">Nevada</option>'+
'<option value="NH">New Hampshire</option>'+
'<option value="NJ">New Jersey</option>'+
'<option value="NM">New Mexico</option>'+
'<option value="NY">New York</option>'+
'<option value="NC">North Carolina</option>'+
'<option value="ND">North Dakota</option>'+
'<option value="OH">Ohio</option>'+
'<option value="OK">Oklahoma</option>'+
'<option value="OR">Oregon</option>'+
'<option value="PA">Pennsylvania</option>'+
'<option value="RI">Rhode Island</option>'+
'<option value="SC">South Carolina</option>'+
'<option value="SD">South Dakota</option>'+
'<option value="TN">Tennessee</option>'+
'<option value="TX">Texas</option>'+
'<option value="UT">Utah</option>'+
'<option value="VT">Vermont</option>'+
'<option value="VA">Virginia</option>'+
'<option value="WA">Washington</option>'+
'<option value="WV">West Virginia</option>'+
'<option value="WI">Wisconsin</option>'+
'<option value="WY">Wyoming</option>'+
'</select>'+
'</div>'+

              ' </div>'+
           
           
              ' </div>    '+  
 ' <div class = "form-group col-lg-6">'+

    '   </div>   '+ ' </div>'+' <div class = "row">'+  
 ' <div class = "form-group col-lg-6">'+
 '     <label for="prop_full_add">Address</label> '+         
 '     <textarea rows="4" name="prop_full_add" class = "form-control" id="prop_full_add" placeholder=""  maxlength="5000"></textarea>  '+

    '   </div>   '+  
 ' <div class = "form-group col-lg-6">'+

    '   </div>   '+' </div>'; 


      $("#new_bid_if_add").html(data2); 

      $(document).ready(function() {
  // Restrict input to digits by using a regular expression filter.
  $("#prop_zip").inputFilter(function(value) {
    return /^\d*$/.test(value);
  });
});

$("#prop_zip").keyup(function() {
    if($(this).val().length == 5) {
        $("#prop_zip").prop('disabled', true);
        $("#prop_city").prop('disabled', true);
        $("#prop_county").prop('disabled', true);
        $("#prop_state").prop('disabled', true);

        var n = $(this).val(); 
        $.ajax({
        type: "POST",
        url: "prop_zip_search_adata.php",
        data:'data='+n,
        success: function(data){
            data = data.trim(); 
            if(data == 'no'){
                $("#prop_zip").prop('disabled', false);
                $("#prop_city").prop('disabled', false);
                $("#prop_county").prop('disabled', false);
                $("#prop_state").prop('disabled', false);
                $('#prop_zip').trigger("reset");                
                $('#prop_city').trigger("reset");                
                $('#prop_county').trigger("reset");
                $('#prop_state').trigger("reset");                

            }else{                
                var data_response = JSON.parse(data);

                var state = data_response.state;
                var state_id = data_response.s_id;
                var city = data_response.city;
                var country = data_response.country;
                var status_res = data_response.status; 
                var county = data_response.county;

                if(status_res = 'yes'){
                    $("#prop_zip").prop('disabled', false);

                    if(city.length >1){
                        $('input[name="prop_city"]').val(city);
                        $("#prop_city").prop('disabled', false);

                    }else{
                        $('input[name="prop_city"]').val(state);
                        $("#prop_city").prop('disabled', false);
                        $('#prop_city').trigger("reset"); 
                    }

                    if(county.length >1){
                        $('input[name="prop_county"]').val(county);
                        $("#prop_county").prop('disabled', false);

                    }else{
                        $('input[name="prop_county"]').val(county);
                        $("#prop_county").prop('disabled', false);
                        $('#prop_county').trigger("reset"); 
                    }

                    if(state_id.length >1){
                        $("#prop_state").val(state_id);
                        $("#prop_state").prop('disabled', false);
                    }else{
                        $("#prop_state").prop('disabled', false);
                        $('#prop_state').trigger("reset"); 
                    }
                   

                }else{
                    $("#prop_zip").prop('disabled', false);
                    $("#prop_city").prop('disabled', false);
                    $("#prop_county").prop('disabled', false);
                    $("#prop_state").prop('disabled', false);
                    $('#prop_zip').trigger("reset");                
                    $('#prop_city').trigger("reset");                
                    $('#prop_county').trigger("reset");
                    $('#prop_state').trigger("reset");   
                }

            }
        }
    });
         
    }
});
}
</script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.3.min.js"></script>

    
    <script src="js/jquery.dataTables.min.js"></script>
    <script src="js/dataTables.bootstrap.min.js"></script>
    <script src="js/dataTables.responsive.js"></script>
 <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js"></script> 
  
<script>
    $(document).ready(function() {
        $('#dataTables-bidwiz').DataTable({
            responsive: true,
            "order": [[ 0, "desc" ]],
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
            dom: 'Blfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ]
        });

        $('#dataTables-bidwiz-emp').DataTable({
            responsive: true,
         
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
            dom: 'Blfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ]
        });

        $('#dataTables-bidwiz-search1').DataTable({
            responsive: true,
            
      
        });
        $('#dataTables-bidwiz-search2').DataTable({
            responsive: true,
            
      
        });
        $('#dataTables-bidwiz-search3').DataTable({
            responsive: true,
            
      
        });
        $('#dataTables-bidwiz-search4').DataTable({
            responsive: true,
            
      
        });
        $('#dataTables-bidwiz-search5').DataTable({
            responsive: true,
            
      
        });
        $('#dataTables-bidwiz-search6').DataTable({
            responsive: true,
            
      
        });
    });
    </script>
    <script>
    $(document).ready(function() {
        $('#dataTables-bidwiz12333').DataTable({
            responsive: true,           
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
          
            "ordering":false,
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ],
        
        });
    });
    </script>
    <script>
    $(document).ready(function() {
        $('#dataTables-bidwiz-dash').DataTable({
            responsive: true,        
            "paging":false,
            "ordering":false,
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
        });
    });
    </script>
    <script>
    $(document).ready(function() {
        $('#dataTables-bidwizlist').DataTable({
            responsive: true,
            "order": [[ 0, "desc" ]],
            "dom": 'lrtip',
        buttons: [
            
        ]
        });
    });
    </script>
    <script>
    $(document).ready(function() {
        $('#dataTables-bidwizzz').DataTable({
            responsive: true,
         
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
            dom: 'Blfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ] 
        });
       
    });
    $(document).ready(function() {
        $('#dataTables-bidwizzz-property').DataTable({
            responsive: true,        
           
            dom: 'Blfrtip',
            buttons: [
                'copyHtml5',
                'excelHtml5',
                'csvHtml5',
                'pdfHtml5'
            ],
            "processing": true,
            "serverSide": true,
            "ajax":{
                url :"property_response.php", 
                type: "post", 
                
            },
            "language": {
                        processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="color:#0b57a4;margin-top:15%"></i><span class="sr-only">Loading..n.</span>'},
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], 
        });       
    });

    $(document).ready(function() {
        $('#dataTables-bidwizzz-search').DataTable({
           
            responsive: true,
            "ordering": false,
            dom: 'Blfrtip',
       
        });
       
    });
    </script>

    <script>
    $(document).ready(function() {
        $('#dataTables-bidwiz-property-list').DataTable({
            responsive: true,
            dom: 'Blfrtip',
            buttons: [
                'copyHtml5',
                'excelHtml5',
                'csvHtml5',
                'pdfHtml5'
            ],
            "processing": true,
            "serverSide": true,
            "ajax":{
                url :"property_list_response.php",
                type: "post",
            },
            "language": {
                        processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="color:#0b57a4;margin-top:15%"></i><span class="sr-only">Loading..n.</span> '},
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], 
        });
       
    });
    $(document).ready(function() {
        $('#dataTables-bidwiz-property-order-list').DataTable({
            responsive: true, 
            "paging":true,
            "ordering":false,
            "bFilter":false,
            "processing": true,
            "serverSide": true,
            "ajax":{
                url :"property_order_list_response.php<?php if(isset($url_prop_id) && isset($url_client_id)){ ?>?view=<?php echo $url_prop_id; ?>&cl=<?php echo $url_client_id; } ?>",                                
                type: "post",
            },
            "language": {
                        processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="color:#0b57a4;margin-top:15%"></i><span class="sr-only">Loading..n.</span> '
                        },
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], 
            rowCallback: function(row, data, index){
                if(data[6] != ''){
                    if(data[6] > 0){
                        var profit_per_cent = data[6]/data[3];
                        var pft_per_cent = profit_per_cent * 100;

                        if(pft_per_cent > 30){
                            $(row).find('td:eq(6)').css('background', '#22803b');
                        }else{
                            $(row).find('td:eq(6)').css('background', '#5de381');
                        }                  
                        
                    }else if(data[6] == 0){
                        $(row).find('td:eq(6)').css('background', 'yellow');
                    }else if (data[6] < 0){
                        $(row).find('td:eq(6)').css('background', 'red');
                    }
                }

                if(data[10] != ''){
                    if(data[10] > 0){
                        var a_profit_per_cent = data[10]/data[4];
                        var a_pft_per_cent = a_profit_per_cent * 100;

                        if(a_pft_per_cent > 30){
                            $(row).find('td:eq(10)').css('background', '#22803b');
                        }else{
                            $(row).find('td:eq(10)').css('background', '#5de381');
                        }
                    }else if(data[10] == 0){
                        $(row).find('td:eq(10)').css('background', 'yellow');
                    }else if (data[10] < 0){
                        $(row).find('td:eq(10)').css('background', 'red');
                    }
                }
            }            
        });       
    });

    $(document).ready(function() {
        $('#dataTables-bidwiz-pay-report').DataTable({
            responsive: true,        
            "paging":true,
            "ordering":false,
            "processing": true,
            "serverSide": true,
            "ajax":{
                url :"pay_report_response.php",                                
                type: "post",
            },
            "language": {
                        processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="color:#0b57a4;margin-top:15%"></i><span class="sr-only">Loading..n.</span> '
                        },
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], 
            rowCallback: function(row, data, index){
                
                if(data[10] != ''){
                    if(data[10] > 0){
                        var profit_per_cent = data[10]/data[4];
                        var pft_per_cent = profit_per_cent * 100;

                        if(pft_per_cent > 30){
                            $(row).find('td:eq(10)').css('background', '#22803b');
                        }else{
                            $(row).find('td:eq(10)').css('background', '#5de381');
                        }                
                        
                    }else if(data[10] == 0){
                        $(row).find('td:eq(10)').css('background', 'yellow');
                    }else if (data[10] < 0){
                        $(row).find('td:eq(10)').css('background', 'red');
                    }
                }

                if(data[11] != ''){
                    if(data[11] > 0){
                        var a_profit_per_cent = data[11]/data[9];
                        var a_pft_per_cent = a_profit_per_cent * 100;

                        if(a_pft_per_cent > 30){
                            $(row).find('td:eq(11)').css('background', '#22803b');
                        }else{
                            $(row).find('td:eq(11)').css('background', '#5de381');
                        }
                    }else if(data[11] == 0){
                        $(row).find('td:eq(11)').css('background', 'yellow');
                    }else if (data[11] < 0){
                        $(row).find('td:eq(11)').css('background', 'red');
                    }
                }
            }            
        });       
    });

    $(document).ready(function() {
        $('#dataTables-bidwiz-MAPS-sheet').DataTable({
            responsive: true,        
            "paging":true,
            "ordering":false,
            "processing": true,
            "serverSide": true,
            "ajax":{
                url :"MAPS_sheet_response.php?client_id=<?php echo $url_client_id; ?>",                                
                type: "post",
            },
            "language": {
                        processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="color:#0b57a4;margin-top:15%"></i><span class="sr-only">Loading..n.</span> '
                        },
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], 
                       
        });       
    });

    $(document).ready(function() {
        $('#dataTables-bidwiz-MAPS-main').DataTable({
            responsive: true,        
            "paging":true,
            "ordering":false,
            "processing": true,
            "serverSide": true,
            "ajax":{
                url :"MAPS_main_response.php?client_id=<?php echo $url_client_id; ?>",                                
                type: "post",
            },
            "language": {
                        processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="color:#0b57a4;margin-top:15%"></i><span class="sr-only">Loading..n.</span> '
                        },
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], 
                       
        });       
    });

    $(document).ready(function() {
        $('#dataTables-bidwiz-vendor-pay-report').DataTable({
            responsive: true,        
            "paging":true,
            "ordering":false,
            "processing": true,
            "serverSide": true,
            "ajax":{
                url :"vendor_pay_report_response.php",                                
                type: "post",
            },
            "language": {
                        processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="color:#0b57a4;margin-top:15%"></i><span class="sr-only">Loading..n.</span> '
                        },
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], 
                       
        });       
    });

    $(document).ready(function() {
        $('#dataTables-bidwiz-client-email-settle-succ').DataTable({
            responsive: true,        
            "paging":true,
            "ordering":false,
            "processing": true,
            "serverSide": true,
            "ajax":{
                url :"client_email_pay_settle_success_response.php",                                
                type: "post",
            },
            "language": {
                        processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="color:#0b57a4;margin-top:15%"></i><span class="sr-only">Loading..n.</span> '
                        },
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], 
                       
        });       
    });
    $(document).ready(function() {
        $('#dataTables-bidwiz-client-email-settle-fail').DataTable({
            responsive: true,        
            "paging":true,
            "ordering":false,
            "processing": true,
            "serverSide": true,
            "ajax":{
                url :"client_email_pay_settle_fail_response.php",                                
                type: "post",
            },
            "language": {
                        processing: '<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="color:#0b57a4;margin-top:15%"></i><span class="sr-only">Loading..n.</span> '
                        },
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], 
                       
        });       
    });
    </script>

   <script>
   
        $('#dataTables-bidwizzz1').DataTable({
            responsive: true,
            "ordering": false,
            dom: 'Bfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ]
        });
  
    </script> 


    <script>
    $(document).ready(function() {
        $('#dataTables-bidwiz2').DataTable({
            responsive: true,
           
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],   
        });
    });
    </script>
    <script>
    $(document).ready(function() {
        $('#dataTables-bidwizqwe2').DataTable({
            responsive: true,
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],          
           
        
        });
    });
    </script>
    <script>
    $(document).ready(function() {
        $('#dataTables-bidwiz1').DataTable({
            responsive: true,
            
            dom: 'Bfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ]
        });
    });
    </script>

    <script>
    $(document).ready(function() {
        $('#dataTables-signup').DataTable({
            responsive: true,
            "order": [[ 0, "desc" ]],
            dom: 'Bfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5'
        ]
        });
    });
    </script>
<script>
(function($) {
  $.fn.inputFilter = function(inputFilter) {
    return this.on("input keydown keyup mousedown mouseup select contextmenu drop", function() {
      if (inputFilter(this.value)) {
        this.oldValue = this.value;
        this.oldSelectionStart = this.selectionStart;
        this.oldSelectionEnd = this.selectionEnd;
      } else if (this.hasOwnProperty("oldValue")) {
        this.value = this.oldValue;
        this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);
      }
    });
  };
}(jQuery));

$(document).ready(function() {
  // Restrict input to digits by using a regular expression filter.
  $("#prop_zip").inputFilter(function(value) {
    return /^\d*$/.test(value);
  });
});

$("#prop_zip").keyup(function() {
    if($(this).val().length == 5) {
        $("#prop_zip").prop('disabled', true);
        $("#prop_city").prop('disabled', true);
        $("#prop_county").prop('disabled', true);
        $("#prop_state").prop('disabled', true);

        var n = $(this).val(); 
        $.ajax({
        type: "POST",
        url: "prop_zip_search_adata.php",
        data:'data='+n,
        success: function(data){
            data = data.trim(); 
            if(data == 'no'){
                $("#prop_zip").prop('disabled', false);
                $("#prop_city").prop('disabled', false);
                $("#prop_county").prop('disabled', false);
                $("#prop_state").prop('disabled', false);
                $('#prop_zip').trigger("reset");                
                $('#prop_city').trigger("reset");                
                $('#prop_county').trigger("reset");
                $('#prop_state').trigger("reset");                

            }else{                
                var data_response = JSON.parse(data);

                var state = data_response.state;
                var state_id = data_response.s_id;
                var city = data_response.city;
                var country = data_response.country;
                var status_res = data_response.status; 
                var county = data_response.county;

                if(status_res = 'yes'){
                    $("#prop_zip").prop('disabled', false);

                    if(city.length >1){
                        $('input[name="prop_city"]').val(city);
                        $("#prop_city").prop('disabled', false);

                    }else{
                        $('input[name="prop_city"]').val(state);
                        $("#prop_city").prop('disabled', false);
                        $('#prop_city').trigger("reset"); 
                    }

                    if(county.length >1){
                        $('input[name="prop_county"]').val(county);
                        $("#prop_county").prop('disabled', false);

                    }else{
                        $('input[name="prop_county"]').val(county);
                        $("#prop_county").prop('disabled', false);
                        $('#prop_county').trigger("reset"); 
                    }

                    if(state_id.length >1){
                        $("#prop_state").val(state_id);
                        $("#prop_state").prop('disabled', false);
                    }else{
                        $("#prop_state").prop('disabled', false);
                        $('#prop_state').trigger("reset"); 
                    }
                   

                }else{
                    $("#prop_zip").prop('disabled', false);
                    $("#prop_city").prop('disabled', false);
                    $("#prop_county").prop('disabled', false);
                    $("#prop_state").prop('disabled', false);
                    $('#prop_zip').trigger("reset");                
                    $('#prop_city').trigger("reset");                
                    $('#prop_county').trigger("reset");
                    $('#prop_state').trigger("reset");   
                }

            }
        }
    });
         
    }
});
</script>        

<script>
$('head').append('<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">');
</script>   
<script src="js/jquery_acomplete.min.js"></script>

<script>
 var countries = [<?php
            $query_fetch_client = "SELECT * FROM client WHERE client_is_delete IS NULL AND is_approve = 1";
            $run_fetch_client = mysqli_query($conn, $query_fetch_client);
            if(mysqli_num_rows($run_fetch_client)>0){
                while($row_fetch_client = mysqli_fetch_array($run_fetch_client)){
                    $client_id = $row_fetch_client['client_id'];
                    $client_alias = $row_fetch_client['client_alias'];
                    $client_name = $row_fetch_client['client_name'];
            ?>{ value: '<?php echo $client_alias . ' - '. $client_name;?>', data: '<?php echo $client_id;?>' },<?php
            }}
            ?>];

$('#new_bid_client_name1').autocomplete({
    lookup: countries,
    onSelect:function (suggestion){
        var val1 = suggestion.data;

document.getElementById("new_bid_client_name").value = val1; 
  if(typeof(val1) != 'undefined' || val1 != null){ 
    var elemxxxq = document.querySelector('#new_bid_wo');
        
        elemxxxq.style.display = 'none';
      
    var data33 = '';
         $("#new_bid_if_add").html(data33);   
        $.ajax({
        type: "POST",
        url: "get_new_bid_client_prop.php",
        data:'cl_id='+val1,
        success: function(data){
            $("#new_bid_prop_column").html(data);
        }
        });
    }  
}
});
 </script> 

<script>  

$('#addVendorModal').click(function(e)
{
    e.preventDefault();   
    $('#vendorModal').modal('show');
});

$(function(){
    $('#fileToUpload1').on('change', function (){
        $("#vendor-alert-warning").fadeIn(); 
        $("#vendor-alert-success").fadeOut();
        $("#vendor-alert").fadeOut();
        var data = new FormData();
        var price_list = document.getElementById('price_list1').value;
        //Form data
        var form_data = $('#bid_item_excel').serializeArray();
        $.each(form_data, function (key, input) {
            data.append(input.name, input.value);
        });
        data.append('price_list', price_list);

        //File data
        var file_data = $('input[name="fileToUpload1"]')[0].files;
        for (var i = 0; i < file_data.length; i++) {
            data.append("fileToUpload1[]", file_data[i]);
        }
      
        $.ajax({
            url: "bid-item-import-adata.php?upload_xl_bid_item=",
            type: "POST",
            data:  data,
            contentType: false,
            cache: false,
            processData:false,
            success: function(data){
                document.getElementById('fileToUpload1').value = "";
                document.getElementById('price_list').value = "";

                var data = data.trim();
                var data_response = JSON.parse(data);
                var status = data_response.status;
                if(status == 'price_list_not_set'){
                    $("#danger_text").html("You have not selected price list to upload the items.").fadeIn();
                    $("#vendor-alert").fadeIn();
                    
                }else if(status == 'Invalid_Excel_Format'){
                    $("#danger_text").html("The excel you uploaded is of incorrect format.").fadeIn();
                    $("#vendor-alert").fadeIn();                   
                }else if(status == 'yes'){
                    var mess = data_response.mess;
                    var err = data_response.err;
                    var succ = data_response.succ;  
                    if(mess == 'err'){
                        $("#danger_text").html(err).fadeIn();
                        $("#vendor-alert").fadeIn(); 
                    }else if(mess == 'succ'){                         
                        $("#danger_text1").html(succ).fadeIn();
                        $("#vendor-alert-success").fadeIn();   
                    } else if(mess == 'both'){
                        $("#danger_text").html(err).fadeIn();
                        $("#vendor-alert").fadeIn();  
                        $("#danger_text1").html(succ).fadeIn();
                        $("#vendor-alert-success").fadeIn();   
                    }  
                }
                $("#vendor-alert-warning").fadeOut();   

            }          
        });

    });
});
$('#vendorModal').on('hidden.bs.modal', function () {
 location.reload();
})

$(function(){
    $('#fileToUpload_vendor').on('change', function (){
        $("#vendor-alert-warning").fadeIn(); 
        $("#vendor-alert-success").fadeOut();
        $("#vendor-alert").fadeOut();
        var data = new FormData();
        //Form data
        var form_data = $('#bid_item_excel').serializeArray();
        $.each(form_data, function (key, input) {
            data.append(input.name, input.value);
        });       
        //File data
        var file_data = $('input[name="fileToUpload_vendor"]')[0].files;
        for (var i = 0; i < file_data.length; i++) {
            data.append("fileToUpload_vendor[]", file_data[i]);
        }
      
        $.ajax({
            url: "vendor-import-adata.php?upload_xl_vendor=",
            type: "POST",
            data:  data,
            contentType: false,
            cache: false,
            processData:false,
            success: function(data){
                document.getElementById('fileToUpload_vendor').value = "";
                var data = data.trim();
                var data_response = JSON.parse(data);
                var status = data_response.status;
                if(status == 'Invalid_Excel_Format'){
                    $("#danger_text").html("The excel you uploaded is of incorrect format.").fadeIn();
                    $("#vendor-alert").fadeIn();                   
                }else if(status == 'yes'){
                    var mess = data_response.mess;
                    var err = data_response.err;
                    var succ = data_response.succ;  
                    if(mess == 'err'){
                        $("#danger_text").html(err).fadeIn();
                        $("#vendor-alert").fadeIn(); 
                    }else if(mess == 'succ'){                         
                        $("#danger_text1").html(succ).fadeIn();
                        $("#vendor-alert-success").fadeIn();   
                    } else if(mess == 'both'){
                        $("#danger_text").html(err).fadeIn();
                        $("#vendor-alert").fadeIn();  
                        $("#danger_text1").html(succ).fadeIn();
                        $("#vendor-alert-success").fadeIn();   
                    }  
                }
                $("#vendor-alert-warning").fadeOut(); 
            }          
        });

    });
});
</script>


<script>
 var lists = [{ value: 'MAPS', data: '0' },<?php
 $query_fetch_list = "SELECT * FROM client WHERE is_list = 1";
 $run_fetch_list = mysqli_query($conn, $query_fetch_list);
 if(mysqli_num_rows($run_fetch_list)>0){
 while($row_fetch_list = mysqli_fetch_array($run_fetch_list)){
 $client_id = $row_fetch_list['client_id'];
 $client_name = $row_fetch_list['client_name'];
 ?>{ value: '<?php echo $client_name;?>', data: '<?php echo $client_id;?>' },<?php
 }}
 ?>];

$('#price_list').autocomplete({
        
        lookup: lists,
        onSelect:function (suggestion){
        var val1 = suggestion.value;  
        var val2 = suggestion.data;        
      
        document.getElementById('price_list').value = val1; 
        document.getElementById('price_list1').value = val2; 

        }
    });

</script>
<link href="css/datepicker.css" rel="stylesheet" type="text/css" />
<script src="js/datepicker.js"></script>
<script>
var datefield = document.createElement("input");

datefield.setAttribute("type", "date");
if (datefield.type != "date"){   
    $('input[id$=staff_date]').datepicker({
        dateFormat: 'yy-mm-dd'
    });
} 
</script>

            <?php include_once "search_footer.php" ?>
          

</body>
</html>