<?php
/**
 * Default customer processing order email template.
 *
 * @package MailDoctor
 */

defined( 'ABSPATH' ) || exit;

$mail_doctor_defaults = array(
	'subject' => 'We\'ve received your order {{order_number}}',
	'heading' => 'We\'re processing your order',
	'html'    => '<div class="wpmd-email">' .
		'<div class="wpmd-email__logo">{{shop_brand}}</div>' .
		'<h1>{{heading}}</h1>' .
		'<p>Hi {{customer_name}}, thanks for shopping with {{shop_name}}. We\'re processing your order right now.</p>' .
		'<p><strong>Order number:</strong> {{order_number}}</p>' .
		'<p><strong>Placed on:</strong> {{order_date}}</p>' .
		'<p><strong>Payment method:</strong> {{payment_method}}</p>' .
		'<div class="wpmd-email__table">' .
		'{{items_table}}' .
		'</div>' .
		'<p class="wpmd-email__total"><strong>Order total:</strong> {{order_total}}</p>' .
		'<p>You can review your order any time by visiting {{site_url}}.</p>' .
		'</div>',
	'css'     => '.wpmd-email{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;padding:24px;background:#ffffff;color:#0f172a;}' .
		'.wpmd-email h1{margin-top:0;font-size:24px;color:#1d4ed8;}' .
		'.wpmd-email__logo{margin:0 0 16px;text-align:center;}' .
		'.wpmd-email__logo img{max-width:200px;height:auto;}' .
		'.wpmd-brand-text{font-weight:700;font-size:20px;color:inherit;}' .
		'.wpmd-email__table{margin:20px 0;}' .
		'.wpmd-email__total{font-size:16px;margin:16px 0;}' .
		'.wpmd-items-table{width:100%;border-collapse:collapse;}' .
		'.wpmd-items-table th{background:#eff6ff;padding:8px;text-align:left;border-bottom:1px solid #c7d2fe;}' .
		'.wpmd-items-table td{padding:8px;border-bottom:1px solid #e5e7eb;}' .
		'.wpmd-items-table tfoot th,.wpmd-items-table tfoot td{font-weight:600;background:#f8fafc;}',
);

global $mail_doctor_collecting_defaults;

if ( ! empty( $mail_doctor_collecting_defaults ) ) {
	return $mail_doctor_defaults;
}

$mail_doctor_order_id = 0;
if ( isset( $order ) && class_exists( 'WC_Order' ) && $order instanceof WC_Order ) {
	$mail_doctor_order_id = $order->get_id();
}

echo wp_kses_post(
	mail_doctor_render_email(
		'customer_processing_order',
		$mail_doctor_order_id,
		array(
			'defaults' => $mail_doctor_defaults,
		)
	)
);
