Compare commits
25 Commits
2ba801d77d
...
dd97fd134c
Author | SHA1 | Date |
---|---|---|
Jun Barroga | dd97fd134c | |
Jun Barroga | 5f1aa3ab36 | |
MarkHipe | 2f45d91e53 | |
gelonspr | 95d2332aa2 | |
MarkHipe | db76cbc13a | |
jouls | c3c8d36238 | |
MarkHipe | 36289d353a | |
Stacy | 3a0f07e6fa | |
Stacy | 31910967a4 | |
Stacy | fea6570001 | |
Stacy | 1f073bce9d | |
MarkHipe | 7c8571cc1f | |
raymart | d15427e671 | |
MarkHipe | ec737139fa | |
MarkHipe | 26653ef372 | |
jouls | 2c29e3cd17 | |
jouls | 191d081c0f | |
jouls | f9e03219fa | |
jouls | c95015152d | |
jouls | d1bf1a6395 | |
jouls | 3d9d52dfcc | |
jouls | 04903b33ed | |
jouls | 2ab77fe749 | |
jouls | 096cc84506 | |
jouls | 31f38da140 |
12
about-us.php
12
about-us.php
|
@ -183,7 +183,7 @@
|
|||
</section>
|
||||
|
||||
<!-- ec testmonial Start -->
|
||||
<section class="section ec-test-section section-space-ptb-100 section-space-m" id="reviews">
|
||||
<!-- <section class="section ec-test-section section-space-ptb-100 section-space-m" id="reviews">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
|
@ -270,11 +270,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section> -->
|
||||
<!-- ec testmonial end -->
|
||||
|
||||
<!-- services Section Start -->
|
||||
<section class="section ec-services-section section-space-p" id="services">
|
||||
<!-- <section class="section ec-services-section section-space-p" id="services">
|
||||
<h2 class="d-none">Services</h2>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
@ -324,7 +324,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section> -->
|
||||
<!--services Section End -->
|
||||
|
||||
<!-- Ec Instagram Start -->
|
||||
|
@ -437,7 +437,7 @@
|
|||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- Recent Purchase Popup -->
|
||||
<div class="recent-purchase">
|
||||
<!-- <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>
|
||||
|
@ -445,7 +445,7 @@
|
|||
<p>10 Minutes ago</p>
|
||||
</div>
|
||||
<a href="javascript:void(0)" class="icon-btn recent-close">×</a>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Recent Purchase Popup end -->
|
||||
|
||||
<!-- Cart Floating Button -->
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
$(document).ready(function() {
|
||||
"use strict";
|
||||
|
||||
let responseData;
|
||||
|
||||
function fetchDataAndInitializeChart() {
|
||||
fetchData()
|
||||
.then(function (response) {
|
||||
responseData = response.data;
|
||||
console.log(responseData);
|
||||
const completedOrdersCount = countCompletedOrders(responseData);
|
||||
const toPayOrdersCount = countToPayOrders(responseData);
|
||||
const toShipOrdersCount = countToShipOrders(responseData);
|
||||
const returnedOrdersCount = countReturnedpOrders(responseData);
|
||||
initializeChart(completedOrdersCount, toPayOrdersCount, toShipOrdersCount, returnedOrdersCount);
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.error('Error fetching data:', error);
|
||||
});
|
||||
}
|
||||
fetchDataAndInitializeChart();
|
||||
function fetchData() {
|
||||
return axios.get('https://api.obanana.shop/api/v1/orders/');
|
||||
}
|
||||
|
||||
|
||||
function countCompletedOrders(data) {
|
||||
let completedOrdersCount = 0;
|
||||
data.forEach(function(order) {
|
||||
if (order.status === 'COMPLETED') {
|
||||
completedOrdersCount++;
|
||||
}
|
||||
});
|
||||
console.log(completedOrdersCount)
|
||||
return completedOrdersCount;
|
||||
}
|
||||
|
||||
|
||||
function countToPayOrders(data) {
|
||||
let toPayOrdersCount = 0;
|
||||
data.forEach(function(order) {
|
||||
if (order.status === 'TO PAY') {
|
||||
toPayOrdersCount++;
|
||||
}
|
||||
});
|
||||
console.log(toPayOrdersCount)
|
||||
return toPayOrdersCount;
|
||||
}
|
||||
|
||||
|
||||
function countToShipOrders(data) {
|
||||
let toShipOrdersCount = 0;
|
||||
data.forEach(function(order) {
|
||||
if (order.status === 'TO SHIP') {
|
||||
toShipOrdersCount++;
|
||||
}
|
||||
});
|
||||
console.log(toShipOrdersCount)
|
||||
return toShipOrdersCount;
|
||||
}
|
||||
function countReturnedpOrders(data) {
|
||||
let returnedOrdersCount = 0;
|
||||
data.forEach(function(order) {
|
||||
if (order.status === 'RETURNED') {
|
||||
returnedOrdersCount++;
|
||||
}
|
||||
});
|
||||
console.log(returnedOrdersCount)
|
||||
return returnedOrdersCount;
|
||||
}
|
||||
|
||||
function initializeChart(completedOrdersCount , toPayOrdersCount, toShipOrdersCount, returnedOrdersCount) {
|
||||
var doughnut = document.getElementById("doughnut-chart");
|
||||
if (doughnut !== null) {
|
||||
var myDoughnutChart = new Chart(doughnut, {
|
||||
type: "doughnut",
|
||||
data: {
|
||||
labels: ["Completed", "To Pay", "To Ship", "Returned"],
|
||||
datasets: [
|
||||
{
|
||||
label: "Order Status",
|
||||
data: [completedOrdersCount, toPayOrdersCount, toShipOrdersCount, returnedOrdersCount],
|
||||
backgroundColor: ["#88aaf3", "#50d7ab", "#9586cd", "#ed9090"],
|
||||
borderWidth: 1
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
cutoutPercentage: 75,
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
title: function(tooltipItem, data) {
|
||||
return "Order : " + data["labels"][tooltipItem[0]["index"]];
|
||||
},
|
||||
label: function(tooltipItem, data) {
|
||||
return data["datasets"][0]["data"][tooltipItem["index"]];
|
||||
}
|
||||
},
|
||||
titleFontColor: "#888",
|
||||
bodyFontColor: "#555",
|
||||
titleFontSize: 12,
|
||||
bodyFontSize: 14,
|
||||
backgroundColor: "rgba(256,256,256,0.95)",
|
||||
displayColors: true,
|
||||
borderColor: "rgba(220, 220, 220, 0.9)",
|
||||
borderWidth: 2
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function convertToCSV(data) {
|
||||
const columnTitles = ['ORDER ID', 'STATUS', 'BUYER NAME', 'TOTAL AMOUNT', 'ORDER DATE',
|
||||
'ORDER TIME', 'PRODUCT NAME','PRICE', 'QUANTITY',
|
||||
'VENDOR ID', 'VENDOR NAME',];
|
||||
const header = columnTitles.join(',') + '\n';
|
||||
const body = data.map(order => {
|
||||
const orderDate = new Date(order.order_date).toLocaleDateString('en-US');
|
||||
const orderTime = new Date(order.order_date).toLocaleTimeString('en-US');
|
||||
const productName = order.items.length > 0 ? `"${order.items[0].product.name}"` : '';
|
||||
return [
|
||||
order._id,
|
||||
order.status,
|
||||
order.customer[0]?.name,
|
||||
order.total_amount,
|
||||
orderDate,
|
||||
orderTime,
|
||||
productName,
|
||||
order.items[0]?.price,
|
||||
order.items[0]?.quantity,
|
||||
order.items[0]?.vendor_id,
|
||||
order.items[0]?.vendor_name
|
||||
].join(',');
|
||||
}).join('\n');
|
||||
return header + body;
|
||||
}
|
||||
function downloadCSV(filename) {
|
||||
const csv = convertToCSV(responseData);
|
||||
const blob = new Blob([csv], { type: 'text/csv' });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
$('#download-btn').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
downloadCSV('orders_data.csv');
|
||||
});
|
||||
});
|
248
admin/index.php
248
admin/index.php
|
@ -13,6 +13,11 @@ if ($_SESSION["userId"] <> "") {
|
|||
if($_SESSION["user_type"]!="admin"){
|
||||
header("location: login.php?alert=Only admins allowed here!");
|
||||
}
|
||||
|
||||
$all_orders = getAllOrder();
|
||||
date_default_timezone_set('Asia/Manila');
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
|
@ -24,6 +29,7 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<meta name="description" content="oBanana B2B - Admin Dashboard">
|
||||
|
||||
<title>oBanana B2B - Admin Dashboard</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
||||
|
||||
<!-- GOOGLE FONTS -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
|
@ -97,7 +103,7 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<li class="dropdown-header">
|
||||
<img src="assets/img/user/user.png" class="img-circle" alt="User Image" />
|
||||
<div class="d-inline-block">
|
||||
John Deo <small class="pt-1">john.example@gmail.com</small>
|
||||
John Deo <small class="pt-1"><?php echo $_SESSION['email']?></small>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -719,8 +725,27 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<div class="col-xl-3 col-sm-6 p-b-15 lbl-card">
|
||||
<div class="card card-mini dash-card card-3">
|
||||
<div class="card-body">
|
||||
<h2 class="mb-1">15,503</h2>
|
||||
<p>Daily Order</p>
|
||||
<?php
|
||||
$currentDate = date('m-d-Y'); // Get current date
|
||||
$orderCount = 0; // Initialize order count
|
||||
$dailyRevenue = 0;
|
||||
|
||||
foreach ($all_orders as $x => $val) {
|
||||
$paymentStatus = strtolower($val['payment']['status']);
|
||||
|
||||
$formattedOrderDate = date('m-d-Y', strtotime($val['order_date']));
|
||||
if ($formattedOrderDate == $currentDate) {
|
||||
$orderCount++;
|
||||
if($paymentStatus == "paid"){
|
||||
$dailyRevenue += $val['total_amount'];
|
||||
} // Increment order count for each order on the current date
|
||||
}
|
||||
}
|
||||
|
||||
$finalDailyRevenue = number_format($dailyRevenue, 2, '.', ',');
|
||||
?>
|
||||
<h2 class="mb-1"><?php echo $orderCount; ?></h2>
|
||||
<p>Today's Order</p>
|
||||
<span class="mdi mdi-package-variant"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -728,9 +753,9 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<div class="col-xl-3 col-sm-6 p-b-15 lbl-card">
|
||||
<div class="card card-mini dash-card card-4">
|
||||
<div class="card-body">
|
||||
<h2 class="mb-1">$98,503</h2>
|
||||
<p>Daily Revenue</p>
|
||||
<span class="mdi mdi-currency-usd"></span>
|
||||
<h2 class="mb-1"> ₱ <?php echo $finalDailyRevenue ?></h2>
|
||||
<p>Today's Revenue</p>
|
||||
<span class="mdi mdi-cash-multiple"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -741,6 +766,7 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<!-- Sales Graph -->
|
||||
<div id="user-acquisition" class="card card-default">
|
||||
<div class="card-header">
|
||||
|
||||
<h2>Sales Report</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
@ -778,9 +804,9 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<h2>Orders Overview</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<canvas id="doChart"></canvas>
|
||||
<canvas id="doughnut-chart"></canvas>
|
||||
</div>
|
||||
<a href="#" class="pb-5 d-block text-center text-muted"><i
|
||||
<a href="#" id="download-btn" class="pb-5 d-block text-center text-muted"><i
|
||||
class="mdi mdi-download mr-2"></i> Download overall report</a>
|
||||
<div class="card-footer d-flex flex-wrap bg-white p-0">
|
||||
<div class="col-6">
|
||||
|
@ -789,9 +815,9 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<li class="mb-2"><i class="mdi mdi-checkbox-blank-circle-outline mr-2"
|
||||
style="color: #4c84ff"></i>Order Completed</li>
|
||||
<li class="mb-2"><i class="mdi mdi-checkbox-blank-circle-outline mr-2"
|
||||
style="color: #80e1c1 "></i>Order Unpaid</li>
|
||||
style="color: #80e1c1 "></i>Order To Pay</li>
|
||||
<li><i class="mdi mdi-checkbox-blank-circle-outline mr-2"
|
||||
style="color: #ff7b7b "></i>Order returned</li>
|
||||
style="color: #ff7b7b "></i>Order Returned</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -799,11 +825,7 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<div class="p-20">
|
||||
<ul class="d-flex flex-column justify-content-between">
|
||||
<li class="mb-2"><i class="mdi mdi-checkbox-blank-circle-outline mr-2"
|
||||
style="color: #8061ef"></i>Order Pending</li>
|
||||
<li class="mb-2"><i class="mdi mdi-checkbox-blank-circle-outline mr-2"
|
||||
style="color: #ffa128"></i>Order Canceled</li>
|
||||
<li><i class="mdi mdi-checkbox-blank-circle-outline mr-2"
|
||||
style="color: #7be6ff"></i>Order Broken</li>
|
||||
style="color: #8061ef"></i>Order To Ship</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -995,9 +1017,6 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<div class="card card-table-border-none card-default recent-orders" id="recent-orders">
|
||||
<div class="card-header justify-content-between">
|
||||
<h2>Recent Orders</h2>
|
||||
<div class="date-range-report">
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-5">
|
||||
<table class="table card-table table-responsive table-responsive-large"
|
||||
|
@ -1005,155 +1024,60 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<thead>
|
||||
<tr>
|
||||
<th>Order ID</th>
|
||||
<th>Product Name</th>
|
||||
<th class="d-none d-lg-table-cell">Units</th>
|
||||
<th>Customer Name</th>
|
||||
<th class="d-none d-lg-table-cell">Vendor Name</th>
|
||||
<th class="d-none d-lg-table-cell">Total Amount</th>
|
||||
<th class="d-none d-lg-table-cell">Order Date</th>
|
||||
<th class="d-none d-lg-table-cell">Order Cost</th>
|
||||
<th>Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>24541</td>
|
||||
<td>
|
||||
<a class="text-dark" href=""> Coach Swagger</a>
|
||||
</td>
|
||||
<td class="d-none d-lg-table-cell">1 Unit</td>
|
||||
<td class="d-none d-lg-table-cell">Oct 20, 2018</td>
|
||||
<td class="d-none d-lg-table-cell">$230</td>
|
||||
<td>
|
||||
<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>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
<li class="dropdown-item">
|
||||
<a href="#">Remove</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>24541</td>
|
||||
<td>
|
||||
<a class="text-dark" href=""> Toddler Shoes, Gucci Watch</a>
|
||||
</td>
|
||||
<td class="d-none d-lg-table-cell">2 Units</td>
|
||||
<td class="d-none d-lg-table-cell">Nov 15, 2018</td>
|
||||
<td class="d-none d-lg-table-cell">$550</td>
|
||||
<td>
|
||||
<span class="badge badge-primary">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>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
<li class="dropdown-item">
|
||||
<a href="#">Remove</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>24541</td>
|
||||
<td>
|
||||
<a class="text-dark" href=""> Hat Black Suits</a>
|
||||
</td>
|
||||
<td class="d-none d-lg-table-cell">1 Unit</td>
|
||||
<td class="d-none d-lg-table-cell">Nov 18, 2018</td>
|
||||
<td class="d-none d-lg-table-cell">$325</td>
|
||||
<td>
|
||||
<span class="badge badge-warning">On 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>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
<li class="dropdown-item">
|
||||
<a href="#">Remove</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>24541</td>
|
||||
<td>
|
||||
<a class="text-dark" href=""> Backpack Gents, Swimming Cap Slin</a>
|
||||
</td>
|
||||
<td class="d-none d-lg-table-cell">5 Units</td>
|
||||
<td class="d-none d-lg-table-cell">Dec 13, 2018</td>
|
||||
<td class="d-none d-lg-table-cell">$200</td>
|
||||
<td>
|
||||
<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>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
<li class="dropdown-item">
|
||||
<a href="#">Remove</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>24541</td>
|
||||
<td>
|
||||
<a class="text-dark" href=""> Speed 500 Ignite</a>
|
||||
</td>
|
||||
<td class="d-none d-lg-table-cell">1 Unit</td>
|
||||
<td class="d-none d-lg-table-cell">Dec 23, 2018</td>
|
||||
<td class="d-none d-lg-table-cell">$150</td>
|
||||
<td>
|
||||
<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">
|
||||
<li class="dropdown-item">
|
||||
<a href="#">View</a>
|
||||
</li>
|
||||
<li class="dropdown-item">
|
||||
<a href="#">Remove</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$iterationCount = 0;
|
||||
foreach (array_reverse($all_orders) as $x => $val) {
|
||||
$paymentStatus = strtolower($val['payment']['status']);
|
||||
$formattedOrderDate = date('m-d-Y', strtotime($val['order_date']));
|
||||
$orderId = $val['_id'];
|
||||
$customerName = $val['customer'][0]['name'];
|
||||
$vendorName = $val['items'][0]['vendor_name'];
|
||||
$totalAmount = $val['total_amount'];
|
||||
$orderStatus = strtoupper($val['status']);
|
||||
|
||||
$statusClass = '';
|
||||
if ($orderStatus === 'UNPAID' || $orderStatus === 'RETURNED') {
|
||||
$statusClass = '#cb3747';
|
||||
} elseif ($orderStatus === 'TO PAY') {
|
||||
$statusClass = '#50d7ab';
|
||||
} elseif ($orderStatus === 'TO SHIP') {
|
||||
$statusClass = '#9586cd';
|
||||
}
|
||||
elseif ($orderStatus === 'TO RECEIVE') {
|
||||
$statusClass = '#ffc319';
|
||||
} elseif ($orderStatus === 'COMPLETED') {
|
||||
$statusClass = '#88aaf3';
|
||||
}
|
||||
|
||||
if ($formattedOrderDate == $currentDate) {
|
||||
$displayDate = date('m-d-Y, g:i A', strtotime($val['order_date']));
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $orderId ?></td>
|
||||
<td><?php echo $customerName ?></td>
|
||||
<td><?php echo $vendorName ?></td>
|
||||
<td><?php echo $totalAmount ?></td>
|
||||
<td><?php echo $displayDate ?></td>
|
||||
<td><span style="color: <?php echo $statusClass; ?>"><?php echo $orderStatus ?></span></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$iterationCount++;
|
||||
if ($iterationCount >= 8) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -1427,6 +1351,8 @@ if($_SESSION["user_type"]!="admin"){
|
|||
<script src="assets/plugins/charts/Chart.min.js"></script>
|
||||
<script src="assets/js/chart.js"></script>
|
||||
|
||||
<!-- gelo added dynamic charts -->
|
||||
<script src="assets/js/dashboard-chart.js"></script>
|
||||
<!-- Google map chart -->
|
||||
<script src="assets/plugins/charts/google-map-loader.js"></script>
|
||||
<script src="assets/plugins/charts/google-map.js"></script>
|
||||
|
|
|
@ -31,7 +31,8 @@ if ($_SESSION["isLoggedIn"] == true and $_SESSION["user_type"] == "admin"){
|
|||
<link id="ekka-css" href="assets/css/ekka.css" rel="stylesheet" />
|
||||
|
||||
<!-- FAVICON -->
|
||||
<link href="assets/img/favicon.png" rel="shortcut icon" />
|
||||
<!-- <link href="assets/img/favicon.png" rel="shortcut icon" /> -->
|
||||
<link href="assets/img/favicon/favicon.png" rel="shortcut icon" />
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ $allorders = json_encode($orders, true);
|
|||
<link id="ekka-css" rel="stylesheet" href="assets/css/ekka.css" />
|
||||
|
||||
<!-- FAVICON -->
|
||||
<link href="assets/img/favicon.png" rel="shortcut icon" />
|
||||
<!-- <link href="assets/img/favicon.png" rel="shortcut icon" /> -->
|
||||
<link href="assets/img/favicon/favicon.png" rel="shortcut icon" />
|
||||
</head>
|
||||
|
||||
<body class="ec-header-fixed ec-sidebar-fixed ec-sidebar-dark ec-header-light" id="body">
|
||||
|
|
|
@ -190,7 +190,61 @@ if($_SESSION["user_type"]!="admin"){
|
|||
const array = new Array(productData)
|
||||
console.log(array)
|
||||
// const parseJs =JSON.parse(productData)
|
||||
function searchProduct(e){
|
||||
function searchProduct(e) {
|
||||
const searchInput = document.getElementById('searchProduct');
|
||||
const productWrap = document.getElementById('productWrap');
|
||||
|
||||
// Clear previous search results
|
||||
productWrap.innerHTML = '';
|
||||
|
||||
// Get search query and ensure it's lowercase
|
||||
const query = searchInput.value.trim().toLowerCase();
|
||||
|
||||
// Filter products based on search query
|
||||
const filteredProducts = array[0].filter(product => {
|
||||
return product.product_name.toLowerCase().includes(query);
|
||||
});
|
||||
|
||||
if (filteredProducts.length > 0) {
|
||||
// Display filtered products
|
||||
filteredProducts.forEach(prod => {
|
||||
const productImage = prod.images.split(',') ?? [];
|
||||
const image = productImage[0] ?
|
||||
`<img class="img-fluid" src="${productImage[0]}" alt="product image" style="object-fit: cover; width: 100%; height: 100%;" />` :
|
||||
`<img class="img-fluid rounded-circle" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="placeholder image" style="object-fit: cover; width: 100%; height: 100%;" />`;
|
||||
|
||||
const card = document.createElement('div');
|
||||
card.classList.add('col-lg-3', 'col-md-4', 'col-sm-6');
|
||||
card.innerHTML = `
|
||||
<div class="card-wrapper">
|
||||
<div class="card-container">
|
||||
<div class="card-top">
|
||||
<div class="image-container" style="height: 300px;">
|
||||
${image}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-bottom">
|
||||
<h3>${prod.product_name}</h3>
|
||||
<p>₱${prod.regular_price}</p>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="card-edit" onclick="editProduct('${prod._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="deleteProduct('${prod._id}');"><i class="mdi mdi mdi-delete-outline"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
productWrap.appendChild(card);
|
||||
});
|
||||
} else {
|
||||
// Display message if no products found
|
||||
productWrap.innerHTML = `<p style="padding-top:10px; padding-left:20px;">No Product Found.</p>`;
|
||||
}
|
||||
}
|
||||
const search = document.getElementById('searchProduct');
|
||||
search.addEventListener("input", searchProduct);
|
||||
/* function searchProduct(e){
|
||||
const searchInput = document.getElementById('searchProduct')
|
||||
|
||||
let search = []
|
||||
|
@ -255,7 +309,7 @@ if($_SESSION["user_type"]!="admin"){
|
|||
// console.log(search)
|
||||
}
|
||||
const search = document.getElementById('searchProduct')
|
||||
search.addEventListener("input", searchProduct)
|
||||
search.addEventListener("input", searchProduct) */
|
||||
</script>
|
||||
<!-- 3-18-24 raymart add function for search bar -->
|
||||
<!-- <div class="row">
|
||||
|
|
|
@ -73,17 +73,17 @@ if (isset($_SESSION["token"])) {
|
|||
|
||||
$issued_at_time = $token_data->iat;
|
||||
$expiration_time = $token_data->exp;
|
||||
$renewal_time = $issued_at_time + 3300;
|
||||
$renewal_time = $issued_at_time + 3000;
|
||||
|
||||
if (time() >= $renewal_time || time() >= $expiration_time) {
|
||||
header("Location: token-renew.php");
|
||||
exit;
|
||||
}
|
||||
// if (time() >= $renewal_time || time() >= $expiration_time) {
|
||||
// header("Location: token-renew.php");
|
||||
// exit;
|
||||
// }
|
||||
}
|
||||
// $token = loginRenew($_SESSION["email"], $_SESSION["password"], $token);
|
||||
// $_SESSION["token"] = $token;
|
||||
|
||||
|
||||
date_default_timezone_set('Asia/Manila');
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
@ -114,7 +114,7 @@ if (isset($_SESSION["token"])) {
|
|||
<!-- FAVICON -->
|
||||
<link href="assets/img/favicon.png" rel="shortcut icon" />
|
||||
|
||||
<script>
|
||||
<!-- <script>
|
||||
function renewToken() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "token-renew.php", true);
|
||||
|
@ -125,12 +125,33 @@ if (isset($_SESSION["token"])) {
|
|||
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> -->
|
||||
<script>
|
||||
function renewToken() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "token-renew.php", true);
|
||||
xhr.send();
|
||||
console.log("Token renewed at: " + new Date().toLocaleString());
|
||||
}
|
||||
|
||||
setInterval(function() {
|
||||
var currentTime = <?php echo time(); ?>;
|
||||
var renewalTime = <?php echo $renewal_time; ?>;
|
||||
var expirationTime = <?php echo $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>
|
||||
|
||||
<body class="ec-header-fixed ec-sidebar-fixed ec-sidebar-dark ec-header-light" id="body">
|
||||
|
@ -214,6 +235,7 @@ if (isset($_SESSION["token"])) {
|
|||
|
||||
?>
|
||||
<?php echo $_SESSION["token"] ?><br>
|
||||
<?php $real_time = date('Y-m-d H:i:s', $expiration_time); echo $real_time?>
|
||||
<?php // echo $_SESSION["email"] ?> <br>
|
||||
<?php // echo "Updated token: " . $token; ?>
|
||||
<?php // echo $_SESSION["password"] ?>
|
||||
|
@ -288,7 +310,7 @@ if (isset($_SESSION["token"])) {
|
|||
</div>
|
||||
|
||||
<div class="card-body pt-0 pb-0 table-responsive">
|
||||
<table class="table">
|
||||
<table id='paymentsTable'class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox"></th>
|
||||
|
@ -312,12 +334,13 @@ if (isset($_SESSION["token"])) {
|
|||
|
||||
if ($orderItems['payment']['status'] === 'PAID') {
|
||||
foreach ($orderItems['items'] as $item) {
|
||||
$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>
|
||||
<td><?php echo $item['price']; ?></td>
|
||||
<td><?php echo $orderItems['total_amount']; ?></td>
|
||||
<td>
|
||||
<span class="badge badge-success"><?php echo $orderItems['payment']['status']; ?></span>
|
||||
</td>
|
||||
|
@ -327,7 +350,7 @@ if (isset($_SESSION["token"])) {
|
|||
<td>
|
||||
<a class="text-dark" href=""><?php echo $item['product']['name']; ?></a>
|
||||
</td>
|
||||
<td><?php echo $orderItems['updatedAt']; ?></td>
|
||||
<td><?php echo $displayDate; ?></td>
|
||||
<td hidden><?php echo $orderItems['_id']; ?></td>
|
||||
<td class="text-right">
|
||||
<div class="dropdown show d-inline-block widget-dropdown">
|
||||
|
|
28
header.php
28
header.php
|
@ -140,6 +140,8 @@ if ($_SESSION["userId"] <> "") {
|
|||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<!--Ec Header Top Start -->
|
||||
<div class="header-top">
|
||||
<div class="container">
|
||||
|
@ -180,6 +182,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function displayPopup() {
|
||||
// Show the pop-up
|
||||
|
@ -205,6 +208,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Newsletter Modal Start -->
|
||||
<div id="ec-popnews-bg2"></div>
|
||||
<div id="ec-popnews-box2">
|
||||
|
@ -308,6 +312,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
</div>
|
||||
<!-- Ec Header Top End -->
|
||||
|
||||
<!-- Ec Header Bottom Start -->
|
||||
<div class="ec-header-bottom d-none d-lg-block">
|
||||
<div class="container position-relative">
|
||||
|
@ -428,19 +433,30 @@ if ($_SESSION["userId"] <> "") {
|
|||
</a>
|
||||
<div class="ec-pro-content">
|
||||
|
||||
<a href="product-left-sidebar.php?id=<?php echo $order['items'][0]['product']['product_id']; ?>" class="cart_pro_title"><?php echo $order['items'][0]['product']['name']; ?></a>
|
||||
<a href="product-left-sidebar.php?id=<?php echo $order['items'][0]['product']['product_id']; ?>" class="cart_pro_title">
|
||||
<?php echo $order['items'][0]['product']['name']; ?>
|
||||
</a>
|
||||
<span class="cart-price">Unit Price: <span><?php echo $order['items'][0]['price']; ?></span></span>
|
||||
<div class="cart-price">
|
||||
<span class="subtotal-<?php echo $order['_id']; ?>">Subtotal: <?php echo $order['total_amount'] ?></span>
|
||||
</div>
|
||||
<!-- 02-16-2024 Stacy added style -->
|
||||
<div class="qty-plus-minuses" style="display:flex; overflow:visible; align-items:center; padding-top:10px;">
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="qtyDecrement('<?php echo $order['_id']; ?>' , '<?php echo $order['items'][0]['_id']; ?>')">-</div>
|
||||
<input style="width:100px; height:40px" id="qty-input-<?php echo $order['items'][0]['_id']; ?>" class="qty-input" type="number" name="ec_qtybtn" value="<?php echo $order['items'][0]['quantity']; ?>" oninput="handleQtyInput(this, '<?php echo $order['_id']; ?>', '<?php echo $order['items'][0]['_id']; ?>')" />
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:30px; padding-left:5px; cursor: pointer;" onclick="qtyIncrement('<?php echo $order['_id']; ?>' , '<?php echo $order['items'][0]['_id']; ?>', false)">+</div>
|
||||
<div class="qty-plus-minuses" style="display:flex; overflow:visible; align-items:center; margin-top:5px;">
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:35px; margin-right:5px; cursor: pointer;" onclick="qtyDecrement('<?php echo $order['_id']; ?>' ,
|
||||
'<?php echo $order['items'][0]['_id']; ?>')" onmouseover="this.style.color='#a15d00'" onmouseout="this.style.color='#ffaa00'">-
|
||||
</div>
|
||||
<input style="width:100px; height:40px" id="qty-input-<?php echo $order['items'][0]['_id']; ?>" class="qty-input" type="number"
|
||||
name="ec_qtybtn" value="<?php echo $order['items'][0]['quantity']; ?>" oninput="handleQtyInput(this, '<?php echo $order['_id']; ?>',
|
||||
'<?php echo $order['items'][0]['_id']; ?>')" />
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:30px; margin-left:5px; cursor: pointer;" onclick="qtyIncrement('<?php echo $order['_id']; ?>' ,
|
||||
'<?php echo $order['items'][0]['_id']; ?>', false)" onmouseover="this.style.color='#a15d00'" onmouseout="this.style.color='#ffaa00'">+
|
||||
</div>
|
||||
<!-- <a class="remove">x</a> -->
|
||||
<!-- <a href="#" class="removeCart" onclick="deleteOrder('<?php #echo $order['_id']; ?>')">x</a> -->
|
||||
<a href="#" class="removeCart" onclick="deleteOrder('<?php echo $order['_id']; ?>')"><i class="ecicon eci-trash" style="padding:20px; opacity:70%"></i></a>
|
||||
<a href="#" class="removeCart" style="margin-left:30px;" onclick="deleteOrder('<?php echo $order['_id']; ?>')">
|
||||
<i class="ecicon eci-trash" style="color:#7e7e7e;" onmouseover="this.style.color='#aaaaaa'"
|
||||
onmouseout="this.style.color='#7e7e7e'"></i>
|
||||
</a>
|
||||
</div>
|
||||
<!-- 02-16-2024 Stacy added style -->
|
||||
</div>
|
||||
|
|
|
@ -19,7 +19,13 @@
|
|||
if ($result > 0) {
|
||||
$_SESSION["isVendor"] = true;
|
||||
}
|
||||
header("location: $url");
|
||||
|
||||
if ($url == "/forgot_password.php" || $url == "/forget_otp.php")
|
||||
{
|
||||
header("location: index.php");
|
||||
}else {
|
||||
header("location: $url");
|
||||
}
|
||||
} else {
|
||||
// $_SESSION["loginError"] = "Invalid email or password. Please try again.";
|
||||
header("location: login.php?error=1");
|
||||
|
|
|
@ -408,7 +408,7 @@ if (isset($_GET['id'])) {
|
|||
<div class="ec-pro-variation-content">
|
||||
<ul class="eccart-pro-items">
|
||||
<?php
|
||||
$main_product_image = isset($product_details["product_image"]) ? $product_details["product_image"] : 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
$main_product_image = isset($product_details["images"]) ? $product_details["images"] : 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
?>
|
||||
<a href="javascript:void(0);" onclick="selectVariation(<?php echo htmlspecialchars(json_encode($product_details), ENT_QUOTES, 'UTF-8'); ?>)">
|
||||
<li style="width: 100px; height: 100px">
|
||||
|
@ -421,7 +421,7 @@ if (isset($_GET['id'])) {
|
|||
|
||||
<?php
|
||||
foreach ($variation_details as $index => $variation) {
|
||||
$variationImage = isset($variation["product_image"]) ? $variation["product_image"] : 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
$variationImage = isset($variation["images"]) ? $variation["images"] : 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
?>
|
||||
<a href="javascript:void(0);" onclick="selectVariation(<?php echo htmlspecialchars(json_encode($variation), ENT_QUOTES, 'UTF-8'); ?>)">
|
||||
<li style="width: 100px; height: 100px">
|
||||
|
@ -447,10 +447,11 @@ if (isset($_GET['id'])) {
|
|||
document.getElementById("shortDescription").innerHTML = variation.product_description;
|
||||
document.getElementById("productTitle").innerText = variation.product_name;
|
||||
document.getElementById("product_Id").value = variation._id;
|
||||
var productImage = variation.product_image || 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
var productImage = variation.images || 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
|
||||
document.getElementById('mainProductImage').src = productImage;
|
||||
|
||||
document.getElementById('mainProductImage').classList.remove('zoom-image-hover');
|
||||
$('.zoom-image-hover').zoom();
|
||||
document.getElementById("productTitlemodal").innerText = variation.product_name;
|
||||
document.getElementById('mainProductImagemodal').src = productImage;
|
||||
|
||||
|
@ -487,27 +488,34 @@ if (isset($_GET['id'])) {
|
|||
<div class="ec-single-cart" style="display:flex; flex-direction:row; width:80%; overflow:visible; text-align:center; align-items:center; ">
|
||||
<!-- 02-13-24 Jun Jihad Contact Seller will appear to Variable products with no price -->
|
||||
<?php
|
||||
$product_price = (!empty($product_details['sale_price'])) ? $product_details['sale_price'] : $product_details['regular_price'] ;
|
||||
if ($_SESSION["isLoggedIn"]) {
|
||||
if ($product_details['product_type'] === "variable") {
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="decrement()">-</div>';
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="decrement()"
|
||||
onmouseover="this.style.color=\'#a15d00\'" onmouseout="this.style.color=\'#ffaa00\'">-</div>';
|
||||
echo '<input class="qty-inputs" style="width:110px; height:40px" type="number" name="ec_qtybtn" value="';
|
||||
echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1";
|
||||
echo '" id="qty-input" />';
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:25px; padding-left:5px; cursor: pointer;" onclick="increment()">+</div>';
|
||||
echo '<div style="display:flex; margin-left:45px;"><button type="button" class="btn btn-primary" id="contactSellerButton" style="background:#ffaa00; width:190px;" data-bs-toggle="modal" data-bs-target="#priceModal"><i class="fi-rr-envelope" style="font-size:20px; margin-bottom:-3px; margin-right:10px;"></i>Contact Seller</button>';
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:25px; padding-left:5px; cursor: pointer;" onclick="increment()"
|
||||
onmouseover="this.style.color=\'#a15d00\'" onmouseout="this.style.color=\'#ffaa00\'">+</div>';
|
||||
echo '<div style="display:flex; margin-left:45px;"><button type="button" class="btn btn-primary" id="contactSellerButton" style="background:#ffaa00; width:190px;"
|
||||
data-bs-toggle="modal" data-bs-target="#priceModal"><i class="fi-rr-envelope" style="font-size:20px; margin-bottom:-3px; margin-right:10px;"></i>Contact Seller</button>';
|
||||
echo '<button class="btn btn-primary" id="addToCartButton" style="display:none">Add To Cart</button>';
|
||||
echo '<div class="ec-single-wishlist">
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="wishlist()"><i class="fi fi-rr-heart" style="color:#B80F0A; font-size:20px;"></i></a>
|
||||
</div></div>';
|
||||
} else {
|
||||
if (!empty($product_details['regular_price']) || !empty($product_details['sale_price'])) {
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="decrement()">-</div>';
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:35px; margin-right:5px; cursor: pointer;" onclick="decrement()"
|
||||
onmouseover="this.style.color=\'#a15d00\'" onmouseout="this.style.color=\'#ffaa00\'">-</div>';
|
||||
echo '<input class="qty-inputs" style="width:100px; height:40px" type="number" name="ec_qtybtn" value="';
|
||||
echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1";
|
||||
echo '" id="qty-input" />';
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:25px; padding-left:5px; cursor: pointer;" onclick="increment()">+</div>';
|
||||
// echo '<div id="addToCartMessage" style="border:1px solid red;"></div>';
|
||||
echo '<div> <div id="addToCartMessage" style="padding-left:45px;"></div> <button class="btn btn-primary" id="addToCartButton" style="text-wrap:nowrap; background:#ffaa00; margin-left:55px;"><i class="fi-rr-shopping-bag" style="font-size:20px; margin-bottom:-3px; margin-right:10px;"></i>Add To Cart</button></div>';
|
||||
echo '<div class="qty-btn" style="color:#ffaa00; font-size:25px; margin-left:5px; cursor: pointer;" onclick="increment()"
|
||||
onmouseover="this.style.color=\'#a15d00\'" onmouseout="this.style.color=\'#ffaa00\'">+</div>';
|
||||
echo '<div> <div id="addToCartMessage" style="padding-left:45px;"></div> <button class="btn btn-primary" id="addToCartButton" style="text-wrap:nowrap;
|
||||
background:#ffaa00; margin-left:55px;" onmouseover="this.style.background=\'#df9000\'" onmouseout="this.style.background=\'#ffaa00\'">
|
||||
<i class="fi-rr-shopping-bag" style="font-size:20px; margin-bottom:-3px; margin-right:10px;"></i>Add To Cart</button></div>';
|
||||
echo '<div class="ec-single-wishlist">
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="wishlist()"><i class="fi fi-rr-heart" style="color:#B80F0A; font-size:20px;"></i></a>
|
||||
</div>';
|
||||
|
@ -517,7 +525,8 @@ if (isset($_GET['id'])) {
|
|||
}
|
||||
} else {
|
||||
echo '<div class="login-button" style=""><p style="color:red; text-wrap:nowrap;">Please log in to your account.</p>';
|
||||
echo '<a href="login.php" style="margin-left:-2px;"><button type="button" class="btn btn-primary" style="margin-left:-2px; margin-top:-20px; background:#ffaa00; border-radius:10px; letter-spacing:1px;" data-bs-toggle="modal">LOGIN</button></a></div>';
|
||||
echo '<a href="login.php" style="margin-left:-2px;"><button type="button" class="btn btn-primary" style="margin-left:-2px; margin-top:-20px; background:#ffaa00;
|
||||
border-radius:10px; letter-spacing:1px;" data-bs-toggle="modal">LOGIN</button></a></div>';
|
||||
}
|
||||
?>
|
||||
<!-- <div class="ec-single-wishlist" style="border: 1px solid yellow;">
|
||||
|
@ -626,12 +635,120 @@ if (isset($_GET['id'])) {
|
|||
</div> -->
|
||||
</div>
|
||||
<script>
|
||||
function increment() {
|
||||
/* 04-18-24 raymart added functioning the quantity to handle if the product has price matrix */
|
||||
function handleInput(action) {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
qtyInput.value = parseInt(qtyInput.value) + 1;
|
||||
var currentQuantity = parseInt(qtyInput.value);
|
||||
var minimumOrder = <?php echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1"; ?>;
|
||||
|
||||
/* default to quantity 1 if input is empty */
|
||||
if (!currentQuantity || isNaN(currentQuantity)) {
|
||||
currentQuantity = 1;
|
||||
}
|
||||
|
||||
/* default to minimum quantity if the product has minimun order */
|
||||
if (currentQuantity < minimumOrder) {
|
||||
currentQuantity = minimumOrder;
|
||||
console.log("The minimum order quantity is " + minimumOrder);
|
||||
}
|
||||
|
||||
/* Ensure the quantity never goes below 1 */
|
||||
if (action === 'increment') {
|
||||
currentQuantity += 1;
|
||||
} else if (action === 'decrement' && currentQuantity > 1) {
|
||||
currentQuantity -= 1;
|
||||
}
|
||||
currentQuantity = Math.max(currentQuantity, 1);
|
||||
|
||||
qtyInput.value = currentQuantity;
|
||||
|
||||
var handlePrice = document.getElementById('productNewPrice') || document.getElementById('productPrice');
|
||||
var product_price = '<?php echo $product_price; ?>';
|
||||
var priceMatrices = <?php echo (!empty($product_details['price_matrix'])) ? json_encode($product_details['price_matrix']) : "[]"; ?>;
|
||||
var foundPrice = false;
|
||||
|
||||
for (var m = 0; m < priceMatrices.length; m++) {
|
||||
var priceMatrix = priceMatrices[m];
|
||||
|
||||
for (var i = 0; i < priceMatrix.length; i++) {
|
||||
var matrixQuantity = parseFloat(priceMatrix[i].quantity);
|
||||
var nextMatrixQuantity = (i < priceMatrix.length - 1) ? parseFloat(priceMatrix[i + 1].quantity) : Infinity;
|
||||
|
||||
if (currentQuantity >= matrixQuantity && currentQuantity < nextMatrixQuantity) {
|
||||
var unitPrice = parseFloat(priceMatrix[i].price);
|
||||
handlePrice.innerText = unitPrice.toFixed(2).toString().replace(/\.00$/, '');
|
||||
foundPrice = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundPrice) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundPrice) {
|
||||
// Handle when quantity exceeds the highest price matrix
|
||||
var lastMatrix = priceMatrices[priceMatrices.length - 1];
|
||||
var highestQuantity = parseFloat(lastMatrix[lastMatrix.length - 1].quantity);
|
||||
if (currentQuantity >= highestQuantity) {
|
||||
var highestPrice = parseFloat(lastMatrix[lastMatrix.length - 1].price);
|
||||
handlePrice.innerText = highestPrice.toFixed(2).replace(/\.00$/, '');
|
||||
foundPrice = true;
|
||||
}
|
||||
}
|
||||
// If original price is within the quantity range
|
||||
if (!foundPrice) {
|
||||
handlePrice.innerText = product_price;
|
||||
}
|
||||
}
|
||||
|
||||
function decrement() {
|
||||
function increment() {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
var currentQuantity = parseInt(qtyInput.value);
|
||||
currentQuantity++;
|
||||
qtyInput.value = currentQuantity;
|
||||
|
||||
var incrementPrice;
|
||||
if (document.getElementById('productNewPrice')) {
|
||||
incrementPrice = document.getElementById('productNewPrice');
|
||||
} else {
|
||||
incrementPrice = document.getElementById('productPrice');
|
||||
}
|
||||
// var productPrice = document.getElementById('productPrice');
|
||||
var product_price = '<?php echo $product_price; ?>';
|
||||
|
||||
var foundPrice = false;
|
||||
var priceMatrix = <?php echo (!empty($product_details['price_matrix'])) ? json_encode($product_details['price_matrix']) : "[]"; ?>;
|
||||
|
||||
/* to determine if regular price or price matrix but it depends to the quantity */
|
||||
if (priceMatrix.length > 0) {
|
||||
for (var i = 0; i < priceMatrix.length; i++) {
|
||||
for (var j = 0; j < priceMatrix[i].length; j++) {
|
||||
var matrixQuantity = parseFloat(priceMatrix[i][j].quantity);
|
||||
var nextMatrixQuantity = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].quantity) : Infinity;
|
||||
|
||||
if (currentQuantity >= matrixQuantity && currentQuantity < nextMatrixQuantity) {
|
||||
var regularPrice = parseFloat(priceMatrix[i][j].price);
|
||||
var nextPrice = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].price) : product_price;
|
||||
var unitPrice = regularPrice;
|
||||
incrementPrice.innerText = parseFloat(unitPrice.toFixed(2)).toString(); // Convert to floating-point number and then to string
|
||||
foundPrice = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundPrice) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* function increment() {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
qtyInput.value = parseInt(qtyInput.value) + 1;
|
||||
} */
|
||||
|
||||
/* function decrement() {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
var currentQuantity = parseInt(qtyInput.value);
|
||||
|
||||
|
@ -646,7 +763,64 @@ if (isset($_GET['id'])) {
|
|||
qtyInput.value = currentQuantity - 1;
|
||||
}
|
||||
<?php endif; ?>
|
||||
} */
|
||||
|
||||
function decrement() {
|
||||
var qtyInput = document.getElementById('qty-input');
|
||||
var currentQuantity = parseInt(qtyInput.value);
|
||||
var minimumOrder = <?php echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1"; ?>;
|
||||
if (currentQuantity <= minimumOrder) {
|
||||
console.log("The minimum order quantity is " + minimumOrder);
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentQuantity > 1) {
|
||||
currentQuantity--;
|
||||
} else {
|
||||
return; // Don't decrement further if quantity is already 1
|
||||
}
|
||||
qtyInput.value = currentQuantity;
|
||||
|
||||
var decrementPrice;
|
||||
if (document.getElementById('productNewPrice')) {
|
||||
decrementPrice = document.getElementById('productNewPrice');
|
||||
} else {
|
||||
decrementPrice = document.getElementById('productPrice');
|
||||
}
|
||||
// var productPrice = document.getElementById('productPrice');
|
||||
var product_price = '<?php echo $product_price; ?>';
|
||||
|
||||
var foundPrice = false;
|
||||
var priceMatrix = <?php echo (!empty($product_details['price_matrix'])) ? json_encode($product_details['price_matrix']) : "[]"; ?>;
|
||||
|
||||
/* to determine if regular price or price matrix but it depends to the quantity */
|
||||
if (priceMatrix.length > 0) {
|
||||
for (var i = 0; i < priceMatrix.length; i++) {
|
||||
for (var j = 0; j < priceMatrix[i].length; j++) {
|
||||
var matrixQuantity = parseFloat(priceMatrix[i][j].quantity);
|
||||
var nextMatrixQuantity = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].quantity) : Infinity;
|
||||
|
||||
if (currentQuantity >= matrixQuantity && currentQuantity < nextMatrixQuantity) {
|
||||
var regularPrice = parseFloat(priceMatrix[i][j].price);
|
||||
var nextPrice = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].price) : product_price;
|
||||
var unitPrice = regularPrice;
|
||||
decrementPrice.innerText = parseFloat(unitPrice.toFixed(2)).toString(); /* Convert to floating-point number and then to string */
|
||||
foundPrice = true;
|
||||
break;
|
||||
} else if (currentQuantity < matrixQuantity) {
|
||||
/* If current quantity is less than the minimum in the price matrix, display the regular price */
|
||||
decrementPrice.innerText = parseFloat(product_price).toFixed(2).replace(/\.00$/, ''); /* Remove trailing .00 */
|
||||
foundPrice = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundPrice) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 04-18-24 raymart added functioning the quantity to handle if the product has price matrix */
|
||||
|
||||
<?php
|
||||
|
||||
|
@ -772,7 +946,22 @@ if (isset($_GET['id'])) {
|
|||
if (parseInt(quantityValue) < minimumOrder) {
|
||||
quantityValue = minimumOrder;
|
||||
alert("The minimum order quantity is " + minimumOrder);
|
||||
}
|
||||
} /* else {
|
||||
if (priceMatrix.length > 0) {
|
||||
var selectedPrice = null;
|
||||
for (var i = 0; i < priceMatrix.length; i++) {
|
||||
if (parseInt(priceMatrix[i].quantity) === parseInt(quantityValue)) {
|
||||
selectedPrice = priceMatrix[i].price;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedPrice !== null) {
|
||||
document.getElementById("price-display").innerText = "Price: $" + selectedPrice;
|
||||
} else {
|
||||
document.getElementById("price-display").innerText = "Price not available for this quantity";
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
// April 3, 2024 Jun Jihad Apply Matrix
|
||||
var productPrice;
|
||||
|
@ -906,25 +1095,29 @@ if (isset($_GET['id'])) {
|
|||
newOrder.id = `order_${response._id}`;
|
||||
console.log(response)
|
||||
newOrder.innerHTML = `
|
||||
<a href="shop-left-sidebar-col-4.php" class="sidekka_pro_img">
|
||||
<img src="${response.items[0].product.product_image}" alt="product">
|
||||
</a>
|
||||
<div class="ec-pro-content">
|
||||
<a href="shop-left-sidebar-col-4.php" class="cart_pro_title">${response.items[0].product.name}</a>
|
||||
<span class="cart-price" id="cart-price">
|
||||
Unit Price: <span>${response.items[0].price}</span>
|
||||
</span>
|
||||
<span id="subtotal-${response._id}" class="subtotal-${response._id}">Subtotal: ${totalAmount}</span>
|
||||
<!-- 02-16-2024 Stacy added style -->
|
||||
<div class="qty-plus-minuses" style="display:flex; overflow:visible; align-items:center; padding-top:10px;">
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="qtyDecrement('${response._id}', '${response.items[0]._id}', true)">-</div>
|
||||
<input style="width:100px; height:40px" id="qty-input-${response.items[0]._id}" class="qty-input" type="number" name="ec_qtybtn" value="${productData.quantity}" oninput="handleQtyInput(this, '${response._id}', '${response.items[0]._id}', true)"/>
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:30px; padding-left:5px; cursor: pointer;" onclick="qtyIncrement('${response._id}', '${response.items[0]._id}', true)">+</div>
|
||||
<a href="#" class="removeCart" onclick="deleteOrder('${response._id}')"><i class="ecicon eci-trash" style="padding:20px; opacity:70%"></i></a>
|
||||
</div>
|
||||
<!-- 02-16-2024 Stacy added style -->
|
||||
</div>
|
||||
`;
|
||||
<a href="shop-left-sidebar-col-4.php" class="sidekka_pro_img">
|
||||
<img src="${response.items[0].product.product_image}" alt="product">
|
||||
</a>
|
||||
<div class="ec-pro-content">
|
||||
<a href="shop-left-sidebar-col-4.php" class="cart_pro_title">${response.items[0].product.name}</a>
|
||||
<span class="cart-price" id="cart-price">
|
||||
Unit Price: <span>${response.items[0].price}</span>
|
||||
</span>
|
||||
<span id="subtotal-${response._id}" class="subtotal-${response._id}">Subtotal: ${totalAmount}</span>
|
||||
<!-- 02-16-2024 Stacy added style -->
|
||||
<div class="qty-plus-minuses" style="display:flex; overflow:visible; align-items:center; margin-top:5px;">
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:35px; margin-right:5px; cursor: pointer;" onclick="qtyDecrement('${response._id}', '${response.items[0]._id}', true)"
|
||||
onmouseover="this.style.color='#a15d00'" onmouseout="this.style.color='#ffaa00'">-</div>
|
||||
<input style="width:100px; height:40px" id="qty-input-${response.items[0]._id}" class="qty-input" type="number" name="ec_qtybtn" value="${productData.quantity}" oninput="handleQtyInput(this, '${response._id}', '${response.items[0]._id}', true)"/>
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:30px; margin-left:5px; cursor: pointer;" onclick="qtyIncrement('${response._id}', '${response.items[0]._id}', true)"
|
||||
onmouseover="this.style.color='#a15d00'" onmouseout="this.style.color='#ffaa00'">+</div>
|
||||
<a href="#" class="removeCart" style="margin-left:30px;" onclick="deleteOrder('${response._id}')">
|
||||
<i class="ecicon eci-trash" style="color:#7e7e7e;" onmouseover="this.style.color='#aaaaaa'"
|
||||
onmouseout="this.style.color='#7e7e7e'"></i></a>
|
||||
</div>
|
||||
<!-- 02-16-2024 Stacy added style -->
|
||||
</div>
|
||||
`;
|
||||
getLatestOrders()
|
||||
updateCartItemCount()
|
||||
cartList.appendChild(newOrder);
|
||||
|
@ -985,23 +1178,29 @@ if (isset($_GET['id'])) {
|
|||
var totalAmount = response.items[0].price * updatedQuantity;
|
||||
// If the cart item already exists, update its content using innerHTML
|
||||
cartItem.innerHTML = `
|
||||
<a href="shop-left-sidebar-col-4.php" class="sidekka_pro_img">
|
||||
<img src="${response.items[0].product.product_image}" alt="product">
|
||||
</a>
|
||||
<div class="ec-pro-content">
|
||||
<a href="shop-left-sidebar-col-4.php" class="cart_pro_title">${response.items[0].product.name}</a>
|
||||
<span class="cart-price" id="cart-price">
|
||||
Unit Price: <span>${response.items[0].price}</span>
|
||||
</span>
|
||||
<span id="subtotal-${response._id}" class="subtotal-${response._id}">Subtotal: ${totalAmount}</span>
|
||||
<div class="qty-plus-minuses">
|
||||
<div class="qty-btn" onclick="qtyDecrement('${response._id}', '${response.items[0]._id}', true)">-</div>
|
||||
<input id="qty-input-${response.items[0]._id}" class="qty-input" type="number" name="ec_qtybtn" value="${productData.quantity}" oninput="handleQtyInput(this, '${response._id}', '${response.items[0]._id}', true)"/>
|
||||
<div class="qty-btn" onclick="qtyIncrement('${response._id}', '${response.items[0]._id}', true)">+</div>
|
||||
</div>
|
||||
<a href="#" class="removeCart" onclick="deleteOrder('${response._id}')">x</a>
|
||||
</div>
|
||||
`;
|
||||
<a href="shop-left-sidebar-col-4.php" class="sidekka_pro_img">
|
||||
<img src="${response.items[0].product.product_image}" alt="product">
|
||||
</a>
|
||||
<div class="ec-pro-content">
|
||||
<a href="shop-left-sidebar-col-4.php" class="cart_pro_title">${response.items[0].product.name}</a>
|
||||
<span class="cart-price" id="cart-price">
|
||||
Unit Price: <span>${response.items[0].price}</span>
|
||||
</span>
|
||||
<span id="subtotal-${response._id}" class="subtotal-${response._id}">Subtotal: ${totalAmount}</span>
|
||||
<!-- 04-17-2024 Stacy added style -->
|
||||
<div class="qty-plus-minuses" style="display:flex; overflow:visible; align-items:center; margin-top:5px;">
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:35px; margin-right:5px; cursor: pointer;" onclick="qtyDecrement('${response._id}', '${response.items[0]._id}', true)"
|
||||
onmouseover="this.style.color='#a15d00'" onmouseout="this.style.color='#ffaa00'">-</div>
|
||||
<input style="width:100px; height:40px" id="qty-input-${response.items[0]._id}" class="qty-input" type="number" name="ec_qtybtn" value="${productData.quantity}" oninput="handleQtyInput(this, '${response._id}', '${response.items[0]._id}', true)"/>
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:30px; margin-left:5px; cursor: pointer;" onclick="qtyIncrement('${response._id}', '${response.items[0]._id}', true)"
|
||||
onmouseover="this.style.color='#a15d00'" onmouseout="this.style.color='#ffaa00'">+</div>
|
||||
<a href="#" class="removeCart" style="margin-left:30px;" onclick="deleteOrder('${response._id}')">
|
||||
<i class="ecicon eci-trash" style="color:#7e7e7e;" onmouseover="this.style.color='#aaaaaa'"
|
||||
onmouseout="this.style.color='#7e7e7e'"></i></a>
|
||||
</div>
|
||||
<!-- 04-17-2024 Stacy added style -->
|
||||
</div>
|
||||
`;
|
||||
document.getElementById(`qty-input-${response.items[0]._id}`).value = updatedQuantity;
|
||||
} else {
|
||||
// If the cart item doesn't exist, create a new one
|
||||
|
|
|
@ -250,7 +250,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
<div class="modal-dialog modal-dialog-centered modal-sm" role="document" style="max-width: 800px;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" style="overflow-y: auto; max-height: 90vh;">
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#secondModal">Add New Address</button>
|
||||
<button type="button" class="btn btn-primary mb-3" data-bs-toggle="modal" data-bs-target="#secondModal">Add New Address</button>
|
||||
|
||||
<!-- Display a list of addresses and let the user choose -->
|
||||
<form id="addressForm">
|
||||
|
@ -362,7 +362,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
<label for="addressCountry" class="text-dark font-weight-medium pt-3 mb-2">Country</label>
|
||||
<input type="text" class="form-control" id="addressCountry" >
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" id="submitBtn">Submit</button>
|
||||
<button type="button" class="btn btn-primary mt-4" id="submitBtn">Submit</button>
|
||||
|
||||
</form>
|
||||
|
||||
|
@ -447,7 +447,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
<label for="addressCountry2" class="text-dark font-weight-medium pt-3 mb-2">Country</label>
|
||||
<input type="text" class="form-control" id="addressCountry2">
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" id="submitBtn2">Submit</button>
|
||||
<button type="button" class="btn btn-primary mt-4" id="submitBtn2">Submit</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -276,11 +276,28 @@ $products = productList();
|
|||
<!-- 03-11-2024 Stacy added pagination for vendor -->
|
||||
<!-- Ec Pagination Start -->
|
||||
<div class="pagination mt-3">
|
||||
<?php
|
||||
for ($i = 1; $i <= $totalPages; $i++) {
|
||||
echo "<a href='?page=$i' class='" . ($currentpage == $i ? 'active' : '') . "'>$i</a>";
|
||||
<?php
|
||||
$start = max(1, $currentpage - 2);
|
||||
$end = min($totalPages, $start + 4);
|
||||
|
||||
if ($start > 1) {
|
||||
echo "<a href='?page=1'>1</a>";
|
||||
if ($start > 2) {
|
||||
echo "<span> ... </span>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
for ($i = $start; $i <= $end; $i++) {
|
||||
echo "<a href='?page=$i' class='" . ($currentpage == $i ? 'active' : '') . "'>$i</a> ";
|
||||
}
|
||||
|
||||
if ($end < $totalPages) {
|
||||
if ($end < $totalPages - 1) {
|
||||
echo "<span> ... </span>";
|
||||
}
|
||||
echo "<a href='?page=$totalPages'>$totalPages</a>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<!-- Ec Pagination End -->
|
||||
</div>
|
||||
|
|
|
@ -488,10 +488,10 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
console.log(response);
|
||||
var paymentId = response.payment.reference_number;
|
||||
$('#paymentIdSpan').text(paymentId);
|
||||
var gross_price = response.payment.details[0]?.attributes.data.attributes.amount;
|
||||
var gross_price = (response.payment.details[0]?.attributes.data.attributes.amount / 100).toFixed(2);
|
||||
var payment_status = response.payment.status;
|
||||
var fee = response.payment.details[0]?.attributes.data.attributes.fee;
|
||||
var net_amount = response.payment.details[0]?.attributes.data.attributes.payments[0].attributes.net_amount;
|
||||
var net_amount = (response.payment.details[0]?.attributes.data.attributes.payments[0].attributes.net_amount / 100).toFixed(2);
|
||||
var desc = response.items[0].product.name;
|
||||
var method = response.payment_method;
|
||||
var name = response.billing_address.billing_first_name + " " + response.billing_address.billing_last_name;
|
||||
|
@ -522,7 +522,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
|
||||
<div class="d-flex justify-content-between p-2">
|
||||
<div class="fw-bold">Gross Amount</div>
|
||||
<div>₱ ${net_amount}</div>
|
||||
<div>₱ ${gross_price}</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between p-2" style="border-bottom: 1px solid #000;">
|
||||
<div class="fw-bold"> Fees <span data-bs-toggle="tooltip" data-bs-placement="top"
|
||||
|
@ -532,7 +532,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</div>
|
||||
<div class="d-flex justify-content-between p-2">
|
||||
<div class="fw-bold"> Net Amount</div>
|
||||
<div>₱ ${gross_price} </div>
|
||||
<div>₱ ${net_amount} </div>
|
||||
</div>
|
||||
<div class="d-flex p-2">
|
||||
<div class="fw-bold"> Payment Description </div>
|
||||
|
@ -598,7 +598,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</div>
|
||||
<div class="d-flex justify-content-between p-2">
|
||||
<div class="fw-bold"> Net Amount</div>
|
||||
<div>₱ ${gross_price} </div>
|
||||
<div>₱ ${net_amount} </div>
|
||||
</div>
|
||||
<div class="d-flex p-2">
|
||||
<div class="fw-bold"> Payment Description </div>
|
||||
|
|
|
@ -84,6 +84,24 @@ $vendorPayoutData = json_decode($response, true);
|
|||
<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">
|
||||
|
@ -151,7 +169,7 @@ $vendorPayoutData = json_decode($response, true);
|
|||
<div class="ec-vendor-card-body">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4 mb-5">
|
||||
<div class="col-md-12 mb-5">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h5 class="panel-title"><strong>Upcoming Payout</strong></h5>
|
||||
|
@ -167,9 +185,9 @@ $vendorPayoutData = json_decode($response, true);
|
|||
|
||||
foreach ($upcomingPayout as $x => $val) {
|
||||
$paymentStatus = strtolower($val['payment']['status']);
|
||||
$orderStatus = $val['status'];
|
||||
$orderStatus = strtolower($val['status']);
|
||||
$payoutStatus = empty($val['payout_status']);
|
||||
if(( $paymentStatus == "paid") && ( $orderStatus == "COMPLETED") && ($payoutStatus == true)){
|
||||
if(( $paymentStatus == "paid") && ( $orderStatus == "completed") && ($payoutStatus == true)){
|
||||
$orderAmount = $val['total_amount'];
|
||||
$payoutSum += $orderAmount;
|
||||
}
|
||||
|
@ -201,7 +219,8 @@ $vendorPayoutData = json_decode($response, true);
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-5">
|
||||
<!-- ADDITIONAL PANELS FOR PAYOUTS FOR FUTURE USE, DO NOT REMOVE -->
|
||||
<!-- <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>
|
||||
|
@ -242,19 +261,19 @@ $vendorPayoutData = json_decode($response, true);
|
|||
</strong>
|
||||
</div>
|
||||
</h4>
|
||||
<!-- <div class="text-sm mt-3">
|
||||
<- <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> -
|
||||
<div class="text-sm">
|
||||
Receipient: Philippine National Bank (PNB) Account ending in <?php echo $bankNumEnding?>
|
||||
Receipient: Philippine National Bank (PNB) Account ending in <php echo $bankNumEnding?>
|
||||
</div>
|
||||
</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">
|
||||
|
@ -320,7 +339,7 @@ $vendorPayoutData = json_decode($response, 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">Payment ID: <span id="payoutIdSpan"></span></h5>
|
||||
<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">
|
||||
|
@ -598,6 +617,7 @@ $vendorPayoutData = json_decode($response, true);
|
|||
console.log(response);
|
||||
var grossAmount = response.gross_amount;
|
||||
var totalFees = response.fees_deduction_adjustment;
|
||||
var feeBreakdown = response.breakdown[0].transfer_fee;
|
||||
var netAmount = response.net_amount;
|
||||
var payoutStatus = response.status;
|
||||
payoutStatus = payoutStatus.charAt(0).toUpperCase() + payoutStatus.slice(1).toLowerCase();
|
||||
|
@ -611,12 +631,19 @@ $vendorPayoutData = json_decode($response, true);
|
|||
{
|
||||
|
||||
var paymentType = log.Type;
|
||||
var transDate = log?.Transaction_date;
|
||||
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>
|
||||
|
@ -650,7 +677,7 @@ $vendorPayoutData = json_decode($response, true);
|
|||
<div class="fw-bold"> Fees, Deductions, Adjustments
|
||||
|
||||
</div>
|
||||
<div> - ${totalFees}</div>
|
||||
<div> - ${totalFees} (${feeBreakdown})</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between p-2">
|
||||
<div class="fw-bold"> Net Amount</div>
|
||||
|
|
|
@ -304,7 +304,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<div class="modal-dialog modal-dialog-centered modal-sm" role="document" style="max-width: 800px;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" style="overflow-y: auto; max-height: 90vh;">
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#secondModal">Add New Address</button>
|
||||
<button type="button" class="btn btn-primary mb-3" data-bs-toggle="modal" data-bs-target="#secondModal">Add New Address</button>
|
||||
|
||||
<!-- Display a list of addresses and let the user choose -->
|
||||
<form id="addressForm">
|
||||
|
@ -322,7 +322,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div class="selectWrap" style="display: flex; justify-content: center; align-items: center; width: 50%;">
|
||||
<div class="selectWrap" style="display: flex; justify-content: center; align-items: center; width: 50%; margin-left:-20px;">
|
||||
<input type="radio" style="padding-left: 0px !important; margin: 0px 0px !important;" name="selectedShippingAddress[<?php echo $vendor_index; ?>]" id="shipping_address_<?php echo $vendor_index; ?>_<?php echo $address_index; ?>" value="<?php echo $vendor_index; ?>_<?php echo $address_index; ?>" class="form-check-input" onchange="updateAddressShipping('<?php echo $vendor['_id']; ?>', <?php echo $address_index; ?>, true)" <?php echo $address["shipping"] ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label" style="margin: 0px 10px !important;" for="shipping_address_<?php echo $vendor_index; ?>_<?php echo $address_index; ?>">
|
||||
Shipping Address
|
||||
|
@ -420,7 +420,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<label for="addressCountry" class="text-dark font-weight-medium pt-3 mb-2">Country</label>
|
||||
<input type="text" class="form-control" id="addressCountry">
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" id="submitBtn">Submit</button>
|
||||
<button type="button" class="btn btn-primary mt-4" id="submitBtn">Submit</button>
|
||||
|
||||
</form>
|
||||
|
||||
|
@ -505,7 +505,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<label for="addressCountry2" class="text-dark font-weight-medium pt-3 mb-2">Country</label>
|
||||
<input type="text" class="form-control" id="addressCountry2">
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" id="submitBtn2">Submit</button>
|
||||
<button type="button" class="btn btn-primary mt-4" id="submitBtn2">Submit</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
@ -519,7 +519,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<div class="modal-dialog modal-dialog-centered modal-sm" role="document" style="max-width: 800px;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" style="overflow-y: auto; max-height: 90vh;">
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#secondBankModal">Add New Bank</button>
|
||||
<button type="button" class="btn btn-primary mb-3" data-bs-toggle="modal" data-bs-target="#secondBankModal">Add New Bank</button>
|
||||
|
||||
<!-- Display a list of banks and let the user choose -->
|
||||
<form id="BankForm">
|
||||
|
@ -530,19 +530,17 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<div class="card-body">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 mx-auto">
|
||||
<div class="form-check" style="display: flex; align-items: center;">
|
||||
<label class="form-check-label" for="address_<?php echo $vendor_index; ?>_<?php echo $bank_index; ?>">
|
||||
<strong style="font-weight: bold;">Bank Name: </strong><?php echo $bank['bank_name']; ?> <br>
|
||||
<strong style="font-weight: bold;">Bank Account Number: </strong><?php echo $bank['bank_account_number']; ?> <br>
|
||||
<strong style="font-weight: bold;">Bank Account Name: </strong><?php echo $bank['bank_account_name']; ?>
|
||||
</label>
|
||||
<div class="selectWrap" style="margin-left: auto; display: flex; align-items: center;">
|
||||
<input type="radio" style="height:15px !important; width: 15px !important;" name="payout_bank" id="payout_bank_<?php echo $vendor_index; ?>_<?php echo $bank_index; ?>" value="<?php echo $vendor_index; ?>_<?php echo $bank_index; ?>" onchange="setPayoutBank('<?php echo $vendor['_id']; ?>', <?php echo $bank_index; ?>, true)" <?php echo $bank['bank_payout'] ? 'checked' : ''; ?>>
|
||||
<label for="payout_bank_<?php echo $vendor_index; ?>_<?php echo $bank_index; ?>" style="margin-bottom: 0; margin-left: 5px;">Set as Payout Bank</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mx-auto">
|
||||
<label class="form-check-label" for="address_<?php echo $vendor_index; ?>_<?php echo $bank_index; ?>">
|
||||
<strong style="font-weight: bold;">Bank Name: </strong><?php echo $bank['bank_name']; ?> <br>
|
||||
<strong style="font-weight: bold;">Bank Account Number: </strong><?php echo $bank['bank_account_number']; ?> <br>
|
||||
<strong style="font-weight: bold;">Bank Account Name: </strong><?php echo $bank['bank_account_name']; ?>
|
||||
<div class="selectWrap" style="display: flex; justify-content: center; align-items: center; width: 50%;">
|
||||
<input type="radio" name="payout_bank" id="payout_bank_<?php echo $vendor_index; ?>_<?php echo $bank_index; ?>" value="<?php echo $vendor_index; ?>_<?php echo $bank_index; ?>" onchange="setPayoutBank('<?php echo $vendor['_id']; ?>', <?php echo $bank_index; ?>, true)" <?php echo $bank['bank_payout'] ? 'checked' : ''; ?>>
|
||||
<label for="payout_bank_<?php echo $vendor_index; ?>_<?php echo $bank_index; ?>">Set as Payout Bank</label>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -573,7 +571,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<input type="text" class="form-control" id="bankAccountName">
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-primary" id="submitBankBtn">Add Bank</button>
|
||||
<button type="button" class="btn btn-primary mt-4" id="submitBankBtn">Add Bank</button>
|
||||
|
||||
</form>
|
||||
|
||||
|
|
Loading…
Reference in New Issue