| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
use YayMail\Page\Source\CustomPostType; |
| 5 |
$sent_to_admin = ( isset( $sent_to_admin ) ? $sent_to_admin : false ); |
| 6 |
$email = ( isset( $email ) ? $email : '' ); |
| 7 |
$plain_text = ( isset( $plain_text ) ? $plain_text : '' ); |
| 8 |
$text_align = is_rtl() ? 'right' : 'left'; |
| 9 |
$postID = CustomPostType::postIDByTemplate( $this->template ); |
| 10 |
$text_link_color = get_post_meta( $postID, '_yaymail_email_textLinkColor_settings', true ) ? get_post_meta( $postID, '_yaymail_email_textLinkColor_settings', true ) : '#7f54b3'; |
| 11 |
// instructions payment |
| 12 |
$paymentGateways = wc_get_payment_gateway_by_order( $order ); |
| 13 |
$yaymail_settings = get_option( 'yaymail_settings' ); |
| 14 |
$cash_on_delivery = esc_html__( 'Cash on delivery', 'woocommerce' ); |
| 15 |
$productItemCost = isset( $yaymail_settings['product_item_cost'] ) ? $yaymail_settings['product_item_cost'] : 0; |
| 16 |
|
| 17 |
if ( ( 'customer_on_hold_order' === $this->template |
| 18 |
|| 'customer_processing_order' === $this->template |
| 19 |
|| 'customer_completed_order' === $this->template |
| 20 |
|| 'customer_refunded_order' === $this->template |
| 21 |
|| 'customer_invoice' === $this->template |
| 22 |
|| 'customer_note' === $this->template |
| 23 |
|| 'customer_partial_shipped_order' === $this->template |
| 24 |
|| 'customer_shipped_order' === $this->template ) |
| 25 |
&& 2 == $yaymail_settings['payment'] |
| 26 |
|| ( isset( $paymentGateways->method_title ) ? $cash_on_delivery == $paymentGateways->method_title : false |
| 27 |
&& 'cancelled_order' != $this->template |
| 28 |
&& 'new_order' != $this->template |
| 29 |
&& 'failed_order' != $this->template |
| 30 |
&& 'customer_new_account' != $this->template |
| 31 |
&& 'customer_reset_password' != $this->template ) |
| 32 |
) {?> |
| 33 |
|
| 34 |
<p style="text-align: <?php echo esc_attr( $text_align ); ?>; margin: 0 0 16px;" class="yaymail_builder_instructions"> |
| 35 |
<?php echo wp_kses_post( isset( $paymentGateways->instructions ) ? $paymentGateways->instructions : '', 'woocommerce' ); ?> |
| 36 |
</p> |
| 37 |
|
| 38 |
<?php } elseif ( 1 == $yaymail_settings['payment'] ) { ?> |
| 39 |
|
| 40 |
<p style="margin: 0 0 16px;" class="yaymail_builder_instructions"> |
| 41 |
<?php echo wp_kses_post( isset( $paymentGateways->instructions ) ? $paymentGateways->instructions : '', 'woocommerce' ); ?> |
| 42 |
</p> |
| 43 |
|
| 44 |
<?php |
| 45 |
} |
| 46 |
|
| 47 |
/* |
| 48 |
Our bank details |
| 49 |
payment: Direct bank transfer |
| 50 |
*/ |
| 51 |
if ( false != $paymentGateways && isset( $paymentGateways->account_details ) ) { |
| 52 |
$account_details = $paymentGateways->account_details; |
| 53 |
$texts = array( |
| 54 |
'bank_name' => 'Bank', |
| 55 |
'account_number' => 'Account number', |
| 56 |
'sort_code' => 'Sort code', |
| 57 |
'iban' => 'IBAN', |
| 58 |
'bic' => 'BIC', |
| 59 |
); |
| 60 |
$direct_bank_transfer = esc_html__( 'Direct bank transfer', 'woocommerce' ); |
| 61 |
|
| 62 |
if ( ( 'customer_on_hold_order' === $this->template |
| 63 |
|| 'customer_processing_order' === $this->template |
| 64 |
|| 'customer_completed_order' === $this->template |
| 65 |
|| 'customer_refunded_order' === $this->template |
| 66 |
|| 'customer_invoice' === $this->template |
| 67 |
|| 'customer_note' === $this->template |
| 68 |
|| 'customer_partial_shipped_order' === $this->template |
| 69 |
|| 'customer_shipped_order' === $this->template ) |
| 70 |
&& $direct_bank_transfer == $paymentGateways->method_title |
| 71 |
&& is_array( $account_details ) |
| 72 |
&& count( $account_details ) > 0 |
| 73 |
&& 1 == $yaymail_settings['payment'] |
| 74 |
) { |
| 75 |
?> |
| 76 |
|
| 77 |
<section style="text-align: ' . $text_align . '" class="yaymail_builder_wrap_account"> |
| 78 |
<h2 class="yaymail_builder_bank_details" style="color: #7f54b3;"> |
| 79 |
<?php esc_html_e( 'Our bank details', 'woocommerce' ); ?> |
| 80 |
</h2> |
| 81 |
|
| 82 |
<?php |
| 83 |
foreach ( $account_details as $accounts ) { |
| 84 |
foreach ( $accounts as $label_name => $infor_account ) { |
| 85 |
if ( 'account_name' === $label_name && ! empty( $infor_account ) ) { |
| 86 |
?> |
| 87 |
<h3 class="yaymail_builder_account_name" style="color: #7f54b3;"> |
| 88 |
<?php |
| 89 |
esc_html_e( $infor_account, 'woocommerce' ); |
| 90 |
?> |
| 91 |
</h3> |
| 92 |
<?php |
| 93 |
} |
| 94 |
} |
| 95 |
?> |
| 96 |
|
| 97 |
<ul> |
| 98 |
<?php |
| 99 |
foreach ( $accounts as $label_name => $infor_account ) { |
| 100 |
if ( 'account_name' !== $label_name && ! empty( $infor_account ) ) { |
| 101 |
?> |
| 102 |
|
| 103 |
<li><?php esc_html_e( $texts[ $label_name ], 'woocommerce' ); ?>: |
| 104 |
<strong><?php esc_html_e( $infor_account, 'woocommerce' ); ?></strong> |
| 105 |
</li> |
| 106 |
|
| 107 |
<?php |
| 108 |
} |
| 109 |
} |
| 110 |
?> |
| 111 |
</ul> |
| 112 |
|
| 113 |
<?php } ?> |
| 114 |
|
| 115 |
</section> |
| 116 |
<?php |
| 117 |
} |
| 118 |
} |
| 119 |
?> |
| 120 |
|
| 121 |
<!-- Title Table Order Items --> |
| 122 |
<?php if ( $is_display ) { ?> |
| 123 |
<div class="yaymail_builder_order" style="color: #7f54b3;font-size: 18px;font-weight: 700;"> |
| 124 |
<?php |
| 125 |
if ( $sent_to_admin ) { |
| 126 |
$before = '<a style="font-weight: normal;color: ' . esc_attr( $text_link_color ) . '" class="yaymail_builder_link" href="' . esc_url( $order->get_edit_order_url() ) . '">'; |
| 127 |
$after = '</a>'; |
| 128 |
/* translators: %s: Order ID. */ |
| 129 |
echo wp_kses_post( $before . sprintf( __( '[Order #%s]', 'woocommerce' ) . $after . ' (<time datetime="%s">%s</time>)', $order->get_order_number(), $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ) ); |
| 130 |
} else { |
| 131 |
$before = '<h2 style="font-weight: normal;' . esc_attr( $text_link_color ) . '" class="yaymail_builder_link" >'; |
| 132 |
$after = '</h2>'; |
| 133 |
/* translators: %s: Order ID. */ |
| 134 |
echo wp_kses_post( $before . sprintf( __( '[Order #%s]', 'woocommerce' ) . ' (<time datetime="%s">%s</time>)', $order->get_order_number(), $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ) . $after ); |
| 135 |
} |
| 136 |
?> |
| 137 |
</div> |
| 138 |
<?php } ?> |
| 139 |
|
| 140 |
<!-- Table Items has Border --> |
| 141 |
<table class="yaymail_builder_table_items_content yaymail-list-order-item" cellspacing="0" cellpadding="6" border="1" style="border-collapse: separate; color: #636363; border: 1px solid #e5e5e5; font-family: Helvetica,Roboto,Arial,sans-serif;" width="100%"> |
| 142 |
<thead> |
| 143 |
<tr style="word-break: normal"> |
| 144 |
<th class="td yaymail-title-item-product" scope="col" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit;"> |
| 145 |
<?php esc_html_e( 'Product', 'woocommerce' ); ?> |
| 146 |
</th> |
| 147 |
<?php if ( $productItemCost ) { ?> |
| 148 |
<th class="td yaymail_item_price_per_item" scope="col" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit;"> |
| 149 |
<?php esc_html_e( 'Quantity', 'woocommerce' ); ?> |
| 150 |
</th> |
| 151 |
<?php } ?> |
| 152 |
<th class="td yaymail-title-item-quantity" scope="col" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit;"> |
| 153 |
<?php esc_html_e( 'Quantity', 'woocommerce' ); ?> |
| 154 |
</th> |
| 155 |
<th class="td yaymail-title-item-price" scope="col" style="text-align:left; width: 30%;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit;"> |
| 156 |
<?php esc_html_e( 'Price', 'woocommerce' ); ?> |
| 157 |
</th> |
| 158 |
</tr> |
| 159 |
</thead> |
| 160 |
|
| 161 |
<tbody style="flex-direction:inherit;" > |
| 162 |
<?php |
| 163 |
echo wp_kses_post( |
| 164 |
$this->ordetItemTables( |
| 165 |
$order, |
| 166 |
array( |
| 167 |
'show_sku' => $sent_to_admin, |
| 168 |
'show_image' => false, |
| 169 |
'image_size' => array( 32, 32 ), |
| 170 |
'plain_text' => $plain_text, |
| 171 |
'sent_to_admin' => $sent_to_admin, |
| 172 |
) |
| 173 |
) |
| 174 |
); |
| 175 |
|
| 176 |
?> |
| 177 |
</tbody> |
| 178 |
|
| 179 |
<tfoot> |
| 180 |
<?php |
| 181 |
if ( $is_display ) { |
| 182 |
$totalItem = $order->get_order_item_totals(); |
| 183 |
$i = 0; |
| 184 |
foreach ( $totalItem as $key => $total ) { |
| 185 |
$i++; |
| 186 |
?> |
| 187 |
|
| 188 |
<tr> |
| 189 |
<th class="td" scope="row" colspan="<?php echo esc_attr( $productItemCost ? 3 : 2 ); ?>" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 190 |
<?php echo esc_html( $total['label'] ); ?> |
| 191 |
</th> |
| 192 |
<td class="td" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 193 |
<?php echo wp_kses_post( $total['value'] ); ?> |
| 194 |
</td> |
| 195 |
</tr> |
| 196 |
|
| 197 |
<?php |
| 198 |
} |
| 199 |
|
| 200 |
if ( ! empty( $order->get_customer_note() ) ) { |
| 201 |
$note = $order->get_customer_note(); |
| 202 |
?> |
| 203 |
|
| 204 |
<tr> |
| 205 |
<th class="td" scope="row" colspan="<?php echo esc_attr( $productItemCost ? 3 : 2 ); ?>" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 206 |
<?php esc_html_e( 'Note:', 'woocommerce' ); ?> |
| 207 |
</th> |
| 208 |
<td class="td" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 209 |
<?php echo esc_html( $note ); ?> |
| 210 |
</td> |
| 211 |
</tr> |
| 212 |
|
| 213 |
<?php |
| 214 |
} |
| 215 |
} |
| 216 |
?> |
| 217 |
</tfoot> |
| 218 |
</table> |
| 219 |
|