'subscrpt_status',
'placeholder' => __( 'All Status', 'subscription' ),
'value' => $status,
'options' => array(
array(
'value' => 'active',
'label' => __( 'Active', 'subscription' ),
),
array(
'value' => 'pending',
'label' => __( 'Pending', 'subscription' ),
),
array(
'value' => 'pe_cancelled',
'label' => __( 'Pending Cancellation', 'subscription' ),
),
array(
'value' => 'cancelled',
'label' => __( 'Cancelled', 'subscription' ),
),
array(
'value' => 'expired',
'label' => __( 'Expired', 'subscription' ),
),
array(
'value' => 'trash',
'label' => __( 'Trash', 'subscription' ),
),
),
)
);
?>
$label ) {
$date_options[] = array(
'value' => $val,
'label' => $label,
);
}
wpsubs_render_adv_select(
array(
'name' => 'date_filter',
'placeholder' => __( 'All Dates', 'subscription' ),
'value' => $date_filter,
'options' => $date_options,
)
);
?>
'per_page',
'value' => (string) $current_per_page,
'options' => array(
array(
'value' => '10',
'label' => __( '10 / page', 'subscription' ),
),
array(
'value' => '20',
'label' => __( '20 / page', 'subscription' ),
),
array(
'value' => '50',
'label' => __( '50 / page', 'subscription' ),
),
array(
'value' => '100',
'label' => __( '100 / page', 'subscription' ),
),
),
'align' => 'right',
'id' => 'wpsubs-per-page-select',
)
);
?>
'restore',
'label' => __( 'Restore selected', 'subscription' ),
),
array(
'value' => 'delete',
'label' => __( 'Delete permanently', 'subscription' ),
'danger' => true,
'confirm' => __( 'Delete selected subscriptions permanently? This cannot be undone.', 'subscription' ),
),
)
: array(
array(
'value' => 'trash',
'label' => __( 'Move to trash', 'subscription' ),
'danger' => true,
'confirm' => __( 'Move selected subscriptions to trash?', 'subscription' ),
),
);
wpsubs_render_adv_select(
array(
'name' => 'action',
'placeholder' => __( 'Select Action', 'subscription' ),
'value' => '-1',
'options' => $bulk_options,
'id' => 'wpsubs-bulk-action-select',
'align' => 'right',
)
);
?>
|
|
|
|
|
|
|
|
|
ID;
$subscription_data = SpringDevs\Subscription\Illuminate\Helper::get_subscription_data( $subscription_id );
$subscrpt_status = $subscription_data['status'] ?? '';
$subscrpt_status = empty( $subscrpt_status ) ? get_post_status( $subscription_id ) : $subscrpt_status;
$order_id = $subscription_data['order']['order_id'] ?? 0;
$order_item_id = $subscription_data['order']['order_item_id'] ?? 0;
$order = $order_id ? wc_get_order( $order_id ) : null;
$order_item = $order ? $order->get_item( $order_item_id ) : null;
$product_name = $order_item ? $order_item->get_name() : '-';
$product_id = $subscription_data['product']['variation_id'] ?: ( $subscription_data['product']['product_id'] ?? 0 );
$product_url = $product_id ? get_edit_post_link( $product_id ) : '';
$customer = $order ? $order->get_formatted_billing_full_name() : '-';
$customer_id = $order ? $order->get_customer_id() : 0;
$customer_url = $customer_id ? admin_url( 'user-edit.php?user_id=' . $customer_id ) : '';
$customer_email = $order ? $order->get_billing_email() : '';
$start_date = $subscription_data['start_date'] ? strtotime( $subscription_data['start_date'] ) : 0;
$renewal_date = $subscription_data['next_date'] ? strtotime( $subscription_data['next_date'] ) : 0;
$is_trash = 'trash' === $subscription->post_status;
$is_grace_period = isset( $subscription_data['grace_period'] );
$grace_remaining = $subscription_data['grace_period']['remaining_days'] ?? 0;
// Amount + timing. Net of any discount that carries into renewals.
$quantity = $order_item ? (int) $order_item->get_quantity() : 1;
$amount_totals = SpringDevs\Subscription\Illuminate\Helper::get_subscription_display_totals( $subscription_id, $order_item );
$price = '' !== ( $subscription_data['price'] ?? '' ) ? (float) $amount_totals['total'] : '';
$price_full = (float) $amount_totals['full_excl'] + $amount_totals['tax'] + $amount_totals['discount_tax'];
$has_discount = (bool) $amount_totals['has_discount'];
$price_per_unit = '' !== $price ? $price / max( 1, $quantity ) : '';
$timing_per = $subscription_data['schedule']['timing_per'] ?? '';
$timing_option = $subscription_data['schedule']['timing_option'] ?? '';
$timing_label = '';
if ( $timing_per && $timing_option ) {
$timing_label = ( (int) $timing_per > 1 )
? $timing_per . ' ' . $timing_option . 's'
: $timing_option;
}
// Avatar
$name_parts = array_values( array_filter( explode( ' ', trim( $customer ) ) ) );
$initials = '?';
if ( $name_parts ) {
$initials = '';
foreach ( array_slice( $name_parts, 0, 2 ) as $part ) {
$initials .= strtoupper( $part[0] );
}
}
$color_slot = ord( strtolower( $initials[0] ?? 'a' ) ) % 8;
// Action URLs
$nonce_action = 'wpsubs_action_' . $subscription->ID;
$view_url = admin_url( 'admin.php?page=wp-subscription-details&id=' . $subscription->ID );
$trash_url = wp_nonce_url( admin_url( 'admin.php?page=wp-subscription&action=trash&sub_id=' . $subscription->ID ), $nonce_action );
$delete_url = wp_nonce_url( admin_url( 'admin.php?page=wp-subscription&action=delete&sub_id=' . $subscription->ID ), $nonce_action );
$restore_url = wp_nonce_url( admin_url( 'admin.php?page=wp-subscription&action=restore&sub_id=' . $subscription->ID ), $nonce_action );
// Status badge
$badge_mod_map = array(
'active' => 'active',
'pending' => 'pending',
'pe_cancelled' => 'pending-cancel',
'cancelled' => 'cancelled',
'expired' => 'expired',
'draft' => 'draft',
'trash' => 'trash',
);
$badge_mod = $badge_mod_map[ $subscrpt_status ] ?? 'expired';
$verbose_status = SpringDevs\Subscription\Illuminate\Helper::get_verbose_status( $subscrpt_status );
if ( $is_grace_period && $grace_remaining > 0 ) {
$badge_mod = 'active';
$verbose_status = __( 'Active', 'subscription' );
}
?>
|
|
0 ) : ?>
|
#ID; ?>
|
|
1 ) : ?>
×
/
—
|
—
|
—
|
|
|
|
(int) $paged,
'total' => max( 1, (int) $max_num_pages ),
'info' => true,
'per_page' => (int) $per_page,
'item_count' => (int) $total,
'base_url' => remove_query_arg( 'paged' ),
'link_mode' => 'url',
// translators: %1$s = first item number, %2$s = last item number, %3$s = total items.
'info_format' => __( 'Showing %1$sโ%2$s of %3$s subscriptions', 'subscription' ),
'context' => 'subscription-list',
)
);
?>