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