| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
use YayMail\Page\Source\CustomPostType; |
| 5 |
|
| 6 |
if ( empty( $subscriptions ) ) { |
| 7 |
return; |
| 8 |
} |
| 9 |
$sent_to_admin = ( isset( $sent_to_admin ) ? true : false ); |
| 10 |
$plain_text = ( isset( $plain_text ) ? $plain_text : '' ); |
| 11 |
$email = ( isset( $email ) ? $email : '' ); |
| 12 |
$has_automatic_renewal = false; |
| 13 |
$is_parent_order = wcs_order_contains_subscription( $order, 'parent' ); |
| 14 |
$postID = CustomPostType::postIDByTemplate( $this->template ); |
| 15 |
$text_link_color = get_post_meta( $postID, '_yaymail_email_textLinkColor_settings', true ) ? get_post_meta( $postID, '_yaymail_email_textLinkColor_settings', true ) : '#96588a'; |
| 16 |
?> |
| 17 |
|
| 18 |
|
| 19 |
<!-- Table Items has Border --> |
| 20 |
<table class="yaymail_builder_table_items_border yaymail_builder_table_subcription" cellspacing="0" cellpadding="6" border="1" style="width: 100% !important;border-color: inherit;color: inherit;flex-direction:inherit;" width="100%"> |
| 21 |
<thead> |
| 22 |
<tr style="word-break: normal"> |
| 23 |
<th class="td" scope="col" style="text-align:left;"><?php echo esc_html_x( 'ID', 'subscription ID table heading', 'yaymail' ); ?></th> |
| 24 |
<th class="td" scope="col" style="text-align:left;"><?php echo esc_html_x( 'Start date', 'table heading', 'yaymail' ); ?></th> |
| 25 |
<th class="td" scope="col" style="text-align:left;"><?php echo esc_html_x( 'End date', 'table heading', 'yaymail' ); ?></th> |
| 26 |
<th class="td" scope="col" style="text-align:left;"><?php echo esc_html_x( 'Recurring total', 'table heading', 'yaymail' ); ?></th> |
| 27 |
</tr> |
| 28 |
</thead> |
| 29 |
|
| 30 |
<tbody style="flex-direction:inherit;"> |
| 31 |
<?php foreach ( $subscriptions as $subscription ) : ?> |
| 32 |
<?php $has_automatic_renewal = $has_automatic_renewal || ! $subscription->is_manual(); ?> |
| 33 |
<tr class="order_item" style="flex-direction:inherit;"> |
| 34 |
<td class="td" width="1%" style="text-align:left; vertical-align:middle;"> |
| 35 |
<?php /* translators: #%s: search term */ ?> |
| 36 |
<a style="color:<?php echo esc_attr( $text_link_color ); ?>" href="<?php echo esc_url( ( $is_admin_email ) ? wcs_get_edit_post_link( $subscription->get_id() ) : $subscription->get_view_order_url() ); ?>"><?php echo sprintf( esc_html_x( '#%s', 'subscription number in email table. (eg: #106)', 'woocommerce-subscriptions' ), esc_html( $subscription->get_order_number() ) ); ?></a> |
| 37 |
</td> |
| 38 |
<td class="td" style="text-align:left; vertical-align:middle;"> |
| 39 |
<?php echo esc_html( date_i18n( wc_date_format(), $subscription->get_time( 'start_date', 'site' ) ) ); ?> |
| 40 |
</td> |
| 41 |
<td class="td" style="text-align:left; vertical-align:middle;"> |
| 42 |
<?php echo esc_html( ( 0 < $subscription->get_time( 'end' ) ) ? date_i18n( wc_date_format(), $subscription->get_time( 'end', 'site' ) ) : _x( 'When cancelled', 'Used as end date for an indefinite subscription', 'woocommerce-subscriptions' ) ); ?> |
| 43 |
</td> |
| 44 |
<td class="td" style="text-align:left; vertical-align:middle;"> |
| 45 |
<?php echo wp_kses_post( $subscription->get_formatted_order_total() ); ?> |
| 46 |
<?php if ( $is_parent_order && $subscription->get_time( 'next_payment' ) > 0 ) : ?> |
| 47 |
<br> |
| 48 |
<small><?php printf( esc_html__( 'Next payment: ', 'woocommerce-subscriptions' ) . esc_html( date_i18n( wc_date_format(), $subscription->get_time( 'next_payment', 'site' ) ) ) ); ?></small> |
| 49 |
<?php endif; ?> |
| 50 |
</td> |
| 51 |
</tr> |
| 52 |
<?php endforeach; ?> |
| 53 |
</tbody> |
| 54 |
</table> |
| 55 |
<?php |
| 56 |
if ( $has_automatic_renewal && ! $is_admin_email && $subscription->get_time( 'next_payment' ) > 0 ) { |
| 57 |
if ( count( $subscriptions ) === 1 ) { |
| 58 |
$subscription = reset( $subscriptions ); |
| 59 |
$my_account_url = $subscription->get_view_order_url(); |
| 60 |
} else { |
| 61 |
$my_account_url = wc_get_endpoint_url( 'subscriptions', '', wc_get_page_permalink( 'myaccount' ) ); |
| 62 |
} |
| 63 |
|
| 64 |
printf( |
| 65 |
'<small>%s</small>', |
| 66 |
wp_kses_post( |
| 67 |
sprintf( |
| 68 |
/* translators: %1$s: search term */ |
| 69 |
/* translators: %2$s: search term */ |
| 70 |
_n( |
| 71 |
// Translators: Placeholders are opening and closing My Account link tags. |
| 72 |
'This subscription is set to renew automatically using your payment method on file. You can manage or cancel this subscription from your %1$smy account page%2$s.', |
| 73 |
'These subscriptions are set to renew automatically using your payment method on file. You can manage or cancel your subscriptions from your %1$smy account page%2$s.', |
| 74 |
count( $subscriptions ), |
| 75 |
'woocommerce-subscriptions' |
| 76 |
), |
| 77 |
'<a href="' . $my_account_url . '">', |
| 78 |
'</a>' |
| 79 |
) |
| 80 |
) |
| 81 |
); |
| 82 |
} |
| 83 |
?> |
| 84 |
</div> |
| 85 |
|