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

/**
 * HTML Template: Withdraw Request Email
 *
 * Sent to the admin when a new withdrawal request is submitted.
 *
 * @var string   $email_heading
 * @var string   $withdrawal_id
 * @var string   $withdrawal_amount
 * @var string   $freelancer_label
 * @var string   $withdrawal_date
 * @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 bool     $sent_to_admin
 * @var bool     $plain_text
 * @var WC_Email $email
 */
// 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 echo esc_html__( 'Hello,', 'gigneo' ); ?>
			</p>

			<!-- Introduction -->
			<p style="margin: 0 0 30px 0;">
				<?php echo esc_html__( 'A new withdrawal request has been submitted and is awaiting your review. The details are outlined below.', 'gigneo' ); ?>
			</p>

			<!-- Section heading -->
			<h3 style="margin: 0 0 15px 0;">
				<?php echo esc_html__( 'Request 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>

				<!-- Freelancer name dynamic label -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html( $freelancer_label ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo esc_html( $profile_name ); ?>
					</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>

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

			<!-- 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( admin_url( 'edit.php?post_type=gigneo_withdrawal' ) ); ?>" target="_blank" rel="noopener">
							<?php echo esc_html__( 'Review request', 'gigneo' ); ?> &rarr;
						</a>
					</td>
				</tr>
			</table>

			<!-- Closing note -->
			<p style="margin: 0 0 10px 0;">
				<?php echo esc_html__( 'Please log in to your admin dashboard to review and process this withdrawal request.', 'gigneo' ); ?>
			</p>

		</td>
	</tr>
</table>

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