| @@ -1,68 +1,190 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Template for displaying orders statistics tab Overview statistics page. | |
| 4 | - */ | |
| 5 | -?> | |
| 6 | -<div class="lp-admin-statistics-tab-content"> | |
| 7 | - <div class="btn-group btn-group-filter"> | |
| 8 | - <button class="btn-filter-time active" type="button" data-filter="today" ><?php _e( 'Today', 'learnpress' ); ?></button> | |
| 9 | - <!-- <button class="btn-filter-time" type="button" data-filter="yesterday" ><?php _e( 'Yesterday', 'learnpress' ); ?></button> --> | |
| 10 | - <button class="btn-filter-time" type="button" data-filter="last7days" ><?php _e( 'Last 7 days', 'learnpress' ); ?></button> | |
| 11 | - <button class="btn-filter-time" type="button" data-filter="last30days" ><?php _e( 'Last 30 days', 'learnpress' ); ?></button> | |
| 12 | - <!-- <button class="btn-filter-time" type="button" data-filter="thismonth" ><?php _e( 'This month', 'learnpress' ); ?></button> --> | |
| 13 | - <button class="btn-filter-time" type="button" data-filter="last12months"><?php _e( 'Last 12 months', 'learnpress' ); ?></button> | |
| 14 | - <button class="btn-filter-time" type="button" data-filter="thisyear" ><?php _e( 'This year', 'learnpress' ); ?></button> | |
| 15 | - <button class="btn-filter-time" type="button" data-filter="custom" ><?php _e( 'Custom', 'learnpress' ); ?></button> | |
| 16 | - <div class="custom-filter-time"> | |
| 17 | - <input type="date" id="ct-filter-1" /> | |
| 18 | - <input type="date" id="ct-filter-2"> | |
| 19 | - <button class="custom-filter-btn button button-primary" type="button"><?php _e( 'Filter', 'learnpress' ); ?></button> | |
| 20 | - </div> | |
| 21 | - </div> | |
| 22 | - <div class="statistics-content"> | |
| 23 | - <div class="statistics-group group-statistic-overview"> | |
| 24 | - <input class="statistics-type" type="hidden" value="overview-statistics"> | |
| 25 | - <div class="statistics-item"> | |
| 26 | - <span class="statistics-item-title"><?php _e( 'Total Sales', 'learnpress' ); ?></span> | |
| 27 | - <span class="statistics-item-count total-sales">0</span> | |
| 28 | - </div> | |
| 29 | - <div class="statistics-item"> | |
| 30 | - <span class="statistics-item-title"><?php _e( 'Total Orders', 'learnpress' ); ?></span> | |
| 31 | - <span class="statistics-item-count total-orders">0</span> | |
| 32 | - </div> | |
| 33 | - <div class="statistics-item"> | |
| 34 | - <span class="statistics-item-title"><?php _e( 'Total Courses', 'learnpress' ); ?></span> | |
| 35 | - <span class="statistics-item-count total-courses">0</span> | |
| 36 | - </div> | |
| 37 | - <div class="statistics-item"> | |
| 38 | - <span class="statistics-item-title"><?php _e( 'Total Instructors', 'learnpress' ); ?></span> | |
| 39 | - <span class="statistics-item-count total-instructors">0</span> | |
| 40 | - </div> | |
| 41 | - <div class="statistics-item"> | |
| 42 | - <span class="statistics-item-title"><?php _e( 'Total Students', 'learnpress' ); ?></span> | |
| 43 | - <span class="statistics-item-count total-students">0</span> | |
| 44 | - </div> | |
| 45 | - </div> | |
| 46 | - <h3 class="statistics-title"><?php _e( 'Net Sales', 'learnpress' ); ?></h3> | |
| 47 | - <div id="net-sales-chart" class="statistics-chart-wrapper"> | |
| 48 | - <?php lp_skeleton_animation_html( 10, 100 ); ?> | |
| 49 | - <canvas id="net-sales-chart-content" style="display: none;"></canvas> | |
| 50 | - </div> | |
| 51 | - <div class="sold-course-analytics"> | |
| 52 | - <div class="col-50"> | |
| 53 | - <div class="col-50-contents"> | |
| 54 | - <h5 class="top-course-analytics-title"><?php _e( 'Top Courses Sold', 'learnpress' ); ?></h5> | |
| 55 | - <?php lp_skeleton_animation_html( 10, 100 ); ?> | |
| 56 | - <ul class="top-course-sold"></ul> | |
| 57 | - </div> | |
| 58 | - </div> | |
| 59 | - <div class="col-50"> | |
| 60 | - <div class="col-50-contents"> | |
| 61 | - <h5 class="top-course-analytics-title"><?php _e( 'Top Categories Sold', 'learnpress' ); ?></h5> | |
| 62 | - <?php lp_skeleton_animation_html( 10, 100 ); ?> | |
| 63 | - <ul class="top-category-sold"></ul> | |
| 64 | - </div> | |
| 65 | - </div> | |
| 66 | - </div> | |
| 67 | - </div> | |
| 68 | -</div> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Template for displaying the Overview statistics dashboard tab. | |
| 4 | + * | |
| 5 | + * Data is rendered by assets/src/js/admin/statistics/tab-overview.js from the | |
| 6 | + * `dashboard` key of the overviews-statistics endpoint. | |
| 7 | + * | |
| 8 | + * @since 4.4.2 | |
| 9 | + */ | |
| 10 | + | |
| 11 | +defined( 'ABSPATH' ) || exit(); | |
| 12 | + | |
| 13 | +$order_health_boxes = array( | |
| 14 | + 'completed' => __( 'Completed', 'learnpress' ), | |
| 15 | + 'processing' => __( 'Processing', 'learnpress' ), | |
| 16 | + 'pending' => __( 'Pending', 'learnpress' ), | |
| 17 | + 'cancelled_failed' => __( 'Cancelled / failed', 'learnpress' ), | |
| 18 | +); | |
| 19 | + | |
| 20 | +$health_checks = array( | |
| 21 | + 'no_enrollment' => array( | |
| 22 | + 'label' => __( 'Published courses without any enrollment', 'learnpress' ), | |
| 23 | + 'url' => admin_url( 'edit.php?post_type=lp_course&post_status=publish' ), | |
| 24 | + ), | |
| 25 | + 'no_content' => array( | |
| 26 | + 'label' => __( 'Published courses with an empty curriculum', 'learnpress' ), | |
| 27 | + 'url' => admin_url( 'edit.php?post_type=lp_course&post_status=publish' ), | |
| 28 | + ), | |
| 29 | + 'pending_review' => array( | |
| 30 | + 'label' => __( 'Courses waiting for review', 'learnpress' ), | |
| 31 | + 'url' => admin_url( 'edit.php?post_type=lp_course&post_status=pending' ), | |
| 32 | + ), | |
| 33 | + 'quiz_low_pass' => array( | |
| 34 | + 'label' => __( 'Quizzes with a low pass rate', 'learnpress' ), | |
| 35 | + 'url' => admin_url( 'edit.php?post_type=lp_quiz' ), | |
| 36 | + ), | |
| 37 | + 'low_completion' => array( | |
| 38 | + 'label' => __( 'Courses below the completion target', 'learnpress' ), | |
| 39 | + 'url' => admin_url( 'admin.php?page=learn-press-statistics&tab=courses' ), | |
| 40 | + ), | |
| 41 | +); | |
| 42 | + | |
| 43 | +$funnel_steps = array( | |
| 44 | + 'registered' => __( 'Registered', 'learnpress' ), | |
| 45 | + 'enrolled' => __( 'Enrolled', 'learnpress' ), | |
| 46 | + 'started' => __( 'Started learning', 'learnpress' ), | |
| 47 | + 'completed' => __( 'Completed', 'learnpress' ), | |
| 48 | +); | |
| 49 | + | |
| 50 | +$kpi_cards = array( | |
| 51 | + 'net-sales' => __( 'Net sales', 'learnpress' ), | |
| 52 | + 'completed-orders' => __( 'Completed orders', 'learnpress' ), | |
| 53 | + 'enrollments' => __( 'Enrollments', 'learnpress' ), | |
| 54 | + 'completion-rate' => __( 'Completion rate', 'learnpress' ), | |
| 55 | + 'active-learners' => __( 'Active learners', 'learnpress' ), | |
| 56 | + 'failed-orders' => __( 'Failed orders', 'learnpress' ), | |
| 57 | +); | |
| 58 | + | |
| 59 | +// Section config filters — add/remove/relabel cards and lists. @since 4.4.2 | |
| 60 | +$kpi_cards = (array) apply_filters( 'learn-press/statistics/overview/kpi-cards', $kpi_cards ); | |
| 61 | +$health_checks = (array) apply_filters( 'learn-press/statistics/overview/health-checks', $health_checks ); | |
| 62 | +$funnel_steps = (array) apply_filters( 'learn-press/statistics/overview/funnel-steps', $funnel_steps ); | |
| 63 | +$order_health_boxes = (array) apply_filters( 'learn-press/statistics/overview/order-health-boxes', $order_health_boxes ); | |
| 64 | +?> | |
| 65 | +<div class="lp-admin-statistics-tab-content lp-stats-tab-overview"> | |
| 66 | + <?php | |
| 67 | + /** | |
| 68 | + * Fires at the top of the Overview statistics tab, inside the tab container. | |
| 69 | + * | |
| 70 | + * @since 4.4.2 | |
| 71 | + */ | |
| 72 | + do_action( 'learn-press/statistics/overview/before' ); | |
| 73 | + | |
| 74 | + learn_press_admin_view( 'statistics/parts/filter-bar' ); | |
| 75 | + ?> | |
| 76 | + | |
| 77 | + <div class="lp-stats-dashboard-body"> | |
| 78 | + <div class="lp-stats-kpi-grid"> | |
| 79 | + <?php | |
| 80 | + foreach ( $kpi_cards as $key => $title ) { | |
| 81 | + learn_press_admin_view( | |
| 82 | + 'statistics/parts/kpi-card', | |
| 83 | + array( | |
| 84 | + 'key' => $key, | |
| 85 | + 'title' => $title, | |
| 86 | + ) | |
| 87 | + ); | |
| 88 | + } | |
| 89 | + ?> | |
| 90 | + </div> | |
| 91 | + | |
| 92 | + <div class="lp-stats-overview-grid lp-stats-overview-grid--chart"> | |
| 93 | + <div class="lp-stats-section statistics-content"> | |
| 94 | + <div class="lp-stats-section__header"> | |
| 95 | + <div> | |
| 96 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Revenue and enrollments', 'learnpress' ); ?></h3> | |
| 97 | + <p class="lp-stats-section__description"><?php esc_html_e( 'Completed order revenue with enrollment volume for the selected range.', 'learnpress' ); ?></p> | |
| 98 | + </div> | |
| 99 | + </div> | |
| 100 | + <div class="statistics-chart-wrapper"> | |
| 101 | + <?php lp_skeleton_animation_html( 10, 100 ); ?> | |
| 102 | + <canvas id="net-sales-chart-content" style="display: none;"></canvas> | |
| 103 | + </div> | |
| 104 | + </div> | |
| 105 | + | |
| 106 | + <div class="lp-stats-section"> | |
| 107 | + <div class="lp-stats-section__header"> | |
| 108 | + <div> | |
| 109 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Learner funnel', 'learnpress' ); ?></h3> | |
| 110 | + <p class="lp-stats-section__description"><?php esc_html_e( 'Registered users to completed courses.', 'learnpress' ); ?></p> | |
| 111 | + </div> | |
| 112 | + </div> | |
| 113 | + <?php lp_skeleton_animation_html( 4, 100 ); ?> | |
| 114 | + <div class="lp-stats-funnel"> | |
| 115 | + <?php foreach ( $funnel_steps as $step => $label ) : ?> | |
| 116 | + <div class="lp-stats-funnel__step" data-step="<?php echo esc_attr( $step ); ?>"> | |
| 117 | + <span class="lp-stats-funnel__label"><?php echo esc_html( $label ); ?></span> | |
| 118 | + <span class="lp-stats-funnel__track"><span class="lp-stats-funnel__bar" style="width: 0;"></span></span> | |
| 119 | + <span class="lp-stats-funnel__count">–</span> | |
| 120 | + </div> | |
| 121 | + <?php endforeach; ?> | |
| 122 | + </div> | |
| 123 | + </div> | |
| 124 | + </div> | |
| 125 | + | |
| 126 | + <div class="lp-stats-overview-grid lp-stats-overview-grid--tables"> | |
| 127 | + <div class="lp-stats-section"> | |
| 128 | + <div class="lp-stats-section__header"> | |
| 129 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Top course performance', 'learnpress' ); ?></h3> | |
| 130 | + <button type="button" class="button-link lp-stats-section__action lp-stats-view-all-courses"><?php esc_html_e( 'View all courses', 'learnpress' ); ?></button> | |
| 131 | + </div> | |
| 132 | + <?php lp_skeleton_animation_html( 5, 100 ); ?> | |
| 133 | + <div class="lp-stats-table-top-courses"></div> | |
| 134 | + </div> | |
| 135 | + | |
| 136 | + <div class="lp-stats-section"> | |
| 137 | + <div class="lp-stats-section__header"> | |
| 138 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Instructor performance', 'learnpress' ); ?></h3> | |
| 139 | + <a class="lp-stats-section__action" href="<?php echo esc_url( admin_url( 'users.php?role=lp_teacher' ) ); ?>"><?php esc_html_e( 'Manage instructors', 'learnpress' ); ?></a> | |
| 140 | + </div> | |
| 141 | + <?php lp_skeleton_animation_html( 5, 100 ); ?> | |
| 142 | + <div class="lp-stats-table-instructors"></div> | |
| 143 | + </div> | |
| 144 | + </div> | |
| 145 | + | |
| 146 | + <div class="lp-stats-overview-grid lp-stats-overview-grid--health"> | |
| 147 | + <div class="lp-stats-section"> | |
| 148 | + <div class="lp-stats-section__header"> | |
| 149 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Order health', 'learnpress' ); ?></h3> | |
| 150 | + </div> | |
| 151 | + <div class="lp-stats-health-grid lp-stats-order-health"> | |
| 152 | + <?php foreach ( $order_health_boxes as $status => $label ) : ?> | |
| 153 | + <a class="lp-stats-health-box" data-status="<?php echo esc_attr( $status ); ?>" | |
| 154 | + href="<?php echo esc_url( admin_url( 'admin.php?page=learn-press-statistics&tab=orders&order_status=' . $status ) ); ?>"> | |
| 155 | + <span class="lp-stats-health-box__count">–</span> | |
| 156 | + <span class="lp-stats-health-box__label"><?php echo esc_html( $label ); ?></span> | |
| 157 | + </a> | |
| 158 | + <?php endforeach; ?> | |
| 159 | + </div> | |
| 160 | + </div> | |
| 161 | + | |
| 162 | + <div class="lp-stats-section"> | |
| 163 | + <div class="lp-stats-section__header"> | |
| 164 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Course health checks', 'learnpress' ); ?></h3> | |
| 165 | + </div> | |
| 166 | + <ul class="lp-stats-health-checks"> | |
| 167 | + <?php foreach ( $health_checks as $check => $item ) : ?> | |
| 168 | + <li> | |
| 169 | + <a href="<?php echo esc_url( $item['url'] ); ?>"> | |
| 170 | + <span class="lp-stats-health-check__count" data-check="<?php echo esc_attr( $check ); ?>">–</span> | |
| 171 | + <?php echo esc_html( $item['label'] ); ?> | |
| 172 | + </a> | |
| 173 | + </li> | |
| 174 | + <?php endforeach; ?> | |
| 175 | + </ul> | |
| 176 | + </div> | |
| 177 | + </div> | |
| 178 | + </div> | |
| 179 | + | |
| 180 | + <?php | |
| 181 | + learn_press_admin_view( 'statistics/parts/report-modal' ); | |
| 182 | + | |
| 183 | + /** | |
| 184 | + * Fires at the bottom of the Overview statistics tab, inside the tab container. | |
| 185 | + * | |
| 186 | + * @since 4.4.2 | |
| 187 | + */ | |
| 188 | + do_action( 'learn-press/statistics/overview/after' ); | |
| 189 | + ?> | |
| 190 | +</div> | |