PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/admin/views/statistics/orders.php +110 -61 4.1.7.24.4.8 View file →
@@ -1,72 +1,121 @@
1 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 + */
2 10
3 -if ( ! defined( 'ABSPATH' ) ) {
4 - exit; // Exit if accessed directly
5 -}
11 +defined( 'ABSPATH' ) || exit();
6 12
7 -$sections = array(
8 - 'students' => __( 'Students', 'learnpress' ),
9 - 'instructors' => __( 'Instructors', 'learnpress' ),
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' ),
10 20 );
11 21
12 -$section = 'students';
13 -$sections_count = sizeof( $sections );
14 -$count = 0;
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 );
15 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' );
16 42
17 -<div id="learn-press-statistic" class="learn-press-statistic-orders">
18 - <ul class="subsubsub chart-buttons">
19 - <li>
20 - <button class="button" data-type="order-last-7-days" disabled="disabled"><?php _e( 'Last 7 Days', 'learnpress' ); ?></button>
21 - </li>
22 - <li>
23 - <button class="button" data-type="order-last-30-days"><?php _e( 'Last 30 Days', 'learnpress' ); ?></button>
24 - </li>
25 - <li>
26 - <button class="button" data-type="order-last-12-months"><?php _e( 'Last 12 Months', 'learnpress' ); ?></button>
27 - </li>
28 - <li>
29 - <button class="button" data-type="order-all"><?php _e( 'All', 'learnpress' ); ?></button>
30 - </li>
31 - <li>
32 - <form id="order-custom-time">
33 - <span><?php _e( 'From', 'learnpress' ); ?></span>
34 - <input type="text" placeholder="Y/m/d" name="from" class="date-picker" readonly="readonly">
35 - <span><?php _e( 'To', 'learnpress' ); ?></span>
36 - <input type="text" placeholder="Y/m/d" name="to" class="date-picker" readonly="readonly">
37 - <input type="hidden" name="action" value="learnpress_custom_stats">
38 - <button class="button button-primary" data-type="order-custom-time" type="submit" disabled="disabled"><?php _e( 'Go', 'learnpress' ); ?></button>
39 - </form>
40 - </li>
41 - </ul>
42 - <div class="clear"></div>
43 - <br/>
44 - <div id="chart-options">
45 - <?php _e( 'Sale by', 'learnpress' ); ?>
46 - <select id="report_sales_by">
47 - <option value="date"><?php _e( 'Date', 'learnpress' ); ?></option>
48 - <option value="course"><?php _e( 'Course', 'learnpress' ); ?></option>
49 - <option value="category"><?php _e( 'Course Category', 'learnpress' ); ?></option>
50 - </select>
51 - <span id="panel_report_sales_by_course" class="panel_report_option">
52 - <?php _e( 'Select a course', 'learnpress' ); ?>
53 - <input id="report-by-course-id" class="statistics-search-course" />
54 - </span>
55 - <span id="panel_report_sales_by_category" class="panel_report_option">
56 - <?php _e( 'Select a course category', 'learnpress' ); ?>
57 - <input id="report-by-course-category-id" class="statistics-search-course-category" />
58 - </span>
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">&ndash;</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>
59 109 </div>
60 110
61 - <div class="clear"></div>
62 - <div id="learn-press-chart" class="learn-press-chart">
63 - </div>
111 + <?php
112 + learn_press_admin_view( 'statistics/parts/report-modal' );
64 113
65 - <script type="text/javascript">
66 - var LP_Chart_Config = <?php learn_press_config_chart(); ?>;
67 - jQuery(document).ready(function ($) {
68 - $('#learn-press-chart').LP_Chart_Line(<?php echo json_encode( learn_press_get_chart_orders( null, 'days', 7 ) ); ?>, LP_Chart_Config);
69 - });
70 - </script>
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 + ?>
71 121 </div>
72 -