<!-- CONTENT -->
<section class="Content R">

   <?php $points = isset($_POST['points']) ? (int)$_POST['points'] : null; isset($_POST['points']) ? query("INSERT INTO orders (user_id, paypal, points, amount, fee, status, date_created) VALUES ('{$user_id}', '{$u['email']}', '{$points}', 0.00, 0.00, 'Pending', '{$t}')") : null; ?>
   <?php $id = isset($_GET['id']) ? (int)$_GET['id'] : fetch_record("SELECT id FROM orders WHERE user_id = '{$user_id}' ORDER BY id DESC LIMIT 1"); ?>
   <?php $points = fetch_record("SELECT points FROM orders WHERE id = '{$id}' LIMIT 1"); ?>

   <!-- TABLE -->
   <section class="Table">

      <div class="row">
         <span class="date">Field</span>
         <span class="data"></span>
         <span class="data"></span>
         <span class="data">Value</span>
      </div>
      
      <div class="row">
         <span class="date">Balance:</span>
         <span class="data"></span>
         <span class="data"></span>
         <span class="data"><?php echo comma_number($u['points']); ?> Points</span>
      </div>

      <div class="row">
         <span class="date">Order:</span>
         <span class="data"></span>
         <span class="data"></span>
         <span class="data"><?php echo comma_number($points); ?> Points</span>
      </div>

      <div class="row">
         <span class="date">Unit Price:</span>
         <span class="data"></span>
         <span class="data"></span>
         <span class="data">$<?php echo decimal_number($set['point_price']); ?></span>
      </div>

      <div class="row">
         <span class="date">Total:</span>
         <span class="data"></span>
         <span class="data"></span>
         <span class="data">$<?php echo decimal_number($set['point_price'] * $points); ?></span>
      </div>

      <div class="row">
         <span class="date">Currency:</span>
         <span class="data"></span>
         <span class="data"></span>
         <span class="data">USD</span>
      </div>

      <div class="row" style="margin-bottom: 50px">
         <span class="date">Payment Method:</span>
         <span class="data"></span>
         <span class="data"></span>
         <span class="data">PayPal</span>
      </div>

   </section>
   <!-- TABLE -->

   <!-- FORM -->
   <form action="https://www.paypal.com/cgi-bin/webscr" class="Form" method="POST" name="_cart">
   
      <input type="hidden" name="cmd" value="_cart" />
      <input type="hidden" name="upload" value="1" />
      <input type="hidden" name="business" value="<?php echo $set['paypal'] ?>" />
      <input type="hidden" name="currency_code" value="USD" />
      <input type="hidden" name="item_name_1" value="<?php echo $set['website_name']; ?> Points" />
      <input type="hidden" name="amount_1" id="Amount" value="<?php echo decimal_number($set['point_price'] * $points); ?>" />
      <input type="hidden" name="custom" value="<?php echo $id; ?>" />
      <input type="hidden" name="return" value="<?php echo URL; ?>dashboard/listings" />
      <input type='hidden' name='notify_url' value='<?php echo URL; ?>ex/ipn.php'>
      <input type="hidden" name="cancel_return" value="<?php echo URL; ?>dashboard/orders" />
   
      <div class="submit">
         <input type="submit" value="Place Order">
      </div>

   </form>
   <!-- FORM -->

</section>
<!-- CONTENT -->