| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying the Orders statistics dashboard tab. |
| 4 |
* |
| 5 |
* Data is rendered by assets/src/js/admin/statistics/tab-orders.js from the |
| 6 |
* `dashboard` key of the order-statistics endpoint. |
| 7 |
* |
| 8 |
* @since 4.4.2 |
| 9 |
*/ |
| 10 |
|
| 11 |
defined( 'ABSPATH' ) || exit(); |
| 12 |
|
| 13 |
$kpi_cards = array( |
| 14 |
'net-sales' => __( 'Net sales', 'learnpress' ), |
| 15 |
'completed-orders' => __( 'Completed orders', 'learnpress' ), |
| 16 |
'processing' => __( 'Processing orders', 'learnpress' ), |
| 17 |
'pending' => __( 'Pending orders', 'learnpress' ), |
| 18 |
'cancelled-failed' => __( 'Cancelled / failed', 'learnpress' ), |
| 19 |
'paid-courses-sold' => __( 'Paid courses sold', 'learnpress' ), |
| 20 |
); |
| 21 |
|
| 22 |
$payment_health = array( |
| 23 |
'completed' => __( 'Completed', 'learnpress' ), |
| 24 |
'processing' => __( 'Processing', 'learnpress' ), |
| 25 |
'pending' => __( 'Pending', 'learnpress' ), |
| 26 |
'cancelled' => __( 'Cancelled', 'learnpress' ), |
| 27 |
'failed' => __( 'Failed', 'learnpress' ), |
| 28 |
); |
| 29 |
|
| 30 |
// Section config filters — add/remove/relabel cards and lists. @since 4.4.2 |
| 31 |
$kpi_cards = (array) apply_filters( 'learn-press/statistics/orders/kpi-cards', $kpi_cards ); |
| 32 |
$payment_health = (array) apply_filters( 'learn-press/statistics/orders/payment-health', $payment_health ); |
| 33 |
?> |
| 34 |
<div class="lp-admin-statistics-tab-content lp-stats-tab-orders"> |
| 35 |
<?php |
| 36 |
/** |
| 37 |
* Fires at the top of the Orders statistics tab, inside the tab container. |
| 38 |
* |
| 39 |
* @since 4.4.2 |
| 40 |
*/ |
| 41 |
do_action( 'learn-press/statistics/orders/before' ); |
| 42 |
|
| 43 |
learn_press_admin_view( 'statistics/parts/filter-bar' ); |
| 44 |
?> |
| 45 |
|
| 46 |
<div class="lp-stats-dashboard-body"> |
| 47 |
<div class="lp-stats-kpi-grid"> |
| 48 |
<?php |
| 49 |
foreach ( $kpi_cards as $key => $title ) { |
| 50 |
learn_press_admin_view( |
| 51 |
'statistics/parts/kpi-card', |
| 52 |
array( |
| 53 |
'key' => $key, |
| 54 |
'title' => $title, |
| 55 |
) |
| 56 |
); |
| 57 |
} |
| 58 |
?> |
| 59 |
</div> |
| 60 |
|
| 61 |
<div class="lp-stats-overview-grid lp-stats-overview-grid--chart"> |
| 62 |
<div class="lp-stats-section statistics-content"> |
| 63 |
<div class="lp-stats-section__header"> |
| 64 |
<div> |
| 65 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Order volume and revenue', 'learnpress' ); ?></h3> |
| 66 |
<p class="lp-stats-section__description"><?php esc_html_e( 'Completed order revenue, order count, and status health for the selected period.', 'learnpress' ); ?></p> |
| 67 |
</div> |
| 68 |
</div> |
| 69 |
<div id="orders-chart" class="statistics-chart-wrapper"> |
| 70 |
<?php lp_skeleton_animation_html( 10, 100 ); ?> |
| 71 |
<canvas id="orders-chart-content" style="display: none;"></canvas> |
| 72 |
</div> |
| 73 |
</div> |
| 74 |
|
| 75 |
<div class="lp-stats-section"> |
| 76 |
<div class="lp-stats-section__header"> |
| 77 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Payment health', 'learnpress' ); ?></h3> |
| 78 |
</div> |
| 79 |
<ul class="lp-stats-payment-health"> |
| 80 |
<?php foreach ( $payment_health as $status => $label ) : ?> |
| 81 |
<li class="lp-stats-payment-health__row" data-status="<?php echo esc_attr( $status ); ?>"> |
| 82 |
<span class="lp-stats-payment-health__label"><?php echo esc_html( $label ); ?></span> |
| 83 |
<span class="lp-stats-payment-health__count">–</span> |
| 84 |
</li> |
| 85 |
<?php endforeach; ?> |
| 86 |
</ul> |
| 87 |
</div> |
| 88 |
</div> |
| 89 |
|
| 90 |
<div class="lp-stats-overview-grid lp-stats-overview-grid--tables"> |
| 91 |
<div class="lp-stats-section"> |
| 92 |
<div class="lp-stats-section__header"> |
| 93 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Top sold courses', 'learnpress' ); ?></h3> |
| 94 |
<button type="button" class="button-link lp-stats-section__action lp-stats-view-all-top-sold"><?php esc_html_e( 'Open report', 'learnpress' ); ?></button> |
| 95 |
</div> |
| 96 |
<?php lp_skeleton_animation_html( 5, 100 ); ?> |
| 97 |
<div class="lp-stats-table-top-sold-courses"></div> |
| 98 |
</div> |
| 99 |
|
| 100 |
<div class="lp-stats-section"> |
| 101 |
<div class="lp-stats-section__header"> |
| 102 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Recent order exceptions', 'learnpress' ); ?></h3> |
| 103 |
<button type="button" class="button-link lp-stats-section__action lp-stats-view-all-exceptions"><?php esc_html_e( 'Open report', 'learnpress' ); ?></button> |
| 104 |
</div> |
| 105 |
<?php lp_skeleton_animation_html( 5, 100 ); ?> |
| 106 |
<div class="lp-stats-table-order-exceptions"></div> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
</div> |
| 110 |
|
| 111 |
<?php |
| 112 |
learn_press_admin_view( 'statistics/parts/report-modal' ); |
| 113 |
|
| 114 |
/** |
| 115 |
* Fires at the bottom of the Orders statistics tab, inside the tab container. |
| 116 |
* |
| 117 |
* @since 4.4.2 |
| 118 |
*/ |
| 119 |
do_action( 'learn-press/statistics/orders/after' ); |
| 120 |
?> |
| 121 |
</div> |
| 122 |
|