earning
7 years ago
enrolled-courses
7 years ago
instructor
7 years ago
withdraw-method-fields
7 years ago
dashboard.php
7 years ago
earning.php
7 years ago
enrolled-courses.php
7 years ago
index.php
7 years ago
logged-in.php
7 years ago
my-courses.php
7 years ago
my-profile.php
7 years ago
my-reviews.php
7 years ago
quiz-attempts.php
7 years ago
registration.php
7 years ago
wishlist.php
7 years ago
withdraw.php
7 years ago
withdraw.php
271 lines
| 1 | <?php |
| 2 | $earning_sum = tutor_utils()->get_earning_sum(); |
| 3 | $min_withdraw = tutor_utils()->get_option('min_withdraw_amount'); |
| 4 | |
| 5 | $saved_account = tutor_utils()->get_user_withdraw_method(); |
| 6 | $withdraw_method_name = tutor_utils()->avalue_dot('withdraw_method_name', $saved_account); |
| 7 | |
| 8 | $user_id = get_current_user_id(); |
| 9 | ?> |
| 10 | |
| 11 | <div class="tutor-dashboard-content-inner"> |
| 12 | |
| 13 | <div class="withdraw-page-current-balance"> |
| 14 | <h4><?php _e('Current Balance', 'tutor'); ?></h4> |
| 15 | |
| 16 | <div class="withdraw-balance-row"> |
| 17 | |
| 18 | <?php |
| 19 | $balance_formatted = tutor_utils()->tutor_price($earning_sum->balance); |
| 20 | if ($earning_sum->balance >= $min_withdraw){ |
| 21 | ?> |
| 22 | <p class="withdraw-balance-col"> |
| 23 | <?php echo sprintf( __('You currently have %s %s %s ready to withdraw', 'tutor'), "<strong class='available_balance'>", $balance_formatted, '</strong>' ); ?> |
| 24 | </p> |
| 25 | |
| 26 | <?php if ($withdraw_method_name) { ?> |
| 27 | <p><a class="open-withdraw-form-btn" href="javascript:;"><?php _e( 'Make a withdraw', 'tutor' ); ?></a></p> |
| 28 | <?php |
| 29 | } |
| 30 | }else{ |
| 31 | ?> |
| 32 | |
| 33 | <p class="withdraw-balance-col"> <?php echo sprintf( __('You currently have %s %s %s and this is insufficient balance to withdraw', |
| 34 | 'tutor'), "<strong class='available_balance'>", $balance_formatted, '</strong>' ); ?> |
| 35 | </p> |
| 36 | |
| 37 | <?php |
| 38 | } |
| 39 | ?> |
| 40 | |
| 41 | </div> |
| 42 | |
| 43 | <div class="current-withdraw-account-wrap"> |
| 44 | <?php |
| 45 | if ($withdraw_method_name){ |
| 46 | ?> |
| 47 | <p> |
| 48 | <?php _e('You will get paid by', 'tutor'); ?> <strong><?php echo $withdraw_method_name; ?></strong> |
| 49 | </p> |
| 50 | <p> |
| 51 | <?php |
| 52 | $my_profile_url = tutor_utils()->get_tutor_dashboard_page_permalink('my-profile'); |
| 53 | echo sprintf(__( 'You can change your %s withdraw preference %s ' , 'tutor'), "<a href='{$my_profile_url}'>", '</a>' ); |
| 54 | ?> |
| 55 | </p> |
| 56 | <?php |
| 57 | }else{ |
| 58 | ?> |
| 59 | <p> |
| 60 | <?php |
| 61 | $my_profile_url = tutor_utils()->get_tutor_dashboard_page_permalink('my-profile'); |
| 62 | echo sprintf(__( 'Please add your %s withdraw preference %s to make withdraw' , 'tutor'), "<a href='{$my_profile_url}'>", '</a>' ); |
| 63 | ?> |
| 64 | </p> |
| 65 | <?php |
| 66 | } |
| 67 | ?> |
| 68 | </div> |
| 69 | |
| 70 | </div> |
| 71 | |
| 72 | <?php |
| 73 | if ($earning_sum->balance >= $min_withdraw && $withdraw_method_name){ |
| 74 | ?> |
| 75 | |
| 76 | <div class="tutor-earning-withdraw-form-wrap" style="display: none;"> |
| 77 | |
| 78 | <form id="tutor-earning-withdraw-form" action="" method="post"> |
| 79 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 80 | <input type="hidden" value="tutor_make_an_withdraw" name="action"/> |
| 81 | |
| 82 | <p><?php _e('Enter withdraw amount and click withdraw button', 'tutor'); ?></p> |
| 83 | |
| 84 | <?php do_action('tutor_withdraw_form_before'); ?> |
| 85 | |
| 86 | <div class="withdraw-form-field-row"> |
| 87 | <div class="withdraw-form-field-amount"> |
| 88 | <input type="text" name="tutor_withdraw_amount"> |
| 89 | </div> |
| 90 | <div class="withdraw-form-field-button"> |
| 91 | <button type="submit" id="tutor-earning-withdraw-btn" name="withdraw-form-submit"><?php _e('Withdraw', 'tutor'); ?></button> |
| 92 | </div> |
| 93 | </div> |
| 94 | |
| 95 | <div id="tutor-withdraw-form-response"></div> |
| 96 | |
| 97 | <?php do_action('tutor_withdraw_form_after'); ?> |
| 98 | </form> |
| 99 | |
| 100 | </div> |
| 101 | |
| 102 | <?php |
| 103 | } |
| 104 | ?> |
| 105 | |
| 106 | |
| 107 | <?php |
| 108 | $withdraw_pending_histories = tutor_utils()->get_withdrawals_history(null, array('status' => array('pending'))); |
| 109 | $withdraw_completed_histories = tutor_utils()->get_withdrawals_history(null, array('status' => array('approved'))); |
| 110 | $withdraw_rejected_histories = tutor_utils()->get_withdrawals_history(null, array('status' => array('rejected'))); |
| 111 | ?> |
| 112 | |
| 113 | <div class="withdraw-history-table-wrap"> |
| 114 | <div class="withdraw-history-table-title"> |
| 115 | <h4> <?php _e('Pending Withdrawals', 'tutor'); ?></h4> |
| 116 | </div> |
| 117 | |
| 118 | <?php |
| 119 | if (tutor_utils()->count($withdraw_pending_histories->results)){ |
| 120 | ?> |
| 121 | <table class="withdrawals-history"> |
| 122 | <thead> |
| 123 | <tr> |
| 124 | <th><?php _e('Amount', 'tutor') ?></th> |
| 125 | <th><?php _e('Withdraw Method', 'tutor') ?></th> |
| 126 | <th><?php _e('Date', 'tutor') ?></th> |
| 127 | </tr> |
| 128 | </thead> |
| 129 | <?php |
| 130 | foreach ($withdraw_pending_histories->results as $withdraw_history){ |
| 131 | ?> |
| 132 | <tr> |
| 133 | <td><?php echo tutor_utils()->tutor_price($withdraw_history->amount); ?></td> |
| 134 | <td> |
| 135 | <?php |
| 136 | $method_data = maybe_unserialize($withdraw_history->method_data); |
| 137 | echo tutor_utils()->avalue_dot('withdraw_method_name', $method_data) |
| 138 | ?> |
| 139 | </td> |
| 140 | <td> |
| 141 | <?php |
| 142 | echo date_i18n(get_option('date_format').' '.get_option('time_format'), strtotime($withdraw_history->created_at)); |
| 143 | ?> |
| 144 | </td> |
| 145 | </tr> |
| 146 | <?php |
| 147 | } |
| 148 | ?> |
| 149 | </table> |
| 150 | <?php |
| 151 | }else{ |
| 152 | ?> |
| 153 | <p><?php _e('No withdrawals pending yet', 'tutor'); ?></p> |
| 154 | <?php |
| 155 | } |
| 156 | ?> |
| 157 | </div> |
| 158 | |
| 159 | <div class="withdraw-history-table-wrap"> |
| 160 | <div class="withdraw-history-table-title"> |
| 161 | <h4> <?php _e('Completed Withdrawals', 'tutor'); ?></h4> |
| 162 | </div> |
| 163 | |
| 164 | <?php |
| 165 | if (tutor_utils()->count($withdraw_completed_histories->results)){ |
| 166 | ?> |
| 167 | <table class="withdrawals-history"> |
| 168 | <thead> |
| 169 | <tr> |
| 170 | <th><?php _e('Amount', 'tutor') ?></th> |
| 171 | <th><?php _e('Withdraw Method', 'tutor') ?></th> |
| 172 | <th><?php _e('Requested At', 'tutor') ?></th> |
| 173 | <th><?php _e('Approved At', 'tutor') ?></th> |
| 174 | </tr> |
| 175 | </thead> |
| 176 | <?php |
| 177 | foreach ($withdraw_completed_histories->results as $withdraw_history){ |
| 178 | ?> |
| 179 | <tr> |
| 180 | <td><?php echo tutor_utils()->tutor_price($withdraw_history->amount); ?></td> |
| 181 | <td> |
| 182 | <?php |
| 183 | $method_data = maybe_unserialize($withdraw_history->method_data); |
| 184 | echo tutor_utils()->avalue_dot('withdraw_method_name', $method_data) |
| 185 | ?> |
| 186 | </td> |
| 187 | <td> |
| 188 | <?php |
| 189 | echo date_i18n(get_option('date_format').' '.get_option('time_format'), strtotime($withdraw_history->created_at)); |
| 190 | ?> |
| 191 | </td> |
| 192 | |
| 193 | <td> |
| 194 | <?php |
| 195 | if ($withdraw_history->updated_at){ |
| 196 | echo date_i18n(get_option('date_format').' '.get_option('time_format'), strtotime($withdraw_history->updated_at)); |
| 197 | } |
| 198 | ?> |
| 199 | </td> |
| 200 | </tr> |
| 201 | <?php |
| 202 | } |
| 203 | ?> |
| 204 | </table> |
| 205 | <?php |
| 206 | }else{ |
| 207 | ?> |
| 208 | <p><?php _e('No withdrawals completed yet', 'tutor'); ?></p> |
| 209 | <?php |
| 210 | } |
| 211 | ?> |
| 212 | </div> |
| 213 | |
| 214 | |
| 215 | <div class="withdraw-history-table-wrap"> |
| 216 | <div class="withdraw-history-table-title"> |
| 217 | <h4> <?php _e('Rejected Withdrawals', 'tutor'); ?></h4> |
| 218 | </div> |
| 219 | |
| 220 | <?php |
| 221 | if (tutor_utils()->count($withdraw_rejected_histories->results)){ |
| 222 | ?> |
| 223 | <table class="withdrawals-history"> |
| 224 | <thead> |
| 225 | <tr> |
| 226 | <th><?php _e('Amount', 'tutor') ?></th> |
| 227 | <th><?php _e('Withdraw Method', 'tutor') ?></th> |
| 228 | <th><?php _e('Requested At', 'tutor') ?></th> |
| 229 | <th><?php _e('Rejected At', 'tutor') ?></th> |
| 230 | </tr> |
| 231 | </thead> |
| 232 | <?php |
| 233 | foreach ($withdraw_rejected_histories->results as $withdraw_history){ |
| 234 | ?> |
| 235 | <tr> |
| 236 | <td><?php echo tutor_utils()->tutor_price($withdraw_history->amount); ?></td> |
| 237 | <td> |
| 238 | <?php |
| 239 | $method_data = maybe_unserialize($withdraw_history->method_data); |
| 240 | echo tutor_utils()->avalue_dot('withdraw_method_name', $method_data) |
| 241 | ?> |
| 242 | </td> |
| 243 | <td> |
| 244 | <?php |
| 245 | echo date_i18n(get_option('date_format').' '.get_option('time_format'), strtotime($withdraw_history->created_at)); |
| 246 | ?> |
| 247 | </td> |
| 248 | |
| 249 | <td> |
| 250 | <?php |
| 251 | if ($withdraw_history->updated_at){ |
| 252 | echo date_i18n(get_option('date_format').' '.get_option('time_format'), strtotime($withdraw_history->updated_at)); |
| 253 | } |
| 254 | ?> |
| 255 | </td> |
| 256 | </tr> |
| 257 | <?php |
| 258 | } |
| 259 | ?> |
| 260 | </table> |
| 261 | <?php |
| 262 | }else{ |
| 263 | ?> |
| 264 | <p><?php _e('No withdrawals rejected yet', 'tutor'); ?></p> |
| 265 | <?php |
| 266 | } |
| 267 | ?> |
| 268 | </div> |
| 269 | |
| 270 | |
| 271 | </div> |