746 lines
39 KiB
PHP
746 lines
39 KiB
PHP
<?php
|
||
include "functions.php";
|
||
|
||
if ($_SESSION["userId"] <> "") {
|
||
$_SESSION["isLoggedIn"] = true;
|
||
} else {
|
||
$_SESSION["isLoggedIn"] = false;
|
||
header("location: login.php");
|
||
}
|
||
|
||
if (isset($_SESSION["token"])) {
|
||
$token = $_SESSION["token"];
|
||
$token_parts = explode(".", $token);
|
||
$token_payload = base64_decode($token_parts[1]);
|
||
$token_data = json_decode($token_payload);
|
||
|
||
$issued_at_time = $token_data->iat;
|
||
$expiration_time = $token_data->exp;
|
||
$renewal_time = $issued_at_time + 3300;
|
||
|
||
if (time() >= $renewal_time || time() >= $expiration_time) {
|
||
header("Location:vendor-payoutsTokenRN.php");
|
||
exit;
|
||
}
|
||
}
|
||
|
||
if ($_SESSION["isCustomer"] == true) {
|
||
header("location: user-profile.php");
|
||
}
|
||
|
||
$vendorLoginId = searchVendorbyLoginId($_SESSION["userId"]);
|
||
$vendorLoginIdjson = json_decode($vendorLoginId, true);
|
||
if (isset($vendorLoginIdjson['results'][0])) {
|
||
$vendorData = $vendorLoginIdjson['results'][0];
|
||
$vendorId = $vendorData['_id'];
|
||
$_SESSION["LoggedInVendorId"] = $vendorId;
|
||
}
|
||
|
||
$authToken = $_SESSION['token'];
|
||
|
||
$response = getAllPayout($authToken);
|
||
$vendorPayoutData = json_decode($response, true);
|
||
|
||
?>
|
||
<!DOCTYPE html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta http-equiv="x-ua-compatible" content="ie=edge" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
||
|
||
<title>oBanana B2B - Elevate Your Business</title>
|
||
<meta name="keywords" content="apparel, catalog, clean, ecommerce, ecommerce HTML, electronics, fashion, html eCommerce, html store, minimal, multipurpose, multipurpose ecommerce, online store, responsive ecommerce template, shops" />
|
||
<meta name="description" content="Best ecommerce html template for single and multi vendor store.">
|
||
<meta name="author" content="ashishmaraviya">
|
||
|
||
<!-- site Favicon -->
|
||
<link rel="icon" href="assets/images/favicon/favicon.png" sizes="32x32" />
|
||
<link rel="apple-touch-icon" href="assets/images/favicon/favicon.png" />
|
||
<meta name="msapplication-TileImage" content="assets/images/favicon/favicon.png" />
|
||
|
||
<!-- css Icon Font -->
|
||
<link rel="stylesheet" href="assets/css/vendor/ecicons.min.css" />
|
||
|
||
<!-- css All Plugins Files -->
|
||
<link rel="stylesheet" href="assets/css/plugins/animate.css" />
|
||
<link rel="stylesheet" href="assets/css/plugins/swiper-bundle.min.css" />
|
||
<link rel="stylesheet" href="assets/css/plugins/jquery-ui.min.css" />
|
||
<link rel="stylesheet" href="assets/css/plugins/countdownTimer.css" />
|
||
<link rel="stylesheet" href="assets/css/plugins/slick.min.css" />
|
||
<link rel="stylesheet" href="assets/css/plugins/bootstrap.css" />
|
||
|
||
<!-- Main Style -->
|
||
<link rel="stylesheet" href="assets/css/style.css" />
|
||
<link rel="stylesheet" href="assets/css/style2.css" />
|
||
<link rel="stylesheet" href="assets/css/responsive.css" />
|
||
<link href="https://cdn.datatables.net/v/bs5/dt-2.0.3/r-3.0.0/sp-2.3.0/datatables.min.css" rel="stylesheet">
|
||
|
||
|
||
|
||
<!-- Background css -->
|
||
<link rel="stylesheet" id="bg-switcher-css" href="assets/css/backgrounds/bg-4.css">
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@latest/dist/css/select2.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
|
||
<script src="https://cdn.jsdelivr.net/npm/select2@latest/dist/js/select2.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||
|
||
<script>
|
||
function renewToken() {
|
||
var xhr = new XMLHttpRequest();
|
||
xhr.open("GET", "vendor-payoutsTokenRN.php", true);
|
||
xhr.send();
|
||
}
|
||
|
||
setInterval(function() {
|
||
var currentTime = <?php echo time(); ?>;
|
||
var renewalTime = <?php echo $renewal_time; ?>;
|
||
var expirationTime = <?php echo $expiration_time; ?>;
|
||
|
||
if (currentTime >= renewalTime || currentTime >= expirationTime) {
|
||
renewToken();
|
||
}
|
||
}, 60000);
|
||
</script>
|
||
</head>
|
||
|
||
<body class="shop_page">
|
||
<div id="ec-overlay">
|
||
<div class="ec-ellipsis">
|
||
<div></div>
|
||
<div></div>
|
||
<div></div>
|
||
<div></div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Header start -->
|
||
<?php include "header.php" ?>
|
||
<!-- Header End -->
|
||
|
||
<!-- ekka Cart Start -->
|
||
|
||
<!-- ekka Cart End -->
|
||
|
||
<!-- Category Sidebar start -->
|
||
<?php include "category-slider.php" ?>
|
||
|
||
<!-- Ec breadcrumb start -->
|
||
<div class="sticky-header-next-sec ec-breadcrumb section-space-mb">
|
||
<div class="container">
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="row ec_breadcrumb_inner">
|
||
<div class="col-md-6 col-sm-12">
|
||
<h2 class="ec-breadcrumb-title">Vendor Settings</h2>
|
||
</div>
|
||
<div class="col-md-6 col-sm-12">
|
||
<!-- ec-breadcrumb-list start -->
|
||
<ul class="ec-breadcrumb-list">
|
||
<li class="ec-breadcrumb-item"><a href="index.php">Home</a></li>
|
||
<li class="ec-breadcrumb-item active">Settings</li>
|
||
</ul>
|
||
<!-- ec-breadcrumb-list end -->
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- Ec breadcrumb end -->
|
||
|
||
<!-- Vendor setting section -->
|
||
<section class="ec-page-content ec-vendor-uploads section-space-p">
|
||
<div class="container">
|
||
<div class="row">
|
||
<!-- Sidebar Area Start -->
|
||
<div class="ec-shop-leftside ec-vendor-sidebar col-lg-3 col-md-12">
|
||
<div class="ec-sidebar-wrap ec-border-box">
|
||
<!-- Sidebar Category Block -->
|
||
<div class="ec-sidebar-block">
|
||
<div class="ec-vendor-block">
|
||
<?php include "vendor-user-tabs.php" ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="ec-shop-rightside col-lg-9 col-md-12">
|
||
<div class="ec-vendor-dashboard-card ec-vendor-setting-card">
|
||
<div class="ec-vendor-card-body">
|
||
<div class="row">
|
||
|
||
<div class="col-md-4 mb-5">
|
||
<div class="panel panel-primary">
|
||
<div class="panel-heading">
|
||
<h5 class="panel-title"><strong>Upcoming Payout</strong></h5>
|
||
</div>
|
||
<div class="panel-body ">
|
||
<div class="row">
|
||
<h4 style="color: #444;">
|
||
<div class="d-flex align-items-center">
|
||
<?php
|
||
$response = getOrderbyVendorId($vendorId);
|
||
$upcomingPayout = json_decode($response, true);
|
||
$payoutSum = 0;
|
||
|
||
foreach ($upcomingPayout as $x => $val) {
|
||
$paymentStatus = strtolower($val['payment']['status']);
|
||
$orderStatus = strtolower($val['status']);
|
||
$payoutStatus = empty($val['payout_status']);
|
||
if(( $paymentStatus == "paid") && ( $orderStatus == "completed") && ($payoutStatus == true)){
|
||
$orderAmount = $val['total_amount'];
|
||
$payoutSum += $orderAmount;
|
||
}
|
||
}
|
||
|
||
$finalPayoutSum = number_format($payoutSum, 2, '.', ',');
|
||
?>
|
||
<strong>
|
||
₱ <?php echo $finalPayoutSum ?>
|
||
</strong>
|
||
</div>
|
||
</h4>
|
||
<!-- <div class="text-sm mt-3">
|
||
Payout Generation: Tue, Mar 19, 2024
|
||
</div>
|
||
<div class="text-sm">
|
||
Receive Payout on or before: Wed, Mar 20, 2024
|
||
</div> -->
|
||
<div class="text-sm">
|
||
<?php
|
||
$vendorResponse = getVendorbyId($vendorId);
|
||
$vendorInformation = json_decode($vendorResponse, true);
|
||
$bankAccountNumber = $vendorInformation['bank_acount_details'][0]['bank_account_number'];
|
||
$bankNumEnding = substr($bankAccountNumber, -3);
|
||
?>
|
||
Receipient: Philippine National Bank (PNB) Account ending in <?php echo $bankNumEnding?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- <div class="col-md-4 mb-5">
|
||
<div class="panel panel-primary">
|
||
<div class="panel-heading">
|
||
<h5 class="panel-title"><strong>Payout Generation Schedule</strong></h5>
|
||
</div>
|
||
<div class="panel-body ">
|
||
<div class="row">
|
||
<h4 style="color: #444;">
|
||
<div class="d-flex align-items-center">
|
||
<i class="fi-rs-calendar mt-1 mr-3 "></i>
|
||
<strong>
|
||
Weekly
|
||
</strong>
|
||
</div>
|
||
</h4>
|
||
<div class="mt-3">
|
||
<h6>
|
||
<strong class="text-primary ">Every Tuesday</strong>
|
||
</h6>
|
||
</div>
|
||
<div class="text-sm">
|
||
Payouts that will fall on holiday will be processed the next banking day
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-4 mb-5">
|
||
<div class="panel panel-primary">
|
||
<div class="panel-heading">
|
||
<h5 class="panel-title"><strong>Next Payout</strong></h5>
|
||
</div>
|
||
<div class="panel-body ">
|
||
<div class="row">
|
||
<h4 style="color: #444;">
|
||
<div class="d-flex align-items-center">
|
||
<strong>
|
||
₱ 0.00
|
||
</strong>
|
||
</div>
|
||
</h4>
|
||
<- <div class="text-sm mt-3">
|
||
Payout Generation: Tue, Mar 25, 2024
|
||
</div>
|
||
<div class="text-sm">
|
||
Receive Payout on or before: Wed, Mar 26, 2024
|
||
</div> -
|
||
<div class="text-sm">
|
||
Receipient: Philippine National Bank (PNB) Account ending in <?php echo $bankNumEnding?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div> -->
|
||
<div class="col-md-12 mt-3">
|
||
<h5 class='m-0'><strong>Payout History</strong></h5>
|
||
<div class="table-responsive px-4">
|
||
<table id='payoutsTableContent' class="table ec-table">
|
||
<thead>
|
||
<tr>
|
||
<th scope="col">Amount</th>
|
||
<th scope="col">Bank</th>
|
||
<th scope="col">Account Number</th>
|
||
<th scope="col">Payout Generation</th>
|
||
<th scope="col">Status</th>
|
||
<th scope="col">Action</th>
|
||
|
||
</tr>
|
||
</thead>
|
||
<tbody class='table-group-divider'>
|
||
<?php
|
||
foreach ($vendorPayoutData as $x => $val) {
|
||
$vendorIdCheck = $val['vendor_details'][0]['vendor_id'];
|
||
$status = ucfirst(strtolower($val['status']));
|
||
$payoutDate = date("F d, Y", strtotime($val['createdAt']));
|
||
$payoutId = $val['_id'];
|
||
if ((empty($vendorIdCheck) == false) && ($vendorIdCheck == $vendorId) && ($status == "Deposited")) { ?>
|
||
<tr>
|
||
<td> <?php echo "₱ " . $val['net_amount'] ?> </td>
|
||
<?php if (empty($val['bank_information'][0]['bank_name']) == false) {
|
||
?>
|
||
<td> <?php echo $val['bank_information'][0]['bank_name'] ?> </td>
|
||
<?php } else { ?>
|
||
<td> N/A </td>
|
||
<?php }
|
||
if (empty($val['bank_information'][0]['bank_account_number']) == false) {
|
||
$accNum = $val['bank_information'][0]['bank_account_number'];
|
||
// Replace characters with asterisks for all characters except the last three segments
|
||
$maskedAccNum = substr_replace($accNum, str_repeat('*', strlen($accNum) - 3), 0, -3); ?>
|
||
<td> <?php echo $maskedAccNum ?> </td>
|
||
<?php } else { ?>
|
||
<td> N/A </td>
|
||
<?php } ?>
|
||
<td> <?php echo $payoutDate ?> </td>
|
||
<td> <?php echo $status ?> </td>
|
||
<td>
|
||
<button type="button" class="btn btn-primary btn-sm showSinglePayoutBtn" data-order-id="<?php echo $payoutId; ?>" data-bs-toggle="modal" data-bs-target="#payoutsModal">View</button>
|
||
</td>
|
||
</tr>
|
||
<?php
|
||
}
|
||
} ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- Modal Box for the breakdown of payouts from the payouts data table - JOHN LOUIE C. SUEPERALIS MARCH 22, 2024 -->
|
||
<div class="modal fade" id="payoutsModal" tabindex="-1" aria-labelledby="payoutsModalLabel" aria-hidden="true">
|
||
<div class="modal-dialog modal-xl" style="min-width: 90%;">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h5 class="modal-title fs-5" id="payoutsModalLabel">Payout ID: <span id="payoutIdSpan"></span></h5>
|
||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="container-fluid" id="payoutDetailsContainer">
|
||
<!-- Dynamic content will be inserted here -->
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- End Vendor setting section -->
|
||
|
||
<!-- Footer Start -->
|
||
<?php include "footer.php" ?>
|
||
<!-- Footer Area End -->
|
||
<!-- Start Modal Copy-->
|
||
<!-- Modal -->
|
||
|
||
<!-- Footer navigation panel for responsive display end -->
|
||
|
||
<!-- raymart remove popup feb 20 2024 -->
|
||
<!-- Recent Purchase Popup -->
|
||
<!-- <div class=" recent-purchase">
|
||
<img src="assets/images/product-image/1.jpg" alt="payment image">
|
||
<div class="detail">
|
||
<p>Someone in new just bought</p>
|
||
<h6>stylish baby shoes</h6>
|
||
<p>10 Minutes ago</p>
|
||
</div>
|
||
<a href="javascript:void(0)" class="icon-btn recent-close">×</a>
|
||
</div> -->
|
||
<!-- Recent Purchase Popup end -->
|
||
|
||
<!-- Cart Floating Button -->
|
||
<div class="ec-cart-float">
|
||
<a href="#ec-side-cart" class="ec-header-btn ec-side-toggle">
|
||
<div class="header-icon"><i class="fi-rr-shopping-basket"></i>
|
||
</div>
|
||
<span class="ec-cart-count cart-count-lable">3</span>
|
||
</a>
|
||
</div>
|
||
<!-- Cart Floating Button end -->
|
||
|
||
<!-- Whatsapp -->
|
||
<div class="ec-style ec-right-bottom">
|
||
<!-- Start Floating Panel Container -->
|
||
<div class="ec-panel">
|
||
<!-- Panel Header -->
|
||
<div class="ec-header">
|
||
<strong>Need Help?</strong>
|
||
<p>Chat with us on WhatsApp</p>
|
||
</div>
|
||
<!-- Panel Content -->
|
||
<div class="ec-body">
|
||
<ul>
|
||
<!-- Start Single Contact List -->
|
||
<li>
|
||
<a class="ec-list" data-number="918866774266" data-message="Please help me! I have got wrong product - ORDER ID is : #654321485">
|
||
<div class="d-flex bd-highlight">
|
||
<!-- Profile Picture -->
|
||
<div class="ec-img-cont">
|
||
<img src="assets/images/whatsapp/profile_01.jpg" class="ec-user-img" alt="Profile image">
|
||
<span class="ec-status-icon"></span>
|
||
</div>
|
||
<!-- Display Name & Last Seen -->
|
||
<div class="ec-user-info">
|
||
<span>Sahar Darya</span>
|
||
<p>Sahar left 7 mins ago</p>
|
||
</div>
|
||
<!-- Chat iCon -->
|
||
<div class="ec-chat-icon">
|
||
<i class="fa fa-whatsapp"></i>
|
||
</div>
|
||
</div>
|
||
</a>
|
||
</li>
|
||
<!--/ End Single Contact List -->
|
||
<!-- Start Single Contact List -->
|
||
<li>
|
||
<a class="ec-list" data-number="918866774266" data-message="Please help me! I have got wrong product - ORDER ID is : #654321485">
|
||
<div class="d-flex bd-highlight">
|
||
<!-- Profile Picture -->
|
||
<div class="ec-img-cont">
|
||
<img src="assets/images/whatsapp/profile_02.jpg" class="ec-user-img" alt="Profile image">
|
||
<span class="ec-status-icon ec-online"></span>
|
||
</div>
|
||
<!-- Display Name & Last Seen -->
|
||
<div class="ec-user-info">
|
||
<span>Yolduz Rafi</span>
|
||
<p>Yolduz is online</p>
|
||
</div>
|
||
<!-- Chat iCon -->
|
||
<div class="ec-chat-icon">
|
||
<i class="fa fa-whatsapp"></i>
|
||
</div>
|
||
</div>
|
||
</a>
|
||
</li>
|
||
<!--/ End Single Contact List -->
|
||
<!-- Start Single Contact List -->
|
||
<li>
|
||
<a class="ec-list" data-number="918866774266" data-message="Please help me! I have got wrong product - ORDER ID is : #654321485">
|
||
<div class="d-flex bd-highlight">
|
||
<!-- Profile Picture -->
|
||
<div class="ec-img-cont">
|
||
<img src="assets/images/whatsapp/profile_03.jpg" class="ec-user-img" alt="Profile image">
|
||
<span class="ec-status-icon ec-offline"></span>
|
||
</div>
|
||
<!-- Display Name & Last Seen -->
|
||
<div class="ec-user-info">
|
||
<span>Nargis Hawa</span>
|
||
<p>Nargis left 30 mins ago</p>
|
||
</div>
|
||
<!-- Chat iCon -->
|
||
<div class="ec-chat-icon">
|
||
<i class="fa fa-whatsapp"></i>
|
||
</div>
|
||
</div>
|
||
</a>
|
||
</li>
|
||
<!--/ End Single Contact List -->
|
||
<!-- Start Single Contact List -->
|
||
<li>
|
||
<a class="ec-list" data-number="918866774266" data-message="Please help me! I have got wrong product - ORDER ID is : #654321485">
|
||
<div class="d-flex bd-highlight">
|
||
<!-- Profile Picture -->
|
||
<div class="ec-img-cont">
|
||
<img src="assets/images/whatsapp/profile_04.jpg" class="ec-user-img" alt="Profile image">
|
||
<span class="ec-status-icon ec-offline"></span>
|
||
</div>
|
||
<!-- Display Name & Last Seen -->
|
||
<div class="ec-user-info">
|
||
<span>Khadija Mehr</span>
|
||
<p>Khadija left 50 mins ago</p>
|
||
</div>
|
||
<!-- Chat iCon -->
|
||
<div class="ec-chat-icon">
|
||
<i class="fa fa-whatsapp"></i>
|
||
</div>
|
||
</div>
|
||
</a>
|
||
</li>
|
||
<!--/ End Single Contact List -->
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<!--/ End Floating Panel Container -->
|
||
<!-- Start Right Floating Button-->
|
||
<div class="ec-right-bottom">
|
||
<div class="ec-box">
|
||
<div class="ec-button rotateBackward">
|
||
<img class="whatsapp" src="assets/images/common/whatsapp.png" alt="whatsapp icon" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!--/ End Right Floating Button-->
|
||
</div>
|
||
<!-- Whatsapp end -->
|
||
|
||
<!-- Feature tools -->
|
||
<div class="ec-tools-sidebar-overlay"></div>
|
||
<div class="ec-tools-sidebar">
|
||
<div class="tool-title">
|
||
<h3>Features</h3>
|
||
</div>
|
||
<a href="#" class="ec-tools-sidebar-toggle in-out">
|
||
<img alt="icon" src="assets/images/common/settings.png" />
|
||
</a>
|
||
<div class="ec-tools-detail">
|
||
<div class="ec-tools-sidebar-content ec-change-color ec-color-desc">
|
||
<h3>Color Scheme</h3>
|
||
<ul class="bg-panel">
|
||
<li class="active" data-color="01"><a href="#" class="colorcode1"></a></li>
|
||
<li data-color="02"><a href="#" class="colorcode2"></a></li>
|
||
<li data-color="03"><a href="#" class="colorcode3"></a></li>
|
||
<li data-color="04"><a href="#" class="colorcode4"></a></li>
|
||
<li data-color="05"><a href="#" class="colorcode5"></a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="ec-tools-sidebar-content">
|
||
<h3>Backgrounds</h3>
|
||
<ul class="bg-panel">
|
||
<li class="bg"><a class="back-bg-1" id="bg-1">Background-1</a></li>
|
||
<li class="bg"><a class="back-bg-2" id="bg-2">Background-2</a></li>
|
||
<li class="bg"><a class="back-bg-3" id="bg-3">Background-3</a></li>
|
||
<li class="bg"><a class="back-bg-4" id="bg-4">Default</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="ec-tools-sidebar-content">
|
||
<h3>Full Screen mode</h3>
|
||
<div class="ec-fullscreen-mode">
|
||
<div class="ec-fullscreen-switch">
|
||
<div class="ec-fullscreen-btn">Mode</div>
|
||
<div class="ec-fullscreen-on">On</div>
|
||
<div class="ec-fullscreen-off">Off</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="ec-tools-sidebar-content">
|
||
<h3>Dark mode</h3>
|
||
<div class="ec-change-mode">
|
||
<div class="ec-mode-switch">
|
||
<div class="ec-mode-btn">Mode</div>
|
||
<div class="ec-mode-on">On</div>
|
||
<div class="ec-mode-off">Off</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="ec-tools-sidebar-content">
|
||
<h3>RTL mode</h3>
|
||
<div class="ec-change-rtl">
|
||
<div class="ec-rtl-switch">
|
||
<div class="ec-rtl-btn">Rtl</div>
|
||
<div class="ec-rtl-on">On</div>
|
||
<div class="ec-rtl-off">Off</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="ec-tools-sidebar-content">
|
||
<h3>Clear local storage</h3>
|
||
<a class="clear-cach" href="javascript:void(0)">Clear Cache & Default</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- Feature tools end -->
|
||
|
||
<!-- Vendor JS -->
|
||
<!-- <script src="assets/js/vendor/jquery-3.5.1.min.js"></script> -->
|
||
<script src="assets/js/vendor/popper.min.js"></script>
|
||
<script src="assets/js/vendor/bootstrap.min.js"></script>
|
||
<script src="assets/js/vendor/jquery-migrate-3.3.0.min.js"></script>
|
||
<script src="assets/js/vendor/modernizr-3.11.2.min.js"></script>
|
||
|
||
<!--Plugins JS-->
|
||
<script src="assets/js/plugins/swiper-bundle.min.js"></script>
|
||
<script src="assets/js/plugins/countdownTimer.min.js"></script>
|
||
<script src="assets/js/plugins/scrollup.js"></script>
|
||
<script src="assets/js/plugins/jquery.zoom.min.js"></script>
|
||
<script src="assets/js/plugins/slick.min.js"></script>
|
||
<script src="assets/js/plugins/infiniteslidev2.js"></script>
|
||
<script src="assets/js/vendor/jquery.magnific-popup.min.js"></script>
|
||
<script src="assets/js/plugins/jquery.sticky-sidebar.js"></script>
|
||
<script src="assets/js/plugins/nouislider.js"></script>
|
||
<script src="https://cdn.datatables.net/v/bs5/dt-2.0.3/r-3.0.0/sp-2.3.0/datatables.min.js"></script>
|
||
|
||
<!-- <script>
|
||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
||
</script> -->
|
||
|
||
<!-- Main Js -->
|
||
<script src="assets/js/vendor/index.js"></script>
|
||
<script src="assets/js/main.js"></script>
|
||
|
||
<!-- JS CRIPT FOR DYNAMIC MODAL BOX USING AJAX - JOHN LOUIE C. SUPERALIS MARCH 22, 2024 -->
|
||
<script>
|
||
$(document).ready(function() {
|
||
$('.showSinglePayoutBtn').click(function() {
|
||
var payoutId = $(this).data('order-id');
|
||
var token = "<?php echo $authToken; ?>";
|
||
$('#payoutIdSpan').text(payoutId);
|
||
$.ajax({
|
||
// url: 'https://api.obanana.shop/api/v1/payouts/' + payoutId,
|
||
url: 'https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/payouts/' + payoutId,
|
||
type: 'GET',
|
||
headers: {
|
||
'Authorization': 'Bearer ' + token
|
||
},
|
||
success: function(response) {
|
||
// Handle successful response
|
||
console.log(response);
|
||
var grossAmount = response.gross_amount;
|
||
var totalFees = response.fees_deduction_adjustment;
|
||
var netAmount = response.net_amount;
|
||
var payoutStatus = response.status;
|
||
payoutStatus = payoutStatus.charAt(0).toUpperCase() + payoutStatus.slice(1).toLowerCase();
|
||
var bankName = response.bank_information[0].bank_name;
|
||
var bankNum = response.bank_information[0].bank_account_number;
|
||
var bankNumEnding = bankNum.slice(-3); // Extract last three characters of bankNum
|
||
var maskedBankNum = "Ending in " + bankNumEnding; // Create message
|
||
var bankAccName = response.bank_information[0].bank_account_name;
|
||
var transactionLogsHtml = ''; // Initialize empty string to store HTML for transaction logs
|
||
response.transaction_logs.forEach(function(log)
|
||
{
|
||
|
||
var paymentType = log.Type;
|
||
var transDate = new Date(log?.Transaction_date).toLocaleString('en-US', {
|
||
year: 'numeric',
|
||
month: '2-digit',
|
||
day: '2-digit',
|
||
hour: 'numeric',
|
||
minute: '2-digit',
|
||
hour12: true
|
||
});
|
||
var transGrossAmount = log?.Gross_Amount;
|
||
var transFee = log.Fee;
|
||
var transNetAmount = log?.Net_Amount;
|
||
var transDesc = log.Description;
|
||
|
||
// Append HTML for current transaction log to the transactionLogsHtml string
|
||
transactionLogsHtml += `
|
||
<tr>
|
||
<td>${paymentType}</td>
|
||
<td>${transDate}</td>
|
||
<td>₱ ${transGrossAmount}</td>
|
||
<td>- ₱ ${transFee}</td>
|
||
<td>₱ ${transNetAmount}</td>
|
||
<td>${transDesc}</td>
|
||
</tr>`;
|
||
});
|
||
|
||
|
||
// Populate data dynamically using the response
|
||
var payoutDetailsHtml = `
|
||
<div class="row">
|
||
<div class="col-md-7 mb-4">
|
||
<div class="d-flex flex-column">
|
||
<div class="d-flex justify-content-between p-2">
|
||
<div>
|
||
<h6><strong>Payout Information</strong></h6>
|
||
</div>
|
||
|
||
<button class="fw-bold border border-success border-2 btn-outline-success btn-sm" disabled>${payoutStatus}</button>
|
||
</div>
|
||
<div class="d-flex justify-content-between p-2">
|
||
<div class="fw-bold">Gross Amount</div>
|
||
<div>₱ ${grossAmount}</div>
|
||
</div>
|
||
<div class="d-flex justify-content-between p-2" style="border-bottom: 1px solid #000;">
|
||
<div class="fw-bold"> Fees, Deductions, Adjustments
|
||
|
||
</div>
|
||
<div> - ${totalFees}</div>
|
||
</div>
|
||
<div class="d-flex justify-content-between p-2">
|
||
<div class="fw-bold"> Net Amount</div>
|
||
<div>₱ ${netAmount}</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-5 mb-4">
|
||
<div class="d-flex flex-column" style="border-bottom: 1px solid #000;">
|
||
<div class="d-flex justify-content-between p-2">
|
||
<h6><strong>Bank Information</strong></h6>
|
||
</div>
|
||
<div class="d-flex justify-content-between p-2">
|
||
<div class="fw-bold">Bank</div>
|
||
<div>${bankName}</div>
|
||
</div>
|
||
<div class="d-flex justify-content-between p-2">
|
||
<div class="fw-bold">Account Name</div>
|
||
<div>${bankAccName}</div>
|
||
</div>
|
||
<div class="d-flex justify-content-between p-2">
|
||
<div class="fw-bold">Account Number</div>
|
||
<div>${maskedBankNum}</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="col-12">
|
||
<div class="mt-5">
|
||
<h6><strong>Transaction Logs</strong></h6>
|
||
<div class="table-responsive">
|
||
<table id="example" class="table ec-table">
|
||
<thead>
|
||
<tr>
|
||
<th>Type</th>
|
||
<th>Transaction Date</th>
|
||
<th>Gross Amount</th>
|
||
<th>Fee</th>
|
||
<th>Net Amount</th>
|
||
<th>Description</th>
|
||
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
${transactionLogsHtml} <!-- Insert transaction logs HTML here -->
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>`;
|
||
$('#payoutDetailsContainer').html(payoutDetailsHtml);
|
||
|
||
},
|
||
})
|
||
|
||
});
|
||
});
|
||
</script>
|
||
<script>
|
||
$(document).ready( function () {
|
||
$('#payoutsTableContent').DataTable();
|
||
} );
|
||
</script>
|
||
|
||
</body>
|
||
|
||
</html>
|