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