added pagination admin vendor payments and payouts table
This commit is contained in:
parent
4620fde33d
commit
f616306a45
|
@ -93,7 +93,7 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
<!-- Sidebar toggle button -->
|
||||
<button id="sidebar-toggler" class="sidebar-toggle"></button>
|
||||
<!-- search form -->
|
||||
|
||||
|
||||
<!-- 03-07-2024 Stacy & Raymart modified this block of code -->
|
||||
<div class="search-form d-lg-inline-block">
|
||||
<form action="vendor-product-search-action.php">
|
||||
|
@ -648,22 +648,22 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
</header>
|
||||
|
||||
|
||||
<!-- 3-19-24 raymart added vendor search -->
|
||||
<?php if (!empty($vendorSearchResult['results'])) : ?>
|
||||
<div class="shop-pro-content" style="margin-bottom:40px; margin-right: 2%; margin-left: 2%;">
|
||||
<div class="ec-product-inner">
|
||||
<h5 class="ec-pro-title" style="margin-top: 25px; margin-left: 5%; font-size: 25px;">Vendor Search Results</h5>
|
||||
<div class="row mt-4">
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($vendorSearchResult['results'] as $vendor) {
|
||||
if ($count < 2) {
|
||||
?>
|
||||
<div class="col-md-12">
|
||||
<div class="card" style="margin:5px">
|
||||
<div class="card-body">
|
||||
<div class="vendor-info" style="display: flex; align-items: center;">
|
||||
<div class="ec-catalog-vendor" style="display: inline-block;">
|
||||
<!-- 3-19-24 raymart added vendor search -->
|
||||
<?php if (!empty($vendorSearchResult['results'])) : ?>
|
||||
<div class="shop-pro-content" style="margin-bottom:40px; margin-right: 2%; margin-left: 2%;">
|
||||
<div class="ec-product-inner">
|
||||
<h5 class="ec-pro-title" style="margin-top: 25px; margin-left: 5%; font-size: 25px;">Vendor Search Results</h5>
|
||||
<div class="row mt-4">
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($vendorSearchResult['results'] as $vendor) {
|
||||
if ($count < 2) {
|
||||
?>
|
||||
<div class="col-md-12">
|
||||
<div class="card" style="margin:5px">
|
||||
<div class="card-body">
|
||||
<div class="vendor-info" style="display: flex; align-items: center;">
|
||||
<div class="ec-catalog-vendor" style="display: inline-block;">
|
||||
<a href="vendor-profile.php?id=<?php echo $vendor["_id"] ?>">
|
||||
<?php if (isset($vendor['vendor_image'])) : ?>
|
||||
<img loading="lazy" src="<?php echo $vendor['vendor_image']; ?>" alt="<?php echo $vendor['user_login']; ?>" class="vendor-image" style="max-width: 100px; max-height: 100px;">
|
||||
|
@ -671,117 +671,124 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
<img loading="lazy" src="https://api.obanana.com/images/storage/web_images/1708588564876-viber_image_2024-02-22_15-54-42-498.png" class="vendor-image-placeholder" style="max-width: 100px; max-height: 100px;">
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="vendor-details" style="display:inline-block;">
|
||||
<h6 class="ec-pro-title" style="padding:0 30px;font-family: Poppins, sans-serif; text-decoration: none; color: #777;white-space: nowrap;text-overflow: ellipsis;display: block;font-size: 16px;font-weight: 400;">
|
||||
<a href="vendor-profile.php?id=<?php echo $vendor["_id"] ?>">
|
||||
<?php echo $vendor['user_login']; ?>
|
||||
</a>
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: auto; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller Products</h6>
|
||||
<?php
|
||||
$products = productList();
|
||||
$vendorId = $vendor['_id'];
|
||||
$product = array_filter($products, function ($var) use ($vendorId) {
|
||||
return ($var['vendor_api_id'] == $vendorId);
|
||||
});
|
||||
?>
|
||||
<p><?php echo count($product); ?></p>
|
||||
</div>
|
||||
<div class="vendor-details" style="display:inline-block;">
|
||||
<h6 class="ec-pro-title" style="padding:0 30px;font-family: Poppins, sans-serif; text-decoration: none; color: #777;white-space: nowrap;text-overflow: ellipsis;display: block;font-size: 16px;font-weight: 400;">
|
||||
<a href="vendor-profile.php?id=<?php echo $vendor["_id"] ?>">
|
||||
<?php echo $vendor['user_login']; ?>
|
||||
</a>
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: auto; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller Products</h6>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: 5px; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller since</h6>
|
||||
<p>
|
||||
<?php
|
||||
$products = productList();
|
||||
$vendorId = $vendor['_id'];
|
||||
$product = array_filter($products, function ($var) use ($vendorId) {
|
||||
return ($var['vendor_api_id'] == $vendorId);
|
||||
});
|
||||
if (!empty($vendor['date_registered'])) {
|
||||
echo $vendor['date_registered'];
|
||||
} else {
|
||||
echo "Not yet registered";
|
||||
}
|
||||
?>
|
||||
<p><?php echo count($product); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: 5px; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller since</h6>
|
||||
<p><?php echo $vendor['date_registered']; ?></p>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!-- vendor search end -->
|
||||
|
||||
<!-- 3-19-24 raymart added Shop content Start -->
|
||||
<div class="shop-pro-content" style="margin-right: 2%; margin-left: 2%;">
|
||||
<div class="shop-pro-inner list-view">
|
||||
<div class="row">
|
||||
<?php
|
||||
// $productSearchResult = [];
|
||||
// foreach ($productSearchResult['results'] as $product => $productListVendor) {
|
||||
// echo "$product .":" . $productListVendor";
|
||||
// $vendorOfProduct = getVendorbyId($product['vendor_api_id']);
|
||||
|
||||
$products = productListVendor($vendorId);
|
||||
$totalProducts = count($products);
|
||||
|
||||
|
||||
for ($i = 0; $i <= $totalProducts - 1; $i++) {
|
||||
$product = $products[$i];
|
||||
?>
|
||||
<div class="col-lg-3 col-md-4 col-sm-6">
|
||||
<div class="card-wrapper">
|
||||
<div class="card-container">
|
||||
<div class="card-top">
|
||||
<div class="image-container" style="height: 300px;"> <!-- Adjust the height as needed -->
|
||||
<?php
|
||||
if (isset($product['images'])) {
|
||||
$image_urls = explode(',', $product['images']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="img-fluid" src="<?php echo $first_image_url; ?>" alt="edit" style="object-fit: cover; width: 100%; height: 100%;"/>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img loading="lazy" class="img-fluid rounded-circle" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-bottom">
|
||||
<h3><?php echo $product['product_name']; ?></h3>
|
||||
<p>₱<?php echo $product['regular_price']; ?></p>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="card-edit" onclick="editProduct('<?php echo $product['_id'] ?>');"><i class="mdi mdi-circle-edit-outline"></i></div>
|
||||
<div class="card-preview"><i class="mdi mdi-eye-outline"></i></div>
|
||||
<div class="card-remove" onclick="deleteProd('<?php echo $product['_id'] ?>');"><i class="mdi mdi mdi-delete-outline"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Shop content End -->
|
||||
|
||||
<!-- 3-19-24 raymart added function for delete & edit -->
|
||||
<script>
|
||||
<?php endif; ?>
|
||||
<!-- vendor search end -->
|
||||
|
||||
var sessionToken = '<?php echo isset($_SESSION["token"]) ? $_SESSION["token"] : ""; ?>';
|
||||
var email = '<?php echo isset($_SESSION["email"]) ? $_SESSION["email"] : ""; ?>';
|
||||
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
|
||||
<!-- 3-19-24 raymart added Shop content Start -->
|
||||
<div class="shop-pro-content" style="margin-right: 2%; margin-left: 2%;">
|
||||
<div class="shop-pro-inner list-view">
|
||||
<div class="row">
|
||||
<?php
|
||||
// $productSearchResult = [];
|
||||
// foreach ($productSearchResult['results'] as $product => $productListVendor) {
|
||||
// echo "$product .":" . $productListVendor";
|
||||
// $vendorOfProduct = getVendorbyId($product['vendor_api_id']);
|
||||
|
||||
function editProduct(productId) {
|
||||
$products = productListVendor($vendorId);
|
||||
$totalProducts = count($products);
|
||||
|
||||
|
||||
for ($i = 0; $i <= $totalProducts - 1; $i++) {
|
||||
$product = $products[$i];
|
||||
?>
|
||||
<div class="col-lg-3 col-md-4 col-sm-6">
|
||||
<div class="card-wrapper">
|
||||
<div class="card-container">
|
||||
<div class="card-top">
|
||||
<div class="image-container" style="height: 300px;"> <!-- Adjust the height as needed -->
|
||||
<?php
|
||||
if (isset($product['images'])) {
|
||||
$image_urls = explode(',', $product['images']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="img-fluid" src="<?php echo $first_image_url; ?>" alt="edit" style="object-fit: cover; width: 100%; height: 100%;" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img loading="lazy" class="img-fluid rounded-circle" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-bottom">
|
||||
<h3><?php echo $product['product_name']; ?></h3>
|
||||
<p>₱<?php echo $product['regular_price']; ?></p>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="card-edit" onclick="editProduct('<?php echo $product['_id'] ?>');"><i class="mdi mdi-circle-edit-outline"></i></div>
|
||||
<div class="card-preview"><i class="mdi mdi-eye-outline"></i></div>
|
||||
<div class="card-remove" onclick="deleteProd('<?php echo $product['_id'] ?>');"><i class="mdi mdi mdi-delete-outline"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Shop content End -->
|
||||
|
||||
<!-- 3-19-24 raymart added function for delete & edit -->
|
||||
<script>
|
||||
var sessionToken = '<?php echo isset($_SESSION["token"]) ? $_SESSION["token"] : ""; ?>';
|
||||
var email = '<?php echo isset($_SESSION["email"]) ? $_SESSION["email"] : ""; ?>';
|
||||
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
|
||||
|
||||
function editProduct(productId) {
|
||||
console.log("Session Token:", sessionToken);
|
||||
login(email, password, function() {
|
||||
// Removed the call to updateSessionToken
|
||||
|
@ -818,36 +825,35 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
.then(data => {
|
||||
// Update the session token on the server side
|
||||
fetch("update-token-session.php", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: data.token
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: data.token
|
||||
})
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.status === 'success') {
|
||||
// Update the session token in the client-side variable
|
||||
sessionToken = data.token;
|
||||
console.log("New Token:", sessionToken);
|
||||
callback();
|
||||
} else {
|
||||
throw new Error("Unable to update session token");
|
||||
}
|
||||
});
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.status === 'success') {
|
||||
// Update the session token in the client-side variable
|
||||
sessionToken = data.token;
|
||||
console.log("New Token:", sessionToken);
|
||||
callback();
|
||||
} else {
|
||||
throw new Error("Unable to update session token");
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error:", error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<!-- 3-19-24 raymart added function for delete & edit -->
|
||||
|
||||
</script>
|
||||
<!-- 3-19-24 raymart added function for delete & edit -->
|
||||
|
||||
|
||||
<!-- Common Javascript -->
|
||||
<!-- Common Javascript -->
|
||||
<script src="assets/plugins/jquery/jquery-3.5.1.min.js"></script>
|
||||
<script src="assets/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/plugins/simplebar/simplebar.min.js"></script>
|
||||
|
@ -860,6 +866,6 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
<!-- Ekka Custom -->
|
||||
<script src="assets/js/ekka.js"></script>
|
||||
|
||||
</body>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,45 +1,44 @@
|
|||
<?php
|
||||
include "../functions.php";
|
||||
|
||||
if(isset($_SESSION["vendorId"])){
|
||||
if(isset($_GET["id"])){
|
||||
$_SESSION["vendorId"]=$_GET["id"];
|
||||
}
|
||||
if (isset($_SESSION["vendorId"])) {
|
||||
if (isset($_GET["id"])) {
|
||||
$_SESSION["vendorId"] = $_GET["id"];
|
||||
}
|
||||
} else {
|
||||
if(isset($_GET["id"])){
|
||||
$_SESSION["vendorId"]=$_GET["id"];
|
||||
} else {
|
||||
header("location: vendor-card.php");
|
||||
}
|
||||
if (isset($_GET["id"])) {
|
||||
$_SESSION["vendorId"] = $_GET["id"];
|
||||
} else {
|
||||
header("location: vendor-card.php");
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
|
||||
|
||||
|
||||
if ($_SESSION["userId"] <> "") {
|
||||
$_SESSION["isLoggedIn"] = true;
|
||||
|
||||
$_SESSION["isLoggedIn"] = true;
|
||||
} else {
|
||||
$_SESSION["isLoggedIn"] = false;
|
||||
header("location: login.php");
|
||||
$_SESSION["isLoggedIn"] = false;
|
||||
header("location: login.php");
|
||||
}
|
||||
|
||||
if($_SESSION["user_type"]!="admin"){
|
||||
header("location: login.php?alert=Only admins allowed here!");
|
||||
if ($_SESSION["user_type"] != "admin") {
|
||||
header("location: login.php?alert=Only admins allowed here!");
|
||||
}
|
||||
|
||||
$vendor = getVendorbyId($_SESSION["vendorId"]);
|
||||
$vendorData = json_decode($vendor,true);
|
||||
$vendorData = json_decode($vendor, true);
|
||||
|
||||
$selectedBankAccount = null;
|
||||
foreach ($vendorData['bank_acount_details'] as $bankAccount) {
|
||||
if ($bankAccount['bank_payout']) {
|
||||
$selectedBankAccount = $bankAccount;
|
||||
break;
|
||||
}
|
||||
if ($bankAccount['bank_payout']) {
|
||||
$selectedBankAccount = $bankAccount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($selectedBankAccount === null && !empty($vendorData['bank_acount_details'])) {
|
||||
$selectedBankAccount = $vendorData['bank_acount_details'][0];
|
||||
$selectedBankAccount = $vendorData['bank_acount_details'][0];
|
||||
}
|
||||
$selectedBankAccountJSON = json_encode($selectedBankAccount);
|
||||
|
||||
|
@ -47,22 +46,22 @@ $selectedBankAccountJSON = json_encode($selectedBankAccount);
|
|||
$shopOrders = getOrderbyVendorId($_SESSION["vendorId"]);
|
||||
$vendorOrderss = json_decode($shopOrders);
|
||||
if (is_array($vendorOrderss)) {
|
||||
$vendorOrders = json_decode($shopOrders);
|
||||
$vendorOrders = json_decode($shopOrders);
|
||||
} elseif (is_object($vendorOrderss) && property_exists($vendorOrderss, 'message')) {
|
||||
$vendorOrders = [];
|
||||
$vendorOrders = [];
|
||||
} else {
|
||||
echo "Unknown type or no 'message' property found.";
|
||||
echo "Unknown type or no 'message' property found.";
|
||||
}
|
||||
|
||||
$allPayouts = getAllPayout($_SESSION["token"]);
|
||||
$vendorPayouts = json_decode($allPayouts,true);
|
||||
$vendorPayouts = json_decode($allPayouts, true);
|
||||
|
||||
|
||||
$filteredPayouts = [];
|
||||
foreach ($vendorPayouts as $payout) {
|
||||
if ($payout['vendor_details'][0]['vendor_id'] == $_SESSION["vendorId"]) {
|
||||
$filteredPayouts[] = $payout;
|
||||
}
|
||||
if ($payout['vendor_details'][0]['vendor_id'] == $_SESSION["vendorId"]) {
|
||||
$filteredPayouts[] = $payout;
|
||||
}
|
||||
}
|
||||
|
||||
// if (isset($_SESSION["token"])) {
|
||||
|
@ -114,55 +113,82 @@ date_default_timezone_set('Asia/Manila');
|
|||
<!-- FAVICON -->
|
||||
<link href="assets/img/favicon.png" rel="shortcut icon" />
|
||||
|
||||
<script>
|
||||
<style>
|
||||
.tab.active {
|
||||
background-color: #ffaa00;
|
||||
/* Set your desired background color for the active tab */
|
||||
color: #ffffff;
|
||||
/* Set your desired text color for the active tab */
|
||||
|
||||
var token_parts = "<?php echo $_SESSION["token"]; ?>".split(".");
|
||||
console.log("Token Payload: " + token_parts[1]);
|
||||
var token_payload = atob(token_parts[1]);
|
||||
var token_data = JSON.parse(token_payload);
|
||||
}
|
||||
|
||||
#pagination, #po_pagination {
|
||||
display: flex;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
justify-content: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#pagination a, #po_pagination a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
var token_parts = "<?php echo $_SESSION["token"]; ?>".split(".");
|
||||
console.log("Token Payload: " + token_parts[1]);
|
||||
var token_payload = atob(token_parts[1]);
|
||||
var token_data = JSON.parse(token_payload);
|
||||
|
||||
|
||||
var issued_at_time = token_data.iat;
|
||||
var expiration_time = token_data.exp;
|
||||
var renewal_time = issued_at_time + 200;
|
||||
console.log("Issued At Time: " + new Date(issued_at_time * 1000).toLocaleString());
|
||||
console.log("Expiration Time: " + new Date(expiration_time * 1000).toLocaleString());
|
||||
console.log("Renewal Time: " + new Date(renewal_time * 1000).toLocaleString());
|
||||
function renewToken() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "token-renew.php", true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
|
||||
var newToken = xhr.responseText;
|
||||
token_parts = newToken.split(".");
|
||||
token_payload = atob(token_parts[1]);
|
||||
token_data = JSON.parse(token_payload);
|
||||
issued_at_time = token_data.iat
|
||||
renewal_time = issued_at_time + 200
|
||||
expiration_time = token_data.exp;
|
||||
|
||||
console.log("New Token: " + token_parts)
|
||||
console.log("Token renewed at: " + new Date().toLocaleString());
|
||||
console.log("New expiration time: " + new Date(expiration_time * 1000).toLocaleString());
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
var issued_at_time = token_data.iat;
|
||||
var expiration_time = token_data.exp;
|
||||
var renewal_time = issued_at_time + 200;
|
||||
console.log("Issued At Time: " + new Date(issued_at_time * 1000).toLocaleString());
|
||||
console.log("Expiration Time: " + new Date(expiration_time * 1000).toLocaleString());
|
||||
console.log("Renewal Time: " + new Date(renewal_time * 1000).toLocaleString());
|
||||
|
||||
function renewToken() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "token-renew.php", true);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
|
||||
var newToken = xhr.responseText;
|
||||
token_parts = newToken.split(".");
|
||||
token_payload = atob(token_parts[1]);
|
||||
token_data = JSON.parse(token_payload);
|
||||
issued_at_time = token_data.iat
|
||||
renewal_time = issued_at_time + 200
|
||||
expiration_time = token_data.exp;
|
||||
|
||||
console.log("New Token: " + token_parts)
|
||||
console.log("Token renewed at: " + new Date().toLocaleString());
|
||||
console.log("New expiration time: " + new Date(expiration_time * 1000).toLocaleString());
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
|
||||
setInterval(function() {
|
||||
var currentTime = Date.now() / 1000;
|
||||
var renewalTime = renewal_time;
|
||||
var expirationTime = expiration_time;
|
||||
console.log("Current Time: " + new Date(currentTime * 1000).toLocaleString());
|
||||
console.log("Renewal Time: " + new Date(renewalTime * 1000).toLocaleString());
|
||||
console.log("Expiration Time: " + new Date(expirationTime * 1000).toLocaleString());
|
||||
if (currentTime >= renewalTime || currentTime >= expirationTime) {
|
||||
console.log("Renewing token...");
|
||||
renewToken();
|
||||
}
|
||||
}, 60000);
|
||||
</script>
|
||||
setInterval(function() {
|
||||
var currentTime = Date.now() / 1000;
|
||||
var renewalTime = renewal_time;
|
||||
var expirationTime = expiration_time;
|
||||
console.log("Current Time: " + new Date(currentTime * 1000).toLocaleString());
|
||||
console.log("Renewal Time: " + new Date(renewalTime * 1000).toLocaleString());
|
||||
console.log("Expiration Time: " + new Date(expirationTime * 1000).toLocaleString());
|
||||
if (currentTime >= renewalTime || currentTime >= expirationTime) {
|
||||
console.log("Renewing token...");
|
||||
renewToken();
|
||||
}
|
||||
}, 60000);
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
|
@ -202,13 +228,14 @@ function renewToken() {
|
|||
<div class="ec-disp">
|
||||
<div class="text-center widget-profile px-0 border-0">
|
||||
<div class="card-img mx-auto rounded-circle">
|
||||
<img loading="lazy" src="<?php
|
||||
if($vendorData["vendor_image"]!=""){
|
||||
echo $vendorData["vendor_image"];
|
||||
} else {
|
||||
echo "assets/img/vendor/u1.jpg";
|
||||
}
|
||||
|
||||
<img loading="lazy" src="
|
||||
<?php
|
||||
if ($vendorData["vendor_image"] != "") {
|
||||
echo $vendorData["vendor_image"];
|
||||
} else {
|
||||
echo "assets/img/vendor/u1.jpg";
|
||||
}
|
||||
|
||||
?>" alt="user image" class="img-fluid rounded-circle" alt="Avatar Image" style="width: 100px; height: 100px; object-fit: cover; border-radius: 50%;">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
@ -245,28 +272,28 @@ function renewToken() {
|
|||
<php // echo "Updated token: " . $token; ?>
|
||||
<php // echo $_SESSION["password"] ?> -->
|
||||
<p class="text-dark font-weight-medium pt-24px mb-2">Email address</p>
|
||||
<p><?php echo $vendorData["user_email"]; ?></p>
|
||||
<p><?php echo $vendorData["user_email"]; ?></p>
|
||||
<p class="text-dark font-weight-medium pt-24px mb-2">Phone Number</p>
|
||||
<p>
|
||||
<?php
|
||||
if (!empty($vendorData["phone"])) {
|
||||
echo $vendorData["phone"];
|
||||
} else {
|
||||
echo "NONE";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
if (!empty($vendorData["phone"])) {
|
||||
echo $vendorData["phone"];
|
||||
} else {
|
||||
echo "NONE";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p class="text-dark font-weight-medium pt-24px mb-2">Vendor Since</p>
|
||||
<p>
|
||||
<?php
|
||||
if (!empty($vendorData["createdAt"])) {
|
||||
$createdAt = new DateTime($vendorData["createdAt"]);
|
||||
echo $createdAt->format('F j, Y');
|
||||
} else {
|
||||
echo "Unknown";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
if (!empty($vendorData["createdAt"])) {
|
||||
$createdAt = new DateTime($vendorData["createdAt"]);
|
||||
echo $createdAt->format('F j, Y');
|
||||
} else {
|
||||
echo "Unknown";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<!-- <p class="text-dark font-weight-medium pt-24px mb-2">Social Profile</p>
|
||||
<p class="social-button">
|
||||
<a href="#" class="mb-1 btn btn-outline btn-twitter rounded-circle">
|
||||
|
@ -293,35 +320,26 @@ function renewToken() {
|
|||
<div class="profile-content-right profile-right-spacing py-5">
|
||||
<ul class="nav nav-tabs px-3 px-xl-5 nav-style-border" id="myProfileTab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="payments-tab" data-bs-toggle="tab"
|
||||
data-bs-target="#payments" type="button" role="tab"
|
||||
aria-controls="payments" aria-selected="true">Payments</button>
|
||||
<button class="nav-link active" id="payments-tab" data-bs-toggle="tab" data-bs-target="#payments" type="button" role="tab" aria-controls="payments" aria-selected="true">Payments</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="payouts-tab" data-bs-toggle="tab"
|
||||
data-bs-target="#payouts" type="button" role="tab"
|
||||
aria-controls="payouts" aria-selected="true">Payouts</button>
|
||||
<button class="nav-link" id="payouts-tab" data-bs-toggle="tab" data-bs-target="#payouts" type="button" role="tab" aria-controls="payouts" aria-selected="true">Payouts</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="profile-tab" data-bs-toggle="tab"
|
||||
data-bs-target="#profile" type="button" role="tab"
|
||||
aria-controls="profile" aria-selected="true">Profile</button>
|
||||
<button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="true">Profile</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="settings-tab" data-bs-toggle="tab"
|
||||
data-bs-target="#settings" type="button" role="tab"
|
||||
aria-controls="settings" aria-selected="false">Settings</button>
|
||||
<button class="nav-link" id="settings-tab" data-bs-toggle="tab" data-bs-target="#settings" type="button" role="tab" aria-controls="settings" aria-selected="false">Settings</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content px-3 px-xl-5" id="myTabContent">
|
||||
|
||||
<div class="tab-pane fade show active" id="payments" role="tabpanel"
|
||||
aria-labelledby="payments-tab">
|
||||
<div class="tab-pane fade show active" id="payments" role="tabpanel" aria-labelledby="payments-tab">
|
||||
<div class="tab-widget mt-5">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<!-- Recent Order Table -->
|
||||
<div class="card card-default card-table-border-none ec-tbl"id="recent-orders">
|
||||
<div class="card card-default card-table-border-none ec-tbl" id="recent-orders">
|
||||
<div class="card-header justify-content-between">
|
||||
<h2>Payments</h2>
|
||||
|
||||
|
@ -331,7 +349,7 @@ function renewToken() {
|
|||
</div>
|
||||
|
||||
<div class="card-body pt-0 pb-0 table-responsive">
|
||||
<table id='paymentsTable'class="table">
|
||||
<table id='paymentsTable' class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox"></th>
|
||||
|
@ -345,19 +363,22 @@ function renewToken() {
|
|||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tbody id="paymentBody">
|
||||
<?php
|
||||
|
||||
$totalOrders = count($vendorOrders);
|
||||
$reversedOrders = array_reverse($vendorOrders);
|
||||
$paidOrderCount = 0;
|
||||
for ($i = 0; $i < $totalOrders; $i++) {
|
||||
$order = $vendorOrders[$i];
|
||||
$order = $reversedOrders[$i];
|
||||
$orderArray = json_encode($order, true);
|
||||
$orderItems = json_decode($orderArray, true);
|
||||
|
||||
if (strtoupper($orderItems['payment']['status']) === 'PAID') {
|
||||
foreach ($orderItems['items'] as $item) {
|
||||
$paidOrderCount++;
|
||||
$displayDate = date('m-d-Y, g:i A', strtotime($orderItems['updatedAt']));
|
||||
$isPayoutCompleted = !empty($orderItems['payout_status']);
|
||||
?>
|
||||
?>
|
||||
<tr>
|
||||
<td><input type="checkbox" <?php echo $isPayoutCompleted ? 'disabled' : ''; ?>></td>
|
||||
<td><?php echo $orderItems['payment_method']; ?></td>
|
||||
|
@ -384,7 +405,7 @@ function renewToken() {
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -392,133 +413,184 @@ function renewToken() {
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="pagination"></div>
|
||||
<script>
|
||||
const itemsPerPage = 5;
|
||||
const totalItems = <?php echo $paidOrderCount; ?>;
|
||||
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
||||
|
||||
|
||||
function showPage(page) {
|
||||
const startIndex = (page - 1) * itemsPerPage;
|
||||
const endIndex = startIndex + itemsPerPage;
|
||||
const tableRows = document.querySelectorAll('#paymentBody tr');
|
||||
|
||||
// for pagination button
|
||||
const pager = document.querySelectorAll('.page-btn')
|
||||
pager.forEach((row, index) => {
|
||||
if (index !== page - 1) {
|
||||
row.style.backgroundColor = "white";
|
||||
row.style.color = "black";
|
||||
} else {
|
||||
row.style.backgroundColor = "#007bff";
|
||||
row.style.color = "white";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
tableRows.forEach((row, index) => {
|
||||
if (index >= startIndex && index < endIndex) {
|
||||
row.style.display = 'table-row';
|
||||
} else {
|
||||
row.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createPagination() {
|
||||
const paginationContainer = document.getElementById('pagination');
|
||||
|
||||
for (let i = 1; i <= totalPages; i++) {
|
||||
// created a tag
|
||||
const pageButton = document.createElement('a');
|
||||
// created class for a tag
|
||||
pageButton.className = "page-btn page-" + i
|
||||
pageButton.textContent = i;
|
||||
pageButton.addEventListener('click', () => showPage(i));
|
||||
paginationContainer.appendChild(pageButton);
|
||||
}
|
||||
}
|
||||
|
||||
createPagination();
|
||||
showPage(1); // Show the first page by default
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end mt-5">
|
||||
<button type="button" class="btn btn-primary mb-2 btn-pill" onclick="createPayout()">Create Payout from Selected</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function createPayout() {
|
||||
var rows = document.querySelectorAll("#recent-orders tbody tr");
|
||||
var selectedBank = JSON.parse('<?php echo $selectedBankAccountJSON; ?>');
|
||||
var selectedOrders = [];
|
||||
var grossAmount = 0;
|
||||
var totalIndividualFee = 0;
|
||||
var feesDeductionAdjustment = <?php echo $_SESSION["transfer_fee"] ?>;
|
||||
var feesPercentage = (feesDeductionAdjustment * 100) + '%';
|
||||
const token = '<?php echo $_SESSION["token"] ?>';
|
||||
const vendorId = '<?php echo ($vendorData['_id']); ?>';
|
||||
const vendorName = '<?php echo ($vendorData['user_login']); ?>';
|
||||
rows.forEach(function(row) {
|
||||
var checkbox = row.querySelector("input[type=checkbox]");
|
||||
if (checkbox && checkbox.checked) {
|
||||
var amount = parseFloat(row.cells[2].innerText);
|
||||
var orderId = row.cells[7].innerText;
|
||||
grossAmount += amount;
|
||||
var individualFee = amount * <?php echo $_SESSION["transfer_fee"] ?>;
|
||||
totalIndividualFee += individualFee;
|
||||
// feesDeductionAdjustment += individualFee;
|
||||
var breakdownItem = {
|
||||
Type: "Payment",
|
||||
Transaction_date: row.cells[6].innerText,
|
||||
Gross_Amount: amount,
|
||||
Fee: individualFee,
|
||||
Net_Amount: amount - individualFee,
|
||||
Description: row.cells[5].querySelector("a").innerText,
|
||||
orderId: orderId
|
||||
};
|
||||
<script>
|
||||
function createPayout() {
|
||||
var rows = document.querySelectorAll("#recent-orders tbody tr");
|
||||
var selectedBank = JSON.parse('<?php echo $selectedBankAccountJSON; ?>');
|
||||
var selectedOrders = [];
|
||||
var grossAmount = 0;
|
||||
var totalIndividualFee = 0;
|
||||
var feesDeductionAdjustment = <?php echo $_SESSION["transfer_fee"] ?>;
|
||||
var feesPercentage = (feesDeductionAdjustment * 100) + '%';
|
||||
const token = '<?php echo $_SESSION["token"] ?>';
|
||||
const vendorId = '<?php echo ($vendorData['_id']); ?>';
|
||||
const vendorName = '<?php echo ($vendorData['user_login']); ?>';
|
||||
rows.forEach(function(row) {
|
||||
var checkbox = row.querySelector("input[type=checkbox]");
|
||||
if (checkbox && checkbox.checked) {
|
||||
var amount = parseFloat(row.cells[2].innerText);
|
||||
var orderId = row.cells[7].innerText;
|
||||
grossAmount += amount;
|
||||
var individualFee = amount * <?php echo $_SESSION["transfer_fee"] ?>;
|
||||
totalIndividualFee += individualFee;
|
||||
// feesDeductionAdjustment += individualFee;
|
||||
var breakdownItem = {
|
||||
Type: "Payment",
|
||||
Transaction_date: row.cells[6].innerText,
|
||||
Gross_Amount: amount,
|
||||
Fee: individualFee,
|
||||
Net_Amount: amount - individualFee,
|
||||
Description: row.cells[5].querySelector("a").innerText,
|
||||
orderId: orderId
|
||||
};
|
||||
|
||||
selectedOrders.push(breakdownItem);
|
||||
}
|
||||
});
|
||||
selectedOrders.push(breakdownItem);
|
||||
}
|
||||
});
|
||||
|
||||
var netAmount = grossAmount - (grossAmount * feesDeductionAdjustment);
|
||||
var netAmount = grossAmount - (grossAmount * feesDeductionAdjustment);
|
||||
|
||||
var fees_breakdown = {
|
||||
transfer_fee: totalIndividualFee, };
|
||||
var fees_breakdown = {
|
||||
transfer_fee: totalIndividualFee,
|
||||
};
|
||||
|
||||
|
||||
var postData = {
|
||||
gross_amount: grossAmount.toFixed(2),
|
||||
fees_deduction_adjustment: feesPercentage,
|
||||
net_amount: netAmount.toFixed(2),
|
||||
breakdown: fees_breakdown,
|
||||
bank_information: [
|
||||
selectedBank
|
||||
],
|
||||
transaction_logs: selectedOrders,
|
||||
vendor_details: [{
|
||||
vendor_id: vendorId,
|
||||
vendor_name: vendorName
|
||||
}],
|
||||
status: "PENDING",
|
||||
created_by: "Sample User",
|
||||
};
|
||||
var postData = {
|
||||
gross_amount: grossAmount.toFixed(2),
|
||||
fees_deduction_adjustment: feesPercentage,
|
||||
net_amount: netAmount.toFixed(2),
|
||||
breakdown: fees_breakdown,
|
||||
bank_information: [
|
||||
selectedBank
|
||||
],
|
||||
transaction_logs: selectedOrders,
|
||||
vendor_details: [{
|
||||
vendor_id: vendorId,
|
||||
vendor_name: vendorName
|
||||
}],
|
||||
status: "PENDING",
|
||||
created_by: "Sample User",
|
||||
};
|
||||
|
||||
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/payouts/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
"Authorization": "Bearer " + token,
|
||||
},
|
||||
body: JSON.stringify(postData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
} else {
|
||||
throw new Error('Failed to create payout');
|
||||
}
|
||||
})
|
||||
.then(data => {
|
||||
console.log('Payout created successfully');
|
||||
selectedOrders.forEach(order => {
|
||||
var orderId = order.orderId;
|
||||
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
"Authorization": "Bearer " + token,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
payout_status: {
|
||||
payout_id: data._id,
|
||||
status: "Processing"
|
||||
}
|
||||
})
|
||||
})
|
||||
.then(response => {
|
||||
// if (!response.ok) {
|
||||
// console.error(`Failed to update payout status for order ${orderId}`);
|
||||
// }
|
||||
if (!response.ok) {
|
||||
console.error(`Failed to update payout status for order ${orderId}`);
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(`Error updating payout status for order ${orderId}:`, error);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/payouts/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
"Authorization": "Bearer " + token,
|
||||
},
|
||||
body: JSON.stringify(postData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
} else {
|
||||
throw new Error('Failed to create payout');
|
||||
}
|
||||
})
|
||||
.then(data => {
|
||||
console.log('Payout created successfully');
|
||||
selectedOrders.forEach(order => {
|
||||
var orderId = order.orderId;
|
||||
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
"Authorization": "Bearer " + token,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
payout_status: {
|
||||
payout_id: data._id,
|
||||
status: "Processing"
|
||||
}
|
||||
})
|
||||
})
|
||||
.then(response => {
|
||||
// if (!response.ok) {
|
||||
// console.error(`Failed to update payout status for order ${orderId}`);
|
||||
// }
|
||||
if (!response.ok) {
|
||||
console.error(`Failed to update payout status for order ${orderId}`);
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(`Error updating payout status for order ${orderId}:`, error);
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="payouts" role="tabpanel"
|
||||
aria-labelledby="payouts-tab">
|
||||
<div class="tab-pane fade" id="payouts" role="tabpanel" aria-labelledby="payouts-tab">
|
||||
<div class="tab-widget mt-5">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<!-- Recent Order Table -->
|
||||
<div class="card card-default card-table-border-none ec-tbl"
|
||||
id="recent-orders">
|
||||
<div class="card card-default card-table-border-none ec-tbl" id="recent-orders">
|
||||
<div class="card-header justify-content-between">
|
||||
<h2>Payouts</h2>
|
||||
|
||||
|
@ -541,57 +613,99 @@ function renewToken() {
|
|||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
<tbody id ="payoutsBody">
|
||||
<?php
|
||||
$totalPayoutOrders = count($filteredPayouts);
|
||||
for ($i = 0; $i < $totalPayoutOrders; $i++) {
|
||||
$order_payouts = $filteredPayouts[$i];
|
||||
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $order_payouts['gross_amount']?></td>
|
||||
<td><?php echo $order_payouts['bank_information'][0]['bank_name']?></td>
|
||||
<td><?php echo $order_payouts['bank_information'][0]['bank_account_number']?></td>
|
||||
<td><?php echo $order_payouts['bank_information'][0]['bank_account_name']?></td>
|
||||
<td><?php echo date('F j Y', strtotime($order_payouts['createdAt'])); ?></td>
|
||||
<td>
|
||||
<span class="badge badge-success"><?php echo $order_payouts['status']?></span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div
|
||||
class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini"
|
||||
href="" role="button"
|
||||
id="dropdown-recent-order1"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
data-display="static"></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right"
|
||||
aria-labelledby="dropdown-recent-order1">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">Details</a>
|
||||
</li>
|
||||
<li class="dropdown-item">
|
||||
<a href="payout_deposit_action.php?payout_id=<?php echo urlencode($order_payouts['_id']); ?>">Deposit</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
$reversedPayouts = array_reverse($filteredPayouts);
|
||||
for ($i = 0; $i < $totalPayoutOrders; $i++) {
|
||||
$order_payouts = $reversedPayouts[$i];
|
||||
$displayPayoutDate = date('m-d-Y, g:i A', strtotime($order_payouts['createdAt']));
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $order_payouts['gross_amount'] ?></td>
|
||||
<td><?php echo $order_payouts['bank_information'][0]['bank_name'] ?></td>
|
||||
<td><?php echo $order_payouts['bank_information'][0]['bank_account_number'] ?></td>
|
||||
<td><?php echo $order_payouts['bank_information'][0]['bank_account_name'] ?></td>
|
||||
<td><?php echo $displayPayoutDate; ?></td>
|
||||
<td>
|
||||
<span class="badge badge-success"><?php echo $order_payouts['status'] ?></span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini" href="" role="button" id="dropdown-recent-order1" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-display="static"></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown-recent-order1">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">Details</a>
|
||||
</li>
|
||||
<li class="dropdown-item">
|
||||
<a href="payout_deposit_action.php?payout_id=<?php echo urlencode($order_payouts['_id']); ?>">Deposit</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="po_pagination"></div>
|
||||
<script>
|
||||
const payoutsPerPage = 5;
|
||||
const totalPayoutsItem = <?php echo $totalPayoutOrders; ?>;
|
||||
const totalPayoutsPage = Math.ceil(totalPayoutsItem / payoutsPerPage);
|
||||
|
||||
|
||||
function showPayoutsPage(page) {
|
||||
const startIndex = (page - 1) * payoutsPerPage;
|
||||
const endIndex = startIndex + payoutsPerPage;
|
||||
const tableRows = document.querySelectorAll('#payoutsBody tr');
|
||||
|
||||
// for pagination button
|
||||
const pager = document.querySelectorAll('.popage-btn')
|
||||
pager.forEach((row, index) => {
|
||||
if (index !== page - 1) {
|
||||
row.style.backgroundColor = "white";
|
||||
row.style.color = "black";
|
||||
} else {
|
||||
row.style.backgroundColor = "#007bff";
|
||||
row.style.color = "white";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
tableRows.forEach((row, index) => {
|
||||
if (index >= startIndex && index < endIndex) {
|
||||
row.style.display = 'table-row';
|
||||
} else {
|
||||
row.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createPOPagination() {
|
||||
const paginationContainer = document.getElementById('po_pagination');
|
||||
|
||||
for (let i = 1; i <= totalPayoutsPage; i++) {
|
||||
// created a tag
|
||||
const pageButton = document.createElement('a');
|
||||
// created class for a tag
|
||||
pageButton.className = "popage-btn page-" + i
|
||||
pageButton.textContent = i;
|
||||
pageButton.addEventListener('click', () => showPayoutsPage(i));
|
||||
paginationContainer.appendChild(pageButton);
|
||||
}
|
||||
}
|
||||
|
||||
createPOPagination();
|
||||
showPayoutsPage(1); // Show the first page by default
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="profile" role="tabpanel"
|
||||
aria-labelledby="profile-tab">
|
||||
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
|
||||
<div class="tab-widget mt-5">
|
||||
<div class="row">
|
||||
<div class="col-xl-4">
|
||||
|
@ -796,8 +910,7 @@ function renewToken() {
|
|||
|
||||
<div class="col-12">
|
||||
<!-- Recent Order Table -->
|
||||
<div class="card card-default card-table-border-none ec-tbl"
|
||||
id="recent-orders">
|
||||
<div class="card card-default card-table-border-none ec-tbl" id="recent-orders">
|
||||
<div class="card-header justify-content-between">
|
||||
<h2>Recent Orders</h2>
|
||||
|
||||
|
@ -831,22 +944,13 @@ function renewToken() {
|
|||
<td>Oct 20, 2018</td>
|
||||
<td>$230</td>
|
||||
<td>
|
||||
<span
|
||||
class="badge badge-success">Completed</span>
|
||||
<span class="badge badge-success">Completed</span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div
|
||||
class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini"
|
||||
href="" role="button"
|
||||
id="dropdown-recent-order1"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
data-display="static"></a>
|
||||
<div class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini" href="" role="button" id="dropdown-recent-order1" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-display="static"></a>
|
||||
|
||||
<ul class="dropdown-menu dropdown-menu-right"
|
||||
aria-labelledby="dropdown-recent-order1">
|
||||
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown-recent-order1">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
|
@ -869,22 +973,13 @@ function renewToken() {
|
|||
<td>Nov 15, 2018</td>
|
||||
<td>$550</td>
|
||||
<td>
|
||||
<span
|
||||
class="badge badge-warning">Delayed</span>
|
||||
<span class="badge badge-warning">Delayed</span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div
|
||||
class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini"
|
||||
href="#" role="button"
|
||||
id="dropdown-recent-order2"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
data-display="static"></a>
|
||||
<div class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini" href="#" role="button" id="dropdown-recent-order2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-display="static"></a>
|
||||
|
||||
<ul class="dropdown-menu dropdown-menu-right"
|
||||
aria-labelledby="dropdown-recent-order2">
|
||||
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown-recent-order2">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
|
@ -911,18 +1006,10 @@ function renewToken() {
|
|||
Hold</span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div
|
||||
class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini"
|
||||
href="#" role="button"
|
||||
id="dropdown-recent-order3"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
data-display="static"></a>
|
||||
<div class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini" href="#" role="button" id="dropdown-recent-order3" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-display="static"></a>
|
||||
|
||||
<ul class="dropdown-menu dropdown-menu-right"
|
||||
aria-labelledby="dropdown-recent-order3">
|
||||
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown-recent-order3">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
|
@ -945,22 +1032,13 @@ function renewToken() {
|
|||
<td>Dec 13, 2018</td>
|
||||
<td>$200</td>
|
||||
<td>
|
||||
<span
|
||||
class="badge badge-success">Completed</span>
|
||||
<span class="badge badge-success">Completed</span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div
|
||||
class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini"
|
||||
href="#" role="button"
|
||||
id="dropdown-recent-order4"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
data-display="static"></a>
|
||||
<div class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini" href="#" role="button" id="dropdown-recent-order4" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-display="static"></a>
|
||||
|
||||
<ul class="dropdown-menu dropdown-menu-right"
|
||||
aria-labelledby="dropdown-recent-order4">
|
||||
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown-recent-order4">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
|
@ -983,21 +1061,12 @@ function renewToken() {
|
|||
<td>Dec 23, 2018</td>
|
||||
<td>$150</td>
|
||||
<td>
|
||||
<span
|
||||
class="badge badge-danger">Cancelled</span>
|
||||
<span class="badge badge-danger">Cancelled</span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div
|
||||
class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini"
|
||||
href="#" role="button"
|
||||
id="dropdown-recent-order5"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
data-display="static"></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right"
|
||||
aria-labelledby="dropdown-recent-order5">
|
||||
<div class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini" href="#" role="button" id="dropdown-recent-order5" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-display="static"></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown-recent-order5">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
|
@ -1019,30 +1088,29 @@ function renewToken() {
|
|||
|
||||
<!-- Bank Details -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="settings" role="tabpanel"
|
||||
aria-labelledby="settings-tab">
|
||||
<div class="tab-pane fade" id="settings" role="tabpanel" aria-labelledby="settings-tab">
|
||||
<div class="tab-pane-content mt-5">
|
||||
|
||||
<table style="width:100%; border-collapse: collapse;">
|
||||
<tr>
|
||||
<td style="border: 1px solid #dddddd; background-color: #f7f7f7; padding: 8px; font-weight: 700;">Bank Name</td>
|
||||
<td style="border: 1px solid #dddddd; padding: 8px;font-weight: 500;"><?php echo $selectedBankAccount['bank_name'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid #dddddd; background-color: #f7f7f7; padding: 8px;font-weight: 700;">Account Number</td>
|
||||
<td style="border: 1px solid #dddddd; padding: 8px;font-weight: 500;"><?php echo $selectedBankAccount["bank_account_number"] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid #dddddd; background-color: #f7f7f7; padding: 8px;font-weight: 700;">Account Name</td>
|
||||
<td style="border: 1px solid #dddddd; padding: 8px;font-weight: 500;"><?php echo $selectedBankAccount["bank_account_name"] ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<table style="width:100%; border-collapse: collapse;">
|
||||
<tr>
|
||||
<td style="border: 1px solid #dddddd; background-color: #f7f7f7; padding: 8px; font-weight: 700;">Bank Name</td>
|
||||
<td style="border: 1px solid #dddddd; padding: 8px;font-weight: 500;"><?php echo $selectedBankAccount['bank_name'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid #dddddd; background-color: #f7f7f7; padding: 8px;font-weight: 700;">Account Number</td>
|
||||
<td style="border: 1px solid #dddddd; padding: 8px;font-weight: 500;"><?php echo $selectedBankAccount["bank_account_number"] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid #dddddd; background-color: #f7f7f7; padding: 8px;font-weight: 700;">Account Name</td>
|
||||
<td style="border: 1px solid #dddddd; padding: 8px;font-weight: 500;"><?php echo $selectedBankAccount["bank_account_name"] ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- <form>
|
||||
<div class="form-group row mb-6">
|
||||
<label for="coverImage"
|
||||
|
@ -1129,8 +1197,7 @@ function renewToken() {
|
|||
<footer class="footer mt-auto">
|
||||
<div class="copyright bg-white">
|
||||
<p>
|
||||
Copyright © <span id="ec-year"></span><a class="text-primary"
|
||||
href="https://themeforest.net/user/ashishmaraviya" target="_blank"> Ekka Admin
|
||||
Copyright © <span id="ec-year"></span><a class="text-primary" href="https://themeforest.net/user/ashishmaraviya" target="_blank"> Ekka Admin
|
||||
Dashboard</a>. All Rights Reserved.
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue