<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>
<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;
}
input[type="date"],input[type="text"]
{
    width:100%;
}
    @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 ><?php include "navbar.php"?></div>
    <div id="fullbody"> 

<div id="content">
<br>
<h3>Edit Credit</h3>
<br>
<!-- entry for edit  -->
<?php 
$code = $_GET['code'];
$crcedit=mysqli_query($connect,"select * from cash_handling where code='$code'&& status!='deleted'");
while($crc_dis = mysqli_fetch_array($crcedit))
{
?>
<form action="update_cashhandling.php" method="post">
            <!--  -->
    <!-- entry for edit  -->    
    <div class="row">
                  <div class="col-sm-1"></div>
                  <div class="col-sm-2"><label>Code</label></div>
                  <div class="col-sm-3"><input type="text" class="required" name="code" value="<?php echo $code ?>" placeholder="Enter Code" readonly></div>
              </div><br>
              <div class="row">
                  <div class="col-sm-1"></div>
                  <div class="col-sm-2"><label>Date</label></div>
                  <div class="col-sm-3"><input type="date" class="required" placeholder="Enter Date" name="date" value="<?php echo $crc_dis['date']?>"><input type="hidden" class="required" placeholder="Enter Date" name="time" value="<?php echo $crc_dis['time']?>"></div>
                  <div class="col-sm-2"><label>Given To</label></div>
                  <div class="col-sm-3">
                <!--  <input type="text" class="required" placeholder="Enter Name" name="givento" id="givento" value="<?php echo $crc_dis['givento']?>" >-->
                <select type="text" class="required"  name="givento" id="givento" >
                  <option value="<?php echo $crc_dis['givento']?>"><?php echo $crc_dis['givento']?></option>
                  <option>To Bank</option>
                  <option>To Management</option>
                  <option>Office Expence</option>
                 <!-- <option>Salary Advance</option>-->
                </select>
                </div>
  </div><br>
              <div class="row">
                  <div class="col-sm-1"></div>
                  <div class="col-sm-2"><label>Given By</label></div>
                  <div class="col-sm-3"><input type="text" class="required" placeholder="Enter Name" name="givenby" id="givenby" value="<?php echo $crc_dis['givenby']?>"></div>
                  <div class="col-sm-2"><label>Given Amount</label></div>
                  <div class="col-sm-3"><input type="number" class="required" placeholder="Enter Amount" name="given_amount" id="given_amount" value="<?php echo $crc_dis['given_amount']?>"></div>
              </div><br>
            
              
             <div class="row">
                  <div class="col-sm-1"></div>
                 
                  <div class="col-sm-2"><label>Remark</label></div>
                  <div class="col-sm-8"><input type="text" class="required" placeholder="Enter Remarks" name="remark"value="<?php echo $crc_dis['remark']?>"><input type="hidden"  placeholder="Enter Remarks" name="financialyear"value="<?php echo $crc_dis['financialyear']?>"></div>
              </div><br>       
              <input type="button"  class="btn btn-success" id="ValidationButton" value="Submit" >
          <input type="hidden" id="submitButton"  class="btn btn-success" data-toggle="modal" data-target="#addpro" value="Add" >
        </div>
<!-- entry for edit -->
        </div>
        
        <!-- Modal footer -->
      
         
       
        
<div class="modal fade" id="addpro">
    <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> Credit Have Been Updated Successfully</span>
        </div>
        
        <!-- Modal footer -->
        <div class="modal-footer">
          <button type="submit" type="button" class="btn btn-warning editsubmit" ><span class="spinner-border spinner-border-sm subspin2" data-dismiss="modal"></span>Ok</button>
        </div>
        
      </div>
    </div>
  </div>
  
<!-- modal for add -->
                  </form>
  <?php 
}
?>
<!-- modal for edit -->
</div>
  <!-- alert -->

<button type="button" class="btn btn-primary" id="alertPending" data-toggle="modal" data-target="#pendingLimit" style="display:none">
      </button>

  <!-- The Modal -->
  <div class="modal fade" id="pendingLimit">
    <div class="modal-dialog modal-lg">
     <div class="alert alert-danger alert-dismissible fade show">
    <button type="button" class="close"  data-dismiss="alert">&times;</button>
    <strong>Amount Exceeds</strong>
  </div>
  </div>
  </div>
        
<!-- alert -->

<script> 
    $('.selectpro').select2({ width: '100%',height:'420px;' });
    
</script>
<script>
  $(document).ready(function(){
    //$("#showcredit").hide();
    $(".subspin").hide();
    $(".subspin2").hide();
$(".addsubmit").click(function(){
$(".subspin").show();
});
$(".editsubmit").click(function(){
$(".subspin2").show();
//$(".subspin2").hide();
});
  });
</script>

<script src="js/editcredit.js"></script>
<script src="restriction/credit.js"></script>
</body>
</html>