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