<?php
/**
 * PW Rewards Offer
 *
 * Shows an individual offer item for the rewards program.
 *
 * This template can be overridden by copying it to yourtheme/pw-rewards/offer.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' ) || exit;

do_action( 'pwlpar_before_offer' );

?>
<div class="pwlpar-offer" data-id="<?php echo esc_attr( $offer_id ); ?>">
    <div class="pwlpar-offer-details">
        <?php if ( !empty( $image_url ) ) : ?>
        <div>
            <img src="<?php echo esc_attr( $image_url ); ?>" class="pwlpar-offer-image" alt="<?php echo esc_attr( $title ); ?>">
        </div>
        <?php endif; ?>
        <div class="pwlpar-offer-info">
            <div class="pwlpar-offer-title"><?php echo wp_kses_post( $title ); ?></div>
            <div class="pwlpar-offer-description pwlpar-nl2br"><?php echo wp_kses_post( $description ); ?></div>
        </div>
        <div class="pwlpar-offer-confirm-info">
            <div class="pwlpar-offer-title"><?php esc_html_e( 'Savings await!', 'pw-loyalty-points-and-rewards-for-woocommerce' ); ?></div>
            <div class="pwlpar-offer-description"><?php esc_html_e( 'Ready to start saving? Use this reward or choose another one.', 'pw-loyalty-points-and-rewards-for-woocommerce' ); ?></div>
        </div>
    </div>
    <?php if ( $can_claim === true ) : ?>
        <div class="pwlpar-offer-claim-button pwlpar-offer-button pwlpar-button"><?php echo wp_kses_post( $button_title ); ?></div>
    <?php else : ?>
        <a href="<?php echo esc_attr( $claim_url ); ?>" class="pwlpar-offer-unavailable-button pwlpar-offer-button pwlpar-button pwlpar-button-unavailable"><?php echo wp_kses_post( $button_title ); ?></a>
    <?php endif; ?>
    <div class="pwlpar-offer-confirm-buttons">
        <a href="<?php echo esc_attr( $claim_url ); ?>" class="pwlpar-offer-confirm-button pwlpar-offer-button pwlpar-button"><?php esc_html_e( 'Confirm', 'pw-loyalty-points-and-rewards-for-woocommerce' ); ?></a>
        <div class="pwlpar-offer-claim-cancel-button pwlpar-button pwlpar-button-cancel"><?php esc_html_e( 'Cancel', 'pw-loyalty-points-and-rewards-for-woocommerce' ); ?></div>
    </div>
</div>
<?php

do_action( 'pwlpar_after_offer' );
