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.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 / templates / dashboard / withdraw.php
tutor / templates / dashboard Last commit date
announcements 4 years ago assignments 4 years ago elements 4 years ago enrolled-courses 4 years ago instructor 4 years ago my-courses 4 years ago my-quiz-attempts 4 years ago notifications 4 years ago question-answer 4 years ago quiz-attempts 4 years ago reviews 4 years ago settings 4 years ago withdraw-method-fields 4 years ago announcements.php 4 years ago assignments.php 4 years ago create-course.php 4 years ago dashboard.php 4 years ago enrolled-courses.php 4 years ago index.php 4 years ago logged-in.php 4 years ago my-courses.php 4 years ago my-profile.php 4 years ago my-quiz-attempts.php 4 years ago purchase_history.php 4 years ago question-answer.php 4 years ago quiz-attempts.php 4 years ago registration.php 4 years ago reviews.php 4 years ago settings.php 4 years ago wishlist.php 4 years ago withdraw.php 4 years ago
withdraw.php
322 lines
1 <?php
2
3 /**
4 * @package TutorLMS/Templates
5 * @version 1.4.3
6 */
7
8 $per_page = tutor_utils()->get_option('statement_show_per_page', 20);
9 $current_page = max( 1, tutor_utils()->avalue_dot( 'current_page', tutor_sanitize_data($_GET) ) );
10 $offset = ( $current_page - 1 ) * $per_page;
11
12 $earning_sum = tutor_utils()->get_earning_sum();
13 $min_withdraw = tutor_utils()->get_option( 'min_withdraw_amount' );
14 $formatted_min_withdraw_amount = tutor_utils()->tutor_price( $min_withdraw );
15
16 $saved_account = tutor_utils()->get_user_withdraw_method();
17 $withdraw_method_name = tutor_utils()->avalue_dot( 'withdraw_method_name', $saved_account );
18
19 $user_id = get_current_user_id();
20 $balance_formatted = tutor_utils()->tutor_price( $earning_sum->balance );
21 $is_balance_sufficient = true; // $earning_sum->balance >= $min_withdraw;
22 $all_histories = tutor_utils()->get_withdrawals_history( $user_id, array( 'status' => array( 'pending', 'approved', 'rejected' ) ), $offset, $per_page );
23 $image_base = tutor()->url . '/assets/images/';
24 $method_icons = array(
25 'bank_transfer_withdraw' => $image_base . 'icon-bank.svg',
26 'echeck_withdraw' => $image_base . 'icon-echeck.svg',
27 'paypal_withdraw' => $image_base . 'icon-paypal.svg',
28 );
29
30 $status_message = array(
31 'rejected' => __( 'Please contact the site administrator for more information.', 'tutor' ),
32 'pending' => __( 'Withdrawal request is pending for approval, please hold tight.', 'tutor' ),
33 );
34
35 $currency_symbol = '';
36 if ( function_exists( 'get_woocommerce_currency_symbol' ) ) {
37 $currency_symbol = get_woocommerce_currency_symbol();
38 } elseif ( function_exists( 'edd_currency_symbol' ) ) {
39 $currency_symbol = edd_currency_symbol();
40 }
41 ?>
42
43 <div class="tutor-dashboard-content-inner tutor-frontend-dashboard-withdrawal tutor-color-black">
44 <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-24"><?php echo __( 'Withdrawal', 'tutor' ); ?></div>
45
46 <div class="tutor-card tutor-p-24">
47 <div class="tutor-row tutor-align-lg-center">
48 <div class="tutor-col-lg-auto tutor-mb-16 tutor-mb-lg-0">
49 <div class="tutor-round-box tutor-p-8">
50 <i class="tutor-icon-wallet" area-hidden="true"></i>
51 </div>
52 </div>
53
54 <div class="tutor-col tutor-mb-16 tutor-mb-lg-0">
55 <div class="tutor-fs-6 tutor-color-muted tutor-mb-4"><?php esc_html_e( 'Current Balance', 'tutor' ); ?></div>
56 <div class="tutor-fs-5 tutor-color-black">
57 <?php
58 if ( $is_balance_sufficient ) {
59 echo sprintf( __( 'You currently have %1$s %2$s %3$s ready to withdraw', 'tutor' ), "<strong class='available_balance'>", $balance_formatted, '</strong>' );
60 } else {
61 echo sprintf( __( 'You currently have %1$s %2$s %3$s and this is insufficient balance to withdraw', 'tutor' ), "<strong class='available_balance'>", $balance_formatted, '</strong>' );
62 }
63 ?>
64 </div>
65 </div>
66
67 <?php
68 if ( $is_balance_sufficient && $withdraw_method_name ) {
69 ?>
70 <div class="tutor-col-lg-auto">
71 <button class="tutor-btn tutor-btn-primary" data-tutor-modal-target="tutor-earning-withdraw-modal">
72 <?php esc_html_e( 'Withdrawal Request', 'tutor' ); ?>
73 </button>
74 </div>
75 <?php
76 }
77 ?>
78 </div>
79 </div>
80
81 <div class="current-withdraw-account-wrap tutor-d-flex tutor-mt-20">
82 <span class="tutor-svg tutor-fs-4 tutor-mr-8">
83 <?php echo tutor_utils()->get_svg_icon('infoCircle'); ?>
84 </span>
85 <span class="tutor-fs-7 tutor-mt-4">
86 <?php
87 $my_profile_url = tutor_utils()->get_tutor_dashboard_page_permalink( 'settings/withdraw-settings' );
88 echo $withdraw_method_name ? sprintf( __( 'The preferred payment method is selected as %s. ', 'tutor' ), $withdraw_method_name ) : '';
89 echo sprintf( __( 'You can change your %1$s Withdraw Preference %2$s', 'tutor' ), "<a href='{$my_profile_url}'>", '</a>' );
90 ?>
91 </span>
92 </div>
93
94 <?php
95 if ( $is_balance_sufficient && $withdraw_method_name ) {
96 ?>
97 <div id="tutor-earning-withdraw-modal" class="tutor-modal">
98 <div class="tutor-modal-overlay"></div>
99 <div class="tutor-modal-window">
100 <div class="tutor-modal-content tutor-modal-content-white">
101 <button class="tutor-iconic-btn tutor-modal-close-o" data-tutor-modal-close>
102 <span class="tutor-icon-times" area-hidden="true"></span>
103 </button>
104
105 <div class="tutor-modal-body">
106 <div class="tutor-py-20 tutor-px-24">
107 <div class="tutor-round-box tutor-round-box-lg tutor-mb-16">
108 <span class="tutor-icon-wallet" area-hidden="true"></span>
109 </div>
110
111 <div class="tutor-fs-4 tutor-fw-medium tutor-color-black tutor-mb-24"><?php esc_html_e( 'Withdrawal Request', 'tutor' ); ?></div>
112 <div class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Please check your transaction notification on your connected withdrawal method', 'tutor' ); ?></div>
113
114 <div class="tutor-row tutor-mt-32">
115 <div class="tutor-col">
116 <div class="tutor-fs-6 tutor-color-secondary tutor-mb-4"><?php esc_html_e( 'Current Balance', 'tutor' ); ?></div>
117 <div class="tutor-fs-6 tutor-fw-bold tutor-color-black"><?php echo wp_kses_post( $balance_formatted ); ?></div>
118 </div>
119
120 <div class="tutor-col">
121 <div class="tutor-fs-6 tutor-color-secondary tutor-mb-4"><?php esc_html_e( 'Selected Payment Method', 'tutor' ); ?></div>
122 <div class="tutor-fs-6 tutor-fw-bold tutor-color-black"><?php esc_html_e( $withdraw_method_name ); ?></div>
123 </div>
124 </div>
125 </div>
126
127 <div class="tutor-mx-n32 tutor-my-32"><div class="tutor-hr" area-hidden="true"></div></div>
128
129 <form id="tutor-earning-withdraw-form" method="post">
130 <div class="tutor-py-20 tutor-px-24">
131 <div>
132 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
133 <input type="hidden" value="tutor_make_an_withdraw" name="action" />
134 <?php do_action( 'tutor_withdraw_form_before' ); ?>
135
136 <label class="tutor-form-label" for="tutor_withdraw_amount"><?php esc_html_e( 'Amount', 'tutor' ); ?></label>
137 <div class="tutor-form-wrap tutor-mb-16">
138 <span class="tutor-form-icon"><?php echo esc_attr( $currency_symbol ); ?></span>
139 <input type="number" class="tutor-form-control" min="<?php echo esc_attr( $min_withdraw ); ?>" name="tutor_withdraw_amount" id="tutor_withdraw_amount" step=".01" required />
140 </div>
141
142 <div class="tutor-form-help tutor-d-flex tutor-align-center">
143 <span class="tutor-icon-circle-question-mark tutor-mr-8" area-hidden="true"></span>
144 <span><?php echo __( 'Minimum withdraw amount is', 'tutor' ) . ' ' . strip_tags( $formatted_min_withdraw_amount ); ?></span>
145 </div>
146
147 <div class="tutor-withdraw-form-response"></div>
148
149 <?php do_action( 'tutor_withdraw_form_after' ); ?>
150 </div>
151
152 <div class="tutor-d-flex tutor-mt-48">
153 <div>
154 <button class="tutor-btn tutor-btn-outline-primary" data-tutor-modal-close>
155 <?php _e( 'Cancel', 'tutor' ); ?>
156 </button>
157 </div>
158
159 <div class="tutor-ml-auto">
160 <button type="submit" name="withdraw-form-submit" id="tutor-earning-withdraw-btn" class="tutor-btn tutor-btn-primary tutor-modal-btn-edit tutor-ml-16">
161 <?php esc_html_e( 'Submit Request', 'tutor' ); ?>
162 </button>
163 </div>
164 </div>
165 </form>
166 </div>
167 </div>
168 </div>
169 </div>
170 </div>
171 <?php
172 }
173
174 if ( is_array( $all_histories->results ) && count ( $all_histories->results ) ) {
175 ?>
176 <div class="withdraw-history-table-wrap tutor-tooltip-inside tutor-mt-40">
177 <div class="withdraw-history-table-title">
178 <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-24">
179 <?php esc_html_e( 'Withdrawal History', 'tutor' ); ?>
180 </div>
181 </div>
182
183 <table class="tutor-table tutor-table-responsive">
184 <thead class="tutor-fs-7 tutor-color-secondary">
185 <tr>
186 <th width="40%">
187 <div>
188 <?php esc_html_e( 'Withdrawal Method', 'tutor' ); ?>
189 </div>
190 </th>
191 <th width="28%">
192 <div>
193 <?php esc_html_e( 'Requested On', 'tutor' ); ?>
194 </div>
195 </th>
196 <th width="13%">
197 <div>
198 <?php esc_html_e( 'Amount', 'tutor' ); ?>
199 </div>
200 </th>
201 <th width="13%">
202 <div>
203 <?php esc_html_e( 'Status', 'tutor' ); ?>
204 </div>
205 </th>
206 <th></th>
207 </tr>
208 </thead>
209 <tbody>
210 <?php
211 foreach ( $all_histories->results as $withdraw_history ) {
212 ?>
213 <tr>
214 <td>
215 <?php
216 $method_data = maybe_unserialize( $withdraw_history->method_data );
217 $method_key = $method_data['withdraw_method_key'];
218 $method_title = '';
219
220 switch ( $method_key ) {
221 case 'bank_transfer_withdraw':
222 $method_title = $method_data['account_number']['value'];
223 $method_title = substr_replace( $method_title, '****', 2, strlen( $method_title ) - 4 );
224 break;
225 case 'paypal_withdraw':
226 $method_title = $method_data['paypal_email']['value'];
227 $email_base = substr( $method_title, 0, strpos( $method_title, '@' ) );
228 $method_title = substr_replace( $email_base, '****', 2, strlen( $email_base ) - 3 ) . substr( $method_title, strpos( $method_title, '@' ) );
229 break;
230 }
231 ?>
232 <div class="tutor-withdrawals-method">
233 <div class="tutor-withdrawals-method-icon">
234 <img src="<?php echo esc_url( isset( $method_icons[ $method_key ] ) ? $method_icons[ $method_key ] : '' ); ?>" />
235 </div>
236 <div class="tutor-withdrawals-method-name">
237 <div class="withdraw-method-name tutor-fs-6 tutor-fw-medium tutor-color-black">
238 <?php echo esc_html( tutor_utils()->avalue_dot( 'withdraw_method_name', $method_data ) ); ?>
239 </div>
240 <div class="tutor-fs-7 tutor-color-muted">
241 <?php echo esc_html( $method_title ); ?>
242 </div>
243 </div>
244 </div>
245 </td>
246 <td>
247 <span class="tutor-color-black">
248 <?php
249 echo esc_attr( date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $withdraw_history->created_at ) ) );
250 ?>
251 </span>
252 </td>
253 <td>
254 <div class="tutor-fs-7 tutor-fw-medium tutor-color-black">
255 <?php echo tutor_utils()->tutor_price( $withdraw_history->amount ); ?>
256 </div>
257 </td>
258 <td>
259 <span class="inline-image-text is-inline-block">
260 <span class="tutor-badge-label
261 <?php
262 if ( $withdraw_history->status == 'approved' ) {
263 echo 'label-success'; }
264 ?>
265 <?php
266 if ( $withdraw_history->status == 'pending' ) {
267 echo 'label-warning'; }
268 ?>
269 <?php
270 if ( $withdraw_history->status == 'rejected' ) {
271 echo 'label-danger'; }
272 ?>
273 ">
274 <?php echo __( ucfirst( $withdraw_history->status ), 'tutor' ); ?>
275 </span>
276 </span>
277 </td>
278 <td>
279 <?php
280 if ( $withdraw_history->status !== 'approved' && isset( $status_message[ $withdraw_history->status ] ) ) {
281 ?>
282 <span class="tool-tip-container">
283 <div class="tooltip-wrap tooltip-icon tutor-mt-12">
284 <span class="tooltip-txt tooltip-left">
285 <?php echo esc_html( $status_message[ $withdraw_history->status ] ); ?>
286 </span>
287 </div>
288 </span>
289 <?php
290 }
291 ?>
292 </td>
293 </tr>
294 <?php
295 }
296 ?>
297 </tbody>
298 </table>
299 </div>
300 <?php
301 } else {
302 tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() );
303 }
304 ?>
305 </div>
306
307 <div class="tutor-mt-25">
308 <?php
309 if($all_histories->count >= $per_page) {
310 $pagination_data = array(
311 'total_items' => $all_histories->count,
312 'per_page' => $per_page,
313 'paged' => $current_page,
314 );
315
316 tutor_load_template_from_custom_path(
317 tutor()->path . 'templates/dashboard/elements/pagination.php',
318 $pagination_data
319 );
320 }
321 ?>
322 </div>