PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 1.10.2
Subscriptions for WooCommerce with Stripe Recurring Payments v1.10.2
2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 All 61 releases
subscription / includes / Admin / views / related-subscriptions.php

related-subscriptions.php in Subscriptions for WooCommerce with Stripe Recurring Payments 1.10.2, at includes/Admin/views/related-subscriptions.php

108 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Related Subscriptions meta box view.
4 *
5 * @package SpringDevs\Subscription\Admin
6 */
7
8 // Exit if accessed directly.
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 ?>
14 <style>
15 .subscrpt-related-subscriptions td{
16 vertical-align: middle;
17 }
18 </style>
19
20 <table class="widefat striped subscrpt-related-subscriptions">
21 <thead>
22 <tr>
23 <th><?php esc_html_e( 'ID', 'subscription' ); ?></th>
24 <th><?php esc_html_e( 'Product', 'subscription' ); ?></th>
25 <th><?php esc_html_e( 'Recurring', 'subscription' ); ?></th>
26 <th><?php esc_html_e( 'Started on', 'subscription' ); ?></th>
27 <th><?php esc_html_e( 'Expiry date', 'subscription' ); ?></th>
28 <th><?php esc_html_e( 'Status', 'subscription' ); ?></th>
29 </tr>
30 </thead>
31 <tbody>
32 <?php
33 foreach ( $histories as $history ) :
34 $subscription_id = $history->subscription_id;
35 $subscription_data = SpringDevs\Subscription\Illuminate\Helper::get_subscription_data( $subscription_id );
36
37 $subscrpt_status = $subscription_data['status'] ?? '';
38 $verbose_status = SpringDevs\Subscription\Illuminate\Helper::get_verbose_status( $subscrpt_status );
39
40 $order_item_id = get_post_meta( $history->subscription_id, '_subscrpt_order_item_id', true );
41 $order_item = $order->get_item( $history->order_item_id );
42
43 $trial = get_post_meta( $history->subscription_id, '_subscrpt_trial', true );
44
45 $start_date = $subscription_data['start_date'] ?? '';
46 $start_date = ! empty( $start_date ) ? wp_date( 'F j, Y - g:i A', strtotime( $start_date ) ) : '-';
47
48 $next_date = $subscription_data['next_date'] ?? '';
49 $next_date = ! empty( $next_date ) ? wp_date( 'F j, Y - g:i A', strtotime( $next_date ) ) : '-';
50
51 $quantity = (int) $order_item->get_quantity();
52 $price = (float) ( $subscription_data['price'] ?? 0 ) * max( 1, $quantity );
53 $price_excl_tax = (float) $order_item->get_total();
54 $tax_amount = (float) $order_item->get_total_tax();
55
56 if ( $tax_amount > 0 ) {
57 $price = $price_excl_tax + $tax_amount;
58 $price = number_format( (float) $price, 2, '.', '' );
59 }
60
61 $is_grace_period = isset( $subscription_data['grace_period'] );
62 $grace_remaining = $subscription_data['grace_period']['remaining_days'] ?? 0;
63 ?>
64 <tr>
65 <td>
66 <a href="<?php echo esc_html( get_edit_post_link( $subscription_id ) ); ?>" target="_blank">Subscription #<?php echo esc_html( $subscription_id ); ?></a>
67 </td>
68 <td>
69 <?php echo esc_html( $order_item->get_name() ); ?>
70 </td>
71 <td>
72 <?php echo wp_kses_post( SpringDevs\Subscription\Illuminate\Helper::format_price_with_order_item( $price, $order_item->get_id() ) ); ?>
73 </td>
74 <td>
75 <?php echo esc_html( $start_date ); ?>
76 </td>
77 <td>
78 <?php echo esc_html( $next_date ); ?>
79 </td>
80 <td>
81 <?php if ( $is_grace_period && $grace_remaining > 0 ) : ?>
82 <span class="subscrpt-active grace-active">
83 Active
84
85 <?php
86 $grace_remaining_text = sprintf(
87 // translators: Number of days remaining in grace period.
88 __( '%d days remaining!', 'subscription' ),
89 $grace_remaining
90 );
91 ?>
92 <span class="grace-icon" data-tooltip="<?php echo esc_attr( $grace_remaining_text ); ?>">
93 <span class="dashicons dashicons-warning"></span>
94 </span>
95 </span>
96 <?php else : ?>
97 <span class="subscrpt-<?php echo esc_attr( strtolower( $subscrpt_status ) ); ?>">
98 <?php echo esc_html( $verbose_status ); ?>
99 </span>
100 <?php endif; ?>
101 </td>
102 </tr>
103 <?php
104 endforeach;
105 ?>
106 </tbody>
107 </table>
108