<script>
<!-- Editable table-->
	 $(function () { 
	$("td").dblclick(function () {
	 var OriginalContent = $(this).text();
	  $(this).addClass("cellEditing");
	   $(this).html("<input type='text' value='" + OriginalContent + "' />");
	    $(this).children().first().focus(); 
	    $(this).children().first().keypress(function (e) { 
	    	if (e.which == 13) {
	    	 var newContent = $(this).val();
	    	  $(this).parent().text(newContent); 
	    	  $(this).parent().removeClass("cellEditing");
	    	   } });
	    	    $(this).children().first().blur(function(){
	    	     $(this).parent().text(OriginalContent);
	    	      $(this).parent().removeClass("cellEditing");
	    	       });
	    	        });
	    	         });
</script>
<style>
            .table-bordered>thead>tr>th, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>tbody>tr>td, .table-bordered>tfoot>tr>td {border: 1px solid #333;}
			
            </style>
<div class="content-wrapper">
      <?php
                      $attributes = array('class' => 'form-label-left RequisitionList ','name'  => 'RequisitionList','id'  => 'RequisitionList','method'  => 'post','role'  => 'form'  );
                        
                        echo form_open($this->config->base_url().'purchaseorderform/purchaseorder',$attributes); ?>
 
	 <section class="content">
	  
	 <div>
         <center><b><h2>Requisition List </h2></b></center>
         <div class="container-fluid">
	 <div class="row">
	   <div class="col-md-12">
	   <div class="col-md-3">
		<label>Department Name</label>
			<div>
				 <?php
				$options = array("0"=>'Select Department Name');
				//print_r(  $options);
				
				if(!empty($POType))
				{
				foreach ($SupplierName as $SID):
				  
			   
				  $options[$SID->SupplierID] =  $SID->SupplierID.' '.' - '.' '.$SID->SupplierName;

				endforeach;
				}										
	
				echo form_dropdown('SupplierID', $options,set_value('SupplierID'),'id="SupplierID"' ,'class = "form-control required"','required="true"');

				?>
				 
			</div>
		</div>
		<div class="col-md-3">
		<label>Status</label>
			<div>
				 <?php
				$options = array("0"=>'Select Status');
				//print_r(  $options);
				
				if(!empty($POType))
				{
				foreach ($SupplierName as $SID):
				  
			   
				  $options[$SID->SupplierID] =  $SID->SupplierID.' '.' - '.' '.$SID->SupplierName;

				endforeach;
				}										
	
				echo form_dropdown('SupplierID', $options,set_value('SupplierID'),'id="SupplierID"' ,'class = "form-control required"','required="true"');

				?>
				 
			</div>
		</div>
	 
		<div class="col-md-3">
		<!-- Date range -->
              <div class="form-group">
                <label>Date range:</label>

                <div class="input-group">
                  <div class="input-group-addon">
                    <i class="fa fa-calendar"></i>
                  </div>
                  <input type="text" class="form-control pull-right" id="reservation">
                </div>
                <!-- /.input group -->
              </div>
	   </div>
		 
	   </div>	 
	 </div>
         </div>
	 
          <div class="container-fluid">  
 	  <div align="right">
  
  <button type="button" class="btn btn-primary">Search</button>
  <button type="button" class="btn btn-primary">Clear</button>
  </div><br/>
  
  
     <div class="modal fade" id="myModal" role="dialog">
		<div class="modal-dialog">
	   <!-- Modal content-->
	 <form>
		  <div class="modal-content">
			<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
			  <button type="button" class="close" data-dismiss="modal">&times;</button>
			  <center><h4> Requisition Details - REQ No</h4></center>				
			</div>
			<div align="left"> 
			 
			<div class="col-md-12">
						 <div class="col-md-3">
						 <label>Req Type</label>
									<div class="form-group">
												<?php
										 $data = array('name' => 'RequestType','value' => set_value('RequestType'),'id'=>'RequestType',  'class' => 'form-control' ,'readonly' => 'true');
										echo form_input($data);
										?>   
									</div>
								</div>
						 
						  <div class="col-md-3">
						   <label>Req By</label>
									<div class="form-group">
												<?php
										 $data = array('name' => 'RequestedBy','value' => set_value('RequestedBy'),'id'=>'RequestedBy',  'class' => 'form-control' ,'readonly' => 'true');
										echo form_input($data);
										?>   
									</div>
						 </div>
						 <div class="col-md-3">
						   <label>Dep Name</label>
									<div class="form-group">
												<?php
										 $data = array('name' => 'DeptName','value' => set_value('DeptName'),'id'=>'DeptName',  'class' => 'form-control' ,'readonly' => 'true');
										echo form_input($data);
										?>   
									</div>
						 </div>
						 <div class="col-md-3">
						   <label>Desigination</label>
									<div class="form-group">
												<?php
										 $data = array('name' => 'Desigination','value' => set_value('Desigination'),'id'=>'Desigination',  'class' => 'form-control' ,'readonly' => 'true');
										echo form_input($data);
										?>   
									</div>
						 </div>
						 
						  
		 </div>
		<div class="col-md-12">
		 
						 <div class="col-md-3">
						 <label>Req Dt</label>
									<div class="form-group">
												<?php
										 $data = array('name' => 'RequisitionDt','value' => set_value('RequisitionDt'),'id'=>'RequisitionDt',  'class' => 'form-control' ,'readonly' => 'true');
										echo form_input($data);
										?>   
									</div>
								</div>
						 
						  <div class="col-md-3">
						   <label>Cost Center Name</label>
									<div class="form-group">
												<?php
										 $data = array('name' => 'CostCenterName','value' => set_value('CostCenterName'),'id'=>'CostCenterName',  'class' => 'form-control' ,'readonly' => 'true');
										echo form_input($data);
										?>   
									</div>
						 </div>
						  <div class="col-md-3">
						   <label>Avl Budget Amt</label>
									<div class="form-group">
												<?php
										 $data = array('name' => 'AvailableBudment','value' => set_value('AvailableBudment'),'id'=>'AvailableBudment',  'class' => 'form-control' ,'readonly' => 'true');
										echo form_input($data);
										?>   
									</div>
						 </div>
						 <div class="col-md-3">
						   <label>Status</label>
									<div class="form-group">
												<?php
										 $data = array('name' => 'Status','value' => set_value('Status'),'id'=>'Status',  'class' => 'form-control' ,'readonly' => 'true');
										echo form_input($data);
										?>   
									</div>
						 </div>
						  
		 </div>
		 <div class="col-md-12">
				<table class="table table-bordered" style="border:1px solid #333">
  <div align="right" style="padding-right:10px">
     
  <div class="modal fade"  role="dialog">
		
    <thead style="background-color:#fff">
      <tr>
	     
         <th>S No</th>
         <th>Item Code</th>
         <th>Item Description</th>
       <th>UOM</th>
	   <th>Quantity</th>
        
      </tr>
    </thead>
    <tbody>
      <tr>
	   
        <td> 1 </td>
        <td>R001</td>
        <td>Wasted Sand</td>
		<td>Ton</td>
		<td>100</td>
		 
      </tr>
      <tr>
	   
        <td> 2 </td>
        <td>R002</td>
        <td>Resin</td>
		 <td>Liter</td>
		<td>200</td>
      </tr>
       
    </tbody>
	
  </table>
          
		 </div>
		 
			</div>
			<div class="modal-footer">
			 
						  
								 
			 <button type="button" class="btn btn-default" value="submit">OK</button>
			 
			</div>
		  </div>
		 </form>
			 
		  </div>
	</div>
  
  
    <table class="table table-bordered  editableTable" style="border:1px solid #333">
  <div align="right" style="padding-right:10px">
     
  <div class="modal fade"  role="dialog">
		
    <thead style="background-color:#fff">
      <tr>
	    <th>Select</th>
         <th>Requisition Number</th>
         <th>Requisition Date</th>
         <th>Status</th>
		 <th>Commants</th>
       
        
      </tr>
    </thead>
    <tbody>
      <tr>
	  <td><input type="checkbox" name="chk1" id="chk1"/>&nbsp;</td>
        <td><a data-toggle="modal" data-target="#myModal"><u>REQ000001</u></a></td>
        <td>2/3/2017</td>
       <td data-name="sel">
						    <select name="status">        				        
    					        <option value="1">Pending</option>
        				        <option value="2">Approval</option>
        				        <option value="3">Reject</option>
						    </select>
						</td>
		<td>Need to get quick</td>
		 
      </tr>
      <tr>
	  <td><input type="checkbox" name="chk2" id="chk2" />&nbsp;</td>
        <td><a data-toggle="modal" data-target="#myModal"><u>REQ000001</u></a></td>
        <td>5/4/2017</td>
         <td data-name="sel">
						    <select name="status">        				        
    					        <option value="1">Pending</option>
        				        <option value="2">Approval</option>
        				        <option value="3">Reject</option>
						    </select>
						</td>
		<td>Need to get quick</td>
		 
      </tr>
      <tr>
	  <td><input type="checkbox" name="chk3" id="chk3"/>&nbsp;</td>
        <td><a data-toggle="modal" data-target="#myModal"><u>REQ000001</u></a></td>
        <td>9/4/2017</td>
         <td data-name="sel">
						    <select name="status">        				        
    					        <option value="1">Pending</option>
        				        <option value="2">Approval</option>
        				        <option value="3">Reject</option>
						    </select>
						</td>
		 <td>Need to get quick</td>
      </tr>
    </tbody>
	
  </table>
         
         
 <div align="right" style="padding-right:10px">
  <a href="<?php echo base_url(); ?>purchaseorderform/purchaseorder">
  <button type="button" class="btn btn-primary">Create PO</button></a>
 
    
  </div>
         <br>
	 </div>
         </div>
         
        </section>
</div>
<script>
var baseurl = "<?php print base_url(); ?>";
 $(".RequisitionList").submit(function(e) {
  
  
		e.preventDefault();
		
		var id = '';
		 var chk1 = $('#chk1').val();
		  var chk2 = $('#chk2').val();
		   var chk3 = $('#chk3').val();
		  if( $('#chk1').is(":checked"))
		  {
			 id = ''; 
		  }
		  else if($('#chk2').is(":checked"))
		  {
			   id = ''; 
		  }
		  else if($('#chk3').is(":checked"))
		  {
			   id = ''; 
		  }
		  // alert(chk1);
		   // alert(chk2);
			// alert(chk3);

				window.location =	baseurl +'purchaseorderform/purchaseorder';
				
			
		 });
		  //Date range picker
    $('#reservation').daterangepicker();
		 </script>
		  