PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 1.5.1
Subscriptions for WooCommerce with Stripe Recurring Payments v1.5.1
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 / subscription-list.php

subscription-list.php in Subscriptions for WooCommerce with Stripe Recurring Payments 1.5.1, at includes/Admin/views/subscription-list.php

214 lines 10.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! isset( $date_filter ) ) {
2 $date_filter = ''; } ?>
3 <?php
4 // Determine if filters are active
5 $filters_active = ! empty( $status ) || ! empty( $date_filter ) || ! empty( $search );
6 $months = array();
7 for ( $i = 0; $i < 12; $i++ ) {
8 $month = strtotime( "-$i month" );
9 $months[ date( 'Y-m', $month ) ] = date( 'F Y', $month );
10 }
11 ?>
12 <div class="wp-subscription-admin-content list-page">
13 <div class="wp-subscription-list-title"><h1 class="wp-heading-inline">Subscriptions</h1></div>
14
15 <form method="post" id="subscriptions-form">
16 <div class="wp-subscription-list-header">
17 <div class="wp-subscription-filters">
18 <input type="hidden" name="page" value="wp-subscription" />
19 <select name="subscrpt_status" value="<?php echo esc_attr( $status ); ?>">
20 <option value=""><?php esc_html_e( 'All Status', 'wp_subscription' ); ?></option>
21 <option value="active" <?php selected( $status, 'active' ); ?>><?php esc_html_e( 'Active', 'wp_subscription' ); ?></option>
22 <option value="pending" <?php selected( $status, 'pending' ); ?>><?php esc_html_e( 'Pending', 'wp_subscription' ); ?></option>
23 <option value="cancelled" <?php selected( $status, 'cancelled' ); ?>><?php esc_html_e( 'Cancelled', 'wp_subscription' ); ?></option>
24 <option value="expired" <?php selected( $status, 'expired' ); ?>><?php esc_html_e( 'Expired', 'wp_subscription' ); ?></option>
25 <option value="draft" <?php selected( $status, 'draft' ); ?>><?php esc_html_e( 'Draft', 'wp_subscription' ); ?></option>
26 <option value="trash" <?php selected( $status, 'trash' ); ?>><?php esc_html_e( 'Trash', 'wp_subscription' ); ?></option>
27 </select>
28 <select name="date_filter" value="<?php echo esc_attr( $date_filter ); ?>">
29 <option value=""><?php esc_html_e( 'All Dates', 'wp_subscription' ); ?></option>
30 <?php foreach ( $months as $val => $label ) : ?>
31 <option value="<?php echo esc_attr( $val ); ?>" <?php selected( $date_filter, $val ); ?>><?php echo esc_html( $label ); ?></option>
32 <?php endforeach; ?>
33 </select>
34 <input type="search" name="s" value="<?php echo esc_attr( $search ); ?>" placeholder="<?php esc_attr_e( 'Search by subscription ID...', 'wp_subscription' ); ?>" />
35 <select name="per_page">
36 <?php foreach ( array( 10, 20, 50, 100 ) as $n ) : ?>
37 <option value="<?php echo $n; ?>" <?php selected( isset( $_GET['per_page'] ) ? intval( $_GET['per_page'] ) : 20, $n ); ?>><?php echo $n; ?> per page</option>
38 <?php endforeach; ?>
39 </select>
40 <button type="submit" name="filter_action" value="filter" class="button">Search</button>
41 <?php if ( $filters_active ) : ?>
42 <a href="<?php echo esc_url( remove_query_arg( array( 'subscrpt_status', 'date_filter', 's', 'title', 'paged' ) ) ); ?>" class="button">Reset</a>
43 <?php endif; ?>
44 <?php if ( $filters_active ) : ?>
45 <span>Filters applied</span>
46 <?php endif; ?>
47 </div>
48
49 <?php if ( ! empty( $subscriptions ) ) : ?>
50 <div class="wp-subscription-bulk-actions">
51 <select name="action">
52 <option value="-1"><?php esc_html_e( 'Bulk Actions', 'wp_subscription' ); ?></option>
53 <?php if ( $status === 'trash' ) : ?>
54 <option value="restore"><?php esc_html_e( 'Restore', 'wp_subscription' ); ?></option>
55 <option value="delete"><?php esc_html_e( 'Delete Permanently', 'wp_subscription' ); ?></option>
56 <?php else : ?>
57 <option value="trash"><?php esc_html_e( 'Move to Trash', 'wp_subscription' ); ?></option>
58 <?php endif; ?>
59 </select>
60 <input type="submit" name="bulk_action" value="<?php esc_attr_e( 'Apply', 'wp_subscription' ); ?>" class="button action">
61 <?php if ( $status === 'trash' && ! empty( $subscriptions ) ) : ?>
62 <a href="<?php echo esc_url( admin_url( 'admin.php?page=wp-subscription&action=clean_trash&sub_id=all' ) ); ?>"
63 class="button button-link-delete"
64 onclick="return confirm('<?php esc_attr_e( 'Are you sure you want to permanently delete all items in trash? This action cannot be undone.', 'wp_subscription' ); ?>')">
65 <?php esc_html_e( 'Empty Trash', 'wp_subscription' ); ?>
66 </a>
67 <?php endif; ?>
68 </div>
69 <?php endif; ?>
70 </div>
71
72 <h2 class="screen-reader-text">Subscriptions list</h2>
73 <table class="wp-list-table widefat fixed striped wp-subscription-modern-table">
74 <thead>
75 <tr>
76 <th style="width:30px;"><input type="checkbox" id="cb-select-all-1"></th>
77 <th style="width:180px;">ID</th>
78 <th style="min-width:320px;">Title</th>
79 <th style="width:180px;">Customer</th>
80 <th style="width:100px;">Start Date</th>
81 <th style="width:100px;">Renewal Date</th>
82 <th style="width:80px;">Status</th>
83 <th style="width:80px;">Actions</th>
84 </tr>
85 </thead>
86 <tbody>
87 <?php if ( ! empty( $subscriptions ) ) : ?>
88 <?php
89 foreach ( $subscriptions as $subscription ) :
90 $order_id = get_post_meta( $subscription->ID, '_subscrpt_order_id', true );
91 $order = wc_get_order( $order_id );
92 $order_item_id = get_post_meta( $subscription->ID, '_subscrpt_order_item_id', true );
93 $order_item = $order ? $order->get_item( $order_item_id ) : null;
94 $product_name = $order_item ? $order_item->get_name() : '-';
95 $customer = $order ? $order->get_formatted_billing_full_name() : '-';
96 $customer_id = $order ? $order->get_customer_id() : 0;
97 $customer_url = $customer_id ? admin_url( 'user-edit.php?user_id=' . $customer_id ) : '';
98 $customer_email = $order ? $order->get_billing_email() : '';
99 $start_date = get_post_meta( $subscription->ID, '_subscrpt_start_date', true );
100 $renewal_date = get_post_meta( $subscription->ID, '_subscrpt_next_date', true );
101 $status_obj = get_post_status_object( get_post_status( $subscription->ID ) );
102 $is_trash = $subscription->post_status === 'trash';
103 ?>
104 <tr>
105 <td><input type="checkbox" name="subscription_ids[]" value="<?php echo esc_attr( $subscription->ID ); ?>"></td>
106 <td>
107 <a href="<?php echo esc_url( get_edit_post_link( $subscription->ID ) ); ?>" class="subscrpt-id-link">
108 #<?php echo esc_html( get_the_title( $subscription->ID ) ); ?>
109 </a>
110 </td>
111 <td style="min-width:320px;">
112 <div class="wp-subscription-title-wrap">
113 <span><?php echo esc_html( $product_name ); ?></span>
114 <div class="wp-subscription-row-actions">
115 <a href="<?php echo esc_url( get_edit_post_link( $subscription->ID ) ); ?>">View</a>
116 <?php if ( ! $is_trash ) : ?>
117 <a href="<?php echo esc_url( admin_url( 'admin.php?page=wp-subscription&action=duplicate&sub_id=' . $subscription->ID ) ); ?>">Duplicate</a>
118 <a href="<?php echo esc_url( admin_url( 'admin.php?page=wp-subscription&action=trash&sub_id=' . $subscription->ID ) ); ?>" onclick="return confirm('<?php esc_attr_e( 'Move this subscription to trash?', 'wp_subscription' ); ?>')">Trash</a>
119 <?php else : ?>
120 <a href="<?php echo esc_url( admin_url( 'admin.php?page=wp-subscription&action=restore&sub_id=' . $subscription->ID ) ); ?>">Restore</a>
121 <a href="<?php echo esc_url( admin_url( 'admin.php?page=wp-subscription&action=delete&sub_id=' . $subscription->ID ) ) ?>" onclick="return confirm('<?php esc_attr_e( 'Delete this subscription permanently? This action cannot be undone.', 'wp_subscription' ); ?>')" style="color:#d93025;">Delete Permanently</a>
122 <?php endif; ?>
123 </div>
124 </div>
125 </td>
126 <td>
127 <?php if ( $customer_url ) : ?>
128 <a href="<?php echo esc_url( $customer_url ); ?>" target="_blank"><?php echo esc_html( $customer ); ?></a>
129 <?php else : ?>
130 <?php echo esc_html( $customer ); ?>
131 <?php endif; ?>
132 <?php if ( $customer_email ) : ?>
133 <div class="wp-subscription-customer-email"><?php echo esc_html( $customer_email ); ?></div>
134 <?php endif; ?>
135 </td>
136 <td><?php echo $start_date ? esc_html( gmdate( 'F d, Y', $start_date ) ) : '-'; ?></td>
137 <td><?php echo $renewal_date ? esc_html( gmdate( 'F d, Y', $renewal_date ) ) : '-'; ?></td>
138 <td>
139 <span class="subscrpt-status-badge subscrpt-status-<?php echo esc_attr( $status_obj->name ); ?>">
140 <?php echo esc_html( $status_obj->label ); ?>
141 </span>
142 </td>
143 <td>
144 <a href="<?php echo esc_url( get_edit_post_link( $subscription->ID ) ); ?>" class="button button-small"><?php esc_html_e( 'Edit', 'wp_subscription' ); ?></a>
145 </td>
146 </tr>
147 <?php endforeach; ?>
148 <?php else : ?>
149 <tr>
150 <td colspan="8" class="wp-subscription-list-empty">
151 <?php esc_html_e( 'No subscriptions found.', 'wp_subscription' ); ?>
152 </td>
153 </tr>
154 <?php endif; ?>
155 </tbody>
156 </table>
157
158 <?php if ( ! empty( $subscriptions ) ) : ?>
159 <div class="tablenav bottom">
160 <div class="alignleft actions bulkactions">
161 <select name="action2">
162 <option value="-1"><?php esc_html_e( 'Bulk Actions', 'wp_subscription' ); ?></option>
163 <?php if ( $status === 'trash' ) : ?>
164 <option value="restore"><?php esc_html_e( 'Restore', 'wp_subscription' ); ?></option>
165 <option value="delete"><?php esc_html_e( 'Delete Permanently', 'wp_subscription' ); ?></option>
166 <?php else : ?>
167 <option value="trash"><?php esc_html_e( 'Move to Trash', 'wp_subscription' ); ?></option>
168 <?php endif; ?>
169 </select>
170 <input type="submit" name="bulk_action2" value="<?php esc_attr_e( 'Apply', 'wp_subscription' ); ?>" class="button action">
171 </div>
172 </div>
173 <?php endif; ?>
174 </form>
175
176 <?php if ( $max_num_pages > 1 ) : ?>
177 <div class="wp-subscription-pagination">
178 <span class="total">Total <?php echo intval( $total ); ?></span>
179 <?php
180 $base_url = remove_query_arg( 'paged' );
181 $show_pages = $max_num_pages > 1 || $max_num_pages == 1;
182 for ( $i = 1; $i <= $max_num_pages; $i++ ) :
183 $url = add_query_arg(
184 array(
185 'paged' => $i,
186 'per_page' => $per_page,
187 ),
188 $base_url
189 );
190 $is_current = $i == $paged;
191 ?>
192 <a href="<?php echo esc_url( $url ); ?>" class="button
193 <?php
194 if ( $is_current ) {
195 echo ' button-primary';}
196 ?>
197 "
198 <?php
199 if ( $is_current ) {
200 echo 'disabled';}
201 ?>
202 ><?php echo $i; ?></a>
203 <?php endfor; ?>
204 <span class="goto-label">Go to</span>
205 <form method="get">
206 <input type="hidden" name="page" value="wp-subscription" />
207 <input type="number" name="paged" min="1" max="<?php echo $max_num_pages; ?>" value="<?php echo $paged; ?>" />
208 <input type="hidden" name="per_page" value="<?php echo $per_page; ?>" />
209 <button type="submit" class="button">OK</button>
210 </form>
211 </div>
212 <?php endif; ?>
213 </div>
214