<?php 
include_once("header-footer/header.php")
?>

<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>

 

 <script>
  
  function agChnagege(val)
  {
		 
		location.href = "Mywokexp.php?AgId="+val;
  }
  
  $( function() 
  {
    $( "#datepicker" ).datepicker({
			changeMonth: true,
			changeYear: true,
			yearRange: "1930:2050"
			});
    $( "#datepicker1" ).datepicker({
			changeMonth: true,
			changeYear: true,
			yearRange: "1930:2050"
			});
    $( "#Extention" ).datepicker({
			changeMonth: true,
			changeYear: true,
			yearRange: "1930:2050"
			});
    $( "#timeLimit" ).datepicker({
			changeMonth: true,
			changeYear: true,
			yearRange: "1930:2050"
			});
    $( "#basicIndices" ).datepicker({
			changeMonth: true,
			changeYear: true,
			yearRange: "1930:2050"
			});
    $( "#dateOFcompetition" ).datepicker({
			changeMonth: true,
			changeYear: true,
			yearRange: "1930:2050"
			});
  } );
  
  </script>
<script>
        $(document).ready(function()
        {   
             //// if( ($(window).width()) > 599) 
             //window.location.href  = URL+'/error/default.php';
          
		 
		 
		  
			$("#datepicker").change(function()
			{ 	  
						
						var text = $("#datepicker").val();
						var myArray = text.split("/");

						var mydate = new Date($("#datepicker").val());
						var month = ["January", "February", "March", "April", "May", "June",
						"July", "August", "September", "October", "November", "December"][mydate.getMonth()];
						var str = month + ' ' + mydate.getFullYear();
						
						var basicIndices = month+" "+myArray[2];
						$("#basicIndices").val(basicIndices); 
					
			}); 

			
        	$("#_frm").validate({
        		
        		errorElement:'div',
        		rules:{ 
        		    
        		    
        		    Title:{
        				required:true,
        				maxlength:300,
        				minlength:3 
        			}, 
        			AggNo:{
        				required:true 
        			},
        			workOrder:{
        				required:true 
        			}, 
        			workcomm:{
        				required:true 
        			},
        			cost:{
        				required:true,
        				maxlength:10,
        			} 
        			
        		},
        		messages:{
                   
        			Title:{
        				required:"Enter project title",
        				maxlength:"Maximum  300 charaters allow",
        				minlength:"Minimum 3 charaters required"  
        			},
        			AggNo:{
        				required:"Enter agreement no "
        			},
        			workOrder:{
        				required:"Select date of work order "
        			},
        			workcomm:{
        				required:"Select date : order of commencement  "
        			},
        			cost:{
        				required:"Enter project cost",
    					maxlength:"Maximum  19 digits allow",
        			}      
        			 
        		}
        	}); 
        }); 
        </script>
        
        <style>
          .FormRegister
          {
              border: 1px solid #c2c2c2;
              margin: 1px;
              border-radius: 3px;
          }
        </style>
        
    	<link href="<?php echo ROOTPATH;?>/view/css/screen-600.css" rel="stylesheet" type="text/css">
               <?php 
	    include_once(ABS_PATH."/menu.php");
	?> 
               
                <div class="container mt-35">
                    <div class="row justify-content-center FormRegister">
                            <div class="col-12 p-3 text-center"> 
                                    <h5 class="card-title">  <?php if(isset($_SESSION['tenderSdd'])) echo $_SESSION['tenderSdd']; else echo "Tender Information";?> </h5> 
									<a  class="btn btn-primary mb-2" href="addAgency.php"> Add New Agency</a>  
									<a  class="btn btn-primary mb-2" href="editaddAgency.php?AgId=<?php echo  $_REQUEST['AgId'];?>">   Edit Agency  </a>  
									<?php 
										if($_REQUEST['AgId']!='') 
										{
									?>
									<marquee>  <a  class="btn btn-danger mb-2" href="#">  SELECTED  AGENCY  : <?php echo $pw__newage->name;?>   </a> </marquee>
									<?php } ?>
                            </div>    
                                  <form method="post" autocomplete="off" id="_frm">   
                                            <div class="row">   
													
													<div class="col-md-12 mb-1">  
                                                        <select  class="form-control"  name="agency" onchange="agChnagege(this.value)" required>
                                                            <option value="">Select Agency</option>
															<?php 
																	$stmt=$conn->prepare("select * from pw__newage");   
																	//$stmt->bindValue(':agency', $_POST['agency'] , PDO::PARAM_STR);  
																	$stmt->execute();    
																	$neAgen = $stmt->fetchAll(PDO::FETCH_OBJ); 
																	
																	foreach($neAgen as $asmm)
																	{
															?>
                                                            <option value="<?php echo $asmm->id;?>" <?php if($_REQUEST['AgId']==$asmm->id) echo "Selected";?>> <?php echo $asmm->name;?>  </option> 
															<?php  } ?>                                                    
                                                        </select> 
                                                    </div> 
                                                    
													
													<?php 
													if($_REQUEST['AgId']!='') 
													{
													?>  
														<div class="col-md-12 mb-1">  
														 <select  class="form-control"  name="shortName"   >
                                                            <option value="">Select Short Name</option>
															<?php 
																	$stmt=$conn->prepare("select shortName,id from MyWorks where agency=:agency");   
																	$stmt->bindValue(':agency', $_REQUEST['AgId'] , PDO::PARAM_STR);  
																	$stmt->execute();    
																	$neAgen = $stmt->fetchAll(PDO::FETCH_OBJ); 
																	
																	foreach($neAgen as $asmm)
																	{
															?>
                                                            <option value="<?php echo $asmm->id;?>"> <?php echo $asmm->shortName;?>  </option> 
															<?php  } ?>                                                    
                                                        </select> 
														</div>
														
														<div class="col-md-12 mb-1">  
														 <select  class="form-control"  name="randomNo"  >
                                                            <option value="">Select Random No</option>
															<?php 
																	$stmt=$conn->prepare("select randNo,id from MyWorks where agency=:agency");   
																	$stmt->bindValue(':agency', $_REQUEST['AgId'] , PDO::PARAM_STR);  
																	$stmt->execute();    
																	$neAgen = $stmt->fetchAll(PDO::FETCH_OBJ); 
																	
																	foreach($neAgen as $asmm)
																	{															
															?>
                                                           <option value="<?php echo $asmm->randNo;?>"> <?php echo $asmm->randNo;?>  </option> 
															<?php  } ?>                                                    
                                                        </select> 
														</div>
													<?php 
													}
													?>
												 
                                                    
                                                    <div class="col-md-12 text-center">
        										    	<input  type="submit" class="btn btn-primary mb-2" name="submitAgency" value="Add Agency Profile" > 
        										    	<input  type="submit" class="btn btn-primary mb-2" name="submitLogin" value="Continue Billing" > 
        										    	<input  type="submit" class="btn btn-primary mb-2" name="submitReport" value="View Report" > 
        										    </div> 
        										    
                                            </div>  
                                    </form>  
                    </div>       
                </div>
				
				
				
			 
				   
				
				 
<?php 
unset($_SESSION['tenderSdd']);
include_once("header-footer/footer.php");

?> 