/** * Withdraw listing for admin * * @param string $status * * @return void */ function admin_withdraw_list($status) { $pagenum = isset($_GET['paged']) ? absint($_GET['paged']) : 1; $limit = 20; $offset = ($pagenum - 1) * $limit; $result = $this->get_withdraw_requests('', $this->get_status_code($status), $limit, $offset); ?> <?php if (isset($_GET['message'])) { $message = ''; switch ($_GET['message']) { case 'trashed': $message = __('Requests deleted!', 'dokan'); break; case 'cancelled': $message = __('Requests cancelled!', 'dokan'); break; case 'approved': $message = __('Requests approved!', 'dokan'); break; } if (!empty($message)) { ?> <div class="updated"> <p><strong><?php echo $message; ?> </strong></p> </div> <?php } } ?> <form method="post" action="" id="dokan-admin-withdraw-action"> <?php wp_nonce_field('dokan_withdraw_admin_bulk_action', 'dokan_withdraw_admin_bulk_action_nonce'); ?> <table class="widefat withdraw-table"> <thead> <tr> <th class="check-column"> <input type="checkbox" class="dokan-withdraw-allcheck"> </th> <th><?php _e('User Name', 'dokan'); ?> </th> <th><?php _e('Amount', 'dokan'); ?> </th> <th><?php _e('Method', 'dokan'); ?> </th> <th><?php _e('Method Details', 'dokan'); ?> </th> <th><?php _e('Note', 'dokan'); ?> </th> <th><?php _e('IP', 'dokan'); ?> </th> <th><?php _e('Date', 'dokan'); ?> </th> </tr> </thead> <tfoot> <tr> <th class="check-column"> <input type="checkbox" class="dokan-withdraw-allcheck"> </th> <th><?php _e('User Name', 'dokan'); ?> </th> <th><?php _e('Amount', 'dokan'); ?> </th> <th><?php _e('Method', 'dokan'); ?> </th> <th><?php _e('Method Details', 'dokan'); ?> </th> <th><?php _e('Note', 'dokan'); ?> </th> <th><?php _e('IP', 'dokan'); ?> </th> <th><?php _e('Date', 'dokan'); ?> </th> </tr> </tfoot> <?php if ($result) { $count = 0; foreach ($result as $key => $row) { $user_data = get_userdata($row->user_id); $store_info = dokan_get_store_info($row->user_id); ?> <tr class="<?php echo $count % 2 == 0 ? 'alternate' : 'odd'; ?> "> <th class="check-column"> <input type="checkbox" name="id[<?php echo $row->id; ?> ]" value="<?php echo $row->id; ?> "> <input type="hidden" name="user_id[<?php echo $row->id; ?> ]" value="<?php echo $row->user_id; ?> "> <input type="hidden" name="method[<?php echo $row->id; ?> ]" value="<?php echo esc_attr($row->method); ?> "> <input type="hidden" name="amount[<?php echo $row->id; ?> ]" value="<?php echo esc_attr($row->amount); ?> "> </th> <td> <strong><a href="<?php echo admin_url('user-edit.php?user_id=' . $user_data->ID); ?> "><?php echo $user_data->user_login; ?> </a></strong> <div class="row-actions"> <?php if ($status == 'pending') { ?> <span class="edit"><a href="#" class="dokan-withdraw-action" data-status="approve" data-withdraw_id = "<?php echo $row->id; ?> "><?php _e('Approve', 'dokan'); ?> </a> | </span> <span class="edit"><a href="#" class="dokan-withdraw-action" data-status="cancel" data-withdraw_id = "<?php echo $row->id; ?> "><?php _e('Cancel', 'dokan'); ?> </a></span> <?php } elseif ($status == 'completed') { ?> <span class="edit"><a href="#" class="dokan-withdraw-action" data-status="cancel" data-withdraw_id = "<?php echo $row->id; ?> "><?php _e('Cancel', 'dokan'); ?> </a> | </span> <span class="edit"><a href="#" class="dokan-withdraw-action" data-status="pending" data-withdraw_id = "<?php echo $row->id; ?> "><?php _e('Pending', 'dokan'); ?> </a></span> <?php } elseif ($status == 'cancelled') { ?> <span class="edit"><a href="#" class="dokan-withdraw-action" data-status="approve" data-withdraw_id = "<?php echo $row->id; ?> "><?php _e('Approve', 'dokan'); ?> </a> | </span> <span class="edit"><a href="#" class="dokan-withdraw-action" data-status="pending" data-withdraw_id = "<?php echo $row->id; ?> "><?php _e('Pending', 'dokan'); ?> </a></span> <?php } ?> <?php if ($result) { ?> <span class="trash"> | <a href="#" class="dokan-withdraw-action" data-status="delete" data-withdraw_id = "<?php echo $row->id; ?> "><?php _e('Delete', 'dokan'); ?> </a></span> <?php } ?> </div> </td> <td><?php echo wc_price($row->amount); ?> </td> <td><?php echo dokan_withdraw_get_method_title($row->method); ?> </td> <td> <?php if ($row->method != 'bank') { if (isset($store_info['payment'][$row->method])) { echo $store_info['payment'][$row->method]['email']; } } elseif ($row->method == 'bank') { echo dokan_get_seller_bank_details($row->user_id); } ?> </td> <td> <div class="dokan-add-note"> <div class="note-display"> <p class="ajax_note"><?php echo $row->note; ?> </p> <div class="row-actions"> <a href="#" class="dokan-note-field"><?php _e('Add note', 'dokan'); ?> </a> </div> </div> <div class="note-form" style="display: none;"> <p><input type="text" class="dokan-note-text" name="note[<?php echo $row->id; ?> ]" value="<?php echo esc_attr($row->note); ?> "></p> <a class="dokan-note-submit button" data-id=<?php echo $row->id; ?> href="#" ><?php _e('Save', 'dokan'); ?> </a> <a href="#" class="dokan-note-cancel"><?php _e('cancel', 'dokan'); ?> </a> </div> </div> </td> <td><?php echo $row->ip; ?> </td> <td><?php echo date_i18n('M j, Y g:ia', strtotime($row->date)); ?> </td> </tr> <?php $count++; } } else { ?> <tr> <td colspan="8"> <?php _e('No result found', 'dokan'); ?> </td> </tr> <?php } ?> </table> <div class="tablenav bottom"> <div class="alignleft actions bulkactions"> <select name="dokan_withdraw_bulk"> <option value="-1" selected="selected"><?php _e('Bulk Actions', 'dokan'); ?> </option> <?php if ($status == 'pending') { ?> <option value="approve"><?php _e('Approve Requests', 'dokan'); ?> </option> <option value="cancel"><?php _e('Mark as Cancelled', 'dokan'); ?> </option> <?php } elseif ($status == 'completed') { ?> <option value="cancel"><?php _e('Mark as Cancelled', 'dokan'); ?> </option> <option value="pending"><?php _e('Mark Pending', 'dokan'); ?> </option> <?php } elseif ($status == 'cancelled') { ?> <option value="approve"><?php _e('Approve Requests', 'dokan'); ?> </option> <option value="pending"><?php _e('Mark Pending', 'dokan'); ?> </option> <?php } ?> <?php if ($result) { ?> <option value="delete"><?php _e('Delete', 'dokan'); ?> </option> <option value="paypal"><?php _e('Download PayPal mass payment file', 'dokan'); ?> </option> <?php } ?> </select> <input type="hidden" name="status_page" value="<?php echo $status; ?> "> <input type="submit" name="" id="doaction2" class="button button-primary" value="<?php esc_attr_e('Apply', 'dokan'); ?> "> </div> <?php if ($result) { $counts = dokan_get_withdraw_count(); $num_of_pages = ceil($counts[$status] / $limit); $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('«', 'aag'), 'next_text' => __('»', 'aag'), 'total' => $num_of_pages, 'current' => $pagenum)); if ($page_links) { echo '<div class="tablenav-pages">' . $page_links . '</div>'; } } ?> </div> </form> <?php $ajax_url = admin_url('admin-ajax.php'); ?> <style type="text/css"> .withdraw-table { margin-top: 10px; } .withdraw-table td, .withdraw-table th { vertical-align: top; } .custom-spinner { background: url('images/spinner-2x.gif') no-repeat; background-position: 43% 9px; background-size: 20px 20px; opacity: .4; filter: alpha(opacity=40); width: 20px; height: 20px; } </style> <script> (function($){ $(document).ready(function(){ var url = "<?php echo $ajax_url; ?> "; $('#dokan-admin-withdraw-action').on('click', 'a.dokan-withdraw-action', function(e) { e.preventDefault(); var self = $(this); self.closest( 'tr' ).addClass('custom-spinner'); data = { action: 'dokan_withdraw_form_action', formData : $('#dokan-admin-withdraw-action').serialize(), status: self.data('status') , withdraw_id : self.data( 'withdraw_id' ) } $.post(url, data, function( resp ) { if( resp.success ) { self.closest( 'tr' ).removeClass('custom-spinner'); window.location = resp.data.url; } else { self.closest( 'tr' ).removeClass('custom-spinner'); alert( 'Somthig wrong...!!!' ); } }); }); }); })(jQuery) </script> <?php $this->add_note_script(); }
function admin_withdraw_list($status) { $pagenum = isset($_GET['paged']) ? absint($_GET['paged']) : 1; $limit = 20; $offset = ($pagenum - 1) * $limit; $result = $this->get_withdraw_requests('', $this->get_status_code($status), $limit, $offset); ?> <?php if (isset($_GET['message'])) { if ($_GET['message'] == 'trashed') { ?> <div class="updated"> <p><strong><?php _e('Requests deleted!', 'dokan'); ?> </strong></p> </div> <?php } if ($_GET['message'] == 'cancelled') { ?> <div class="updated"> <p><strong><?php _e('Requests cancelled!', 'dokan'); ?> </strong></p> </div> <?php } if ($_GET['message'] == 'approved') { ?> <div class="updated"> <p><strong><?php _e('Requests approved!', 'dokan'); ?> </strong></p> </div> <?php } } ?> <form method="post" action=""> <table class="widefat withdraw-table"> <thead> <tr> <th class="check-column"> <input type="checkbox" class="dokan-withdraw-allcheck"> </th> <th><?php _e('User Name', 'dokan'); ?> </th> <th><?php _e('Amount', 'dokan'); ?> </th> <th><?php _e('Method', 'dokan'); ?> </th> <th><?php _e('Method Details', 'dokan'); ?> </th> <th><?php _e('Note', 'dokan'); ?> </th> <th><?php _e('IP', 'dokan'); ?> </th> <th><?php _e('Date', 'dokan'); ?> </th> </tr> </thead> <tfoot> <tr> <th class="check-column"> <input type="checkbox" class="dokan-withdraw-allcheck"> </th> <th><?php _e('User Name', 'dokan'); ?> </th> <th><?php _e('Amount', 'dokan'); ?> </th> <th><?php _e('Method', 'dokan'); ?> </th> <th><?php _e('Method Details', 'dokan'); ?> </th> <th><?php _e('Note', 'dokan'); ?> </th> <th><?php _e('IP', 'dokan'); ?> </th> <th><?php _e('Date', 'dokan'); ?> </th> </tr> </tfoot> <?php if ($result) { $count = 0; foreach ($result as $key => $row) { $user_data = get_userdata($row->user_id); $store_info = dokan_get_store_info($row->user_id); ?> <tr class="<?php echo $count % 2 == 0 ? 'alternate' : 'odd'; ?> "> <th class="check-column"> <input type="checkbox" name="id[<?php echo $row->id; ?> ]" value="<?php echo $row->id; ?> "> <input type="hidden" name="user_id[<?php echo $row->id; ?> ]" value="<?php echo $row->user_id; ?> "> <input type="hidden" name="method[<?php echo $row->id; ?> ]" value="<?php echo esc_attr($row->method); ?> "> <input type="hidden" name="amount[<?php echo $row->id; ?> ]" value="<?php echo esc_attr($row->amount); ?> "> </th> <td> <strong><a href="<?php echo admin_url('user-edit.php?user_id=' . $user_data->ID); ?> "><?php echo $user_data->user_login; ?> </a></strong> </td> <td><?php echo wc_price($row->amount); ?> </td> <td><?php echo dokan_withdraw_get_method_title($row->method); ?> </td> <td> <?php if ($row->method != 'bank') { if (isset($store_info['payment'][$row->method])) { echo $store_info['payment'][$row->method]['email']; } } elseif ($row->method == 'bank') { echo dokan_get_seller_bank_details($row->user_id); } ?> </td> <td> <div class="dokan-add-note"> <div class="note-display"> <p class="ajax_note"><?php echo $row->note; ?> </p> <div class="row-actions"> <a href="#" class="dokan-note-field"><?php _e('Add note', 'dokan'); ?> </a> </div> </div> <div class="note-form" style="display: none;"> <p><input type="text" class="dokan-note-text" name="note[<?php echo $row->id; ?> ]" value="<?php echo esc_attr($row->note); ?> "></p> <a class="dokan-note-submit button" data-id=<?php echo $row->id; ?> href="#" ><?php _e('Save', 'dokan'); ?> </a> <a href="#" class="dokan-note-cancel"><?php _e('cancel', 'dokan'); ?> </a> </div> </div> </td> <td><?php echo $row->ip; ?> </td> <td><?php echo date_i18n('M j, Y g:ia', strtotime($row->date)); ?> </td> </tr> <?php $count++; } } else { ?> <tr> <td colspan="8"> <?php _e('No result found', 'dokan'); ?> </td> </tr> <?php } ?> </table> <div class="tablenav bottom"> <div class="alignleft actions bulkactions"> <select name="dokan_withdraw_bulk"> <option value="-1" selected="selected"><?php _e('Bulk Actions', 'dokan'); ?> </option> <?php if ($status == 'pending') { ?> <option value="approve"><?php _e('Approve Requests', 'dokan'); ?> </option> <option value="cancel"><?php _e('Mark as Cancelled', 'dokan'); ?> </option> <?php } elseif ($status == 'completed') { ?> <option value="cancel"><?php _e('Mark as Cancelled', 'dokan'); ?> </option> <option value="pending"><?php _e('Mark Pending', 'dokan'); ?> </option> <?php } elseif ($status == 'cancelled') { ?> <option value="approve"><?php _e('Approve Requests', 'dokan'); ?> </option> <option value="pending"><?php _e('Mark Pending', 'dokan'); ?> </option> <?php } ?> <?php if ($result) { ?> <option value="delete"><?php _e('Delete', 'dokan'); ?> </option> <option value="paypal"><?php _e('Download PayPal mass payment file', 'dokan'); ?> </option> <?php } ?> </select> <input type="hidden" name="status_page" value="<?php echo $status; ?> "> <input type="submit" name="" id="doaction2" class="button button-primary" value="<?php esc_attr_e('Apply', 'dokan'); ?> "> </div> <?php if ($result) { $counts = dokan_get_withdraw_count(); $num_of_pages = ceil($counts[$status] / $limit); $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('«', 'aag'), 'next_text' => __('»', 'aag'), 'total' => $num_of_pages, 'current' => $pagenum)); if ($page_links) { echo '<div class="tablenav-pages">' . $page_links . '</div>'; } } ?> </div> </form> <style type="text/css"> .withdraw-table { margin-top: 10px; } .withdraw-table td, .withdraw-table th { vertical-align: top; } </style> <?php $this->add_note_script(); }