PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / trunk
Subscriptions for WooCommerce with Stripe Recurring Payments vtrunk
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 / delivery-preview.php

delivery-preview.php in Subscriptions for WooCommerce with Stripe Recurring Payments trunk, at includes/Admin/views/delivery-preview.php

291 lines 10.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Delivery Schedules page — interactive preview with sample data (shown when Pro is not active).
4 *
5 * @package SpringDevs\Subscription\Admin
6 */
7
8 defined( 'ABSPATH' ) || exit;
9
10 $upgrade_url = 'https://wpsubscription.co/?utm_source=plugin&utm_medium=admin&utm_campaign=upgrade_pro';
11 $currency = function_exists( 'get_woocommerce_currency_symbol' ) ? get_woocommerce_currency_symbol() : '$';
12
13 $dummy_deliveries = array(
14 array(
15 'id' => 301,
16 'subscription_id' => 1042,
17 'product' => 'Monthly Wellness Box',
18 'customer' => 'Sarah Johnson',
19 'email' => 'sarah.j@example.com',
20 'status' => 'waiting',
21 'ship_on' => '2026-06-10',
22 'shipped_on' => '',
23 'address' => '42 Maple Street, Boston, MA 02101',
24 ),
25 array(
26 'id' => 302,
27 'subscription_id' => 1087,
28 'product' => 'Annual Premium Plan',
29 'customer' => 'Marcus Williams',
30 'email' => 'marcus.w@example.com',
31 'status' => 'shipped',
32 'ship_on' => '2026-05-15',
33 'shipped_on' => '2026-05-16',
34 'address' => '18 Oak Avenue, Chicago, IL 60601',
35 ),
36 array(
37 'id' => 303,
38 'subscription_id' => 1103,
39 'product' => 'Basic Weekly Kit',
40 'customer' => 'Emma Clarke',
41 'email' => 'emma.c@example.com',
42 'status' => 'in_process',
43 'ship_on' => '2026-06-07',
44 'shipped_on' => '',
45 'address' => '7 Pine Road, Austin, TX 78701',
46 ),
47 array(
48 'id' => 304,
49 'subscription_id' => 1155,
50 'product' => 'Monthly Wellness Box',
51 'customer' => 'Linda Zhao',
52 'email' => 'linda.z@example.com',
53 'status' => 'waiting',
54 'ship_on' => '2026-06-12',
55 'shipped_on' => '',
56 'address' => '99 Birch Lane, Seattle, WA 98101',
57 ),
58 array(
59 'id' => 305,
60 'subscription_id' => 1189,
61 'product' => 'Starter Bundle',
62 'customer' => 'James O\'Brien',
63 'email' => 'j.obrien@example.com',
64 'status' => 'cancelled',
65 'ship_on' => '2026-05-28',
66 'shipped_on' => '',
67 'address' => '15 Cedar Blvd, Miami, FL 33101',
68 ),
69 );
70
71 $badge_map = array(
72 'waiting' => array(
73 'mod' => 'pending',
74 'label' => __( 'Waiting', 'subscription' ),
75 ),
76 'in_process' => array(
77 'mod' => 'active',
78 'label' => __( 'In Process', 'subscription' ),
79 ),
80 'shipped' => array(
81 'mod' => 'active',
82 'label' => __( 'Shipped', 'subscription' ),
83 ),
84 'cancelled' => array(
85 'mod' => 'cancelled',
86 'label' => __( 'Cancelled', 'subscription' ),
87 ),
88 );
89
90 $month_options = array(
91 array(
92 'value' => '',
93 'label' => __( 'All Dates', 'subscription' ),
94 ),
95 array(
96 'value' => '2026-06',
97 'label' => 'June 2026',
98 ),
99 array(
100 'value' => '2026-05',
101 'label' => 'May 2026',
102 ),
103 array(
104 'value' => '2026-04',
105 'label' => 'April 2026',
106 ),
107 );
108 ?>
109
110 <div class="wp-subscription-admin-content list-page">
111
112 <!-- Disclaimer banner -->
113 <div style="background:#fffbeb;border:1px solid #fcd34d;border-radius:8px;padding:12px 16px;margin-bottom:20px;display:flex;align-items:flex-start;gap:10px;">
114 <svg width="18" height="18" fill="none" viewBox="0 0 24 24" stroke="#d97706" style="flex-shrink:0;margin-top:1px;" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
115 <p style="margin:0;font-size:13px;color:#92400e;line-height:1.5;">
116 <strong><?php esc_html_e( 'Preview with sample data.', 'subscription' ); ?></strong>
117 <?php esc_html_e( 'This page shows example data to illustrate the feature.', 'subscription' ); ?>
118 <a href="<?php echo esc_url( $upgrade_url ); ?>" target="_blank" rel="noreferrer noopener" style="color:#b45309;font-weight:600;text-decoration:underline;"><?php esc_html_e( 'Upgrade to Pro', 'subscription' ); ?></a>
119 <?php esc_html_e( 'to manage real delivery schedules.', 'subscription' ); ?>
120 </p>
121 </div>
122
123 <?php
124 wpsubs_render_page_header(
125 array(
126 'title' => __( 'Delivery Schedules', 'subscription' ),
127 'description' => __( 'Track and manage subscription delivery schedules.', 'subscription' ),
128 )
129 );
130 ?>
131
132 <!-- Toolbar -->
133 <div class="wpsubs-toolbar" style="margin-top:0;">
134 <?php
135 wpsubs_render_adv_select(
136 array(
137 'name' => 'subscrpt_status',
138 'value' => '',
139 'placeholder' => __( 'All Statuses', 'subscription' ),
140 'align' => 'left',
141 'options' => array(
142 array(
143 'value' => '',
144 'label' => __( 'All Statuses', 'subscription' ),
145 ),
146 array(
147 'value' => 'waiting',
148 'label' => __( 'Waiting', 'subscription' ),
149 ),
150 array(
151 'value' => 'in_process',
152 'label' => __( 'In Process', 'subscription' ),
153 ),
154 array(
155 'value' => 'shipped',
156 'label' => __( 'Shipped', 'subscription' ),
157 ),
158 array(
159 'value' => 'cancelled',
160 'label' => __( 'Cancelled', 'subscription' ),
161 ),
162 ),
163 )
164 );
165 wpsubs_render_adv_select(
166 array(
167 'name' => 'date_filter',
168 'value' => '',
169 'placeholder' => __( 'All Dates', 'subscription' ),
170 'align' => 'left',
171 'options' => $month_options,
172 )
173 );
174 ?>
175 <div class="wpsubs-search">
176 <div class="wpsubs-input-wrap wpsubs-input-wrap--icon-l">
177 <svg class="wpsubs-input-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-4.35-4.35M17 11A6 6 0 105 11a6 6 0 0012 0z"/></svg>
178 <input type="search" class="wpsubs-input" placeholder="<?php esc_attr_e( 'Search by subscription ID...', 'subscription' ); ?>" disabled style="cursor:not-allowed;" />
179 </div>
180 </div>
181 <button type="button" class="wpsubs-btn wpsubs-btn--outline" disabled style="cursor:not-allowed;opacity:0.6;"><?php esc_html_e( 'Filter', 'subscription' ); ?></button>
182 <div class="wpsubs-toolbar__spacer"></div>
183 <?php
184 wpsubs_render_adv_select(
185 array(
186 'name' => 'per_page',
187 'value' => '20',
188 'placeholder' => '20 per page',
189 'align' => 'right',
190 'options' => array(
191 array(
192 'value' => '10',
193 'label' => __( '10 per page', 'subscription' ),
194 ),
195 array(
196 'value' => '20',
197 'label' => __( '20 per page', 'subscription' ),
198 ),
199 array(
200 'value' => '50',
201 'label' => __( '50 per page', 'subscription' ),
202 ),
203 array(
204 'value' => '100',
205 'label' => __( '100 per page', 'subscription' ),
206 ),
207 ),
208 )
209 );
210 ?>
211 <button type="button" class="wpsubs-btn wpsubs-btn--outline" disabled style="cursor:not-allowed;opacity:0.6;">
212 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"/></svg>
213 <?php esc_html_e( 'Print Addresses', 'subscription' ); ?>
214 </button>
215 </div>
216
217 <div class="wpsubs-table-card">
218 <table class="wpsubs-table">
219 <thead>
220 <tr>
221 <th class="wpsubs-col--check">
222 <input type="checkbox" class="wpsubs-checkbox" disabled />
223 </th>
224 <th><?php esc_html_e( 'Subscription', 'subscription' ); ?></th>
225 <th><?php esc_html_e( 'Customer', 'subscription' ); ?></th>
226 <th><?php esc_html_e( 'Status', 'subscription' ); ?></th>
227 <th class="wpsubs-col--nowrap"><?php esc_html_e( 'Shipping On', 'subscription' ); ?></th>
228 <th class="wpsubs-col--nowrap"><?php esc_html_e( 'Shipped On', 'subscription' ); ?></th>
229 <th><?php esc_html_e( 'Delivery Info', 'subscription' ); ?></th>
230 </tr>
231 </thead>
232 <tbody>
233 <?php foreach ( $dummy_deliveries as $delivery ) : ?>
234 <?php
235 $name_parts = array_values( array_filter( explode( ' ', $delivery['customer'] ) ) );
236 $initials = '';
237 foreach ( array_slice( $name_parts, 0, 2 ) as $part ) {
238 $initials .= strtoupper( $part[0] );
239 }
240 $color_slot = ord( strtolower( $initials[0] ?? 'a' ) ) % 8;
241 $badge = $badge_map[ $delivery['status'] ] ?? array(
242 'mod' => 'pending',
243 'label' => $delivery['status'],
244 );
245 ?>
246 <tr>
247 <td class="wpsubs-col--check">
248 <input type="checkbox" class="wpsubs-checkbox" disabled />
249 </td>
250 <td>
251 <span class="wpsubs-cell-title" style="font-weight:600;"><?php echo esc_html( $delivery['product'] ); ?></span>
252 <span class="wpsubs-cell-id">#<?php echo esc_html( $delivery['subscription_id'] ); ?></span>
253 </td>
254 <td>
255 <div class="wpsubs-customer">
256 <div class="wpsubs-avatar" data-color="<?php echo (int) $color_slot; ?>"><?php echo esc_html( $initials ); ?></div>
257 <div class="wpsubs-customer__info">
258 <span class="wpsubs-customer__name"><?php echo esc_html( $delivery['customer'] ); ?></span>
259 <span class="wpsubs-customer__sub"><?php echo esc_html( $delivery['email'] ); ?></span>
260 </div>
261 </div>
262 </td>
263 <td>
264 <span class="wpsubs-badge wpsubs-badge--<?php echo esc_attr( $badge['mod'] ); ?>"><?php echo esc_html( $badge['label'] ); ?></span>
265 </td>
266 <td class="wpsubs-col--nowrap">
267 <span class="wpsubs-cell-title" style="font-weight:400;"><?php echo esc_html( $delivery['ship_on'] ); ?></span>
268 </td>
269 <td class="wpsubs-col--nowrap">
270 <?php if ( $delivery['shipped_on'] ) : ?>
271 <span class="wpsubs-cell-title" style="font-weight:400;"><?php echo esc_html( $delivery['shipped_on'] ); ?></span>
272 <?php else : ?>
273 <span style="color:var(--wpsubs-text-subtle);">&#8212;</span>
274 <?php endif; ?>
275 </td>
276 <td>
277 <span class="wpsubs-cell-id"><?php echo esc_html( $delivery['address'] ); ?></span>
278 </td>
279 </tr>
280 <?php endforeach; ?>
281 </tbody>
282 </table>
283 </div>
284
285 </div>
286
287 <?php
288 $modal_title = __( 'Unlock Delivery Schedules', 'subscription' );
289 $modal_desc = __( 'Delivery Schedules requires WPSubscription Pro. Unlock advanced features, priority support, and more with WPSubscription Pro.', 'subscription' );
290 require __DIR__ . '/pro-upgrade-modal.php';
291