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