<?php
/**
 * Store Credit UI template
 *
 * This template is used to display the store credit balance and apply/remove buttons on the cart and checkout pages.
 *
 * @package Unlock-Addons-for-Elementor
 */

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}
?>

<div class="unlockafe-store-credit-container woocommerce-info">
    <p>
        <?php
        printf(
            // Translators: %s is the formatted credit balance.
            esc_html__('Your available store credit is %s.', 'unlock-addons-for-elementor'),
            wp_kses_post(wc_price($balance))
        );
        ?>
    </p>

    <?php if ($credit_applied > 0) : ?>
        <p class="unlockafe-credit-applied-message">
            <?php
            printf(
                // Translators: %s is the formatted credit amount applied.
                esc_html__('%s of your credit has been applied to this order.', 'unlock-addons-for-elementor'),
                wp_kses_post(wc_price($credit_applied))
            );
            ?>
        </p>
        <button type="button" class="button" id="unlockafe-remove-store-credit"><?php esc_html_e('Remove Credit', 'unlock-addons-for-elementor'); ?></button>
    <?php else : ?>
        <button type="button" class="button" id="unlockafe-apply-store-credit"><?php esc_html_e('Apply Store Credit', 'unlock-addons-for-elementor'); ?></button>
    <?php endif; ?>
    <div class="unlockafe-store-credit-notice" style="display:none;"></div>
</div>
