Open Shubii8760 opened 3 months ago
<?php include DIR . "/header.php"; $status = wpfe_get_distinct_status(); ?> <?php if (!can_user_access_portal_admin()) { die(); }
// $users = wpfe_api_handle_admin_orders();
?>
Yes
NO
<?php include DIR . "/footer.php"; ?>
register_rest_route("wpfe/v1", "/withdraw-requests/query", [ "methods" => "POST", "callback" => "wpfe_query_withdraw_requests", "permission_callback" => "can_user_access_portal_admin", ]);
function wpfe_query_withdraw_requests($request) {
$body = $request->get_body(); $data = json_decode($body, true);
$args = [ "posts_per_page" => $data['rowsPerPage'], "offset" => $data['rowsPerPage'] * ($data['page'] - 1), "order" => "DESC", "post_status" => "private", "post_type" => "withdraw_request", ];
if (isset($data['sortBy'])) {
if ($data['sortBy'] == 'date') { $args['order'] = strtoupper($data['sortType']); } if ($data['sortBy'] == 'id') { $args['orderby'] = 'ID'; $args['order'] = strtoupper($data['sortType']); } if ($data['sortBy'] == 'account_login') { $args['meta_key'] = '_account_login'; $args['orderby'] = 'meta_value_num'; $args['order'] = strtoupper($data['sortType']); } if ($data['sortBy'] == 'amount') { $args['meta_key'] = '_amount'; $args['orderby'] = 'meta_value_num'; $args['order'] = strtoupper($data['sortType']); } if ($data['sortBy'] == 'paid') { $args['meta_key'] = '_paid'; $args['orderby'] = 'meta_value'; $args['order'] = strtoupper($data['sortType']); } if ($data['sortBy'] == 'status') { $args['meta_key'] = '_status'; $args['orderby'] = 'meta_value'; $args['order'] = strtoupper($data['sortType']); }
}
if (isset($data['s'])) {
$search_term = $data['s']; if (get_post_type($search_term) == 'withdraw_request') { $args['p'] = intval($data['s']); } else { $args['meta_query'] = array( 'relation' => 'OR', 'status' => array( 'key' => '_status', 'value' => $data['s'], "compare" => "LIKE", ), 'login' => array( 'key' => '_account_login', 'value' => $data['s'], "compare" => "LIKE", ), 'amount' => array( 'key' => '_amount', 'value' => $data['s'], "compare" => "LIKE", ), 'order_id' => array( 'key' => '_order_id', 'value' => $data['s'], "compare" => "LIKE", ), ); if ($data['s'] == 'paid') { $args['meta_query']['paid'] = array( 'key' => '_paid', 'value' => true, "compare" => "=", ); } if ($data['s'] == 'unpaid') { $args['meta_query']['paid'] = array( 'key' => '_paid', 'value' => false, "compare" => "=", ); } }
$response = [];
$the_query = new WP_Query($args);
$total_posts = $the_query->found_posts;
if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post();
$response[] = get_withdraw_request_by_id(get_the_ID()); }
wp_reset_postdata(); $status = !empty($data['s']) ? $data['s'] : "0";
return [ "results" => $response, "total" => $total_posts, "data" => $data, "args" => $args, "status" => $status, ]; }
this is my code in this when i use search then it is not working can some one help me how to do this
I had to remove the v-model:server-options="serverOptions" to be able to use the search
<?php include DIR . "/header.php"; $status = wpfe_get_distinct_status(); ?> <?php if (!can_user_access_portal_admin()) { die(); }
// $users = wpfe_api_handle_admin_orders();
?>
Withdraw Requests
Yes
NO
<?php include DIR . "/footer.php"; ?>
register_rest_route("wpfe/v1", "/withdraw-requests/query", [ "methods" => "POST", "callback" => "wpfe_query_withdraw_requests", "permission_callback" => "can_user_access_portal_admin", ]);
function wpfe_query_withdraw_requests($request) {
$body = $request->get_body(); $data = json_decode($body, true);
$args = [ "posts_per_page" => $data['rowsPerPage'], "offset" => $data['rowsPerPage'] * ($data['page'] - 1), "order" => "DESC", "post_status" => "private", "post_type" => "withdraw_request", ];
if (isset($data['sortBy'])) {
}
if (isset($data['s'])) {
}
$response = [];
$the_query = new WP_Query($args);
$total_posts = $the_query->found_posts;
if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post();
}
wp_reset_postdata(); $status = !empty($data['s']) ? $data['s'] : "0";
return [ "results" => $response, "total" => $total_posts, "data" => $data, "args" => $args, "status" => $status, ]; }
this is my code in this when i use search then it is not working can some one help me how to do this