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

/**
 * HTML Template: Withdraw Response Email
 *
 * Sent to the user when their withdrawal request is processed.
 *
 * @var string   $email_heading
 * @var WC_Email $email
 * @var string   $withdrawal_id
 * @var string   $withdrawal_status
 * @var string   $withdrawal_amount
 * @var string   $withdrawal_note
 * @var string   $withdrawal_date
 * @var string   $withdrawal_updated
 * @var string   $payment_method
 * @var string   $payout_fee
 * @var string   $fee_label
 * @var string   $net_amount
 * @var string   $payout_tax
 * @var string   $payable_amount
 * @var string   $profile_id
 * @var string   $profile_name
 * @var string   $moderator_name
 * @var string   $site_name
 * @var bool     $sent_to_admin
 * @var bool     $plain_text
 */
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
do_action( 'woocommerce_email_header', $email_heading, $email );
?>

<table role="presentation" cellspacing="0" cellpadding="0" style="width: 100%; margin: 0 auto; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;">
	<tr>
		<td style="padding: 40px 20px;">

			<!-- Greeting -->
			<p style="margin: 0 0 20px 0;">
				<?php
				printf(
					// translators: %s is the user's display name.
					esc_html__( 'Hello %s,', 'gigneo' ),
					esc_html( $profile_name )
				);
				?>
			</p>

			<!-- Introduction -->
			<p style="margin: 0 0 30px 0;">
				<?php
				printf(
					// translators: %1$s: Moderator name, %2$s: Withdrawal status.
					esc_html__( 'Your withdrawal request has been reviewed by %1$s and has been marked as %2$s. The details are outlined below.', 'gigneo' ),
					'<strong>' . esc_html( $moderator_name ) . '</strong>',
					'<strong>' . esc_html( $withdrawal_status ) . '</strong>'
				);
				?>
			</p>

			<!-- Section heading -->
			<h3 style="margin: 0 0 15px 0;">
				<?php echo esc_html__( 'Withdrawal details', 'gigneo' ); ?>
			</h3>

			<!-- Details table -->
			<table role="presentation" cellspacing="0" cellpadding="0" style="width: 100%; background: #F7F7F7; border: 1px solid #f0f0f0; border-radius: 12px; margin: 0 0 30px 0;">
				<!-- Request ID -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; width: 50%;">
						<?php echo esc_html__( 'Request ID', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo esc_html( gigneo_format_id( $withdrawal_id, 'withdraw', false ) ); ?>
					</td>
				</tr>

				<!-- Status -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html__( 'Status', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo esc_html( $withdrawal_status ); ?>
					</td>
				</tr>

				<!-- Amount requested -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html__( 'Amount requested', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo wp_kses_post( $withdrawal_amount ); ?>
					</td>
				</tr>

				<!-- Fee label -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html( $fee_label ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo wp_kses_post( $payout_fee ); ?>
					</td>
				</tr>

				<!-- Net amount -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html__( 'Net amount', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo wp_kses_post( $net_amount ); ?>
					</td>
				</tr>

				<!-- Tax deduction -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html__( 'Tax deduction', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo wp_kses_post( $payout_tax ); ?>
					</td>
				</tr>

				<!-- Payable amount -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html__( 'Payable amount', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo wp_kses_post( $payable_amount ); ?>
					</td>
				</tr>

				<!-- Payout method -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html__( 'Payout method', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo esc_html( $payment_method ); ?>
					</td>
				</tr>

				<!-- Request date -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html__( 'Request date', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo esc_html( $withdrawal_date ); ?>
					</td>
				</tr>

				<!-- Last updated -->
				<tr>
					<td style="padding: 14px 16px;">
						<?php echo esc_html__( 'Last updated', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; text-align: right;">
						<?php echo esc_html( $withdrawal_updated ); ?>
					</td>
				</tr>
			</table>

			<?php if ( ! empty( $withdrawal_note ) ) { ?>
				<!-- Admin note -->
				<h3 style=" margin: 0 0 10px 0; text-align: left;">
					<?php echo esc_html__( 'Admin note', 'gigneo' ); ?>
				</h3>
				<p style="  margin: 0 0 30px 0; background: #F7F7F7; border: 1px solid #f0f0f0; border-radius: 12px; padding: 14px 16px;">
					<?php echo wp_kses_post( nl2br( $withdrawal_note ) ); ?>
				</p>
			<?php } ?>

			<!-- CTA Button -->
			<table role="presentation" cellspacing="0" cellpadding="0" style="width: 100%; margin: 0 0 30px 0;">
				<tr>
					<td style="text-align: center; padding: 10px 0;">
						<a href="<?php echo esc_url( gigneo_dashboard_url( 'account', 'wallet' ) ); ?>" target="_blank" rel="noopener">
							<?php echo esc_html__( 'View your wallet', 'gigneo' ); ?> &rarr;
						</a>
					</td>
				</tr>
			</table>

			<!-- Closing note -->
			<p style="margin: 0 0 10px 0;">
				<?php echo esc_html__( 'All transactions can be viewed in the wallet section of your profile.', 'gigneo' ); ?>
			</p>
		</td>
	</tr>
</table>

<?php
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
do_action( 'woocommerce_email_footer', $email );
