﻿£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
<?php
/**
 * Template Name: All Transactions
 */

get_header();

if (!is_user_logged_in()) {
    echo '<p>Please log in to view your transactions.</p>';
    get_footer();
    return;
}

$user_id = get_current_user_id();

$args = array(
    'customer' => $user_id,
    'status'   => 'any',
    'limit'    => -1
);

$orders = wc_get_orders($args);
?>

<div class="wrap">
    <h2>Your Full Transaction History</h2>
    <table style="width:100%; border-collapse: collapse;">
        <thead>
            <tr>
                <th style="text-align:left; border-bottom: 1px solid #ccc; padding:10px;">Date</th>
                <th style="text-align:left; border-bottom: 1px solid #ccc; padding:10px;">Order</th>
                <th style="text-align:left; border-bottom: 1px solid #ccc; padding:10px;">Amount</th>
                <th style="text-align:left; border-bottom: 1px solid #ccc; padding:10px;">Status</th>
            </tr>
        </thead>
        <tbody>
            <?php
            if (!empty($orders)) {
                foreach ($orders as $order) {
                    $order_date = $order->get_date_created() ? $order->get_date_created()->date('m/d/Y') : '';
                    $order_number = $order->get_order_number();
                    $amount = $order->get_total();
                    $status = $order->get_status();
                    ?>
                    <tr>
                        <td style="padding:10px;"><?php echo esc_html($order_date); ?></td>
                        <td style="padding:10px;">#<?php echo esc_html($order_number); ?></td>
                        <td style="padding:10px;">$<?php echo esc_html($amount); ?></td>
                        <td style="padding:10px;"><?php echo ucfirst($status); ?></td>
                    </tr>
                    <?php
                }
            } else {
                echo '<tr><td colspan="4">No transactions found.</td></tr>';
            }
            ?>
        </tbody>
    </table>
</div>

<?php get_footer(); ?>
