 <?php
include 'header.php';
 ?>
  <!-- Content Wrapper. Contains page content -->

    <!-- /.content-header -->

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- Small boxes (Stat box) -->
   
        <!-- /.row -->
        <!-- Main row -->
        <div class="row">
          
         <div class="col-md-12">
            <!-- general form elements -->
            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Create New Order</h3>
              </div>
           
                         <!-- /.card-header -->
               <form role="form" action="response.php" method="POST">
              <!-- form start -->
                <div class="card-body">
                 <div class="form-group">
                  <label for="exampleInputEmail1">Amount</label>
                  
                  <input type="text" class="form-control amount" name="amount" placeholder="Enter Amount">
                </div>
                <div class="form-group">
                  <label for="exampleInputEmail1">Select Payment Method</label>
                  <select class="form-control paymentSelect" name="websitename">
                    <option value="">Select Payment Method</option>
                    <?php 
                      echo $query = "select distinct(shortname),websitename from new_invoice";
                      $result = mysqli_query($con,$query);
                      while($row = mysqli_fetch_assoc($result)){
                    ?>
                      <option value="<?php echo $row['shortname']?>"><?php echo $row['websitename']?></option>
                      
                       <?php
                     }
                       ?>
                  </select>
                </div>
              
                <div class="form-group">
                  <label for="exampleInputPassword1">Link</label>
                  <textarea class="form-control link" disabled></textarea>
                  <span class="btn btn-info btn-sm pull-right copy" style="display: none">Copy Link</span>
                </div>
                    <div class="card-body">
                 <div class="form-group">
                  <label for="exampleInputEmail1">Email</label>
                  
                  <input type="text" class="form-control" name="email" placeholder="Enter Amount">
                </div>
                </div>
                <!-- /.card-body -->

                <div class="card-footer">
                    
                  <button type="submit" class="btn btn-primary pull-right" name="pay_link">Save Payment link</button>
                </div>
              </form>
            </div>
            <!-- /.card -->

          </div>
        </div>
        
        <!-- /.row (main row) -->
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
 <?php
include 'footer.php';
 ?>
<script type="text/javascript">

  $(document).ready(function(){
     $(function () {
            
          $('#example2').DataTable({
            "paging": true,
            "lengthChange": true,
            "searching": true,
            "ordering": true,
            "order":[[4,"desc"]],
            "info": true,
            "autoWidth": true
          });
        });
  })
</script>
 <script>
 $(document).ready(function(){
   $(".paymentSelect").change(function(){
    var method = $(this).val();
    var amount = $('.amount').val();
    var invoice_id = $(this).val();
    var date = "<?php echo date('Y-m-d-Hi-s')?>";
    var invoice = invoice_id+"-"+date;
  
       var link = 'http://zeeshsoft.com/ipaybankafl/index.php?invoice_id='+invoice+'&&amount='+amount;
     
      $(".link").val(link);
    
    $('.copy').css("display","block");
   })




 })


$('.copy').click(function(){
    $('.link').select();      
    document.execCommand("copy");
});
 </script>