Compare commits
28 Commits
e6ea65914e
...
7679dad1e6
Author | SHA1 | Date |
---|---|---|
raymart | 7679dad1e6 | |
MarkHipe | 4d7a47b158 | |
mark H | 613325f68d | |
mark H | 0c368796a7 | |
mark H | a9853d178c | |
MarkHipe | a7a4b1482d | |
Stacy | c361a31143 | |
MarkHipe | 2cb98f24d6 | |
gelonspr | f278bb854d | |
MarkHipe | c154d801d2 | |
jouls | 32fd214c51 | |
Stacy | 3fdab75955 | |
Stacy | 3e3ebfe66c | |
Stacy | 3f334715f3 | |
Stacy | 7d847cd447 | |
jouls | b4b69ba223 | |
MarkHipe | b92be0667d | |
jouls | ca799e9c23 | |
jouls | 2ad0c9e955 | |
jouls | e8b5b6b50c | |
jouls | 0dd203aba2 | |
jouls | 88ae2713bb | |
jouls | e30cbcebd7 | |
jouls | 0dfa648b19 | |
jouls | 8858763cd6 | |
jouls | 793afa339f | |
jouls | 35a6c3b693 | |
jouls | 46995fef7b |
|
@ -11,7 +11,7 @@ $(document).ready(function() {
|
|||
const completedOrdersCount = countCompletedOrders(responseData);
|
||||
const toPayOrdersCount = countToPayOrders(responseData);
|
||||
const toShipOrdersCount = countToShipOrders(responseData);
|
||||
const returnedOrdersCount = countReturnedpOrders(responseData);
|
||||
const returnedOrdersCount = countReturnedOrders(responseData);
|
||||
initializeChart(completedOrdersCount, toPayOrdersCount, toShipOrdersCount, returnedOrdersCount);
|
||||
})
|
||||
.catch(function (error) {
|
||||
|
@ -24,50 +24,65 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
|
||||
function countCompletedOrders(data) {
|
||||
let completedOrdersCount = 0;
|
||||
data.forEach(function(order) {
|
||||
function getCurrentMonthData(data) {
|
||||
const now = new Date();
|
||||
const currentMonth = now.getMonth();
|
||||
const currentYear = now.getFullYear();
|
||||
|
||||
return data.filter(order => {
|
||||
const orderDate = new Date(order.order_date);
|
||||
return orderDate.getMonth() === currentMonth && orderDate.getFullYear() === currentYear;
|
||||
});
|
||||
}
|
||||
|
||||
function countCompletedOrders(data) {
|
||||
const filteredData = getCurrentMonthData(data);
|
||||
let completedOrdersCount = 0;
|
||||
filteredData.forEach(function(order) {
|
||||
if (order.status === 'COMPLETED') {
|
||||
completedOrdersCount++;
|
||||
completedOrdersCount++;
|
||||
}
|
||||
});
|
||||
console.log(completedOrdersCount)
|
||||
return completedOrdersCount;
|
||||
}
|
||||
|
||||
|
||||
function countToPayOrders(data) {
|
||||
let toPayOrdersCount = 0;
|
||||
data.forEach(function(order) {
|
||||
});
|
||||
console.log(completedOrdersCount);
|
||||
return completedOrdersCount;
|
||||
}
|
||||
|
||||
function countToPayOrders(data) {
|
||||
const filteredData = getCurrentMonthData(data);
|
||||
let toPayOrdersCount = 0;
|
||||
filteredData.forEach(function(order) {
|
||||
if (order.status === 'TO PAY') {
|
||||
toPayOrdersCount++;
|
||||
toPayOrdersCount++;
|
||||
}
|
||||
});
|
||||
console.log(toPayOrdersCount)
|
||||
return toPayOrdersCount;
|
||||
}
|
||||
|
||||
|
||||
function countToShipOrders(data) {
|
||||
let toShipOrdersCount = 0;
|
||||
data.forEach(function(order) {
|
||||
});
|
||||
console.log(toPayOrdersCount);
|
||||
return toPayOrdersCount;
|
||||
}
|
||||
|
||||
function countToShipOrders(data) {
|
||||
const filteredData = getCurrentMonthData(data);
|
||||
let toShipOrdersCount = 0;
|
||||
filteredData.forEach(function(order) {
|
||||
if (order.status === 'TO SHIP') {
|
||||
toShipOrdersCount++;
|
||||
toShipOrdersCount++;
|
||||
}
|
||||
});
|
||||
console.log(toShipOrdersCount)
|
||||
return toShipOrdersCount;
|
||||
}
|
||||
function countReturnedpOrders(data) {
|
||||
let returnedOrdersCount = 0;
|
||||
data.forEach(function(order) {
|
||||
});
|
||||
console.log(toShipOrdersCount);
|
||||
return toShipOrdersCount;
|
||||
}
|
||||
|
||||
function countReturnedOrders(data) {
|
||||
const filteredData = getCurrentMonthData(data);
|
||||
let returnedOrdersCount = 0;
|
||||
filteredData.forEach(function(order) {
|
||||
if (order.status === 'RETURNED') {
|
||||
returnedOrdersCount++;
|
||||
returnedOrdersCount++;
|
||||
}
|
||||
});
|
||||
console.log(returnedOrdersCount)
|
||||
return returnedOrdersCount;
|
||||
}
|
||||
});
|
||||
console.log(returnedOrdersCount);
|
||||
return returnedOrdersCount;
|
||||
}
|
||||
|
||||
|
||||
function initializeChart(completedOrdersCount , toPayOrdersCount, toShipOrdersCount, returnedOrdersCount) {
|
||||
var doughnut = document.getElementById("doughnut-chart");
|
||||
|
@ -115,43 +130,248 @@ $(document).ready(function() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var acquisition = document.getElementById("salesChart");
|
||||
if (acquisition !== null) {
|
||||
function updateDailyLabels() {
|
||||
var labelsDaily = [];
|
||||
for (let i = 6; i >= 0; i--) {
|
||||
var date = new Date();
|
||||
date.setDate(date.getDate() - i);
|
||||
labelsDaily.push(formatDate(date));
|
||||
}
|
||||
return labelsDaily;
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
const options = { day: 'numeric', month: 'short' }; // E.g., 26 Apr
|
||||
return date.toLocaleDateString('en-US', options);
|
||||
}
|
||||
|
||||
// Updating labelsDaily dynamically
|
||||
var labelsDaily = updateDailyLabels();
|
||||
var labelsMonthly = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
||||
var labelsYearly = ["2021", "2022", "2023", "2024", "2025"];
|
||||
var acqData = [
|
||||
{ //daily data
|
||||
first: [91, 180, 44, 75, 150, 66, 70], //COD
|
||||
second: [300, 44, 177, 76, 23, 189, 12], //ObPay
|
||||
third: [44, 167, 102, 123, 183, 88, 134] //Paymongo
|
||||
},
|
||||
{ //monthly data
|
||||
first: [144, 44, 110, 5, 123, 89, 12], //COD
|
||||
second: [22, 123, 45, 130, 112, 54, 181], //ObPay
|
||||
third: [55, 44, 144, 75, 155, 166, 70] //Paymongo
|
||||
},
|
||||
{ //yearly data
|
||||
first: [134, 80, 123, 65, 171, 33, 22], //COD
|
||||
second: [44, 144, 77, 76, 123, 89, 112], //ObPay
|
||||
third: [156, 23, 165, 88, 112, 54, 181] //Paymongo
|
||||
}
|
||||
];
|
||||
|
||||
var configAcq = {
|
||||
// The type of chart we want to create
|
||||
type: "line",
|
||||
|
||||
// The data for our dataset
|
||||
data: {
|
||||
// labels: [
|
||||
// "4 Jan",
|
||||
// "5 Jan",
|
||||
// "6 Jan",
|
||||
// "7 Jan",
|
||||
// "8 Jan",
|
||||
// "9 Jan",
|
||||
// "10 Jan"
|
||||
// ],
|
||||
datasets: [
|
||||
{
|
||||
label: "Cash on Delivery",
|
||||
backgroundColor: "rgba(52, 116, 212, .2)",
|
||||
borderColor: "rgba(52, 116, 212, .7)",
|
||||
data: acqData[0].first,
|
||||
lineTension: 0.3,
|
||||
pointBackgroundColor: "rgba(52, 116, 212,0)",
|
||||
pointHoverBackgroundColor: "rgba(52, 116, 212,1)",
|
||||
pointHoverRadius: 3,
|
||||
pointHitRadius: 30,
|
||||
pointBorderWidth: 2,
|
||||
pointStyle: "rectRounded"
|
||||
},
|
||||
{
|
||||
label: "ObananaPay",
|
||||
backgroundColor: "rgba(255, 192, 203, .3)",
|
||||
borderColor: "rgba(255, 192, 203, .7)",
|
||||
data: acqData[0].second,
|
||||
lineTension: 0.3,
|
||||
pointBackgroundColor: "rgba(255, 192, 203, 0)",
|
||||
pointHoverBackgroundColor: "rgba(255, 192, 203, 1)",
|
||||
pointHoverRadius: 3,
|
||||
pointHitRadius: 30,
|
||||
pointBorderWidth: 2,
|
||||
pointStyle: "rectRounded"
|
||||
},
|
||||
{
|
||||
label: "Paymongo",
|
||||
backgroundColor: "rgb(178, 251, 212, .3)",
|
||||
borderColor: "rgba(178, 251, 212, .7)",
|
||||
data: acqData[0].third,
|
||||
lineTension: 0.3,
|
||||
pointBackgroundColor: "rgba(178, 251, 212, 0)",
|
||||
pointHoverBackgroundColor: "rgba(178, 251, 212, 1)",
|
||||
pointHoverRadius: 3,
|
||||
pointHitRadius: 30,
|
||||
pointBorderWidth: 2,
|
||||
pointStyle: "rectRounded"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// Configuration options go here
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
scales: {
|
||||
xAxes: [
|
||||
{
|
||||
gridLines: {
|
||||
display: false
|
||||
}
|
||||
}
|
||||
],
|
||||
yAxes: [
|
||||
{
|
||||
gridLines: {
|
||||
display: true,
|
||||
color: "#eee",
|
||||
zeroLineColor: "#eee"
|
||||
},
|
||||
ticks: {
|
||||
beginAtZero: true,
|
||||
stepSize: 100,
|
||||
max: 1000
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
tooltips: {
|
||||
mode: "index",
|
||||
titleFontColor: "#888",
|
||||
bodyFontColor: "#555",
|
||||
titleFontSize: 12,
|
||||
bodyFontSize: 15,
|
||||
backgroundColor: "rgba(256,256,256,0.95)",
|
||||
displayColors: true,
|
||||
xPadding: 20,
|
||||
yPadding: 10,
|
||||
borderColor: "rgba(220, 220, 220, 0.9)",
|
||||
borderWidth: 2,
|
||||
caretSize: 10,
|
||||
caretPadding: 15
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var ctx = document.getElementById("salesChart").getContext("2d");
|
||||
var lineAcq = new Chart(ctx, configAcq);
|
||||
document.getElementById("acqLegend").innerHTML = lineAcq.generateLegend();
|
||||
|
||||
var items = document.querySelectorAll(
|
||||
"#user-acquisition .nav-tabs .nav-item"
|
||||
);
|
||||
items.forEach(function (item, index) {
|
||||
item.addEventListener("click", function() {
|
||||
// Determine which tab was clicked
|
||||
var selectedTab = this.textContent.trim();
|
||||
|
||||
// Choose data and labels based on the selected tab
|
||||
switch (selectedTab) {
|
||||
case "Daily":
|
||||
configAcq.data.labels = labelsDaily;
|
||||
configAcq.data.datasets[0].data = acqData[0].first;
|
||||
configAcq.data.datasets[1].data = acqData[0].second;
|
||||
configAcq.data.datasets[2].data = acqData[0].third;
|
||||
break;
|
||||
case "Monthly":
|
||||
configAcq.data.labels = labelsMonthly;
|
||||
configAcq.data.datasets[0].data = acqData[1].first;
|
||||
configAcq.data.datasets[1].data = acqData[1].second;
|
||||
configAcq.data.datasets[2].data = acqData[1].third;
|
||||
break;
|
||||
case "Yearly":
|
||||
configAcq.data.labels = labelsYearly;
|
||||
configAcq.data.datasets[0].data = acqData[2].first;
|
||||
configAcq.data.datasets[1].data = acqData[2].second;
|
||||
configAcq.data.datasets[2].data = acqData[2].third;
|
||||
break;
|
||||
}
|
||||
|
||||
lineAcq.update();
|
||||
});
|
||||
});
|
||||
items[0].click();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
const now = new Date();
|
||||
const currentMonth = now.getMonth(); // Months are 0-indexed (0 for January, 11 for December)
|
||||
const currentYear = now.getFullYear();
|
||||
|
||||
const filteredData = data.filter(order => {
|
||||
const orderDate = new Date(order.order_date);
|
||||
return orderDate.getMonth() === currentMonth && orderDate.getFullYear() === currentYear;
|
||||
});
|
||||
|
||||
const columnTitles = [
|
||||
'ORDER ID', 'STATUS', 'BUYER NAME', 'TOTAL AMOUNT', 'METHOD', 'ORDER DATE',
|
||||
'ORDER TIME', 'PRODUCT NAME', 'PRICE', 'QUANTITY', 'VENDOR ID', 'VENDOR NAME'
|
||||
];
|
||||
const header = columnTitles.join(',') + '\n';
|
||||
const body = filteredData.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,
|
||||
order.payment_method,
|
||||
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() {
|
||||
const now = new Date();
|
||||
const months = ["January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December"];
|
||||
const currentMonthName = months[now.getMonth()];
|
||||
const filename = `${currentMonthName}_orders_overview.csv`;
|
||||
|
||||
const csv = convertToCSV(responseData); // Ensure responseData is up to date
|
||||
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();
|
||||
|
|
395
admin/index.php
395
admin/index.php
|
@ -14,8 +14,15 @@ if($_SESSION["user_type"]!="admin"){
|
|||
header("location: login.php?alert=Only admins allowed here!");
|
||||
}
|
||||
|
||||
$all_orders = getAllOrder();
|
||||
date_default_timezone_set('Asia/Manila');
|
||||
$currentDate = date('m-d-Y');
|
||||
|
||||
$all_orders = getAllOrder();
|
||||
$all_customers = getAllCustomers();
|
||||
$all_vendors = getAllVendors();
|
||||
|
||||
$allSignups = array_merge($all_customers, $all_vendors);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
@ -107,7 +114,7 @@ date_default_timezone_set('Asia/Manila');
|
|||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="user-profile.html">
|
||||
<a href="#">
|
||||
<i class="mdi mdi-account"></i> My Profile
|
||||
</a>
|
||||
</li>
|
||||
|
@ -707,8 +714,19 @@ date_default_timezone_set('Asia/Manila');
|
|||
<div class="col-xl-3 col-sm-6 p-b-15 lbl-card">
|
||||
<div class="card card-mini dash-card card-1">
|
||||
<div class="card-body">
|
||||
<h2 class="mb-1">1,503</h2>
|
||||
<p>Daily Signups</p>
|
||||
<?php
|
||||
$signupCount = 0;
|
||||
|
||||
foreach ($allSignups as $signup) {
|
||||
$signupDate = date('m-d-Y', strtotime($signup['createdAt']));
|
||||
if ($signupDate === $currentDate) {
|
||||
$signupCount++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<h2 class="mb-1"><?php echo $signupCount; ?></h2>
|
||||
<!-- <h2 class="mb-1">1,503</h2> -->
|
||||
<p>Today's Signups</p>
|
||||
<span class="mdi mdi-account-arrow-left"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -716,9 +734,17 @@ date_default_timezone_set('Asia/Manila');
|
|||
<div class="col-xl-3 col-sm-6 p-b-15 lbl-card">
|
||||
<div class="card card-mini dash-card card-2">
|
||||
<div class="card-body">
|
||||
<h2 class="mb-1">79,503</h2>
|
||||
<p>Daily Visitors</p>
|
||||
<span class="mdi mdi-account-clock"></span>
|
||||
<?php
|
||||
$userCount = 0;
|
||||
|
||||
foreach ($allSignups as $signup) {
|
||||
$userCount++;
|
||||
}
|
||||
?>
|
||||
<h2 class="mb-1"><?php echo $userCount; ?></h2>
|
||||
<!-- <h2 class="mb-1">79,503</h2> -->
|
||||
<p>Total Users</p>
|
||||
<span class="mdi mdi-account-multiple"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -726,18 +752,19 @@ date_default_timezone_set('Asia/Manila');
|
|||
<div class="card card-mini dash-card card-3">
|
||||
<div class="card-body">
|
||||
<?php
|
||||
$currentDate = date('m-d-Y'); // Get current date
|
||||
// Get current date
|
||||
$orderCount = 0; // Initialize order count
|
||||
$dailyRevenue = 0;
|
||||
|
||||
foreach ($all_orders as $x => $val) {
|
||||
foreach (array_reverse($all_orders) as $x => $val) {
|
||||
$paymentStatus = strtolower($val['payment']['status']);
|
||||
|
||||
$returnStatus = strtolower($val['return_order']['status']);
|
||||
$orderStatus = strtolower($val['status']);
|
||||
$formattedOrderDate = date('m-d-Y', strtotime($val['order_date']));
|
||||
if ($formattedOrderDate == $currentDate) {
|
||||
$orderCount++;
|
||||
if($paymentStatus == "paid"){
|
||||
$dailyRevenue += $val['total_amount'];
|
||||
if($paymentStatus == "paid" && (!$returnStatus || $orderStatus != "returned" )){
|
||||
$dailyRevenue += $val['total_amount'];
|
||||
} // Increment order count for each order on the current date
|
||||
}
|
||||
}
|
||||
|
@ -745,7 +772,7 @@ date_default_timezone_set('Asia/Manila');
|
|||
$finalDailyRevenue = number_format($dailyRevenue, 2, '.', ',');
|
||||
?>
|
||||
<h2 class="mb-1"><?php echo $orderCount; ?></h2>
|
||||
<p>Today's Order</p>
|
||||
<p>Today's Orders</p>
|
||||
<span class="mdi mdi-package-variant"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -766,7 +793,6 @@ date_default_timezone_set('Asia/Manila');
|
|||
<!-- Sales Graph -->
|
||||
<div id="user-acquisition" class="card card-default">
|
||||
<div class="card-header">
|
||||
|
||||
<h2>Sales Report</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
@ -774,7 +800,7 @@ date_default_timezone_set('Asia/Manila');
|
|||
role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-bs-toggle="tab" href="#todays" role="tab"
|
||||
aria-selected="true">Today's</a>
|
||||
aria-selected="true">Daily</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="tab" href="#monthly" role="tab"
|
||||
|
@ -788,7 +814,7 @@ date_default_timezone_set('Asia/Manila');
|
|||
<div class="tab-content pt-4" id="salesReport">
|
||||
<div class="tab-pane fade show active" id="source-medium" role="tabpanel">
|
||||
<div class="mb-6" style="max-height:247px">
|
||||
<canvas id="acquisition" class="chartjs2"></canvas>
|
||||
<canvas id="salesChart" class="chartjs2" style="width: 100%; height: 400px;"></canvas>
|
||||
<div id="acqLegend" class="customLegend mb-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -807,7 +833,7 @@ date_default_timezone_set('Asia/Manila');
|
|||
<canvas id="doughnut-chart"></canvas>
|
||||
</div>
|
||||
<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>
|
||||
class="mdi mdi-download mr-2"></i> Download Current Month's Overall Report</a>
|
||||
<div class="card-footer d-flex flex-wrap bg-white p-0">
|
||||
<div class="col-6">
|
||||
<div class="p-20">
|
||||
|
@ -1023,26 +1049,31 @@ date_default_timezone_set('Asia/Manila');
|
|||
style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Order ID</th>
|
||||
<th>Payment Method</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>Status</th>
|
||||
<th></th>
|
||||
<th>Return Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$iterationCount = 0;
|
||||
$ordersDisplayed = false;
|
||||
|
||||
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'];
|
||||
$paymentMethod = $val['payment_method'];
|
||||
$customerName = $val['customer'][0]['name'];
|
||||
$vendorName = $val['items'][0]['vendor_name'];
|
||||
$totalAmount = $val['total_amount'];
|
||||
$orderStatus = strtoupper($val['status']);
|
||||
$returnStatus = strtoupper($val['return_order']['status']);
|
||||
|
||||
|
||||
|
||||
$statusClass = '';
|
||||
if ($orderStatus === 'UNPAID' || $orderStatus === 'RETURNED') {
|
||||
|
@ -1059,23 +1090,34 @@ date_default_timezone_set('Asia/Manila');
|
|||
}
|
||||
|
||||
if ($formattedOrderDate == $currentDate) {
|
||||
$ordersDisplayed = true;
|
||||
|
||||
$displayDate = date('m-d-Y, g:i A', strtotime($val['order_date']));
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $orderId ?></td>
|
||||
<td><?php echo $paymentMethod ?></td>
|
||||
<td><?php echo $customerName ?></td>
|
||||
<td><?php echo $vendorName ?></td>
|
||||
<td><?php echo $totalAmount ?></td>
|
||||
<td>₱ <?php echo number_format($totalAmount, 2, '.', ',') ?></td>
|
||||
<td><?php echo $displayDate ?></td>
|
||||
<td><span style="color: <?php echo $statusClass; ?>"><?php echo $orderStatus ?></span></td>
|
||||
<td><?php echo $returnStatus?: "NONE" ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$iterationCount++;
|
||||
if ($iterationCount >= 8) {
|
||||
break;
|
||||
}
|
||||
$iterationCount++;
|
||||
if ($iterationCount >= 8) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ordersDisplayed) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="align-self-center">No Recent Orders Yet.</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
@ -1086,12 +1128,16 @@ date_default_timezone_set('Asia/Manila');
|
|||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-5">
|
||||
<div class="col-xl-6">
|
||||
<!-- New Customers -->
|
||||
<div class="card ec-cust-card card-table-border-none card-default">
|
||||
<div class="card-header justify-content-between ">
|
||||
<?php
|
||||
$weekAgoDate = date('m-d-Y', strtotime('-7 days'));
|
||||
?>
|
||||
<h2>New Customers</h2>
|
||||
<div>
|
||||
<div> From <?php echo $weekAgoDate; ?> to <?php echo $currentDate; ?></div>
|
||||
<!-- <div>
|
||||
<button class="text-black-50 mr-2 font-size-20">
|
||||
<i class="mdi mdi-cached"></i>
|
||||
</button>
|
||||
|
@ -1106,220 +1152,139 @@ date_default_timezone_set('Asia/Manila');
|
|||
<li class="dropdown-item"><a href="#">Something else here</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-15px">
|
||||
<table class="table ">
|
||||
<tbody>
|
||||
<?php
|
||||
$iterationCount = 0;
|
||||
$customersDisplayed = false;
|
||||
|
||||
foreach (array_reverse($all_customers) as $x => $val) {
|
||||
$formattedSignupDate = date('m-d-Y', strtotime($val['createdAt']));
|
||||
$imageUrl = $val['customer_image'];
|
||||
$fullName = $val['first_name'] . ' ' . $val['last_name'];
|
||||
$email = $val['user_email'];
|
||||
if ($formattedSignupDate >= $weekAgoDate && $formattedSignupDate <= $currentDate) {
|
||||
$customersDisplayed = true;
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="media">
|
||||
<div class="media-image mr-3 rounded-circle">
|
||||
<a href="profile.html"><img loading="lazy"
|
||||
class="profile-img rounded-circle w-45"
|
||||
src="assets/img/user/u1.jpg"
|
||||
alt="customer image"></a>
|
||||
<img loading="lazy"
|
||||
class="profile-img rounded-circle w-45"
|
||||
src="<?php echo $imageUrl !== null ? $imageUrl : 'assets/img/user/u1.jpg'; ?>"
|
||||
alt="customer image">
|
||||
</div>
|
||||
<div class="media-body align-self-center">
|
||||
<a href="profile.html">
|
||||
<h6 class="mt-0 text-dark font-weight-medium">Selena
|
||||
Wagner</h6>
|
||||
</a>
|
||||
<small>@selena.oi</small>
|
||||
<h6 class="mt-0 text-dark font-weight-medium"><?php echo $fullName; ?></h6>
|
||||
<small><?php echo $email; ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>2 Orders</td>
|
||||
<td class="text-dark d-none d-md-block">$150</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="media">
|
||||
<div class="media-image mr-3 rounded-circle">
|
||||
<a href="profile.html"><img loading="lazy"
|
||||
class="profile-img rounded-circle w-45"
|
||||
src="assets/img/user/u2.jpg"
|
||||
alt="customer image"></a>
|
||||
</div>
|
||||
<div class="media-body align-self-center">
|
||||
<a href="profile.html">
|
||||
<h6 class="mt-0 text-dark font-weight-medium">Walter
|
||||
Reuter</h6>
|
||||
</a>
|
||||
<small>@walter.me</small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>5 Orders</td>
|
||||
<td class="text-dark d-none d-md-block">$200</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="media">
|
||||
<div class="media-image mr-3 rounded-circle">
|
||||
<a href="profile.html"><img loading="lazy"
|
||||
class="profile-img rounded-circle w-45"
|
||||
src="assets/img/user/u3.jpg"
|
||||
alt="customer image"></a>
|
||||
</div>
|
||||
<div class="media-body align-self-center">
|
||||
<a href="profile.html">
|
||||
<h6 class="mt-0 text-dark font-weight-medium">Larissa
|
||||
Gebhardt</h6>
|
||||
</a>
|
||||
<small>@larissa.gb</small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>1 Order</td>
|
||||
<td class="text-dark d-none d-md-block">$50</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="media">
|
||||
<div class="media-image mr-3 rounded-circle">
|
||||
<a href="profile.html"><img loading="lazy"
|
||||
class="profile-img rounded-circle w-45"
|
||||
src="assets/img/user/u4.jpg"
|
||||
alt="customer image"></a>
|
||||
</div>
|
||||
<div class="media-body align-self-center">
|
||||
<a href="profile.html">
|
||||
<h6 class="mt-0 text-dark font-weight-medium">Albrecht
|
||||
Straub</h6>
|
||||
</a>
|
||||
<small>@albrech.as</small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>2 Orders</td>
|
||||
<td class="text-dark d-none d-md-block">$100</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="media">
|
||||
<div class="media-image mr-3 rounded-circle">
|
||||
<a href="profile.html"><img loading="lazy"
|
||||
class="profile-img rounded-circle w-45"
|
||||
src="assets/img/user/u5.jpg"
|
||||
alt="customer image"></a>
|
||||
</div>
|
||||
<div class="media-body align-self-center">
|
||||
<a href="profile.html">
|
||||
<h6 class="mt-0 text-dark font-weight-medium">Leopold
|
||||
Ebert</h6>
|
||||
</a>
|
||||
<small>@leopold.et</small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>1 Order</td>
|
||||
<td class="text-dark d-none d-md-block">$60</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="media">
|
||||
<div class="media-image mr-3 rounded-circle">
|
||||
<a href="profile.html"><img loading="lazy"
|
||||
class="profile-img rounded-circle w-45"
|
||||
src="assets/img/user/u3.jpg"
|
||||
alt="customer image"></a>
|
||||
</div>
|
||||
<div class="media-body align-self-center">
|
||||
<a href="profile.html">
|
||||
<h6 class="mt-0 text-dark font-weight-medium">Larissa
|
||||
Gebhardt</h6>
|
||||
</a>
|
||||
<small>@larissa.gb</small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>1 Order</td>
|
||||
<td class="text-dark d-none d-md-block">$50</td>
|
||||
<td><?php echo $formattedSignupDate?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$iterationCount++;
|
||||
if ($iterationCount >= 8) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$customersDisplayed) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="align-self-center">No new customers in the past week</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-7">
|
||||
<!-- Top Products -->
|
||||
<div class="card card-default ec-card-top-prod">
|
||||
<div class="card-header justify-content-between">
|
||||
<h2>Top Products</h2>
|
||||
<div>
|
||||
<button class="text-black-50 mr-2 font-size-20"><i
|
||||
class="mdi mdi-cached"></i></button>
|
||||
<div class="col-xl-6">
|
||||
<!-- New Customers -->
|
||||
<div class="card ec-cust-card card-table-border-none card-default">
|
||||
<div class="card-header justify-content-between ">
|
||||
<?php
|
||||
$weekAgoDate = date('m-d-Y', strtotime('-7 days'));
|
||||
?>
|
||||
<h2>New Vendors</h2>
|
||||
<div> From <?php echo $weekAgoDate; ?> to <?php echo $currentDate; ?></div>
|
||||
<!-- <div>
|
||||
<button class="text-black-50 mr-2 font-size-20">
|
||||
<i class="mdi mdi-cached"></i>
|
||||
</button>
|
||||
<div class="dropdown show d-inline-block widget-dropdown">
|
||||
<a class="dropdown-toggle icon-burger-mini" href="#" role="button"
|
||||
id="dropdown-product" data-bs-toggle="dropdown" aria-haspopup="true"
|
||||
id="dropdown-customar" 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="#">Update Data</a></li>
|
||||
<li class="dropdown-item"><a href="#">Detailed Log</a></li>
|
||||
<li class="dropdown-item"><a href="#">Statistics</a></li>
|
||||
<li class="dropdown-item"><a href="#">Clear Data</a></li>
|
||||
<li class="dropdown-item"><a href="#">Action</a></li>
|
||||
<li class="dropdown-item"><a href="#">Another action</a></li>
|
||||
<li class="dropdown-item"><a href="#">Something else here</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="card-body mt-10px mb-10px py-0">
|
||||
<div class="row media d-flex pt-15px pb-15px">
|
||||
<div
|
||||
class="col-lg-3 col-md-3 col-2 media-image align-self-center rounded">
|
||||
<a href="#"><img loading="lazy" src="assets/img/products/p1.jpg" alt="customer image"></a>
|
||||
</div>
|
||||
<div class="col-lg-9 col-md-9 col-10 media-body align-self-center ec-pos">
|
||||
<a href="#">
|
||||
<h6 class="mb-10px text-dark font-weight-medium">Baby cotton shoes</h6>
|
||||
</a>
|
||||
<p class="float-md-right sale"><span class="mr-2">58</span>Sales</p>
|
||||
<p class="d-none d-md-block">Statement belting with double-turnlock hardware
|
||||
adds “swagger” to a simple.</p>
|
||||
<p class="mb-0 ec-price">
|
||||
<span class="text-dark">$520</span>
|
||||
<del>$580</del>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row media d-flex pt-15px pb-15px">
|
||||
<div
|
||||
class="col-lg-3 col-md-3 col-2 media-image align-self-center rounded">
|
||||
<a href="#"><img loading="lazy" src="assets/img/products/p2.jpg" alt="customer image"></a>
|
||||
</div>
|
||||
<div class="col-lg-9 col-md-9 col-10 media-body align-self-center ec-pos">
|
||||
<a href="#">
|
||||
<h6 class="mb-10px text-dark font-weight-medium">Hoodies for men</h6>
|
||||
</a>
|
||||
<p class="float-md-right sale"><span class="mr-2">20</span>Sales</p>
|
||||
<p class="d-none d-md-block">Statement belting with double-turnlock hardware
|
||||
adds “swagger” to a simple.</p>
|
||||
<p class="mb-0 ec-price">
|
||||
<span class="text-dark">$250</span>
|
||||
<del>$300</del>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row media d-flex pt-15px pb-15px">
|
||||
<div
|
||||
class="col-lg-3 col-md-3 col-2 media-image align-self-center rounded">
|
||||
<a href="#"><img loading="lazy" src="assets/img/products/p3.jpg" alt="customer image"></a>
|
||||
</div>
|
||||
<div class="col-lg-9 col-md-9 col-10 media-body align-self-center ec-pos">
|
||||
<a href="#">
|
||||
<h6 class="mb-10px text-dark font-weight-medium">Long slive t-shirt</h6>
|
||||
</a>
|
||||
<p class="float-md-right sale"><span class="mr-2">10</span>Sales</p>
|
||||
<p class="d-none d-md-block">Statement belting with double-turnlock hardware
|
||||
adds “swagger” to a simple.</p>
|
||||
<p class="mb-0 ec-price">
|
||||
<span class="text-dark">$480</span>
|
||||
<del>$654</del>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-15px">
|
||||
<table class="table ">
|
||||
<tbody>
|
||||
<?php
|
||||
$iterationCount = 0;
|
||||
$vendorsDisplayed = false;
|
||||
foreach (array_reverse($all_vendors) as $x => $val) {
|
||||
$formattedSignupDate = date('m-d-Y', strtotime($val['createdAt']));
|
||||
$imageUrl = $val['vendor_image'];
|
||||
$shopName = $val['user_login'];
|
||||
$fullName = $val['first_name'] . ' ' . $val['last_name'];
|
||||
$email = $val['user_email'];
|
||||
if ($formattedSignupDate >= $weekAgoDate && $formattedSignupDate <= $currentDate) {
|
||||
$vendorsDisplayed = true;
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="media">
|
||||
<div class="media-image mr-3 rounded-circle">
|
||||
<img loading="lazy"
|
||||
class="profile-img rounded-circle w-45"
|
||||
src="<?php echo $imageUrl !== null ? $imageUrl : 'assets/img/user/u1.jpg'; ?>"
|
||||
alt="customer image">
|
||||
</div>
|
||||
<div class="media-body align-self-center">
|
||||
<h6 class="mt-0 text-dark font-weight-medium"><?php echo $shopName; ?></h6>
|
||||
<small><?php echo $fullName; ?> || </small>
|
||||
<small><?php echo $email; ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><?php echo $formattedSignupDate?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$iterationCount++;
|
||||
if ($iterationCount >= 8) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$vendorsDisplayed) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="align-self-center">No new vendors in the past week</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1333,7 +1298,7 @@ date_default_timezone_set('Asia/Manila');
|
|||
<p>
|
||||
Copyright © <span id="ec-year"></span><a class="text-primary"
|
||||
href="https://themeforest.net/user/ashishmaraviya" target="_blank"> Ekka Admin Dashboard</a>. All Rights Reserved.
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<style>
|
||||
.sidenav-item.active {
|
||||
background-color: #f0f0f0; /* Change background color */
|
||||
}
|
||||
|
||||
.sidenav-item.active .nav-text {
|
||||
color: #333; /* Change text color */
|
||||
.nav-link:hover{
|
||||
border-left: 5px solid #87CEFA;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -21,18 +17,17 @@
|
|||
<!-- begin sidebar scrollbar -->
|
||||
<div class="ec-navigation" data-simplebar>
|
||||
<!-- sidebar menu -->
|
||||
<ul class="nav sidebar-inner" id="sidebar-menu">
|
||||
<ul class="nav sidebar-inner">
|
||||
<!-- Dashboard -->
|
||||
<li class="active">
|
||||
<li class="nav-link">
|
||||
<a class="sidenav-item-link" href="index.php">
|
||||
<i class="mdi mdi-view-dashboard-outline"></i>
|
||||
<span class="nav-text">Dashboard</span>
|
||||
</a>
|
||||
<hr>
|
||||
</li>
|
||||
|
||||
<!-- Vendors -->
|
||||
<li>
|
||||
<li class="nav-link">
|
||||
<a class="sidenav-item-link" href="vendor-card.php">
|
||||
<i class="mdi mdi-account-group-outline"></i>
|
||||
<span class="nav-text">Vendors</span>
|
||||
|
@ -60,7 +55,7 @@
|
|||
</li>
|
||||
|
||||
<!-- Users -->
|
||||
<li >
|
||||
<li class="nav-link">
|
||||
<a class="sidenav-item-link" href="user-card.php">
|
||||
<i class="mdi mdi-account-group"></i>
|
||||
<span class="nav-text">Users</span>
|
||||
|
@ -143,7 +138,7 @@
|
|||
</li> -->
|
||||
|
||||
<!-- Orders -->
|
||||
<li >
|
||||
<li class="nav-link">
|
||||
<a class="sidenav-item-link" href="order-history.php">
|
||||
<i class="mdi mdi-cart"></i>
|
||||
<span class="nav-text">Orders</span>
|
||||
|
@ -257,4 +252,6 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ if ($_SESSION["user_type"] != "admin") {
|
|||
header("location: login.php?alert=Only admins allowed here!");
|
||||
}
|
||||
$orders = getAllOrder();
|
||||
$allorders = json_encode($orders, true);
|
||||
// $allorders = json_encode($orders, true);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
@ -24,9 +24,9 @@ $allorders = json_encode($orders, true);
|
|||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="Ekka - Admin Dashboard HTML Template.">
|
||||
<meta name="description" content="oBanana B2B - Admin Dashboard">
|
||||
|
||||
<title>Ekka - Admin Dashboard HTML Template.</title>
|
||||
<title>oBanana B2B - Admin Dashboard</title>
|
||||
|
||||
<!-- GOOGLE FONTS -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
|
@ -82,7 +82,8 @@ $allorders = json_encode($orders, true);
|
|||
<table id="responsive-data-table" class="table" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Updated Date</th>
|
||||
<th>Order Date</th>
|
||||
<th>Customer</th>
|
||||
<th>Vendor</th>
|
||||
<th>Product</th>
|
||||
|
@ -102,6 +103,7 @@ $allorders = json_encode($orders, true);
|
|||
?>
|
||||
<tr>
|
||||
<td><?php echo date('Y-m-d', strtotime($order['updatedAt'])) ?></td>
|
||||
<td><?php echo date('Y-m-d', strtotime($order['order_date'])) ?></td>
|
||||
<td><?php echo $order['customer'][0]['name'] ?></td>
|
||||
<td><?php echo $order['items'][0]['vendor_name'] ?></td>
|
||||
<td><?php echo $order['items'][0]['product']['name'] ?></td>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
28
cart.php
28
cart.php
|
@ -229,19 +229,35 @@ if ($_SESSION["userId"] <> "") {
|
|||
?>
|
||||
|
||||
<tr id="cart_order_<?php echo $order['_id'] ?>">
|
||||
<td data-label="Product" class="ec-cart-pro-name"><a href="product-left-sidebar.php?id=<?php echo $order['items'][0]['product']['product_id']; ?>"><img loading="lazy" class="ec-cart-pro-img mr-4" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="" /><?php echo $order['items'][0]['product']['name']; ?></a></td>
|
||||
<td data-label="Product" class="ec-cart-pro-name"><a href="product-left-sidebar.php?id=<?php echo $order['items'][0]['product']['product_id']; ?>">
|
||||
<img loading="lazy" class="ec-cart-pro-img mr-4" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="" />
|
||||
<?php echo $order['items'][0]['product']['name']; ?></a>
|
||||
</td>
|
||||
<td data-label="Price" class="ec-cart-pro-price"><span class="amount"><?php echo $order['items'][0]['price']; ?></span></td>
|
||||
<td data-label="Quantity" class="ec-cart-pro-qty" style="text-align: center;">
|
||||
<div class="cart-qty-plus-minus2" style="width:100px; margin:auto;">
|
||||
<div class="qty-btn" onclick="qtyDecrementCart('<?php echo $order['_id']; ?>' , '<?php echo $order['items'][0]['_id']; ?>',false, '<?php echo $order['items'][0]['product']['product_id']; ?>')">-</div>
|
||||
<input id="cart_qty-input-<?php echo $order['items'][0]['_id']; ?>" class="qty-input" type="number" name="ec_qtybtn" value="<?php echo $order['items'][0]['quantity']; ?>" oninput="handleQtyInputCart(this, '<?php echo $order['_id']; ?>', '<?php echo $order['items'][0]['_id']; ?>','<?php echo $order['items'][0]['product']['product_id']; ?>')" />
|
||||
<div class="qty-btn" onclick="qtyIncrementCart('<?php echo $order['_id']; ?>' , '<?php echo $order['items'][0]['_id']; ?>',false, '<?php echo $order['items'][0]['product']['product_id']; ?>')">+</div>
|
||||
<!-- CART UI -->
|
||||
<div class="cart-qty-plus-minus2 d-flex justify-content-center mt-1">
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:35px; margin-right:5px; cursor: pointer;" onclick="qtyDecrementCart('<?php echo $order['_id']; ?>' ,
|
||||
'<?php echo $order['items'][0]['_id']; ?>',false, '<?php echo $order['items'][0]['product']['product_id']; ?>')"
|
||||
onmouseover="this.style.color='#a15d00'" onmouseout="this.style.color='#ffaa00'">-
|
||||
</div>
|
||||
<input style="width:100px; height:40px mt-3" id="cart_qty-input-<?php echo $order['items'][0]['_id']; ?>" class="qty-input" type="number" name="ec_qtybtn"
|
||||
value="<?php echo $order['items'][0]['quantity']; ?>" oninput="handleQtyInputCart(this, '<?php echo $order['_id']; ?>',
|
||||
'<?php echo $order['items'][0]['_id']; ?>','<?php echo $order['items'][0]['product']['product_id']; ?>')" />
|
||||
<div class="qty-btn" style="color:#ffaa00; font-size:30px; margin-left:5px; cursor: pointer;" onclick="qtyIncrementCart('<?php echo $order['_id']; ?>' ,
|
||||
'<?php echo $order['items'][0]['_id']; ?>',false, '<?php echo $order['items'][0]['product']['product_id']; ?>')"
|
||||
onmouseover="this.style.color='#a15d00'" onmouseout="this.style.color='#ffaa00'">+</div>
|
||||
</div>
|
||||
<span id="cart_qty_<?php echo $order['_id'] ?>"></span>
|
||||
</td>
|
||||
<td data-label="Total" class="cart_subtotal-<?php echo $order['_id']; ?>" style="font-weight:bold"> <?php echo $order['total_amount'] ?></td>
|
||||
<td data-label="Remove" class="ec-cart-pro-remove">
|
||||
<a onclick="deleteOrderCart('<?php echo $order['_id']; ?>')"><i class="ecicon eci-trash-o"></i></a>
|
||||
<!-- <a onclick="deleteOrderCart('<?php # echo $order['_id']; ?>')"><i class="ecicon eci-trash-o"></i></a> -->
|
||||
<a href="#" class="removeCart" onclick="deleteOrderCart('<?php echo $order['_id']; ?>')">
|
||||
<i class="ecicon eci-trash" style="color:#7e7e7e;" onmouseover="this.style.color='#aaaaaa'"
|
||||
onmouseout="this.style.color='#7e7e7e'">
|
||||
</i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
|
|
@ -133,21 +133,35 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
<!-- Background css -->
|
||||
<link rel="stylesheet" id="bg-switcher-css" href="assets/css/backgrounds/bg-4.css">
|
||||
<script>
|
||||
function updateCartItemCount() {
|
||||
$.get("cartitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data, status) {
|
||||
if (data != "") {
|
||||
console.log("Data: " + data + "\nStatus: " + status);
|
||||
document.getElementById("cartItemCount").innerHTML = data;
|
||||
}
|
||||
});
|
||||
function updateCartItemCount() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "cartitems.php?id=<?php echo $_SESSION['customerId']; ?>", true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var data = xhr.responseText;
|
||||
if (data !== "") {
|
||||
console.log("Data: " + data);
|
||||
document.getElementById("cartItemCount").innerHTML = data;
|
||||
}
|
||||
}
|
||||
function updateWishItemCount() {
|
||||
$.get("wishlistitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data) {
|
||||
if (data != "") {
|
||||
document.getElementById("wishItemCount").innerHTML = data;
|
||||
}
|
||||
});
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function updateWishItemCount() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "wishlistitems.php?id=<?php echo $_SESSION['customerId']; ?>", true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var data = xhr.responseText;
|
||||
if (data !== "") {
|
||||
document.getElementById("wishItemCount").innerHTML = data;
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- raymart added css feb 14 2024 -->
|
||||
<style>
|
||||
|
@ -302,7 +316,7 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
<div class="ec-page-description ec-page-description-info"style="background: orange;">
|
||||
<div class="ec-page-block" style="background: #393e46;">
|
||||
<div class="ec-catalog-vendor">
|
||||
<a href="vendor-profile.html">
|
||||
|
||||
<?php
|
||||
if (isset($vendor["vendor_image"])) {
|
||||
?><img loading="lazy" src="<?php echo $vendor["vendor_image"] ?>" alt="vendor img"><?php
|
||||
|
@ -310,14 +324,14 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
?><img loading="lazy" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="vendor img"><?php
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="ec-catalog-vendor-info row" style="justify-content: center;">
|
||||
<div class="col-lg-3 col-md-6 ec-catalog-name pad-15">
|
||||
<a href="vendor-profile.html">
|
||||
|
||||
<h6 class="name"><?php echo $vendor["user_login"] ?></h6>
|
||||
</a>
|
||||
|
||||
<p>( Retail Business )</p>
|
||||
</div>
|
||||
<!-- raymart remove level feb 22 2024 -->
|
||||
|
@ -326,18 +340,20 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
<p>Level : 9 out of 10</p>
|
||||
</div> -->
|
||||
<div class="col-lg-3 col-md-6 ec-catalog-pro-count pad-15">
|
||||
<a href="vendor-profile.html">
|
||||
|
||||
<h6>Seller Products</h6>
|
||||
<?php
|
||||
?>
|
||||
</a>
|
||||
|
||||
<p><?php echo count($products) ?> Products</p>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-6 ec-catalog-since pad-15">
|
||||
<a href="vendor-profile.html">
|
||||
|
||||
<h6>Seller since</h6>
|
||||
<p><?php echo $vendor["date_registered"] ?></p>
|
||||
</a>
|
||||
<!-- <p><?php echo $vendor["date_registered"] ?></p> -->
|
||||
<p><?php echo date('F j, Y', strtotime($vendor['date_registered'])); ?></p>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -391,134 +407,8 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
<!-- Shop content Start -->
|
||||
<div class="shop-pro-content">
|
||||
<div class="shop-pro-inner">
|
||||
<div class="row" id="product-container">
|
||||
<?php
|
||||
//var_dump($products);
|
||||
foreach ($filteredProducts as $product){
|
||||
// $vendorOfProduct = getVendorbyId($product['vendor_api_id']);
|
||||
?>
|
||||
<div class="col-lg-4 col-md-6 col-sm-6 col-xs-6 mb-6 pro-gl-content">
|
||||
<div class="ec-product-inner">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
<div class="ec-pro-image">
|
||||
<!-- raymart added for link for product feb 22 2024 -->
|
||||
<a class="image" href="product-left-sidebar.php?id=<?php echo $product["_id"] ?>"<?php echo $product["product_image"] ?>>
|
||||
<!-- raymart replace new function for images of the product march 8 2024 -->
|
||||
<?php
|
||||
if (isset($product['images'])) {
|
||||
$image_urls = explode(',', $product['images']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;"/>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img loading="lazy" class="main-image" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
<!-- raymart edit action feb 14 2024 -->
|
||||
<div class="ec-pro-actions" style="bottom: -36px;">
|
||||
<!-- raymart replace updated prize for the product march 8 2024 -->
|
||||
<?php if (isset($product["sale_price"]) && $product["sale_price"] > 0) : ?>
|
||||
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>`,`<?php echo htmlspecialchars($vendorOfProduct, ENT_QUOTES, 'UTF-8'); ?>`, `<?php echo isset($_SESSION['token']) ? $_SESSION['token'] : ''; ?>` , `<?php echo isset($_SESSION['email']) ? $_SESSION['email'] : ''; ?>` , `<?php echo isset($_SESSION['password']) ? $_SESSION['password'] : ''; ?>` , `<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>`);" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
|
||||
|
||||
<?php elseif (isset($product["regular_price"]) && $product["regular_price"] != "") : ?>
|
||||
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>`,`<?php echo htmlspecialchars($vendorOfProduct, ENT_QUOTES, 'UTF-8'); ?>`, `<?php echo isset($_SESSION['token']) ? $_SESSION['token'] : ''; ?>` , `<?php echo isset($_SESSION['email']) ? $_SESSION['email'] : ''; ?>` , `<?php echo isset($_SESSION['password']) ? $_SESSION['password'] : ''; ?>` , `<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>`);" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
|
||||
|
||||
<?php else : ($product["regular_price"] == "" || $product["regular_price"] == null) ?>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<!-- <span class="percentage">20%</span>
|
||||
<a href="#" class="quickview" data-link-action="quickview" title="Quick view" data-bs-toggle="modal" data-bs-target="#ec_quickview_modal"><i class="fi-rr-eye"></i></a>
|
||||
<div class="ec-pro-actions">
|
||||
<a href="compare.html" class="ec-btn-group compare" title="Compare"><i class="fi fi-rr-arrows-repeat"></i></a>
|
||||
<button title="Add To Cart" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist"><i class="fi-rr-heart"></i></a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="ec-pro-content">
|
||||
<h5 class="ec-pro-title"><a href="product-left-sidebar.php?id=<?php echo $product["_id"] ?>" style="width: 90%; text-wrap: wrap;"><?php echo $product["product_name"] ?></a></h5>
|
||||
<!-- raymart remove ratings feb 22 2024 -->
|
||||
<!-- <div class="ec-pro-rating">
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star"></i>
|
||||
</div> -->
|
||||
<!-- <div class="ec-pro-list-desc">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dutmmy text ever since the 1500s, when an unknown printer took a galley.</div> -->
|
||||
<span class="ec-price">
|
||||
<!-- raymart added $ to pesos function feb 22 2024 -->
|
||||
<?php if (isset($product["sale_price"]) && $product["sale_price"] > 0) : ?>
|
||||
<span class="old-price">₱<?php echo number_format($product["regular_price"], 2, ".", ",") ?></span>
|
||||
<span class="new-price">₱<?php echo number_format($product["sale_price"], 2, ".", ",") ?></span>
|
||||
<?php elseif (isset($product["regular_price"]) && $product["regular_price"] != "") : ?>
|
||||
<span class="new-price">₱<?php echo number_format($product["regular_price"], 2, ".", ",") ?></span>
|
||||
|
||||
<?php elseif ($product["regular_price"] == "" || $product["regular_price"] == null) : ?>
|
||||
<span class="inquire-text">Inquire</span>
|
||||
<?php else : ?>
|
||||
<span class="inquire-text">Inquire</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- <?php if (isset($product["sale_price"]) && $product["sale_price"] > 0) : ?>
|
||||
<span class="old-price">₱<?php echo number_format($product["regular_price"], 2, ".", ",") ?></span>
|
||||
<span class="new-price">₱<?php echo number_format($product["sale_price"], 2, ".", ",") ?></span>
|
||||
<?php elseif (isset($product["regular_price"]) && $product["regular_price"] != "") : ?>
|
||||
<span class="new-price">₱<?php echo number_format($product["regular_price"], 2, ".", ",") ?></span>
|
||||
|
||||
<?php elseif ($product["regular_price"] == "" || $product["regular_price"] == null) : ?>
|
||||
<span class="inquire-text">Inquire</span>
|
||||
<?php else : ?>
|
||||
<span class="inquire-text">Inquire</span>
|
||||
<?php endif; ?> -->
|
||||
</span>
|
||||
<div class="ec-pro-option">
|
||||
<!-- raymart remove color and size function feb 22 2024 -->
|
||||
<!-- <div class="ec-pro-color">
|
||||
<span class="ec-pro-opt-label">Color</span>
|
||||
<ul class="ec-opt-swatch ec-change-img">
|
||||
<?php
|
||||
if (isset($product["product_image"]) && $product["product_image"] <> "") {
|
||||
?>
|
||||
<li class="active"><a href="#" class="ec-opt-clr-img" data-src="<?php echo $product["product_image"] ?>" data-src-hover="<?php echo $product["product_image"] ?>" data-tooltip="Gray"><span style="background-color:#e8c2ff;"></span></a></li>
|
||||
<li><a href="#" class="ec-opt-clr-img" data-src="<?php echo $product["product_image"] ?>" data-src-hover="<?php echo $product["product_image"] ?>" data-tooltip="Orange"><span style="background-color:#9cfdd5;"></span></a></li>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<li class="active"><a href="#" class="ec-opt-clr-img" data-src="assets/images/product-image/6_1.jpg" data-src-hover="assets/images/product-image/6_1.jpg" data-tooltip="Gray"><span style="background-color:#e8c2ff;"></span></a></li>
|
||||
<li><a href="#" class="ec-opt-clr-img" data-src="assets/images/product-image/6_2.jpg" data-src-hover="assets/images/product-image/6_2.jpg" data-tooltip="Orange"><span style="background-color:#9cfdd5;"></span></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div> -->
|
||||
<!-- <div class="ec-pro-size">
|
||||
<span class="ec-pro-opt-label">Size</span>
|
||||
<ul class="ec-opt-size">
|
||||
<li class="active"><a href="#" class="ec-opt-sz" data-old="$25.00" data-new="$20.00" data-tooltip="Small">S</a></li>
|
||||
<li><a href="#" class="ec-opt-sz" data-old="$27.00" data-new="$22.00" data-tooltip="Medium">M</a></li>
|
||||
<li><a href="#" class="ec-opt-sz" data-old="$30.00" data-new="$25.00" data-tooltip="Large">X</a></li>
|
||||
<li><a href="#" class="ec-opt-sz" data-old="$35.00" data-new="$30.00" data-tooltip="Extra Large">XL</a></li>
|
||||
</ul>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="row" id="product-container3">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -542,8 +432,10 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
// JavaScript
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
|
||||
loadProducts();
|
||||
console.log('<?php echo $json ?>')
|
||||
function loadProducts(page,isFilter) {
|
||||
|
||||
let xhrVendors1 = new XMLHttpRequest();
|
||||
|
||||
// Define the endpoint URL for fetching vendors
|
||||
|
@ -559,67 +451,71 @@ xhrVendors1.onreadystatechange = function() {
|
|||
|
||||
var checkedCategories = getCheckedCheckboxes();
|
||||
var prices = getMinMaxPrices();
|
||||
function filterFunction(checkedCategories, minPrice, maxPrice,products) {
|
||||
var filteredProducts = [];
|
||||
// Filter by category
|
||||
if (checkedCategories.length > 0) {
|
||||
let filteredProduct= products?.filter((product) => {
|
||||
let categoryF = product?.product_category?.toLowerCase();
|
||||
// console.log('Category (lowercase):', categoryF);
|
||||
let result =checkedCategories.includes(categoryF)
|
||||
// console.log('Checked Categories:', result);
|
||||
return result; // Return a boolean value indicating whether the category is included
|
||||
});
|
||||
filteredProducts=filteredProduct
|
||||
console.log(filteredProducts);
|
||||
function filterFunction(checkedCategories, minPrice, maxPrice,products) {
|
||||
var filteredProducts = [];
|
||||
// Filter by category
|
||||
if (checkedCategories.length > 0) {
|
||||
let filteredProduct= products?.filter((product) => {
|
||||
let categoryF = product?.product_category?.toLowerCase();
|
||||
// console.log('Category (lowercase):', categoryF);
|
||||
let result =checkedCategories.includes(categoryF)
|
||||
// console.log('Checked Categories:', result);
|
||||
return result; // Return a boolean value indicating whether the category is included
|
||||
});
|
||||
filteredProducts=filteredProduct
|
||||
console.log(filteredProducts);
|
||||
|
||||
} else {
|
||||
// If no categories are selected, keep all products
|
||||
filteredProducts = products;
|
||||
}
|
||||
} else {
|
||||
// If no categories are selected, keep all products
|
||||
filteredProducts = products;
|
||||
}
|
||||
|
||||
// If minPrice or maxPrice is not provided, set them to default values
|
||||
minPriceFinal = minPrice !== '' ? parseInt(minPrice) : 0;
|
||||
maxPriceFinal = maxPrice !== '' ? parseInt(maxPrice) : Number.MAX_VALUE;
|
||||
console.log(checkedCategories, minPrice,products)
|
||||
// If minPrice or maxPrice is not provided, set them to default values
|
||||
minPriceFinal = minPrice !== '' ? parseInt(minPrice) : 0;
|
||||
maxPriceFinal = maxPrice !== '' ? parseInt(maxPrice) : Number.MAX_VALUE;
|
||||
console.log(checkedCategories, minPrice,products)
|
||||
|
||||
// Filter by price range
|
||||
// Filter by price range
|
||||
if( minPrice !== ''||maxPrice !== ''){
|
||||
// Filter by price range
|
||||
// Filter by price range
|
||||
if( minPrice !== ''||maxPrice !== ''){
|
||||
|
||||
filteredProducts = filteredProducts.filter(function(product) {
|
||||
// Check if product has a sale price
|
||||
var salePrice = parseInt(product.sale_price);
|
||||
var regularPrice = parseInt(product.regular_price);
|
||||
filteredProducts = filteredProducts.filter(function(product) {
|
||||
// Check if product has a sale price
|
||||
var salePrice = parseInt(product.sale_price);
|
||||
var regularPrice = parseInt(product.regular_price);
|
||||
|
||||
// Check if salePrice and regularPrice are valid numbers
|
||||
|
||||
// if (isNaN(salePrice) || isNaN(regularPrice)) {
|
||||
// // One of the prices is not a valid number, use 0 instead
|
||||
// salePrice = salePrice || 0;
|
||||
// regularPrice = regularPrice || 0;
|
||||
// }
|
||||
var priceToCheck = salePrice > 0 ? salePrice : regularPrice;
|
||||
// console.log(priceToCheck);
|
||||
return priceToCheck >= minPriceFinal && priceToCheck <= maxPriceFinal;
|
||||
});
|
||||
}
|
||||
console.log({results:filteredProducts});
|
||||
// Check if salePrice and regularPrice are valid numbers
|
||||
|
||||
// if (isNaN(salePrice) || isNaN(regularPrice)) {
|
||||
// // One of the prices is not a valid number, use 0 instead
|
||||
// salePrice = salePrice || 0;
|
||||
// regularPrice = regularPrice || 0;
|
||||
// }
|
||||
var priceToCheck = salePrice > 0 ? salePrice : regularPrice;
|
||||
// console.log(priceToCheck);
|
||||
return priceToCheck >= minPriceFinal && priceToCheck <= maxPriceFinal;
|
||||
});
|
||||
}
|
||||
console.log({results:filteredProducts});
|
||||
|
||||
// Final filtered products
|
||||
// console.log({results:filteredProducts});
|
||||
let final = filteredProducts ??[]
|
||||
return final;
|
||||
}
|
||||
let productContainer = document.getElementById("product-container");
|
||||
// Final filtered products
|
||||
// console.log({results:filteredProducts});
|
||||
let final = filteredProducts ??[]
|
||||
return final;
|
||||
}
|
||||
|
||||
|
||||
|
||||
let productContainer = document.getElementById("product-container3");
|
||||
productContainer.innerHTML = "";
|
||||
let productsFinal = JSON.parse(xhrVendors1.responseText);
|
||||
console.log(productsFinal);
|
||||
// console.log(productsFinal);
|
||||
productsFinal= filterFunction(checkedCategories, prices.minPrice, prices.maxPrice,productsFinal);
|
||||
|
||||
productsFinal?.forEach(function(prod) {
|
||||
let product = prod;
|
||||
let vendorOfProduct = prod.vendor_api_id;
|
||||
let vendorOfProduct = '<?php echo $json ?>';
|
||||
|
||||
// let card = document.createElement("div");
|
||||
let token ="<?php echo $_SESSION['token'] ?>";
|
||||
let email ="<?php echo $_SESSION['email'] ?>";
|
||||
|
@ -632,17 +528,19 @@ let productContainer = document.getElementById("product-container");
|
|||
let imageUrls = product.images.split(',');
|
||||
let firstImageUrl = imageUrls[0].trim();
|
||||
let img = document.createElement("img");
|
||||
img.setAttribute("style", "width: 290px; height: 200px; object-fit: cover;");
|
||||
img.setAttribute("style", "border: 1px solid #eeeeee; height: 330px; object-fit: cover;");
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("src", firstImageUrl);
|
||||
img.setAttribute("alt", "Product");
|
||||
img.setAttribute("loading", "lazy");
|
||||
|
||||
img.className = "main-image";
|
||||
imageContainer.appendChild(img);
|
||||
} else {
|
||||
let img = document.createElement("img");
|
||||
img.className = "main-image";
|
||||
img.setAttribute("style", "width: 290px; height: 200px; object-fit: cover;");
|
||||
|
||||
img.setAttribute("style", "border: 1px solid #eeeeee; height: 330px; object-fit: cover;");
|
||||
img.setAttribute("loading", "lazy");
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("src", "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png");
|
||||
img.setAttribute("alt", "Product");
|
||||
|
@ -654,14 +552,21 @@ let productContainer = document.getElementById("product-container");
|
|||
card.classList.add("col-lg-4", "col-md-6", "col-sm-6", "col-xs-6", "mb-6", "pro-gl-content", "width-100");
|
||||
card.innerHTML = `
|
||||
<div class="ec-product-inner">
|
||||
<div class="ec-pro-image-outer" style="width: 290px; height: 200px;">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=${product._id}">
|
||||
${imageContainer.innerHTML} <!-- Include the dynamically loaded image here -->
|
||||
</a>
|
||||
<div class="ec-pro-actions" style="bottom: -36px;">
|
||||
<button title="Add To Cart" onclick="popupAddToCart('${encodeURIComponent(JSON.stringify(product))}','${encodeURIComponent(JSON.stringify(vendorOfProduct))}', '${token}', '${email}', '${password}', '${encodeURIComponent(JSON.stringify(customer_data))}');" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('${encodeURIComponent(JSON.stringify(product))}', '${encodeURIComponent(JSON.stringify(customer_data))}');"><i class="fi-rr-heart"></i></a>
|
||||
${
|
||||
(product["sale_price"] && product["sale_price"] > 0) ?
|
||||
`<button title="Add To Cart" onclick="popupAddToCart('${encodeURIComponent(JSON.stringify(product))}','${encodeURIComponent(JSON.stringify(vendorOfProduct))}', '${token}', '${email}', '${password}', '${encodeURIComponent(JSON.stringify(customer_data))}');" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('${encodeURIComponent(JSON.stringify(product))}', '${encodeURIComponent(JSON.stringify(customer_data))}');"><i class="fi-rr-heart"></i></a>` :
|
||||
(product["regular_price"] && product["regular_price"] != "") ?
|
||||
`<button title="Add To Cart" onclick="popupAddToCart('${encodeURIComponent(JSON.stringify(product))}','${encodeURIComponent(JSON.stringify(vendorOfProduct))}', '${token}', '${email}', '${password}', '${encodeURIComponent(JSON.stringify(customer_data))}');" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('${encodeURIComponent(JSON.stringify(product))}', '${encodeURIComponent(JSON.stringify(customer_data))}');"><i class="fi-rr-heart"></i></a>` :
|
||||
`<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('${encodeURIComponent(JSON.stringify(product))}', '${encodeURIComponent(JSON.stringify(customer_data))}');"><i class="fi-rr-heart"></i></a>`
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1270,7 +1175,7 @@ maxPriceInput.addEventListener('input', function() {
|
|||
<!-- Modal end -->
|
||||
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<!-- <div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
<div class="ec-nav-panel">
|
||||
<div class="ec-nav-panel-icons">
|
||||
|
@ -1291,7 +1196,7 @@ maxPriceInput.addEventListener('input', function() {
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- Recent Purchase Popup -->
|
||||
|
|
|
@ -17,7 +17,21 @@ if ($_SESSION["userId"] <> "") {
|
|||
|
||||
$order_ids = [];
|
||||
if ($cartItems) {
|
||||
$cartencode = json_encode($cartItems);
|
||||
if(!empty($_GET['selected'])){
|
||||
$selectedIds = explode('-', $_GET['selected']);
|
||||
|
||||
// Filter $cartItems array based on selected ids
|
||||
$filteredCartItems = array_filter($cartItems, function($item) use ($selectedIds) {
|
||||
return in_array($item['_id'], $selectedIds);
|
||||
});
|
||||
$cartItems = $filteredCartItems;
|
||||
$cartencode = json_encode($filteredCartItems);
|
||||
|
||||
}else{
|
||||
$cartItems = $filteredCartItems;
|
||||
|
||||
$cartencode = json_encode($cartItems);
|
||||
}
|
||||
foreach ($cartItems as $item) {
|
||||
array_push($order_ids, $item['_id']);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<!-- 02-14-2024 Stacy created this file and added contact-us-action.php -->
|
||||
<?php session_start()?>
|
||||
<?php
|
||||
include "functions.php";
|
||||
session_start()
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
|
31
footer.php
31
footer.php
|
@ -1,3 +1,7 @@
|
|||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<!-- Footer Start -->
|
||||
<footer class="ec-footer section-space-mt">
|
||||
<div class="footer-container">
|
||||
|
@ -165,5 +169,30 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
<div class="ec-nav-panel">
|
||||
<!-- <div class="ec-nav-panel-icons">
|
||||
<a href="#ec-mobile-menu" class="navbar-toggler-btn ec-header-btn ec-side-toggle"><i class="fi-rr-menu-burger"></i></a>
|
||||
</div> -->
|
||||
<div class="ec-nav-panel-icons">
|
||||
<a href="cart.php" class="ec-header-btn ec-header-wishlist">
|
||||
<div class="header-icon"><i class="fi-rr-shopping-bag"></i></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="ec-nav-panel-icons">
|
||||
<a href="index.php" class="ec-header-btn"><i class="fi-rr-home"></i></a>
|
||||
</div>
|
||||
<div class="ec-nav-panel-icons">
|
||||
<a href="wishlist.php" class="ec-header-btn"><i class="fi-rr-heart"></i></a>
|
||||
</div>
|
||||
<div class="ec-nav-panel-icons">
|
||||
<a href="#" class="ec-header-btn"><i class="fi-rr-user"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
</footer>
|
||||
<!-- Footer Area End -->
|
||||
<!-- Footer Area End -->
|
||||
|
|
|
@ -2010,3 +2010,48 @@ function updatePayout($token, $payoutId)
|
|||
return $response;
|
||||
}
|
||||
|
||||
function getAllCustomers ()
|
||||
{
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'X-Api-Key: {{apiKey}}'
|
||||
),
|
||||
));
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
$json = json_decode($response, true);
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
function getAllVendors ()
|
||||
{
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'X-Api-Key: {{apiKey}}'
|
||||
),
|
||||
));
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
$json = json_decode($response, true);
|
||||
|
||||
return $json;
|
||||
}
|
123
header.php
123
header.php
|
@ -139,6 +139,20 @@ if ($_SESSION["userId"] <> "") {
|
|||
font-size: 16px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
@media (hover: hover), (hover: none) {
|
||||
.fi-rr-heart:hover,
|
||||
.fi-rr-heart:active,
|
||||
.fi-rr-user:hover,
|
||||
.fi-rr-user:active,
|
||||
.fi-rr-shopping-bag:hover,
|
||||
.fi-rr-shopping-bag:active,
|
||||
.fi-rr-home:hover,
|
||||
.fi-rr-home:active {
|
||||
cursor: pointer !important;
|
||||
color: #005eff !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
@ -288,13 +302,13 @@ if ($_SESSION["userId"] <> "") {
|
|||
<!-- Header Cart Start -->
|
||||
<a href="wishlist.php" class="ec-header-btn ec-header-wishlist">
|
||||
<div class="header-icon"><i class="fi-rr-heart"></i></div>
|
||||
<span class="ec-header-count">0</span>
|
||||
<span id="wishItemCount" class="ec-header-count">0</span>
|
||||
</a>
|
||||
<!-- Header Cart End -->
|
||||
<!-- Header Cart Start -->
|
||||
<a href="cart.php" class="ec-header-btn ec-header-wishlist">
|
||||
<div class="header-icon"><i class="fi-rr-shopping-bag"></i></div>
|
||||
<span class="ec-header-count cart-count-lable">0</span>
|
||||
<span id="cartItemCount" class="ec-header-count">0</span>
|
||||
</a>
|
||||
<!-- Header Cart End -->
|
||||
<a href="javascript:void(0)" class="ec-header-btn ec-sidebar-toggle">
|
||||
|
@ -403,6 +417,20 @@ if ($_SESSION["userId"] <> "") {
|
|||
<span class="cart_title">My Cart</span>
|
||||
<button class="ec-close">×</button>
|
||||
</div>
|
||||
<style>
|
||||
.rowcart{
|
||||
display:flex;
|
||||
justify-content:center;
|
||||
align-self: center;
|
||||
flex-direction:row;
|
||||
}
|
||||
.rowcartCheckbox{
|
||||
height:15px;
|
||||
width:15px;
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<ul class="eccart-pro-items">
|
||||
<?php
|
||||
//var_dump($order_data[0]['items'][0]['product']);
|
||||
|
@ -413,7 +441,8 @@ if ($_SESSION["userId"] <> "") {
|
|||
$product = getProduct($order['items'][0]['product']['product_id']);
|
||||
$product_data = json_decode($product, true);
|
||||
?>
|
||||
<li id="order_<?php echo $order['_id'] ?>">
|
||||
<li class="rowcart" id="order_<?php echo $order['_id'] ?>">
|
||||
<input type="checkbox" class="rowcartCheckbox" name="cart-item[]" value="<?php echo $order['_id']?>"/>
|
||||
<a href="product-left-sidebar.php?id=<?php echo $order['items'][0]['product']['product_id']; ?>" class="sidekka_pro_img">
|
||||
<?php
|
||||
if (isset($order['items'][0]['product']['product_image'])) {
|
||||
|
@ -445,7 +474,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<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"
|
||||
<input style="width:80px; 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']; ?>' ,
|
||||
|
@ -453,7 +482,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<!-- <a class="remove">x</a> -->
|
||||
<!-- <a href="#" class="removeCart" onclick="deleteOrder('<?php #echo $order['_id']; ?>')">x</a> -->
|
||||
<a href="#" class="removeCart" style="margin-left:30px;" onclick="deleteOrder('<?php echo $order['_id']; ?>')">
|
||||
<a href="#" class="removeCart" style="margin-left:10px;" 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>
|
||||
|
@ -522,7 +551,43 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
|
||||
let myLatestOrders = [];
|
||||
var checkboxes = document.querySelectorAll('input[name="cart-item[]"]');
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
checkbox.addEventListener('change', function() {
|
||||
getCheckedCheckboxes();
|
||||
getLatestOrders();
|
||||
// update_Total()
|
||||
});
|
||||
});
|
||||
function getCheckedCheckboxes() {
|
||||
var checkboxes = document.querySelectorAll('input[name="cart-item[]"]:checked');
|
||||
var values = [];
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
values.push(checkbox.value.toLowerCase().trim());
|
||||
});
|
||||
console.log(values);
|
||||
return values;
|
||||
}
|
||||
function update_Total(){
|
||||
|
||||
|
||||
console.log(orderData);
|
||||
var checkedCategories = getCheckedCheckboxes();
|
||||
if (orderData && orderData !== "") {
|
||||
// Calculate the new total amount based on the updated quantities
|
||||
const orderInitial= null
|
||||
if(checkedCategories?.length>0){
|
||||
orderInitial = orderData?.filter(order => checkedCategories?.includes(order._id));
|
||||
|
||||
}else{
|
||||
orderInitial = orderData
|
||||
}
|
||||
let newTotalAmount = orderData.items.reduce((total, item) => {
|
||||
return total + (item.quantity * item.price);
|
||||
}, 0);
|
||||
console.log(response);
|
||||
}
|
||||
}
|
||||
function handleQtyInput(input, orderId, itemId, isFloat) {
|
||||
login(email, password, function(token) {
|
||||
var newQuantity = parseInt(input.value);
|
||||
|
@ -717,7 +782,18 @@ if ($_SESSION["userId"] <> "") {
|
|||
if (orderData && orderData !== "") {
|
||||
console.log(orderData)
|
||||
const filteredOrders = orderData.filter(order => order.status.toUpperCase() === 'CART');
|
||||
const totalAmountSum = filteredOrders.reduce((sum, order) => {
|
||||
var checkedCategories = getCheckedCheckboxes();
|
||||
let orderInitial= null;
|
||||
if (filteredOrders && filteredOrders !== "") {
|
||||
// Calculate the new total amount based on the updated quantities
|
||||
if(checkedCategories?.length>0){
|
||||
orderInitial = filteredOrders?.filter(order => checkedCategories?.includes(order._id));
|
||||
|
||||
}else{
|
||||
orderInitial = filteredOrders
|
||||
}
|
||||
}
|
||||
const totalAmountSum = orderInitial.reduce((sum, order) => {
|
||||
const totalAmount = parseFloat(order.total_amount);
|
||||
return sum + totalAmount;
|
||||
}, 0);
|
||||
|
@ -752,9 +828,12 @@ if ($_SESSION["userId"] <> "") {
|
|||
|
||||
function handleCheckoutButton(event) {
|
||||
event.preventDefault();
|
||||
var checkedCategories = getCheckedCheckboxes();
|
||||
|
||||
const selectedIdString = checkedCategories.join('-');
|
||||
login(email, password, function(token) {
|
||||
|
||||
window.location.href = "checkouttest.php";
|
||||
window.location.href = `checkouttest.php?selected=${selectedIdString}`;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1065,23 +1144,41 @@ if ($_SESSION["userId"] <> "") {
|
|||
</ul>
|
||||
</li> -->
|
||||
<li><a href="offer.php">Hot Offers</a></li>
|
||||
<li class="dropdown scroll-to"><a href="javascript:void(0)"><i class="fi fi-rr-sort-amount-down-alt"></i></a>
|
||||
<?php
|
||||
// Check if the current page is the index page
|
||||
if(basename($_SERVER['PHP_SELF']) === 'index.php') {
|
||||
//include the scroll menu
|
||||
?>
|
||||
<li class="dropdown scroll-to"><a href="javascript:void(0)"><i class="fi fi-rr-sort-amount-down-alt"></i></a>
|
||||
<ul class="sub-menu">
|
||||
<li class="menu_title">Scroll To Section</li>
|
||||
<li><a href="javascript:void(0)" data-scroll="collection" class="nav-scroll">Top Collection</a></li>
|
||||
<li><a href="javascript:void(0)" data-scroll="categories" class="nav-scroll">Categories</a></li>
|
||||
<li><a href="javascript:void(0)" data-scroll="vendors" class="nav-scroll">Top Vendors</a></li>
|
||||
<li><a href="javascript:void(0)" data-scroll="services" class="nav-scroll">Services</a></li>
|
||||
<li><a href="javascript:void(0)" data-scroll="arrivals" class="nav-scroll">New Arrivals</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<!-- <li class="dropdown scroll-to"><a href="javascript:void(0)"><i class="fi fi-rr-sort-amount-down-alt"></i></a>
|
||||
<ul class="sub-menu">
|
||||
<li class="menu_title">Scroll To Section</li>
|
||||
<li><a href="javascript:void(0)" data-scroll="collection" class="nav-scroll">Top
|
||||
Collection</a></li>
|
||||
<li><a href="javascript:void(0)" data-scroll="categories" class="nav-scroll">Categories</a></li>
|
||||
<!-- <li><a href="javascript:void(0)" data-scroll="offers" class="nav-scroll">Offers</a></li> -->
|
||||
<li><a href="javascript:void(0)" data-scroll="offers" class="nav-scroll">Offers</a></li>
|
||||
<li><a href="javascript:void(0)" data-scroll="vendors" class="nav-scroll">Top
|
||||
Vendors</a></li>
|
||||
<li><a href="javascript:void(0)" data-scroll="services" class="nav-scroll">Services</a></li>
|
||||
<li><a href="javascript:void(0)" data-scroll="arrivals" class="nav-scroll">New
|
||||
Arrivals</a></li>
|
||||
<!-- <li><a href="javascript:void(0)" data-scroll="reviews" class="nav-scroll">Client
|
||||
Review</a></li> -->
|
||||
<!-- <li><a href="javascript:void(0)" data-scroll="insta" class="nav-scroll">Instagram Feed</a></li> -->
|
||||
<li><a href="javascript:void(0)" data-scroll="reviews" class="nav-scroll">Client
|
||||
Review</a></li>
|
||||
<li><a href="javascript:void(0)" data-scroll="insta" class="nav-scroll">Instagram Feed</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
34
index.php
34
index.php
|
@ -224,9 +224,9 @@ if ($_SESSION["userId"] <> "") {
|
|||
$vendorOfProduct = getVendorbyId($forAll[$pid]['vendor_api_id']);
|
||||
?>
|
||||
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 ec-product-content" data-animation="fadeIn">
|
||||
<div class="ec-product-inner" style="width: 260px;">
|
||||
<div class="ec-product-inner">
|
||||
<!-- raymart added style feb 26 2024 -->
|
||||
<div class="ec-pro-image-outer">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
<!-- <div class="ec-pro-image-outer"> -->
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $forAll[$pid]["_id"]; ?>">
|
||||
|
@ -237,7 +237,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 280px;" />
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
|
@ -344,9 +344,9 @@ if ($_SESSION["userId"] <> "") {
|
|||
$vendorOfProduct = getVendorbyId($electronics[$pid]['vendor_api_id']);
|
||||
?>
|
||||
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 ec-product-content" data-animation="fadeIn">
|
||||
<div class="ec-product-inner" style="width: 260px;">
|
||||
<div class="ec-product-inner">
|
||||
<!-- raymart added style feb 26 2024 -->
|
||||
<div class="ec-pro-image-outer">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
<!-- <div class="ec-pro-image-outer"> -->
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $electronics[$pid]["_id"]; ?>">
|
||||
|
@ -357,7 +357,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 280px;" />
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
|
@ -466,9 +466,9 @@ if ($_SESSION["userId"] <> "") {
|
|||
$vendorOfProduct = getVendorbyId($smartHome[$pid]['vendor_api_id']);
|
||||
?>
|
||||
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 ec-product-content" data-animation="fadeIn">
|
||||
<div class="ec-product-inner" style="width: 260px;">
|
||||
<div class="ec-product-inner">
|
||||
<!-- raymart added style feb 26 2024 -->
|
||||
<div class="ec-pro-image-outer">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
<!-- <div class="ec-pro-image-outer"> -->
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $smartHome[$pid]["_id"]; ?>">
|
||||
|
@ -479,7 +479,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 280px;" />
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
|
@ -586,9 +586,9 @@ if ($_SESSION["userId"] <> "") {
|
|||
$vendorOfProduct = getVendorbyId($forVehicle[$pid]['vendor_api_id']);
|
||||
?>
|
||||
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 ec-product-content" data-animation="fadeIn">
|
||||
<div class="ec-product-inner" style="width: 260px;">
|
||||
<div class="ec-product-inner">
|
||||
<!-- raymart added style feb 26 2024-->
|
||||
<div class="ec-pro-image-outer">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
<!-- <div class="ec-pro-image-outer"> -->
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $forVehicle[$pid]["_id"]; ?>">
|
||||
|
@ -599,7 +599,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 280px;" />
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
|
@ -1229,9 +1229,9 @@ if ($_SESSION["userId"] <> "") {
|
|||
$vendorOfProduct = getVendorbyId($newArrival[$pid]['vendor_api_id']);
|
||||
?>
|
||||
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 ec-product-content" data-animation="flipInY">
|
||||
<div class="ec-product-inner" style="width: 260px;">
|
||||
<div class="ec-product-inner">
|
||||
<!-- raymart added style feb 26 2024 -->
|
||||
<div class="ec-pro-image-outer">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
<!-- <div class="ec-pro-image-outer"> -->
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $newArrival[$pid]["_id"]; ?>">
|
||||
|
@ -1242,7 +1242,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 280px;" />
|
||||
<img loading="lazy" class="main-image" src="<?php echo $first_image_url; ?>" alt="edit" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
|
@ -1671,7 +1671,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<!-- Newsletter Modal end -->
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<!-- <div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
<div class="ec-nav-panel">
|
||||
<div class="ec-nav-panel-icons">
|
||||
|
@ -1692,7 +1692,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- Recent Purchase Popup -->
|
||||
|
|
|
@ -321,7 +321,7 @@ function loadProducts(page,isFilter) {
|
|||
let product = prod;
|
||||
// let vendor = prod.vendor;
|
||||
|
||||
let vendorOfProduct = prod.vendor;
|
||||
let vendorOfProduct = prod;
|
||||
// let card = document.createElement("div");
|
||||
let token ="<?php echo $_SESSION['token'] ?>";
|
||||
let email ="<?php echo $_SESSION['email'] ?>";
|
||||
|
@ -334,8 +334,10 @@ function loadProducts(page,isFilter) {
|
|||
let imageUrls = product.images.split(',');
|
||||
let firstImageUrl = imageUrls[0].trim();
|
||||
let img = document.createElement("img");
|
||||
img.setAttribute("style", "width: 290px; height: 200px; object-fit: cover;");
|
||||
img.setAttribute("style", "border: 1px solid #eeeeee; height: 330px; object-fit: cover;");
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("loading", "lazy");
|
||||
|
||||
img.setAttribute("src", firstImageUrl);
|
||||
img.setAttribute("alt", "Product");
|
||||
img.className = "main-image";
|
||||
|
@ -343,8 +345,8 @@ function loadProducts(page,isFilter) {
|
|||
} else {
|
||||
let img = document.createElement("img");
|
||||
img.className = "main-image";
|
||||
img.setAttribute("style", "width: 290px; height: 200px; object-fit: cover;");
|
||||
|
||||
img.setAttribute("style", "border: 1px solid #eeeeee; height: 330px; object-fit: cover;");
|
||||
img.setAttribute("loading", "lazy");
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("src", "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png");
|
||||
img.setAttribute("alt", "Product");
|
||||
|
@ -356,14 +358,21 @@ function loadProducts(page,isFilter) {
|
|||
card.classList.add("col-lg-3", "col-md-6", "col-sm-6", "col-xs-6", "mb-6", "pro-gl-content", "width-100");
|
||||
card.innerHTML = `
|
||||
<div class="ec-product-inner">
|
||||
<div class="ec-pro-image-outer" style="width: 290px; height: 200px;">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=${product._id}">
|
||||
${imageContainer.innerHTML} <!-- Include the dynamically loaded image here -->
|
||||
</a>
|
||||
<div class="ec-pro-actions" style="bottom: -36px;">
|
||||
<button title="Add To Cart" onclick="popupAddToCart('${encodeURIComponent(JSON.stringify(product))}','${encodeURIComponent(JSON.stringify(vendorOfProduct))}', '${token}', '${email}', '${password}', '${encodeURIComponent(JSON.stringify(customer_data))}');" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('${encodeURIComponent(JSON.stringify(product))}', '${encodeURIComponent(JSON.stringify(customer_data))}');"><i class="fi-rr-heart"></i></a>
|
||||
${
|
||||
(product["sale_price"] && product["sale_price"] > 0) ?
|
||||
`<button title="Add To Cart" onclick="popupAddToCart('${encodeURIComponent(JSON.stringify(product))}','${encodeURIComponent(JSON.stringify(vendorOfProduct))}', '${token}', '${email}', '${password}', '${encodeURIComponent(JSON.stringify(customer_data))}');" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('${encodeURIComponent(JSON.stringify(product))}', '${encodeURIComponent(JSON.stringify(customer_data))}');"><i class="fi-rr-heart"></i></a>` :
|
||||
(product["regular_price"] && product["regular_price"] != "") ?
|
||||
`<button title="Add To Cart" onclick="popupAddToCart('${encodeURIComponent(JSON.stringify(product))}','${encodeURIComponent(JSON.stringify(vendorOfProduct))}', '${token}', '${email}', '${password}', '${encodeURIComponent(JSON.stringify(customer_data))}');" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('${encodeURIComponent(JSON.stringify(product))}', '${encodeURIComponent(JSON.stringify(customer_data))}');"><i class="fi-rr-heart"></i></a>` :
|
||||
`<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('${encodeURIComponent(JSON.stringify(product))}', '${encodeURIComponent(JSON.stringify(customer_data))}');"><i class="fi-rr-heart"></i></a>`
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -923,7 +932,7 @@ maxPriceInput.addEventListener('input', function() {
|
|||
<!-- Modal end -->
|
||||
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<!-- <div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
<div class="ec-nav-panel">
|
||||
<div class="ec-nav-panel-icons">
|
||||
|
@ -948,7 +957,7 @@ maxPriceInput.addEventListener('input', function() {
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- Recent Purchase Popup -->
|
||||
|
|
|
@ -2027,7 +2027,7 @@ if (isset($_GET['id'])) {
|
|||
<!-- Modal end -->
|
||||
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<!-- <div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
<div class="ec-nav-panel">
|
||||
<div class="ec-nav-panel-icons">
|
||||
|
@ -2048,7 +2048,7 @@ if (isset($_GET['id'])) {
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- Recent Purchase Popup -->
|
||||
|
|
|
@ -112,9 +112,6 @@ $_SESSION["isVendor"] = false;
|
|||
<input type="password" name="password" placeholder="Enter your password" required />
|
||||
</span>
|
||||
<p><input type="checkbox" required> I accept this Terms & Conditions and Privacy Policy </p>
|
||||
<span class="ec-login-wrap ec-login-fp">
|
||||
<label><a href="#">Forgot Password?</a></label>
|
||||
</span>
|
||||
<span class="ec-login-wrap ec-login-btn">
|
||||
<button class="btn btn-primary" type="submit">Register</button>
|
||||
</span>
|
||||
|
|
|
@ -129,8 +129,7 @@ $customerData = json_decode($customers, true);
|
|||
</span>
|
||||
<span class="ec-register-wrap ec-register-half">
|
||||
<label>Phone Number*</label>
|
||||
<input type="text" name="phonenumber" value="<?php echo $_SESSION["phone"] ?>" placeholder="Enter your phone number"
|
||||
required />
|
||||
<input type="text" name="phonenumber" value="+63 <?php echo $_SESSION["phone"] ?>" oninput="preventEraseInPrefix(this)" required />
|
||||
</span>
|
||||
<span class="ec-register-wrap ec-register-btn">
|
||||
<?php
|
||||
|
@ -153,6 +152,25 @@ $customerData = json_decode($customers, true);
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
|
||||
function preventEraseInPrefix(input) { /* edit details */
|
||||
|
||||
var numericValue = input.value.replace(/\D/g, '');
|
||||
if (numericValue.startsWith('63')) {
|
||||
input.value = "+63 " + numericValue.substring(2);
|
||||
} else {
|
||||
input.value = "+63 " + numericValue;
|
||||
}
|
||||
|
||||
if (input.value.length > 14) {
|
||||
input.value = input.value.slice(0, 14);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- End Register -->
|
||||
|
||||
<!-- Footer Start -->
|
||||
|
|
|
@ -144,7 +144,7 @@ $vendorData = json_decode($vendors, true);
|
|||
</span>
|
||||
<span class="ec-register-wrap ec-register-half">
|
||||
<label>Phone Number*</label>
|
||||
<input type="text" name="phonenumber" value="<?php echo $vendorData['phone'] ?>" placeholder="Enter your phone number" required />
|
||||
<input type="text" name="phonenumber" value="+63 <?php echo $vendorData['phone'] ?>" oninput="preventEraseInPrefix(this)" required />
|
||||
</span>
|
||||
|
||||
<!-- <span class="ec-register-wrap">
|
||||
|
@ -224,6 +224,25 @@ $vendorData = json_decode($vendors, true);
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
|
||||
function preventEraseInPrefix(input) { /* edit details */
|
||||
|
||||
var numericValue = input.value.replace(/\D/g, '');
|
||||
if (numericValue.startsWith('63')) {
|
||||
input.value = "+63 " + numericValue.substring(2);
|
||||
} else {
|
||||
input.value = "+63 " + numericValue;
|
||||
}
|
||||
|
||||
if (input.value.length > 14) {
|
||||
input.value = input.value.slice(0, 14);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- End Register -->
|
||||
|
||||
<!-- Footer Start -->
|
||||
|
|
|
@ -516,13 +516,16 @@ function loadProducts(page,isFilter) {
|
|||
img.setAttribute("style", "border: 1px solid #eeeeee; height: 330px; object-fit: cover;");
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("src", firstImageUrl);
|
||||
img.setAttribute("loading", "lazy");
|
||||
|
||||
img.setAttribute("alt", "Product");
|
||||
img.className = "main-image";
|
||||
imageContainer.appendChild(img);
|
||||
} else {
|
||||
let img = document.createElement("img");
|
||||
img.className = "main-image";
|
||||
img.setAttribute("style", "border: 1px solid #eeeeee; height: 330px; object-fit: cover;");
|
||||
img.setAttribute("style", "width: 290px; height: 200px; object-fit: cover;");
|
||||
img.setAttribute("loading", "lazy");
|
||||
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("src", "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png");
|
||||
|
@ -564,7 +567,7 @@ function loadProducts(page,isFilter) {
|
|||
`<span class="new-price">₱${product?.regular_price}</span>`: 'inquire'
|
||||
}
|
||||
</span>
|
||||
<h6 class="" style="color:#ddd3 !important; font-size:13px; padding-top:10px; padding-bottom:10px"><a href="product-left-sidebar.php?id=${vendor._id}" style="width: 90%; text-wrap: wrap;"> <img style="width:25px; height:25px; border-radius:60px; border: 1px solid #eeee" src="${vendor.vendor_image ?? "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"}" /> ${vendor.user_login}</a></h5>
|
||||
<h6 class="" style="color:#ddd3 !important; font-size:13px; padding-top:10px; padding-bottom:10px"><a href="catalog-single-vendor.php?id=${vendor._id}" style="width: 90%; text-wrap: wrap;"> <img style="width:25px; height:25px; border-radius:60px; border: 1px solid #eeee" src="${vendor.vendor_image ?? "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"}" /> ${vendor.user_login}</a></h5>
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
|
@ -1105,20 +1108,22 @@ maxPriceInput.addEventListener('input', function() {
|
|||
|
||||
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<!-- <div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
<div class="ec-nav-panel">
|
||||
<div class="ec-nav-panel-icons">
|
||||
<a href="javascript:void(0)" class="ec-header-btn ec-sidebar-toggle"><i class="fi fi-rr-apps"></i></a>
|
||||
</div>
|
||||
<div class="ec-nav-panel-icons">
|
||||
<a href="cart.php" class="toggle-cart ec-header-btn ec-side-toggle"><i class="fi-rr-shopping-bag"></i><!-- <span class="ec-cart-noti ec-header-count cart-count-lable"></span> --></a>
|
||||
</div>
|
||||
<a href="cart.php" class="ec-header-btn ec-header-wishlist">
|
||||
<div class="header-icon"><i class="fi-rr-shopping-bag"></i></div>
|
||||
<span class="ec-header-count cart-count-lable">0</span>
|
||||
</a> </div>
|
||||
<div class="ec-nav-panel-icons">
|
||||
<a href="index.php" class="ec-header-btn"><i class="fi-rr-home"></i></a>
|
||||
</div>
|
||||
<div class="ec-nav-panel-icons">
|
||||
<a href="wishlist.php" class="ec-header-btn"><i class="fi-rr-heart"></i><!-- <span class="ec-cart-noti"></span> --></a>
|
||||
<a href="wishlist.php" class="ec-header-btn"><i class="fi-rr-heart"></i></a>
|
||||
</div>
|
||||
<div class="ec-nav-panel-icons">
|
||||
<a href="login.php" class="ec-header-btn"><i class="fi-rr-user"></i></a>
|
||||
|
@ -1126,7 +1131,7 @@ maxPriceInput.addEventListener('input', function() {
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- Recent Purchase Popup -->
|
||||
|
|
|
@ -361,7 +361,22 @@ if ($_SESSION["isVendor"] == true) {
|
|||
$jsonorder = json_encode($order);
|
||||
?>
|
||||
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
|
||||
<td><img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
|
||||
<td>
|
||||
<?php
|
||||
if(!empty($order['items'][0]['product']['product_image']))
|
||||
{
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><span class="text-truncate"><?php echo $order['items'][0]['product']['name']; ?></span></td>
|
||||
<td><span><?php echo $order['items'][0]['quantity']; ?></span></td>
|
||||
<td><span><?php echo $order['items'][0]['price']; ?></span></td>
|
||||
|
@ -436,7 +451,22 @@ if ($_SESSION["isVendor"] == true) {
|
|||
$jsonorder = json_encode($order);
|
||||
?>
|
||||
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
|
||||
<td><img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
|
||||
<td>
|
||||
<?php
|
||||
if(!empty($order['items'][0]['product']['product_image']))
|
||||
{
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><span class="text-truncate"><?php echo $order['items'][0]['product']['name']; ?></span></td>
|
||||
<td><span><?php echo $order['items'][0]['quantity']; ?></span></td>
|
||||
<td><span><?php echo $order['items'][0]['price']; ?></span></td>
|
||||
|
@ -507,7 +537,22 @@ if ($_SESSION["isVendor"] == true) {
|
|||
$jsonorder = json_encode($order);
|
||||
?>
|
||||
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
|
||||
<td><img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
|
||||
<td>
|
||||
<?php
|
||||
if(!empty($order['items'][0]['product']['product_image']))
|
||||
{
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><span class="text-truncate"><?php echo $order['items'][0]['product']['name']; ?></span></td>
|
||||
<td><span><?php echo $order['items'][0]['quantity']; ?></span></td>
|
||||
<td><span><?php echo $order['items'][0]['price']; ?></span></td>
|
||||
|
@ -578,7 +623,20 @@ if ($_SESSION["isVendor"] == true) {
|
|||
?>
|
||||
<tr class="tableView">
|
||||
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
|
||||
<img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
|
||||
<?php
|
||||
if(!empty($order['items'][0]['product']['product_image']))
|
||||
{
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span class="text-truncate"><?php echo $order['items'][0]['product']['name']; ?></span></td>
|
||||
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['items'][0]['quantity']; ?></span></td>
|
||||
|
@ -642,7 +700,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
$orders = getOrderbyCustomerId($customer['_id']);
|
||||
$totalAmount = 0;
|
||||
$orderExist = false;
|
||||
if ($orders) {
|
||||
if ($orders) {
|
||||
$order_data = json_decode($orders, true);
|
||||
$_SESSION['cart_items'] = $order_data;
|
||||
foreach ($order_data as $order) {
|
||||
|
@ -656,8 +714,24 @@ if ($_SESSION["isVendor"] == true) {
|
|||
$jsonorder = json_encode($order);
|
||||
?>
|
||||
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
|
||||
<td><img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
|
||||
<td><span class="text-truncate"><?php echo $order['items'][0]['product']['name']; ?></span></td>
|
||||
<td>
|
||||
<?php
|
||||
if(!empty($order['items'][0]['product']['product_image']))
|
||||
{
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo "https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"; ?>" alt="product">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
<td><span class="text-truncate"><?php echo $order['items'][0]['product']['name']; ?> </span></td>
|
||||
<td><span><?php echo $order['items'][0]['quantity']; ?></span></td>
|
||||
<td><span><?php echo $order['items'][0]['price']; ?></span></td>
|
||||
<td><span><?php echo $order['total_amount'] ?></span></td>
|
||||
|
|
|
@ -532,11 +532,11 @@ if ($_SESSION["isVendor"] == true) {
|
|||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
console.log('Email update successful');
|
||||
console.log('Profile updated Successful');
|
||||
location.reload();
|
||||
// Handle any other actions after the successful email update
|
||||
} else {
|
||||
console.error('Email update failed');
|
||||
console.error('Profile Failed to Upload');
|
||||
// Handle errors or display a message to the user
|
||||
}
|
||||
})
|
||||
|
@ -1253,10 +1253,10 @@ if ($_SESSION["isVendor"] == true) {
|
|||
})
|
||||
.then(secondResponse => {
|
||||
if (secondResponse.ok) {
|
||||
console.log('Second request successful');
|
||||
location.reload();
|
||||
console.log('Image Uploaded Successful');
|
||||
// location.reload();
|
||||
} else {
|
||||
console.error('Second request failed');
|
||||
console.error('Image Failed to Upload');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
@ -1294,7 +1294,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
aria-label="Close">Close</a>
|
||||
</div> -->
|
||||
</form>
|
||||
<button type="button" class="btn btn-primary btn-pill my-3" onclick="editUser()">Upload</button>
|
||||
<button type="button" class="btn btn-primary btn-pill mt-3" onclick="editUser()">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -19,6 +19,11 @@ if ($_SESSION["userId"] <> "") {
|
|||
$_SESSION["isLoggedIn"] = false;
|
||||
header("location: login.php");
|
||||
}
|
||||
|
||||
if ($_SESSION["isCustomer"] == true) {
|
||||
header("location: user-profile.php");
|
||||
}
|
||||
|
||||
$products = productList();
|
||||
?>
|
||||
<!--=========================================================
|
||||
|
@ -65,7 +70,9 @@ $products = productList();
|
|||
<!-- Background css -->
|
||||
<link rel="stylesheet" id="bg-switcher-css" href="assets/css/backgrounds/bg-4.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.metroui.org.ua/current/metro.css">
|
||||
<script src="https://cdn.metroui.org.ua/current/metro.js"></script>
|
||||
|
||||
<style>
|
||||
.pagination {
|
||||
display: flex;
|
||||
|
@ -186,16 +193,28 @@ $products = productList();
|
|||
</div>
|
||||
<div class="ec-vendor-card-body">
|
||||
<div class="ec-vendor-card-table">
|
||||
<table class="table ec-table">
|
||||
<table class="table ec-table"
|
||||
id="order-table"
|
||||
data-role="table"
|
||||
data-pagination="true"
|
||||
data-searching="true"
|
||||
data-filtering="true"
|
||||
data-sorting="true"
|
||||
data-show-rows-steps="5,10,20,-1"
|
||||
data-horizontal-scroll="true"
|
||||
data-rownum="true"
|
||||
data-table-info-title="Display from $1 to $2 of $3 product(s)"
|
||||
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Regular Price</th>
|
||||
<th scope="col">Sale Price</th>
|
||||
<th scope="col">Minimum Order</th>
|
||||
<th scope="col">Stock</th>
|
||||
<th scope="col">Action</th>
|
||||
<th data-sortable="false" scope="col">Image</th>
|
||||
<th data-sortable="true" scope="col">Name</th>
|
||||
<th data-sortable="true" scope="col">Regular Price</th>
|
||||
<th data-sortable="true" scope="col">Sale Price</th>
|
||||
<th data-sortable="true" scope="col">Minimum Order</th>
|
||||
<th data-sortable="true" scope="col">Stock</th>
|
||||
<th data-sortable="true" scope="col" style=" flex-direction:row; width:200px">Action</th>
|
||||
|
||||
|
||||
</tr>
|
||||
|
@ -245,19 +264,22 @@ $products = productList();
|
|||
</td>
|
||||
<td><span style="margin-top:8px;"><?php echo $product['product_name']; ?></span></td>
|
||||
<td><span style="margin-top:8px;"><?php echo $product['regular_price']; ?></span></td>
|
||||
<td><span style="margin-top:8px;"><?php echo $product['sale_price']; ?></span></td>
|
||||
<td><span style="margin-top:8px;"><?php echo $product['minimum_order']; ?></span></td>
|
||||
<td><span style="margin-top:8px;"><?php echo $product['stock']; ?></span></td>
|
||||
<td style="display:flex; justify-content:space-around;">
|
||||
<span style="margin-top:4px;">
|
||||
<input type="checkbox" name="product_checkbox[]" style="width:20px; height:33px; " value="<?php echo $product['_id']; ?>">
|
||||
</span>
|
||||
<span style="margin-top:4px;" onclick="editProduct('<?php echo $product['_id'] ?>');">
|
||||
<a class="mdi mdi-circle-edit-outline" style="font-size:20px;"></a>
|
||||
</span>
|
||||
<span style="margin-top:4px;" onclick="deleteProduct('<?php echo $product['_id'] ?>');">
|
||||
<a class="mdi mdi mdi-delete-outline" style="font-size:20px;"></a>
|
||||
</span>
|
||||
<td><span style="margin-top:8px;"><?php echo !empty($product['sale_price']) ?$product['sale_price']: "N/A"; ?></span></td>
|
||||
<td><span style="margin-top:8px;"><?php echo !empty($product['minimum_order']) ?$product['minimum_order']: "N/A"; ?></span></td>
|
||||
<td><span style="margin-top:8px;"><?php echo !empty($product['stock']) ?$product['stock']: "N/A"; ?></span></td>
|
||||
<td >
|
||||
<div style="display:flex; flex-direction:row; min-width:100px; flex-wrap:nowrap">
|
||||
|
||||
<span style="margin-right: 10px;margin-top:4px; color:blue" onclick="editProduct('<?php echo $product['_id'] ?>');">
|
||||
<a class="mdi mdi-circle-edit-outline" style="font-size:20px; color:blue"></a>
|
||||
</span>
|
||||
<span style="margin-top:4px; margin-right: 10px;color:red" onclick="deleteProduct('<?php echo $product['_id'] ?>');">
|
||||
<a class="mdi mdi mdi-delete-outline" style="font-size:20px; color:red"></a>
|
||||
</span>
|
||||
<span style="margin-top:4px; margin-right: 10px;">
|
||||
<input type="checkbox" name="product_checkbox[]" style="width:20px; height:33px; " value="<?php echo $product['_id']; ?>">
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
@ -268,13 +290,13 @@ $products = productList();
|
|||
</div>
|
||||
</div>
|
||||
<!-- 03-11-2024 Stacy added pagination -->
|
||||
<div class="pagination mt-3">
|
||||
<!-- <div class="pagination mt-3">
|
||||
<?php
|
||||
for ($p = 1; $p <= $totalPages; $p++) {
|
||||
echo "<a href='?page=$p' class='" . ($currentpage == $p ? 'active' : '') . "'>$p</a>";
|
||||
}
|
||||
// for ($p = 1; $p <= $totalPages; $p++) {
|
||||
// echo "<a style='margin-bottom:10px' href='?page=$p' class='" . ($currentpage == $p ? 'active' : '') . "'>$p</a>";
|
||||
// }
|
||||
?>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -665,6 +687,7 @@ $products = productList();
|
|||
<script src="assets/js/vendor/jquery.magnific-popup.min.js"></script>
|
||||
<script src="assets/js/plugins/chart.min.js"></script>
|
||||
<script src="assets/js/plugins/jquery.sticky-sidebar.js"></script>
|
||||
<script src="https://cdn.metroui.org.ua/current/metro.js"></script>
|
||||
|
||||
<!-- Main Js -->
|
||||
<script src="assets/js/chart-main.js"></script>
|
||||
|
|
|
@ -15,6 +15,11 @@ if ($_SESSION["userId"] <> "") {
|
|||
$_SESSION["isLoggedIn"] = false;
|
||||
header("location: login.php");
|
||||
}
|
||||
|
||||
if ($_SESSION["isCustomer"] == true) {
|
||||
header("location: user-profile.php");
|
||||
}
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
$_SESSION['vendorOrderId'] = $_GET['id'];
|
||||
}
|
||||
|
@ -252,11 +257,19 @@ $array = json_decode($result, true);
|
|||
<?php
|
||||
if ($array['status'] === 'TO PAY' || $array['status'] === 'To Pay') {
|
||||
echo '<button type="submit" class="btn btn-primary">To Ship</button>';
|
||||
echo '<button type="button" value="Back" onclick="window.history.back();" class="btn btn-primary mt-3">Back</button>';
|
||||
} elseif ($array['status'] === 'TO SHIP' || $array['status'] === 'To Ship') {
|
||||
echo '<button type="submit" class="btn btn-primary">To Receive</button>';
|
||||
echo '<button type="button" value="Back" onclick="window.history.back();" class="btn btn-primary mt-3">Back</button>';
|
||||
} elseif ($array['status'] === 'TO RECEIVE' || $array['status'] === 'To Receive') {
|
||||
echo '<button type="submit" class="btn btn-primary">Completed</button>';
|
||||
echo '<button type="button" value="Back" onclick="window.history.back();" class="btn btn-primary mt-3">Back</button>';
|
||||
} elseif ($array['status'] === 'COMPLETED' || $array['status'] === 'Completed') {
|
||||
echo '<button type="button" value="Back" onclick="window.history.back();" class="btn btn-primary">Back</button>';
|
||||
} elseif ($array['status'] === 'RETURNED' || $array['status'] === 'Returned') {
|
||||
echo '<button type="button" value="Back" onclick="window.history.back();" class="btn btn-primary">Back</button>';
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -70,14 +70,14 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<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" />
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.metroui.org.ua/current/metro.css">
|
||||
<script src="https://cdn.metroui.org.ua/current/metro.js"></script>
|
||||
<!-- Main Style -->
|
||||
<link rel="stylesheet" href="assets/css/style.css" />
|
||||
<link rel="stylesheet" href="assets/css/responsive.css" />
|
||||
|
||||
<!-- Background css -->
|
||||
<link rel="stylesheet" id="bg-switcher-css" href="assets/css/backgrounds/bg-4.css">
|
||||
|
||||
<style>
|
||||
#pagination {
|
||||
display: flex;
|
||||
|
@ -222,19 +222,30 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</div>
|
||||
</div>
|
||||
<div class="ec-vendor-card-body">
|
||||
<div class="ec-vendor-card-table">
|
||||
<table class="table ec-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Customer Shipping Address</th>
|
||||
<th scope="col">Total</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="orderItemsBody">
|
||||
|
||||
<div class="table-container" >
|
||||
<table class="table striped hovered" id="order-table" style="overflow-x: auto;"
|
||||
data-role="table"
|
||||
data-pagination="true"
|
||||
data-searching="true"
|
||||
data-filtering="true"
|
||||
data-sorting="true"
|
||||
data-show-rows-steps="5,10,20,-1"
|
||||
data-horizontal-scroll="true"
|
||||
data-rownum="true"
|
||||
data-table-info-title="Display from $1 to $2 of $3 order(s)"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-sortable="false">Image</th>
|
||||
<th data-sortable="true">Name</th>
|
||||
<th data-sortable="true">Status</th>
|
||||
<th data-sortable="true">Customer</th>
|
||||
<th data-sortable="true" >Total</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="orderItemsBody">
|
||||
<?php
|
||||
$totalOrders = count($vendorOrders);
|
||||
$displayLimit = 5;
|
||||
|
@ -253,27 +264,66 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
# 03-11-2024 Stacy modified
|
||||
if (isset($orderItems['items'][0]['product']['product_image'])) {
|
||||
?>
|
||||
<img loading="lazy" class="prod-img" src="<?php echo $orderItems['items'][0]['product']['product_image']; ?>" alt="edit" />
|
||||
<img loading="lazy" style="height:50px; width:50px" class="prod-img" src="<?php echo $orderItems['items'][0]['product']['product_image']; ?>" alt="edit" />
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<img loading="lazy" class="prod-img rounded-circle" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/495px-No-Image-Placeholder.svg.png?20200912122019" alt="edit" />
|
||||
<img loading="lazy" style="height:50px; width:50px" class="prod-img rounded-circle" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/495px-No-Image-Placeholder.svg.png?20200912122019" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- <?php
|
||||
if (isset($item['product']['product_image']) && !empty($item['product']['product_image'])) {
|
||||
echo '<img loading="lazy" src="' . $item['product']['product_image'] . '" alt="Product Image" class="prod-img">';
|
||||
echo '<img loading="lazy " style="height:50px; width:50px" src="' . $item['product']['product_image'] . '" alt="Product Image" class="prod-img">';
|
||||
} else {
|
||||
echo '<img loading="lazy" src="assets/img/vendor/u1.jpg" class="prod-img rounded-circle" alt="Placeholder Image">';
|
||||
echo '<img loading="lazy " style="height:50px; width:50px" src="assets/img/vendor/u1.jpg" class="prod-img rounded-circle" alt="Placeholder Image">';
|
||||
}
|
||||
?> -->
|
||||
</td>
|
||||
<td style="max-width:300px;"><span class="text-truncate"><?php echo $item['product']['name']; ?></span></td>
|
||||
<td><span><?php echo $orderItems['status']; ?></span></td>
|
||||
<td><span><?php echo $orderItems['shipping_address']['shipping_first_name']; ?></span></td>
|
||||
<td><span><?php echo $orderItems['total_amount']; ?></span></td>
|
||||
<?php
|
||||
$status = $orderItems['status'];
|
||||
$style = '';
|
||||
$textColor = '';
|
||||
$borderColor = '';
|
||||
|
||||
switch ($status) {
|
||||
case 'TO SHIP':
|
||||
$borderColor = 'mint';
|
||||
$textColor = 'min'; // Change this to match the text color you prefer
|
||||
break;
|
||||
case 'TO PAY':
|
||||
$borderColor = '#E0EA00';
|
||||
$textColor = '#E0EA00';
|
||||
break;
|
||||
case 'TO RECEIVE':
|
||||
$borderColor = '#20FF5A';
|
||||
$textColor = '#20FF5A';
|
||||
break;
|
||||
case 'COMPLETED':
|
||||
$borderColor = '#2098FF';
|
||||
$textColor = '#2098FF'; // Change this to match the text color you prefer
|
||||
break;
|
||||
case 'TO REFUND':
|
||||
$borderColor = '#FF5320';
|
||||
$textColor = '#FF5320';
|
||||
break;
|
||||
default:
|
||||
// Default styles if the status doesn't match any case
|
||||
$borderColor = '#464646';
|
||||
$textColor = '#464646';
|
||||
}
|
||||
|
||||
// Generating style attribute based on the selected colors
|
||||
$style = "display: flex; height: 15px;font-weight:400; width:90px; margin-top:10px; font-size:10px !important; justify-content:center; align-items:center; padding: 10px; border: 3px solid $borderColor; border-radius: 30px; color: $textColor;";
|
||||
|
||||
?>
|
||||
|
||||
<td><span style="<?php echo $style; ?>"> <p><?php echo $status; ?></p></span></td>
|
||||
|
||||
<td><span style="text-transform:capitalize"><?php echo $orderItems['shipping_address']['shipping_first_name']; ?></span></td>
|
||||
<td ><span><?php echo $orderItems['total_amount']; ?></span></td>
|
||||
<td style="display:flex; justify-content:center; margin-top:-4px;">
|
||||
<span onclick="editVendorOrder('<?php echo $orderItems['_id'] ?>');">
|
||||
<a class="mdi mdi-circle-edit-outline" style="font-size: 20px;"></a>
|
||||
|
@ -286,10 +336,26 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- <button id="exportBtn">Export to CSV</button> -->
|
||||
</div>
|
||||
<div id="pagination"></div>
|
||||
<!-- <div id="pagination"></div> -->
|
||||
</div>
|
||||
<script>
|
||||
// Initialize Metro UI components
|
||||
// var tables = document.querySelectorAll('[data-role="table"]');
|
||||
// tables.forEach(function(table) {
|
||||
// new METRO.Table(table);
|
||||
// });
|
||||
// document.getElementById("exportBtn").addEventListener("click", function() {
|
||||
// var table = document.querySelector('#order-table')._metroTable;
|
||||
// table.export('CSV', 'all', 'table-export.csv', {
|
||||
// csvDelimiter: "\t",
|
||||
// csvNewLine: "\r\n",
|
||||
// includeHeader: true
|
||||
// });
|
||||
// });
|
||||
</script>
|
||||
<script>
|
||||
var sessionToken = '<?php echo isset($_SESSION["token"]) ? $_SESSION["token"] : ""; ?>';
|
||||
var email = '<?php echo isset($_SESSION["email"]) ? $_SESSION["email"] : ""; ?>';
|
||||
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
|
||||
|
@ -391,21 +457,22 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
});
|
||||
}
|
||||
|
||||
function createPagination() {
|
||||
const paginationContainer = document.getElementById('pagination');
|
||||
// function createPagination() {
|
||||
// const paginationContainer = document.getElementById('pagination');
|
||||
|
||||
for (let i = 1; i <= totalPages; i++) {
|
||||
// created a tag
|
||||
const pageButton = document.createElement('a');
|
||||
// created class for a tag
|
||||
pageButton.className = "page-btn page-" + i
|
||||
pageButton.textContent = i;
|
||||
pageButton.addEventListener('click', () => showPage(i));
|
||||
paginationContainer.appendChild(pageButton);
|
||||
}
|
||||
}
|
||||
// for (let i = 1; i <= totalPages; i++) {
|
||||
// // created a tag
|
||||
// const pageButton = document.createElement('a');
|
||||
// // created class for a tag
|
||||
// pageButton.className = "page-btn page-" + i
|
||||
// pageButton.style="margin:5px"
|
||||
// pageButton.textContent = i;
|
||||
// pageButton.addEventListener('click', () => showPage(i));
|
||||
// paginationContainer.appendChild(pageButton);
|
||||
// }
|
||||
// }
|
||||
|
||||
createPagination();
|
||||
// createPagination();
|
||||
showPage(1); // Show the first page by default
|
||||
</script>
|
||||
|
||||
|
@ -421,15 +488,25 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</div>
|
||||
<div class="ec-vendor-card-body">
|
||||
<div class="ec-vendor-card-table">
|
||||
<table class="table ec-table">
|
||||
<table class="table ec-table"
|
||||
id="order-table"
|
||||
data-role="table"
|
||||
data-searching="true"
|
||||
data-filtering="true"
|
||||
data-sorting="true"
|
||||
data-show-rows-steps="5,10,20,-1"
|
||||
data-horizontal-scroll="true"
|
||||
data-rownum="true"
|
||||
data-table-info-title="Display from $1 to $2 of $3 product(s)"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Image</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Regular Price</th>
|
||||
<th scope="col">Sale Price</th>
|
||||
<th scope="col">Minimum Order</th>
|
||||
<th scope="col">Stock</th>
|
||||
<th data-sortable="false" scope="col">Image</th>
|
||||
<th data-sortable="true" scope="col">Name</th>
|
||||
<th data-sortable="true" scope="col">Regular Price</th>
|
||||
<th data-sortable="true" scope="col">Sale Price</th>
|
||||
<th data-sortable="true" scope="col">Minimum Order</th>
|
||||
<th data-sortable="true" scope="col">Stock</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -438,7 +515,9 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
$products = productListVendor($vendorId);
|
||||
$totalProducts = count($products);
|
||||
$displayLimit = 5;
|
||||
// for ($i = 0; $i < min($totalProducts, $displayLimit); $i++) {
|
||||
for ($i = 0; $i < min($totalProducts, $displayLimit); $i++) {
|
||||
|
||||
$product = $products[$i];
|
||||
?>
|
||||
<tr>
|
||||
|
@ -470,9 +549,9 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</td>
|
||||
<td style="max-width:300px;"><span class="text-truncate"><?php echo $product['product_name']; ?></span></td>
|
||||
<td><span><?php echo $product['regular_price']; ?></span></td>
|
||||
<td><span><?php echo $product['sale_price']; ?></span></td>
|
||||
<td><span><?php echo $product['minimum_order']; ?></span></td>
|
||||
<td><span><?php echo $product['stock']; ?></span></td>
|
||||
<td><span><?php echo !empty($product['sale_price']) ?$product['sale_price']: "N/A"; ?></span></td>
|
||||
<td><span><?php echo !empty($product['minimum_order']) ?$product['minimum_order']: "N/A";?></span></td>
|
||||
<td><span><?php echo !empty($product['stock']) ?$product['stock']: "0"; ?></span></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
@ -480,7 +559,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="pagination"></div>
|
||||
<!-- <div id="pagination"></div> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- 02-26-2024 Stacy commented out -->
|
||||
|
@ -847,7 +926,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<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>
|
||||
|
||||
<script src="https://cdn.metroui.org.ua/current/metro.js"></script>
|
||||
<!--Plugins JS-->
|
||||
<script src="assets/js/plugins/swiper-bundle.min.js"></script>
|
||||
<script src="assets/js/plugins/nouislider.js"></script>
|
||||
|
|
|
@ -74,7 +74,7 @@ $products = productList();
|
|||
text-decoration: none;
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #ccc;
|
||||
/* margin: 0 5px; */
|
||||
margin: 0 5px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,8 @@ $products = productList();
|
|||
<a href="catalog-single-vendor.php?id=<?php echo $vendor['_id'] ?>">
|
||||
<h6>Seller since</h6>
|
||||
</a>
|
||||
<p><?php echo $vendor['date_registered']; ?></p>
|
||||
<!-- <p><?php echo $vendor['date_registered']; ?></p> -->
|
||||
<p><?php echo date('F j, Y', strtotime($vendor['date_registered'])); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -417,7 +418,7 @@ $products = productList();
|
|||
<!-- Modal end -->
|
||||
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<!-- <div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
<div class="ec-nav-panel">
|
||||
<div class="ec-nav-panel-icons">
|
||||
|
@ -438,7 +439,7 @@ $products = productList();
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- raymart remove popup feb 20 2024 -->
|
||||
|
|
|
@ -70,6 +70,8 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<link rel="stylesheet" href="assets/css/style2.css" />
|
||||
<link rel="stylesheet" href="assets/css/responsive.css" />
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.metroui.org.ua/current/metro.css">
|
||||
<script src="https://cdn.metroui.org.ua/current/metro.js"></script>
|
||||
<!-- Background css -->
|
||||
<link rel="stylesheet" id="bg-switcher-css" href="assets/css/backgrounds/bg-4.css">
|
||||
<style>
|
||||
|
@ -206,15 +208,26 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<div id="payments" class="tab-content active">
|
||||
|
||||
<!-- Gelo added vendor payments tab -->
|
||||
<table class="table ec-table">
|
||||
<table class="table ec-table"
|
||||
id="order-table" style="overflow-x: auto;"
|
||||
data-role="table"
|
||||
data-pagination="true"
|
||||
data-searching="true"
|
||||
data-filtering="true"
|
||||
data-sorting="true"
|
||||
data-show-rows-steps="5,10,20,-1"
|
||||
data-horizontal-scroll="true"
|
||||
data-rownum="true"
|
||||
data-table-info-title="Display from $1 to $2 of $3 payment(s)"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Payment Method</th>
|
||||
<th scope="col">Amount</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Date Created</th>
|
||||
<th scope="col">Action</th>
|
||||
<th data-sortable="true" scope="col">Payment Method</th>
|
||||
<th data-sortable="true" scope="col">Amount</th>
|
||||
<th data-sortable="true" scope="col">Status</th>
|
||||
<th data-sortable="true" scope="col">Description</th>
|
||||
<th data-sortable="true" scope="col">Date Created</th>
|
||||
<th data-sortable="true" scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="paymentsTableBody">
|
||||
|
@ -250,7 +263,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="pagination"></div>
|
||||
<!-- <div id="pagination"></div> -->
|
||||
|
||||
|
||||
<script>
|
||||
|
@ -286,21 +299,21 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
});
|
||||
}
|
||||
|
||||
function createPagination() {
|
||||
const paginationContainer = document.getElementById('pagination');
|
||||
// function createPagination() {
|
||||
// const paginationContainer = document.getElementById('pagination');
|
||||
|
||||
for (let i = 1; i <= totalPages; i++) {
|
||||
// created a tag
|
||||
const pageButton = document.createElement('a');
|
||||
// created class for a tag
|
||||
pageButton.className = "page-btn page-" + i
|
||||
pageButton.textContent = i;
|
||||
pageButton.addEventListener('click', () => showPage(i));
|
||||
paginationContainer.appendChild(pageButton);
|
||||
}
|
||||
}
|
||||
// for (let i = 1; i <= totalPages; i++) {
|
||||
// // created a tag
|
||||
// const pageButton = document.createElement('a');
|
||||
// // created class for a tag
|
||||
// pageButton.className = "page-btn page-" + i
|
||||
// pageButton.textContent = i;
|
||||
// pageButton.addEventListener('click', () => showPage(i));
|
||||
// paginationContainer.appendChild(pageButton);
|
||||
// }
|
||||
// }
|
||||
|
||||
createPagination();
|
||||
// createPagination();
|
||||
showPage(1); // Show the first page by default
|
||||
</script>
|
||||
<script>
|
||||
|
@ -885,6 +898,8 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<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.metroui.org.ua/current/metro.js"></script>
|
||||
<script>
|
||||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
||||
|
|
|
@ -211,9 +211,16 @@ $vendorPayoutData = json_decode($response, true);
|
|||
$vendorResponse = getVendorbyId($vendorId);
|
||||
$vendorInformation = json_decode($vendorResponse, true);
|
||||
$bankAccountNumber = $vendorInformation['bank_acount_details'][0]['bank_account_number'];
|
||||
$bankDetails = $vendorInformation['bank_acount_details'];
|
||||
foreach ($bankDetails as $details) {
|
||||
if ($details['bank_payout'] === true) {
|
||||
$bankName = $details['bank_name'];
|
||||
$bankAccountNumber = $details['bank_account_number'];
|
||||
}
|
||||
}
|
||||
$bankNumEnding = substr($bankAccountNumber, -3);
|
||||
?>
|
||||
Receipient: Philippine National Bank (PNB) Account ending in <?php echo $bankNumEnding?>
|
||||
Receipient: <?php echo $bankName; ?> Account ending in <?php echo $bankNumEnding?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -419,7 +419,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="addressContact" class="text-dark font-weight-medium pt-3 mb-2">Contact Number</label>
|
||||
<input type="number" class="form-control" id="addressContact">
|
||||
<input type="text" class="form-control" id="addressContact" value="+63 " oninput="preventErasePrefix(this)">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="addressBuilding" class="text-dark font-weight-medium pt-3 mb-2"> Building,Number </label>
|
||||
|
@ -449,7 +449,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="addressCountry" class="text-dark font-weight-medium pt-3 mb-2">Country</label>
|
||||
<input type="text" class="form-control" id="addressCountry">
|
||||
<input type="text" class="form-control" id="addressCountry" value="Philippines">
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary mt-4" id="submitBtn">Submit</button>
|
||||
|
||||
|
@ -486,7 +486,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<div class="form-group">
|
||||
|
||||
<label for="addressContact" class="text-dark font-weight-medium pt-3 mb-2">Contact Number</label>
|
||||
<input type="text" class="form-control" id="addressContact2" value="<?php echo $address['phone']; ?>">
|
||||
<input type="text" class="form-control" id="addressContact2" value="<?php echo $address['phone']; ?>" oninput="preventEraseThePrefix(this)">
|
||||
|
||||
|
||||
<!-- <label for="addressContact" class="text-dark font-weight-medium pt-3 mb-2">Contact Number</label>
|
||||
|
@ -597,7 +597,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bankAccountNumber" class="text-dark font-weight-medium pt-3 mb-2">Bank Account Number</label>
|
||||
<input type="text" class="form-control" id="bankAccountNumber">
|
||||
<input type="number" class="form-control" id="bankAccountNumber">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bankAccountName" class="text-dark font-weight-medium pt-3 mb-2">Bank Account Name</label>
|
||||
|
@ -612,6 +612,55 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function preventErasePrefix(input) { /* secondmodal */
|
||||
|
||||
var numericValue = input.value.replace(/\D/g, '');
|
||||
if (numericValue.startsWith('63')) {
|
||||
input.value = "+63 " + numericValue.substring(2);
|
||||
} else {
|
||||
input.value = "+63 " + numericValue;
|
||||
}
|
||||
|
||||
if (input.value.length > 14) {
|
||||
input.value = input.value.slice(0, 14);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function preventEraseThePrefix(input) { /* thirdmodal */
|
||||
|
||||
var numericValue = input.value.replace(/\D/g, '');
|
||||
if (numericValue.startsWith('63')) {
|
||||
input.value = "+63 " + numericValue.substring(2);
|
||||
} else {
|
||||
input.value = "+63 " + numericValue;
|
||||
}
|
||||
|
||||
if (input.value.length > 14) {
|
||||
input.value = input.value.slice(0, 14);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function preventEraseInPrefix(input) { /* edit details */
|
||||
|
||||
var numericValue = input.value.replace(/\D/g, '');
|
||||
if (numericValue.startsWith('63')) {
|
||||
input.value = "+63 " + numericValue.substring(2);
|
||||
} else {
|
||||
input.value = "+63 " + numericValue;
|
||||
}
|
||||
|
||||
if (input.value.length > 14) {
|
||||
input.value = input.value.slice(0, 14);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function editUser() {
|
||||
// var fileInput = document.getElementById('fileInput' + vendorId);
|
||||
|
@ -640,11 +689,11 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
console.log('Email update successful');
|
||||
console.log('Profile updated successful');
|
||||
location.reload();
|
||||
// Handle any other actions after the successful email update
|
||||
} else {
|
||||
console.error('Email update failed');
|
||||
console.error('Profile failed to update');
|
||||
// Handle errors or display a message to the user
|
||||
}
|
||||
})
|
||||
|
@ -1492,10 +1541,10 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
})
|
||||
.then(secondResponse => {
|
||||
if (secondResponse.ok) {
|
||||
console.log('Second request successful');
|
||||
location.reload();
|
||||
console.log('Profile Image Uploaded Successful');
|
||||
// location.reload();
|
||||
} else {
|
||||
console.error('Second request failed');
|
||||
console.error('Profile Image Failed to Upload');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
@ -1585,10 +1634,10 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
})
|
||||
.then(secondResponse => {
|
||||
if (secondResponse.ok) {
|
||||
console.log('Second request successful');
|
||||
location.reload();
|
||||
console.log('Profile Banner Uploaded Successful');
|
||||
// location.reload();
|
||||
} else {
|
||||
console.error('Second request failed');
|
||||
console.error('Profile Banner Failed to Upload');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
@ -1625,7 +1674,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="cphone-" class="text-dark font-weight-medium pt-3 mb-2">Contact Number</label>
|
||||
<input type="text" class="form-control" id="cphone-" value="<?php echo $vendorData['phone'] ?>">
|
||||
<input type="text" class="form-control" id="cphone-" value="<?php echo $vendorData['phone'] ?>" oninput="preventEraseInPrefix(this)">
|
||||
</div>
|
||||
<!-- 02-23-2023 Jun Jihad Vendor Description Field-->
|
||||
<div class="form-group">
|
||||
|
@ -1651,7 +1700,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<!-- Modal end -->
|
||||
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<!-- <div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
<div class="ec-nav-panel">
|
||||
<div class="ec-nav-panel-icons">
|
||||
|
@ -1672,7 +1721,7 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
<!-- raymart remove popup feb 20 2024 -->
|
||||
|
|
|
@ -379,7 +379,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
if (xhr.status === 0) {
|
||||
if (xhr.status === 200) {
|
||||
console.log('Products removed successfully');
|
||||
location.reload();
|
||||
} else {
|
||||
|
@ -527,7 +527,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
|
||||
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<!-- <div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
<div class="ec-nav-panel">
|
||||
<div class="ec-nav-panel-icons">
|
||||
|
@ -549,7 +549,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue