<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="datatable/data.css">
<script src="datatable/data.js" type="text/javascript"></script>
<script src="datatable/table.js" type="text/javascript"></script>
<script src="datatable/datatable.js"></script>
<link rel="stylesheet" href="datatable/data-boot.css">
<link href="javascript/select2.css" rel="stylesheet" >
<script src="javascript/selectt2.js"></script>
<script src="ajax/firsttrans.js"></script>

<script src="restriction/firsttrans_restriction.js"></script>

<style>
    
    #navbar
    {
        flex:15%;
        height:100%; 
        flex-direction:row;
        overflow:auto;
        
    }
    #content
    {
        flex:90%;
        overflow:auto;
        padding-left:10px;
        padding-right:10px;
    }
    #fullbody
    {
        display:flex;
        
         height:100%;         
    }
    label
    {
      font-size:20px;
    }
    .edit
    {
        font-size:18px;
        color:green;
        cursor:pointer;
    }
    .dele
    {
        font-size:18px;
        color:red;
        cursor:pointer;
    }
    .edit:hover
    {
        font-size:20px;
        
    }
    .dele:hover
    {
        font-size:20px;
        color:red;
        cursor:pointer;
        
    }
    td
    {
      text-align:center;
    }
    th
    {
      text-align:center;
    }
    li a 
    {
      color:black;
    }
    .page-item.active .page-link {
    
    background-color:yellow;
    border-color: #007bff;
}
    @media (max-width: 800px) {
        #fullbody
    {
        display:flex;
        flex-wrap: wrap;
                 
    }
        #navbar,#content {
    flex: 100%;
  }
}
</style>
<script>
$(document).ready( function () {
    $('#protable').DataTable();
} );
</script>

</head>
<body>
    
    <div id="fullbody"> 
<div id="navbar" class="bg-info"><?php include "navbar.php"?></div>
<div id="content">
<br>
<h3>First-Transaction Edit</h3>
<br>
<!-- body -->
<!-- modal for edit -->
<?php 
$tkt = $_GET['edit'];
$proedit=mysqli_query($connect,"select *,(select customerdetails.name from customerdetails where customerdetails.code = first_transaction.customer )as cusname,(select productdetail.productname from productdetail where productdetail.productcode = first_transaction.product )as proname from first_transaction where first_transaction.status !='deleted'&& ticket = '$tkt' ");
while($fstktshowedi = mysqli_fetch_array($proedit))
{
?>

      
        <!-- Modal Header -->
      
        
        <!-- Modal body -->
        <div class="modal-body">
            <!-- entry for edit  -->
            <form action="updatefirsttrans.php" method="post">
            <div class="row">
              <div class="col-sm-2"><label>Vehicle/Ticket-no</label></div>:
              <div class="col-sm-3"><select class="form-control selectpro" id="ticketselectedit" readonly name="ticketedit" required>

              <option value="<?php echo $fstktshowedi['ticket']?>"><?php echo $fstktshowedi['vehicleno'] ?>/<?php echo $fstktshowedi['ticket']?></option>
             
              </select></div>
              <div class="col-sm-2"><label> vehicle No</label></div>:
     <div class="col-sm-3"><input type="text" class="form-control" autocomplete="off" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?> value="<?php echo $fstktshowedi['vehicleno'] ?>" name="vehiclenoedit" required></div>
            </div><br>
            <!--  -->
    
    <div class="row">
              <div class="col-sm-2"><label>Customer</label></div>:
              <div class="col-sm-3"><select class="form-control selectpro" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?>  name="customeredit">
              <option value="<?php echo $fstktshowedi['customer'];  ?>"><?php echo $fstktshowedi['cusname'];  ?></option>
              
              </select></div>
              <div class="col-sm-2"><label>vehicle-Owner</label></div>:
     <div class="col-sm-3"><input type="text" class="form-control" autocomplete="off" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?> value="<?php echo $fstktshowedi['vehiclename'];  ?>"  name="vehiclenameedit" required></div>
            </div><br>
            <!--  -->
           
    <!--  -->
    <div class="row">
              <div class="col-sm-2"><label>Material</label></div>:
              <div class="col-sm-3"><select class="form-control selectpro" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?> name="productedit" required>
              <option value="<?php echo $fstktshowedi['product'];  ?>"><?php echo $fstktshowedi['proname'];  ?></option>
              
              </select></div>
              <div class="col-sm-2"><label>Weight (Load/Empty)</label></div>:
              <div class="col-sm-3"><select class="form-control selectpro" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?> name="salestypeedit" required>
              <option><?php echo $fstktshowedi['salestype'];  ?></option>
              
                            </select></div>
            </div><br>
            <!--  -->
            

    <div class="row">
     <div class="col-sm-2"><label>Estmated Quantity</label></div>:
     <div class="col-sm-3"><input type="text" class="form-control" autocomplete="off" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?> value="<?php echo $fstktshowedi['estimatedqty'];  ?>" name="estquantityedit" required></div>
     <div class="col-sm-2"><label>Trip Sheet No</label></div>:
     <div class="col-sm-3"><input type="text" class="form-control" autocomplete="off" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?> value="<?php echo $fstktshowedi['tripsheet'];  ?>" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?> name="tripnoedit" required></div>
    </div><br>
    <!--  -->
    
    <div class="row">
     <div class="col-sm-2"><label>Remarks</label></div>:
     <div class="col-sm-3"><input type="text" class="form-control remarkedit" autocomplete="off" value="<?php echo $fstktshowedi['remark'];?>" name="remarkedit" required></div>
     <div class="col-sm-2"><label>Date & Time</label></div>:
     <div class="col-sm-3"><input type="text" class="form-control" autocomplete="off" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?>  value="<?php echo $fstktshowedi['date'];  ?>" name="dateedit"><input type="text" class="form-control" autocomplete="off" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?>  value="<?php echo $fstktshowedi['time'];  ?>" name="timeedit"></div>
    </div><br>
    <!--  -->
    
    <div class="row">
     <div class="col-sm-2"><label>Weight</label></div>:
     <div class="col-sm-3"><input type="text" class="form-control weightedit<?php echo $fstktshowedi['ticket'];  ?>" autocomplete="off"   value="<?php echo $fstktshowedi['weight'];  ?>" name="weightedit" <?php $user=$_SESSION['log']; if($user != 'admin'){ echo "readonly";} ?> required>
    </div>
     <div class="col-sm-1">
     <input type="hidden" class="form-control ticketforedit" autocomplete="off"  value="<?php echo $fstktshowedi['ticket'];  ?>" >  
     <input type="button" class="btn btn-warning weightbuttonedit" value="Get Weight" style="height:40px;"></div>
    </div><br>
    <!--  -->
    <!-- entry for edit  -->           

        </div>
        
        <!-- Modal footer -->
        <div class="modal-footer">
          <input type="button"  class="btn btn-success updatefirsttran"data-toggle="modal" data-target="#update<?php echo $fstktshowedi['ticket'] ?>" value="Update">
        </div>
        <!-- modal for add -->
<div class="modal fade" id="update<?php echo $fstktshowedi['ticket'] ?>">
    <div class="modal-dialog modal-sm">
      <div class="modal-content" style="background-color:rgba(77, 219, 106,0.9)">
      
        <!-- Modal Header -->
        
        
        <!-- Modal body -->
        <div class="modal-body">
          <span style="color:white"><i class="fas fa-check" style="font-size:24px"></i> First Transaction Have Been Updated Successfully</span>
        </div>
        
        <!-- Modal footer -->
        <div class="modal-footer">
          <input type="submit"  id="editsubmit" class="btn btn-warning" value="OK" ><span class="spinner-border spinner-border-sm subspin"></span>
        </div>

      </div>
    </div>
  </div>
  
<!-- modal for add -->
</div>
  </form>
  <?php }?>
<!-- modal for edit -->
<script>
    $('.selectpro').select2({ width: '100%',height:'420px;' });
    
</script>
<script>
  $(document).ready(function(){
    $(".subspin").hide();
    $(".subspin2").hide();
$("#addsubmit").click(function(){
$(".subspin2").show();
});
$("#editsubmit").click(function(){
$(".subspin").show();
//$(".subspin2").hide();
});
  });
</script>
<!-- body -->
</div>
<script>
    $('.selectpro').select2({ width: '100%',height:'420px;' });
    
</script>
</body>
</html>