<?php
/**
 * WalletUpPro Payment Pending Email (HTML)
 *
 * @var WC_Order $order
 * @var string $email_heading
 * @var string $additional_content
 * @var string $payment_method
 * @var bool $sent_to_admin
 * @var bool $plain_text
 * @var WC_Email $email
 * @var string $merchant_name
 * @var string $merchant_email
 * @var string $merchant_phone
 */

defined('ABSPATH') || exit;

do_action('woocommerce_email_header', $email_heading, $email); ?>

<?php /* translators: %s: Customer first name */ ?>
<p><?php printf(esc_html__('Hi %s,', 'walletup'), esc_html($order->get_billing_first_name())); ?></p>

<p><?php esc_html_e('We have received your payment and it is currently being processed. You will receive a confirmation email once the payment is verified.', 'walletup'); ?></p>

<h2><?php
    printf(
        /* translators: %s: Order number */
        esc_html__('Order #%s', 'walletup'),
        esc_html($order->get_order_number())
    );
?></h2>

<table cellspacing="0" cellpadding="6" border="1" style="border-collapse: collapse; width: 100%; border: 1px solid #e5e5e5;">
    <tr>
        <th style="text-align: left; padding: 12px; background-color: #f8f8f8;"><?php esc_html_e('Payment Method', 'walletup'); ?></th>
        <td style="padding: 12px;"><?php echo esc_html($payment_method); ?></td>
    </tr>
    <tr>
        <th style="text-align: left; padding: 12px; background-color: #f8f8f8;"><?php esc_html_e('Order Total', 'walletup'); ?></th>
        <td style="padding: 12px;"><?php echo wp_kses_post($order->get_formatted_order_total()); ?></td>
    </tr>
    <tr>
        <th style="text-align: left; padding: 12px; background-color: #f8f8f8;"><?php esc_html_e('Status', 'walletup'); ?></th>
        <td style="padding: 12px;"><?php esc_html_e('Pending Confirmation', 'walletup'); ?></td>
    </tr>
</table>

<?php
do_action('woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email);
do_action('woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email);
do_action('woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email);
?>

<?php if (!empty($merchant_name) || !empty($merchant_email) || !empty($merchant_phone)) : ?>
<table cellspacing="0" cellpadding="6" border="1" style="border-collapse: collapse; width: 100%; border: 1px solid #e5e5e5; margin-top: 16px;">
    <tr>
        <th colspan="2" style="text-align: left; padding: 12px; background-color: #f8f8f8;"><?php esc_html_e('Merchant Contact', 'walletup'); ?></th>
    </tr>
    <?php if (!empty($merchant_name)) : ?>
    <tr>
        <th style="text-align: left; padding: 12px; background-color: #f8f8f8; width: 40%;"><?php esc_html_e('Name', 'walletup'); ?></th>
        <td style="padding: 12px;"><?php echo esc_html($merchant_name); ?></td>
    </tr>
    <?php endif; ?>
    <?php if (!empty($merchant_email)) : ?>
    <tr>
        <th style="text-align: left; padding: 12px; background-color: #f8f8f8;"><?php esc_html_e('Email', 'walletup'); ?></th>
        <td style="padding: 12px;"><a href="mailto:<?php echo esc_attr($merchant_email); ?>"><?php echo esc_html($merchant_email); ?></a></td>
    </tr>
    <?php endif; ?>
    <?php if (!empty($merchant_phone)) : ?>
    <tr>
        <th style="text-align: left; padding: 12px; background-color: #f8f8f8;"><?php esc_html_e('Phone', 'walletup'); ?></th>
        <td style="padding: 12px;"><a href="tel:<?php echo esc_attr($merchant_phone); ?>"><?php echo esc_html($merchant_phone); ?></a></td>
    </tr>
    <?php endif; ?>
</table>
<?php endif; ?>

<?php if ($additional_content) : ?>
    <p><?php echo wp_kses_post($additional_content); ?></p>
<?php endif; ?>

<?php
do_action('woocommerce_email_footer', $email);
