<?php
/**
 * PW Rewards Order Details
 *
 * Shows the rewards information on the order details area.
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/order/reward-order-details.php.
 *
 * HOWEVER, on occasion Pimwick will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see https://woocommerce.com/document/template-structure/
 */

defined( 'ABSPATH' ) or exit;

do_action( 'pwlpar_order_details_before_rewards_table', $order );

?>
<h2 class="woocommerce-column__title">
    <?php echo esc_html( pwlpar_program_name() ); ?>
</h2>
<?php foreach ( $points_by_status as $status => $points ) : ?>
    <div class="pwlpar-order-details-paragraph">
        <?php esc_html_e( 'Points earned with this order', 'pw-loyalty-points-and-rewards-for-woocommerce' ); ?>
        <p>
            <strong><?php
                echo esc_html( pwlpar_format_points( $points ) );

                if ( $status != 'active' ) {
                    echo esc_html( " ($status)" );
                }
            ?></strong>
        </p>
    </div>
<?php endforeach; ?>
<div class="pwlpar-order-details-paragraph">
    <?php esc_html_e( 'Current points balance', 'pw-loyalty-points-and-rewards-for-woocommerce' ); ?>
    <p>
        <strong><?php echo esc_html( pwlpar_get_member_point_balance( $order->get_user_id( 'edit' ), true ) ); ?></strong>
    </p>
</div>
<?php

do_action( 'pwlpar_order_details_after_rewards_table', $order );
