<?php include("conn.php");?>
<?php include("common/head.php");?>
<?php
 if(isset($_POST["employee_ids"]))  
 {  
      $data=$_POST['employee_ids'];
      $page=$_POST['page'];
  
      $sql = "SELECT * FROM orders_details WHERE orderid = '".$_POST["employee_ids"]."'";  
      $result = mysqli_query($conn, $sql);  
      while ($row=mysqli_fetch_array($result)) {
        $data=$row['orderid'];
        $contact=$row['contact'];
        $customer_name=$row['costomer_name'];
        $price=$row['amount'];
        $status=$row['status'];
        $date=$row['date'];
        $payment_status=$row['payment_status'];
        $payment_method=$row['payment_method'];
        $total=$row['amount'];

        $data_encode=base64_encode($data);

       if ($payment_status==1) {
        $payment_text='Payment confirmed';
        $radio='none';
       }
       else {
        $payment_text='Confirm the payment of';
        $radio='block';
       }


        $real_id=substr($data,-2);
     $ord = sprintf('%03d',$real_id);   

      }}



?>
<div class="activate-itme  m-5">
  <h4 class="text-center">Delivery Confirmation</h4>
  <h6>Are you to confirm this delivery #<?php echo $ord ?>?</h6>
     <form   method="post" class="text-dark">
                <div class="form-group">
                  <label for="exampleFormControlInput1">Customer Name</label>
                  <input type="text" class="form-control" name="name" id="exampleFormControlInput1" value="<?php echo $customer_name?>"  disabled>
                  <input type="hidden" name="by" value="<?php echo $by ?>">
                  <input type="hidden" name="payment_status" value="<?php echo $payment_status ?>">
                </div>
  
                <div class="form-group">
                  <label for="exampleFormControlInput1"><?php echo $payment_text?>: </label>
                  <input type="text" class="form-control" value="<?php echo 'GHC'."".number_format($price,2)?>" name="price" id="exampleFormControlInput1" disabled>

                  <div style="display:<?php echo $radio?>" class="radio">
                  <div class="form-check form-check-inline">
  <input class="form-check-input" type="radio" name="payment" id="inlineRadio1" value="yes">
  <label class="form-check-label" for="inlineRadio1">Yes</label>
</div>
<div class="form-check form-check-inline">
  <input class="form-check-input" type="radio" name="payment" id="inlineRadio2" value="no" checked>
  <label class="form-check-label" for="inlineRadio2">No</label>
</div>
                  </div>
  


                </div>

                
                <input type="hidden" name="id" value="<?php echo $data_encode ?>">
                <input type="hidden" name="date" value="<?php echo date("F j, Y") ?>">
                
                  <button class="btn btn-success btn-sm"  name="submits">Confirm Delivery</button>
        <a href="<?php echo $page ?>" class=" btn btn-secondary btn-sm m-2">Cancel</a>
    </form>


     </div>
