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.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / views / pages / ecommerce / coupon-list.php
tutor / views / pages / ecommerce Last commit date
coupon-list.php 1 year ago order-list.php 1 year ago
coupon-list.php
230 lines
1 <?php
2 /**
3 * Course List Template.
4 *
5 * @package Tutor\Views
6 * @author Themeum <support@themeum.com>
7 * @link https://themeum.com
8 * @since 2.0.0
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 use Tutor\Ecommerce\CouponController;
16 use Tutor\Ecommerce\OptionKeys;
17 use Tutor\Ecommerce\Settings;
18 use TUTOR\Input;
19 use Tutor\Models\CouponModel;
20
21 /**
22 * Determine active tab
23 */
24 $active_tab = Input::get( 'data', 'all' );
25
26 /**
27 * Pagination data
28 */
29 $paged_filter = Input::get( 'paged', 1, Input::TYPE_INT );
30 $limit = (int) tutor_utils()->get_option( 'pagination_per_page', 10 );
31 $offset = ( $limit * $paged_filter ) - $limit;
32
33 $coupon_controller = new CouponController( false );
34
35 $get_coupons = $coupon_controller->get_coupons( $limit, $offset );
36 $coupons = $get_coupons['results'];
37 $total_items = $get_coupons['total_count'];
38 /**
39 * Navbar data to make nav menu
40 */
41 $page_slug = $coupon_controller::PAGE_SLUG;
42 $coupon_page_url = $coupon_controller::get_coupon_page_url();
43
44 $navbar_data = array(
45 'page_title' => $coupon_controller->page_title,
46 'tabs' => $coupon_controller->tabs_key_value(),
47 'active' => $active_tab,
48 'add_button' => true,
49 'button_title' => __( 'Add New', 'tutor' ),
50 'button_url' => $coupon_controller::get_coupon_page_url() . '&action=add_new',
51 );
52
53 /**
54 * Bulk action & filters
55 */
56 $filters = array(
57 'bulk_action' => $coupon_controller->bulk_action,
58 'bulk_actions' => $coupon_controller->prepare_bulk_actions(),
59 'ajax_action' => 'tutor_coupon_bulk_action',
60 'filters' => true,
61 );
62
63 ?>
64
65 <div class="tutor-admin-wrap">
66 <?php
67 /**
68 * Load Templates with data.
69 */
70 $navbar_template = tutor()->path . 'views/elements/navbar.php';
71 $filters_template = tutor()->path . 'views/elements/filters.php';
72 tutor_load_template_from_custom_path( $navbar_template, $navbar_data );
73 tutor_load_template_from_custom_path( $filters_template, $filters );
74 $currency_symbol = Settings::get_currency_symbol_by_code( tutor_utils()->get_option( OptionKeys::CURRENCY_CODE, 'USD' ) );
75 ?>
76 <div class="tutor-admin-body">
77 <div class="tutor-mt-24">
78 <div class="tutor-table-responsive">
79
80 <table class="tutor-table tutor-table-middle">
81 <thead class="tutor-text-sm tutor-text-400">
82 <tr>
83 <th>
84 <div class="tutor-d-flex">
85 <input type="checkbox" id="tutor-bulk-checkbox-all" class="tutor-form-check-input" />
86 </div>
87 </th>
88 <th class="tutor-table-rows-sorting">
89 <?php esc_html_e( 'Name', 'tutor' ); ?>
90 </th>
91 <th>
92 <?php esc_html_e( 'Applies to', 'tutor' ); ?>
93 </th>
94 <th>
95 <?php esc_html_e( 'Discount', 'tutor' ); ?>
96 </th>
97 <th>
98 <?php esc_html_e( 'Type', 'tutor' ); ?>
99 </th>
100 <th>
101 <?php esc_html_e( 'Code', 'tutor' ); ?>
102 </th>
103 <th>
104 <?php esc_html_e( 'Status', 'tutor' ); ?>
105 </th>
106 <th colspan="2">
107 <?php esc_html_e( 'Usage', 'tutor' ); ?>
108 </th>
109 </tr>
110 </thead>
111
112 <tbody>
113 <?php if ( is_array( $coupons ) && count( $coupons ) ) : ?>
114 <?php
115 foreach ( $coupons as $key => $coupon ) :
116 ?>
117 <tr>
118 <td>
119 <div class="td-checkbox tutor-d-flex ">
120 <input type="checkbox" class="tutor-form-check-input tutor-bulk-checkbox" name="tutor-bulk-checkbox-all" value="<?php echo esc_attr( $coupon->id ); ?>" />
121 </div>
122 </td>
123
124 <td>
125 <a href="<?php echo esc_url( $coupon_page_url . '&action=edit&coupon_id=' . $coupon->id ); ?>" class="tutor-table-link tutor-fs-7">
126 <?php echo esc_html( $coupon->coupon_title ); ?>
127 </a>
128 </td>
129
130 <td>
131 <div class="tutor-fs-7">
132 <?php echo esc_html( CouponModel::get_coupon_applies_to_label( $coupon->applies_to ) ); ?>
133 </div>
134 </td>
135
136 <td>
137 <div class="tutor-fs-7">
138 <?php echo wp_kses_post( ( 'flat' === $coupon->discount_type ? tutor_utils()->tutor_price( $coupon->discount_amount ) : $coupon->discount_amount . '%' ) ); ?>
139 </div>
140 </td>
141 <td>
142 <div class="tutor-fs-7">
143 <?php echo esc_html( 'flat' === $coupon->discount_type ? __( 'Amount', 'tutor' ) : __( 'Percent', 'tutor' ) ); ?>
144 </div>
145 </td>
146
147 <td>
148 <div class="tutor-fs-7">
149 <?php echo esc_html( 'automatic' === $coupon->coupon_type ? __( 'Automatic', 'tutor' ) : $coupon->coupon_code ); ?>
150 </div>
151 </td>
152
153 <td>
154 <?php
155 $coupon_status = $coupon->coupon_status;
156 if ( CouponModel::STATUS_ACTIVE === $coupon_status ) {
157 $coupon_status = $coupon_controller->model->has_coupon_validity( $coupon ) ? $coupon->coupon_status : 'expired';
158 }
159 echo wp_kses_post( tutor_utils()->translate_dynamic_text( $coupon_status, true ) );
160 ?>
161 </td>
162
163 <td>
164 <?php echo esc_html( $coupon->usage_count ); ?>
165 </td>
166 <td>
167 <div class="tutor-d-flex tutor-align-center tutor-justify-end tutor-gap-2">
168 <a href="<?php echo esc_url( $coupon_page_url . '&action=edit&coupon_id=' . $coupon->id ); ?>" class="tutor-btn tutor-btn-outline-primary tutor-btn-sm">
169 <?php esc_html_e( 'Edit', 'tutor' ); ?>
170 </a>
171 <?php if ( 'trash' === $active_tab ) : ?>
172 <div class="tutor-dropdown-parent">
173 <button type="button" class="tutor-iconic-btn" action-tutor-dropdown="toggle">
174 <span class="tutor-icon-kebab-menu" area-hidden="true"></span>
175 </button>
176 <div id="table-dashboard-coupon-list-<?php echo esc_attr( $coupon->id ); ?>" class="tutor-dropdown tutor-dropdown-dark tutor-text-left">
177 <a href="javascript:void(0)" class="tutor-dropdown-item tutor-delete-permanently"
178 data-tutor-modal-target="tutor-common-confirmation-modal" data-action="tutor_coupon_permanent_delete" data-id="<?php echo esc_attr( $coupon->id ); ?>">
179 <i class="tutor-icon-trash-can-bold tutor-mr-8" area-hidden="true"></i>
180 <span>
181 <?php esc_html_e( 'Delete Permanently', 'tutor' ); ?>
182 </span>
183 </a>
184 </div>
185 </div>
186 <?php endif ?>
187 </div>
188 </td>
189 </tr>
190 <?php endforeach; ?>
191 <?php else : ?>
192 <tr>
193 <td colspan="100%" class="column-empty-state">
194 <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?>
195 </td>
196 </tr>
197 <?php endif; ?>
198 </tbody>
199 </table>
200
201 <div class="tutor-admin-page-pagination-wrapper tutor-mt-32">
202 <?php
203 /**
204 * Prepare pagination data & load template
205 */
206 if ( $total_items > $limit ) {
207 $pagination_data = array(
208 'total_items' => $total_items,
209 'per_page' => $limit,
210 'paged' => $paged_filter,
211 );
212 $pagination_template = tutor()->path . 'views/elements/pagination.php';
213 tutor_load_template_from_custom_path( $pagination_template, $pagination_data );
214 }
215 ?>
216 </div>
217 </div>
218 <!-- end table responsive -->
219 </div>
220 </div>
221 </div>
222
223 <?php
224 tutor_load_template_from_custom_path(
225 tutor()->path . 'views/elements/common-confirm-popup.php',
226 array(
227 'message' => __( 'Deletion of the course will erase all its topics, lessons, quizzes, events, and other information. Please confirm your choice.', 'tutor' ),
228 )
229 );
230