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