Compare commits

..

12 Commits

20 changed files with 1289 additions and 1308 deletions

View File

@ -81,7 +81,7 @@ if ($_SESSION["isLoggedIn"] == true and $_SESSION["user_type"] == "admin"){
<?php
}
?>
<form action="../login_action.php" method="post">
<form action="login_action_admin.php" method="post">
<div class="mb-3 mt-3">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" name="name">

View File

@ -0,0 +1,41 @@
<?php
include "../functions.php";
$url = $_SESSION["url"];
$_SESSION["email"] = $_POST["name"];
$_SESSION["password"] = $_POST["password"];
$result = login($_SESSION["email"],$_SESSION["password"]);
if ($result) {
$_SESSION["token"] = $result;
$result = profile($_SESSION["token"]);
$_SESSION["userId"] = $result["profile"]["userId"];
$_SESSION["user_type"] = $result["user_type"];
$result = customerExists($_SESSION["email"]);
if ($result > 0) {
$_SESSION["isCustomer"] = true;
}
$result = vendorExists($_SESSION["email"]);
if ($result > 0) {
$_SESSION["isVendor"] = true;
}
header("location: index.php");
} else {
// $_SESSION["loginError"] = "Invalid email or password. Please try again.";
header("location: login.php?error=1");
}
// $_SESSION["token"] = $result;
// $result = profile($_SESSION["token"]);
// $_SESSION["userId"] = $result["profile"]["userId"];
// $result = customerExists($_SESSION["email"]);
// if($result>0){
// $_SESSION["isCustomer"] = true;
// }
// $result = vendorExists($_SESSION["email"]);
// if($result>0){
// $_SESSION["isVendor"] = true;
// }
// header("location: $url")
?>

View File

@ -55,814 +55,14 @@ $allorders = json_encode($orders, true);
<div class="wrapper">
<!-- LEFT MAIN SIDEBAR -->
<div class="ec-left-sidebar ec-bg-sidebar">
<div id="sidebar" class="sidebar ec-sidebar-footer">
<div class="ec-brand">
<a href="index.php" title="Ekka">
<img class="ec-brand-icon" src="assets/img/logo/ec-site-logo.png" alt="" />
<span class="ec-brand-name text-truncate">Ekka</span>
</a>
</div>
<!-- begin sidebar scrollbar -->
<div class="ec-navigation" data-simplebar>
<!-- sidebar menu -->
<ul class="nav sidebar-inner" id="sidebar-menu">
<!-- Dashboard -->
<li>
<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 class="has-sub">
<a class="sidenav-item-link" href="javascript:void(0)">
<i class="mdi mdi-account-group-outline"></i>
<span class="nav-text">Vendors</span> <b class="caret"></b>
</a>
<div class="collapse">
<ul class="sub-menu" id="vendors" data-parent="#sidebar-menu">
<li class="">
<a class="sidenav-item-link" href="vendor-card.html">
<span class="nav-text">Vendor Grid</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="vendor-list.html">
<span class="nav-text">Vendor List</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="vendor-profile.html">
<span class="nav-text">Vendors Profile</span>
</a>
</li>
</ul>
</div>
</li>
<!-- Users -->
<li class="has-sub">
<a class="sidenav-item-link" href="javascript:void(0)">
<i class="mdi mdi-account-group"></i>
<span class="nav-text">Users</span> <b class="caret"></b>
</a>
<div class="collapse">
<ul class="sub-menu" id="users" data-parent="#sidebar-menu">
<li>
<a class="sidenav-item-link" href="user-card.html">
<span class="nav-text">User Grid</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="user-list.html">
<span class="nav-text">User List</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="user-profile.html">
<span class="nav-text">Users Profile</span>
</a>
</li>
</ul>
</div>
<hr>
</li>
<!-- Category -->
<li class="has-sub">
<a class="sidenav-item-link" href="javascript:void(0)">
<i class="mdi mdi-dns-outline"></i>
<span class="nav-text">Categories</span> <b class="caret"></b>
</a>
<div class="collapse">
<ul class="sub-menu" id="categorys" data-parent="#sidebar-menu">
<li class="">
<a class="sidenav-item-link" href="main-category.html">
<span class="nav-text">Main Category</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="sub-category.html">
<span class="nav-text">Sub Category</span>
</a>
</li>
</ul>
</div>
</li>
<!-- Products -->
<li class="has-sub">
<a class="sidenav-item-link" href="javascript:void(0)">
<i class="mdi mdi-palette-advanced"></i>
<span class="nav-text">Products</span> <b class="caret"></b>
</a>
<div class="collapse">
<ul class="sub-menu" id="products" data-parent="#sidebar-menu">
<li class="">
<a class="sidenav-item-link" href="product-add.html">
<span class="nav-text">Add Product</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="product-list.html">
<span class="nav-text">List Product</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="product-grid.html">
<span class="nav-text">Grid Product</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="product-detail.html">
<span class="nav-text">Product Detail</span>
</a>
</li>
</ul>
</div>
</li>
<!-- Orders -->
<li class="has-sub active expand">
<a class="sidenav-item-link" href="javascript:void(0)">
<i class="mdi mdi-cart"></i>
<span class="nav-text">Orders</span> <b class="caret"></b>
</a>
<div class="collapse show">
<ul class="sub-menu" id="orders" data-parent="#sidebar-menu">
<li class="">
<a class="sidenav-item-link" href="new-order.html">
<span class="nav-text">New Order</span>
</a>
</li>
<li class="active">
<a class="sidenav-item-link" href="order-history.html">
<span class="nav-text">Order History</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="order-detail.html">
<span class="nav-text">Order Detail</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="invoice.html">
<span class="nav-text">Invoice</span>
</a>
</li>
</ul>
</div>
</li>
<!-- Reviews -->
<li>
<a class="sidenav-item-link" href="review-list.html">
<i class="mdi mdi-star-half"></i>
<span class="nav-text">Reviews</span>
</a>
</li>
<!-- Brands -->
<li>
<a class="sidenav-item-link" href="brand-list.html">
<i class="mdi mdi-tag-faces"></i>
<span class="nav-text">Brands</span>
</a>
<hr>
</li>
<!-- Authentication -->
<li class="has-sub">
<a class="sidenav-item-link" href="javascript:void(0)">
<i class="mdi mdi-login"></i>
<span class="nav-text">Authentication</span> <b class="caret"></b>
</a>
<div class="collapse">
<ul class="sub-menu" id="authentication" data-parent="#sidebar-menu">
<li class="">
<a href="sign-in.html">
<span class="nav-text">Sign In</span>
</a>
</li>
<li class="">
<a href="sign-up.html">
<span class="nav-text">Sign Up</span>
</a>
</li>
</ul>
</div>
</li>
<!-- Icons -->
<li class="has-sub">
<a class="sidenav-item-link" href="javascript:void(0)">
<i class="mdi mdi-diamond-stone"></i>
<span class="nav-text">Icons</span> <b class="caret"></b>
</a>
<div class="collapse">
<ul class="sub-menu" id="icons" data-parent="#sidebar-menu">
<li class="">
<a class="sidenav-item-link" href="material-icon.html">
<span class="nav-text">Material Icon</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="font-awsome-icons.html">
<span class="nav-text">Font Awsome Icon</span>
</a>
</li>
<li class="">
<a class="sidenav-item-link" href="flag-icon.html">
<span class="nav-text">Flag Icon</span>
</a>
</li>
</ul>
</div>
</li>
<!-- Other Pages -->
<li class="has-sub">
<a class="sidenav-item-link" href="javascript:void(0)">
<i class="mdi mdi-image-filter-none"></i>
<span class="nav-text">Other Pages</span> <b class="caret"></b>
</a>
<div class="collapse">
<ul class="sub-menu" id="otherpages" data-parent="#sidebar-menu">
<li class="has-sub">
<a href="404.html">404 Page</a>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
<?php include 'left-main-sidebar.php' ?>
<!-- PAGE WRAPPER -->
<div class="ec-page-wrapper">
<!-- Header -->
<header class="ec-main-header" id="header">
<nav class="navbar navbar-static-top navbar-expand-lg">
<!-- Sidebar toggle button -->
<button id="sidebar-toggler" class="sidebar-toggle"></button>
<!-- search form -->
<div class="search-form d-lg-inline-block">
<div class="input-group">
<input type="text" name="query" id="search-input" class="form-control" placeholder="search.." autofocus autocomplete="off" />
<button type="button" name="search" id="search-btn" class="btn btn-flat">
<i class="mdi mdi-magnify"></i>
</button>
</div>
<div id="search-results-container">
<ul id="search-results"></ul>
</div>
</div>
<!-- navbar right -->
<div class="navbar-right">
<ul class="nav navbar-nav">
<!-- User Account -->
<li class="dropdown user-menu">
<button class="dropdown-toggle nav-link ec-drop" data-bs-toggle="dropdown" aria-expanded="false">
<img src="assets/img/user/user.png" class="user-image" alt="User Image" />
</button>
<ul class="dropdown-menu dropdown-menu-right ec-dropdown-menu">
<!-- User image -->
<li class="dropdown-header">
<img src="assets/img/user/user.png" class="img-circle" alt="User Image" />
<div class="d-inline-block">
John Deo <small class="pt-1">john.example@gmail.com</small>
</div>
</li>
<li>
<a href="user-profile.html">
<i class="mdi mdi-account"></i> My Profile
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-email"></i> Message
</a>
</li>
<li>
<a href="#"> <i class="mdi mdi-diamond-stone"></i> Projects </a>
</li>
<li class="right-sidebar-in">
<a href="javascript:0"> <i class="mdi mdi-settings-outline"></i> Setting </a>
</li>
<li class="dropdown-footer">
<a href="index.php"> <i class="mdi mdi-logout"></i> Log Out </a>
</li>
</ul>
</li>
<li class="dropdown notifications-menu custom-dropdown">
<button class="dropdown-toggle notify-toggler custom-dropdown-toggler">
<i class="mdi mdi-bell-outline"></i>
</button>
<div class="card card-default dropdown-notify dropdown-menu-right mb-0">
<div class="card-header card-header-border-bottom px-3">
<h2>Notifications</h2>
</div>
<div class="card-body px-0 py-0">
<ul class="nav nav-tabs nav-style-border p-0 justify-content-between" id="myTab" role="tablist">
<li class="nav-item mx-3 my-0 py-0">
<a href="#" class="nav-link active pb-3" id="home2-tab" data-bs-toggle="tab" data-bs-target="#home2" role="tab" aria-controls="home2" aria-selected="true">All (10)</a>
</li>
<li class="nav-item mx-3 my-0 py-0">
<a href="#" class="nav-link pb-3" id="profile2-tab" data-bs-toggle="tab" data-bs-target="#profile2" role="tab" aria-controls="profile2" aria-selected="false">Msgs (5)</a>
</li>
<li class="nav-item mx-3 my-0 py-0">
<a href="#" class="nav-link pb-3" id="contact2-tab" data-bs-toggle="tab" data-bs-target="#contact2" role="tab" aria-controls="contact2" aria-selected="false">Others (5)</a>
</li>
</ul>
<div class="tab-content" id="myTabContent3">
<div class="tab-pane fade show active" id="home2" role="tabpanel" aria-labelledby="home2-tab">
<ul class="list-unstyled" data-simplebar style="height: 360px">
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="position-relative mr-3">
<img class="rounded-circle" src="assets/img/user/u2.jpg" alt="Image">
<span class="status away"></span>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Nitin</h4>
<p class="last-msg">Lorem ipsum dolor sit, amet
consectetur adipisicing elit. Nam itaque
doloremque odio, eligendi delectus vitae.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 30 min
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification media-active">
<div class="position-relative mr-3">
<img class="rounded-circle" src="assets/img/user/u1.jpg" alt="Image">
<span class="status active"></span>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Lovina</h4>
<p class="last-msg">Donec mattis augue a nisl
consequat, nec imperdiet ex rutrum. Fusce et
vehicula enim. Sed in enim eu odio vehic.</p>
<span class="font-size-12 font-weight-medium text-white">
<i class="mdi mdi-clock-outline"></i> Just
now...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="position-relative mr-3">
<img class="rounded-circle" src="assets/img/user/u5.jpg" alt="Image">
<span class="status away"></span>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Crinali</h4>
<p class="last-msg">Lorem ipsum dolor sit, amet
consectetur adipisicing elit. Nam itaque
doloremque odio, eligendi delectus vitae.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 1 hrs
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification event-active">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-info text-white">
<i class="mdi mdi-calendar-check font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Upcomming event added</h4>
<p class="last-msg font-size-14">03/Jan/2020 (1pm -
2pm)</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 10 min
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-warning text-white">
<i class="mdi mdi-chart-areaspline font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Yearly Sales report</h4>
<p class="last-msg font-size-14">Lorem ipsum dolor
sit, amet consectetur adipisicing elit. Nam
itaque doloremque odio, eligendi delectus vitae.
</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 1 hrs
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-primary text-white">
<i class="mdi mdi-account-multiple-check font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">New request</h4>
<p class="last-msg font-size-14">Add Dany Jones as
your contact consequat nec imperdiet ex rutrum.
Fusce et vehicula enim. Sed in enim.</p>
<span class="my-1 btn btn-sm btn-success">Accept</span>
<span class="my-1 btn btn-sm btn-secondary">Delete</span>
<span class="font-size-12 font-weight-medium text-secondary d-block">
<i class="mdi mdi-clock-outline"></i> 5 min
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-danger text-white">
<i class="mdi mdi-server-network-off font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Server overloaded</h4>
<p class="last-msg font-size-14">Donec mattis augue
a nisl consequat, nec imperdiet ex rutrum. Fusce
et vehicula enim. Sed in enim eu odio vehic.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 30 min
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-purple text-white">
<i class="mdi mdi-playlist-check font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Task complete</h4>
<p class="last-msg font-size-14">Nam ut nisi erat.
Ut quis tortor varius, hendrerit arcu quis,
congue nisl. In scelerisque, sem ut ve.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 2 hrs
ago...
</span>
</div>
</div>
</a>
</li>
</ul>
</div>
<div class="tab-pane fade" id="profile2" role="tabpanel" aria-labelledby="profile2-tab">
<ul class="list-unstyled" data-simplebar style="height: 360px">
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="position-relative mr-3">
<img class="rounded-circle" src="assets/img/user/u6.jpg" alt="Image">
<span class="status away"></span>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Hardiko</h4>
<p class="last-msg">Donec mattis augue a nisl
consequat, nec imperdiet ex rutrum. Fusce et
vehicula enim. Sed in enim eu odio vehic.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 1 hrs
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="position-relative mr-3">
<img class="rounded-circle" src="assets/img/user/u7.jpg" alt="Image">
<span class="status away"></span>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Browin</h4>
<p class="last-msg">Nam ut nisi erat. Ut quis tortor
varius, hendrerit arcu quis, congue nisl. In
scelerisque, sem ut ve.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 1 hrs
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification media-active">
<div class="position-relative mr-3">
<img class="rounded-circle" src="assets/img/user/u1.jpg" alt="Image">
<span class="status active"></span>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">jenelia</h4>
<p class="last-msg">Donec mattis augue a nisl
consequat, nec imperdiet ex rutrum. Fusce et
vehicula enim. Sed in enim eu odio vehic.</p>
<span class="font-size-12 font-weight-medium text-white">
<i class="mdi mdi-clock-outline"></i> Just
now...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="position-relative mr-3">
<img class="rounded-circle" src="assets/img/user/u2.jpg" alt="Image">
<span class="status away"></span>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Bhavlio</h4>
<p class="last-msg">Lorem ipsum dolor sit, amet
consectetur adipisicing elit. Nam itaque
doloremque odio, eligendi delectus vitae.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 1 hrs
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="position-relative mr-3">
<img class="rounded-circle" src="assets/img/user/u5.jpg" alt="Image">
<span class="status away"></span>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Browini</h4>
<p class="last-msg">Lorem ipsum dolor sit, amet
consectetur adipisicing elit. Nam itaque
doloremque odio, eligendi delectus vitae.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 1 hrs
ago...
</span>
</div>
</div>
</a>
</li>
</ul>
</div>
<div class="tab-pane fade" id="contact2" role="tabpanel" aria-labelledby="contact2-tab">
<ul class="list-unstyled" data-simplebar style="height: 360px">
<li>
<a href="javscript:void(0)" class="media media-message media-notification event-active">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-info text-white">
<i class="mdi mdi-calendar-check font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Upcomming event added</h4>
<p class="last-msg font-size-14">03/Jan/2020 (1pm -
2pm)</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 10 min
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-warning text-white">
<i class="mdi mdi-chart-areaspline font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">New Sales report</h4>
<p class="last-msg font-size-14">Lorem ipsum dolor
sit, amet consectetur adipisicing elit. Nam
itaque doloremque odio, eligendi delectus vitae.
</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 1 hrs
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-primary text-white">
<i class="mdi mdi-account-multiple-check font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">New Request</h4>
<p class="last-msg font-size-14">Add Dany Jones as
your contact consequat nec imperdiet ex rutrum.
Fusce et vehicula enim. Sed in enim.</p>
<span class="my-1 btn btn-sm btn-success">Accept</span>
<span class="my-1 btn btn-sm btn-secondary">Delete</span>
<span class="font-size-12 font-weight-medium text-secondary d-block">
<i class="mdi mdi-clock-outline"></i> 5 min
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-danger text-white">
<i class="mdi mdi-server-network-off font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">Server overloaded</h4>
<p class="last-msg font-size-14">Donec mattis augue
a nisl consequat, nec imperdiet ex rutrum. Fusce
et vehicula enim. Sed in enim eu odio vehic.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 30 min
ago...
</span>
</div>
</div>
</a>
</li>
<li>
<a href="javscript:void(0)" class="media media-message media-notification">
<div class="d-flex rounded-circle align-items-center justify-content-center mr-3 media-icon iconbox-45 bg-purple text-white">
<i class="mdi mdi-playlist-check font-size-20"></i>
</div>
<div class="media-body d-flex justify-content-between">
<div class="message-contents">
<h4 class="title">New Task complete</h4>
<p class="last-msg font-size-14">Nam ut nisi erat.
Ut quis tortor varius, hendrerit arcu quis,
congue nisl. In scelerisque, sem ut ve.</p>
<span class="font-size-12 font-weight-medium text-secondary">
<i class="mdi mdi-clock-outline"></i> 2 hrs
ago...
</span>
</div>
</div>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<ul class="dropdown-menu dropdown-menu-right d-none">
<li class="dropdown-header">You have 5 notifications</li>
<li>
<a href="#">
<i class="mdi mdi-account-plus"></i> New user registered
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 10 AM</span>
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-account-remove"></i> User deleted
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 07 AM</span>
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-chart-areaspline"></i> Sales report is ready
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 12 PM</span>
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-account-supervisor"></i> New client
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 10 AM</span>
</a>
</li>
<li>
<a href="#">
<i class="mdi mdi-server-network-off"></i> Server overloaded
<span class=" font-size-12 d-inline-block float-right"><i class="mdi mdi-clock-outline"></i> 05 AM</span>
</a>
</li>
<li class="dropdown-footer">
<a class="text-center" href="#"> View All </a>
</li>
</ul>
</li>
<li class="right-sidebar-in right-sidebar-2-menu">
<i class="mdi mdi-settings-outline mdi-spin"></i>
</li>
</ul>
</div>
</nav>
</header>
<?php include 'header.php' ?>
<!-- CONTENT WRAPPER -->
<div class="ec-content-wrapper">

11
admin/token-renew.php Normal file
View File

@ -0,0 +1,11 @@
<?php
include "../functions.php";
$token = loginRenew($_SESSION["email"], $_SESSION["password"], $_SESSION["token"]);
$_SESSION["token"] = $token;
header("Location: vendor-profile.php");
exit;
?>

View File

@ -65,21 +65,20 @@ foreach ($vendorPayouts as $payout) {
}
}
$token = $_SESSION["token"];
if (isset($_SESSION["token"])) {
$token = $_SESSION["token"];
$token_parts = explode(".", $token);
$token_payload = base64_decode($token_parts[1]);
$token_data = json_decode($token_payload);
$token_parts = explode(".", $token);
$token_payload = base64_decode($token_parts[1]);
$token_data = json_decode($token_payload);
$issued_at_time = $token_data->iat;
$expiration_time = $token_data->exp;
$renewal_time = $issued_at_time + 3300;
$expiration_time = $token_data->exp;
$issued_at_time = $token_data->iat;
$renewal_time = $issued_at_time + 3300;
if (time() >= $renewal_time) {
$token = loginRenew($_SESSION["email"], $_SESSION["password"], $token);
$_SESSION["token"] = $token;
if (time() >= $renewal_time || time() >= $expiration_time) {
header("Location: token-renew.php");
exit;
}
}
// $token = loginRenew($_SESSION["email"], $_SESSION["password"], $token);
// $_SESSION["token"] = $token;
@ -115,6 +114,23 @@ if (time() >= $renewal_time) {
<!-- FAVICON -->
<link href="assets/img/favicon.png" rel="shortcut icon" />
<script>
function renewToken() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "token-renew.php", true);
xhr.send();
}
setInterval(function() {
var currentTime = <?php echo time(); ?>;
var renewalTime = <?php echo $renewal_time; ?>;
var expirationTime = <?php echo $expiration_time; ?>;
if (currentTime >= renewalTime || currentTime >= expirationTime) {
renewToken();
}
}, 60000);
</script>
</head>
<body class="ec-header-fixed ec-sidebar-fixed ec-sidebar-dark ec-header-light" id="body">
@ -397,7 +413,7 @@ if (time() >= $renewal_time) {
created_by: "Sample User",
};
fetch('https://api.obanana.shop/api/v1/payouts/', {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/payouts/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@ -416,7 +432,7 @@ if (time() >= $renewal_time) {
console.log('Payout created successfully');
selectedOrders.forEach(order => {
var orderId = order.orderId;
fetch(`https://api.obanana.shop/api/v1/orders/${orderId}`, {
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',

View File

@ -229,7 +229,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr id="cart_order_<?php echo $order['_id'] ?>">
<td data-label="Product" class="ec-cart-pro-name"><a href="shop-left-sidebar-col-4.php"><img 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 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;">
@ -291,6 +291,11 @@ if ($_SESSION["userId"] <> "") {
} else {
console.log('herreeeee')
var newQuantity = parseInt(qtyInputCart.value) + 1;
qtyInput.value = newQuantity;
qtyInputCart.value = newQuantity;
updateQuantityCart(orderId, itemId, newQuantity, isFloat);
}
} else {

View File

@ -346,8 +346,8 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
<div class="ec-page-description p-30">
<h5 class="ec-desc-title">About Our Firm</h5>
<!-- raymart replace the vendor descript march 8 2024 -->
<?php if (!empty($vendorData['vendor_description'])): ?>
<p><?php echo $vendorData['vendor_description']; ?></p>
<?php if (!empty($vendor['vendor_description'])): ?>
<p><?php echo $vendor['vendor_description']; ?></p>
<?php else: ?>
<p>No description available.</p>
<?php endif; ?>

View File

@ -162,10 +162,15 @@
<div class="ec-login-form">
<?php
if (isset($_SESSION["forgotPasswordError"])) {
echo '<div class="alert alert-danger" role="alert">';
echo '<div class="alert alert-danger" id="alertDanger" style="background:#FFCCCB; role="alert">';
echo $_SESSION["forgotPasswordError"];
echo '</div>';
unset($_SESSION["forgotPasswordError"]);
echo " <script>
setTimeout(function() {
document.getElementById('alertDanger').style.display = 'none';
}, 10000);
</script>";
}
?>
<form action="forgot_password_action.php" method="post">

View File

@ -1,13 +1,23 @@
<?php
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
// $customerData = json_decode($customer_data, true);
// $customer_data = getCustomerbyLoginId($_SESSION["userId"]);
$vendorLoginId = searchVendorbyLoginId($_SESSION["userId"]);
$vendorLoginIdjson = json_decode($vendorLoginId, true);
// var_dump( $vendorLoginIdjson);
if (isset($vendorLoginIdjson['results'][0])) {
$vendorData = $vendorLoginIdjson['results'][0];
$vendorId = $vendorData['_id'];
$_SESSION["LoggedInVendorId"] = $vendorId;
}
if (empty($vendorLoginId)) {
$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
}
} else {
$_SESSION["isLoggedIn"] = false;
}
$_SESSION["isLoggedIn"] = false;
}
?>
<?php ?>
@ -163,9 +173,11 @@ if ($_SESSION["userId"] <> "") {
<!-- <button class="text-upper" onclick="displayPopup()">Download App <i aria-hidden="true"></i></button> -->
<?php if(isset($customer_data)) { ?>
<button style="cursor:default;">Hi <span class="text-upper"><?php echo $customer_data[0]['first_name'] ?>!</span></button>
<?php } else { ?>
<?php } else if (isset($vendorData)) {?>
<button style="cursor:default;">Hi <span class="text-upper"><?php echo ($vendorData['user_login']) ?>!</span></button>
<?php } else {?>
<button class="text-upper"><a href="login.php">Login</a></button>
<?php } ?>
<?php } ?>
</div>
<script>
@ -261,7 +273,7 @@ if ($_SESSION["userId"] <> "") {
} else {
?>
<li><a class="dropdown-item" href="register.php">Register</a></li>
<li><a class="dropdown-item" href="checkout.html">Checkout</a></li>
<!-- <li><a class="dropdown-item" href="checkout.html">Checkout</a></li> -->
<li><a class="dropdown-item" href="login.php">Login</a></li>
<?php
}
@ -498,10 +510,25 @@ if ($_SESSION["userId"] <> "") {
function handleQtyInput(input, orderId, itemId, isFloat) {
login(email, password, function(token) {
var newQuantity = parseInt(input.value);
updateQuantity(orderId, itemId, newQuantity, isFloat, token);
if (newQuantity >= 1) {
updateQuantity(orderId, itemId, newQuantity, isFloat, token);
} else {
input.value = 0;
deleteOrder(orderId, itemId, 0, isFloat, token);
// input.value = 1;
// updateQuantity(orderId, itemId, 1, isFloat, token);
}
})
}
// function handleQtyInput(input, orderId, itemId, isFloat) {
// login(email, password, function(token) {
// var newQuantity = parseInt(input.value);
// updateQuantity(orderId, itemId, newQuantity, isFloat, token);
// })
// }
function qtyIncrement(orderId, itemId, isFloat) {
login(email, password, function(token) {
var qtyInput = document.getElementById('qty-input-' + itemId);
@ -516,13 +543,29 @@ if ($_SESSION["userId"] <> "") {
login(email, password, function(token) {
var qtyInput = document.getElementById('qty-input-' + itemId);
var newQuantity = parseInt(qtyInput.value) - 1;
qtyInput.value = newQuantity;
if (newQuantity >= 1) {
qtyInput.value = newQuantity;
updateQuantity(orderId, itemId, newQuantity, isFloat, token);
} else {
qtyInput.value = 0;
deleteOrder(orderId, itemId, 0, isFloat, token);
// qtyInput.value = 1;
// updateQuantity(orderId, itemId, 1, isFloat, token);
}
})
}
// function qtyDecrement(orderId, itemId, isFloat) {
// login(email, password, function(token) {
// var qtyInput = document.getElementById('qty-input-' + itemId);
// var newQuantity = parseInt(qtyInput.value) - 1;
// qtyInput.value = newQuantity;
// if (newQuantity >= 1) {
// updateQuantity(orderId, itemId, newQuantity, isFloat, token);
// }
// })
// }
function updateQuantity(orderId, itemId, newQuantity, isFloat, token) {
console.log(isFloat)
// const token = '<?php echo $_SESSION["token"] ?>';

View File

@ -242,7 +242,7 @@ if ($_SESSION["userId"] <> "") {
}
} else {
?>
<img class="hover-image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/495px-No-Image-Placeholder.svg.png?20200912122019" alt="edit" />
<img class="hover-image" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" alt="edit" />
<?php
}
?>
@ -362,7 +362,7 @@ if ($_SESSION["userId"] <> "") {
}
} else {
?>
<img class="hover-image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/495px-No-Image-Placeholder.svg.png?20200912122019" alt="edit" />
<img class="hover-image" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" alt="edit" />
<?php
}
?>
@ -484,7 +484,7 @@ if ($_SESSION["userId"] <> "") {
}
} else {
?>
<img class="hover-image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/495px-No-Image-Placeholder.svg.png?20200912122019" alt="edit" />
<img class="hover-image" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" alt="edit" />
<?php
}
?>
@ -604,7 +604,7 @@ if ($_SESSION["userId"] <> "") {
}
} else {
?>
<img class="hover-image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/495px-No-Image-Placeholder.svg.png?20200912122019" alt="edit" />
<img class="hover-image" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" alt="edit" />
<?php
}
?>
@ -1054,7 +1054,25 @@ if ($_SESSION["userId"] <> "") {
<div class="ec-vendor-card">
<div class="ec-vendor-detail">
<div class="ec-vendor-avtar" style="width: 75px; height: 75px; overflow: hidden;">
<img src="<?php echo $vendor['vendor_image']; ?>" alt="vendor img" style="width: 100%; height: 100%; object-fit: cover;">
<?php
if (isset($vendor['vendor_image'])) {
$image_urls = explode(',', $vendor['vendor_image']);
if (!empty($image_urls)) {
$first_image_url = trim($image_urls[0]);
?>
<img src="<?php echo $vendor['vendor_image']; ?>" alt="vendor img" style="width: 100%; height: 100%; object-fit: cover;" />
<?php
}
} else {
?>
<img alt="vendor img" style="width: 100%; height: 100%; object-fit: cover;" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" />
<?php
}
?>
<!-- <img src="<?php echo $vendor['vendor_image']; ?>" alt="vendor img" style="width: 100%; height: 100%; object-fit: cover;"> -->
<!-- <img alt="vendor img" style="width: 100%; height: 100%; object-fit: cover;" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" /> -->
</div>
<div class="ec-vendor-info">
<a href="catalog-single-vendor.php?id=<?php echo $vendor['_id'] ?>" class="name"><?php echo $vendor['user_login'] ?></a>
@ -1229,7 +1247,7 @@ if ($_SESSION["userId"] <> "") {
}
} else {
?>
<img class="hover-image" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/495px-No-Image-Placeholder.svg.png?20200912122019" alt="edit" />
<img class="hover-image" src="https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png" alt="edit" />
<?php
}
?>
@ -1244,7 +1262,7 @@ if ($_SESSION["userId"] <> "") {
<?php if (isset($newArrival[$pid]["sale_price"]) && $newArrival[$pid]["sale_price"] > 0) : ?>
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($newArrival[$pid]), 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($newArrival[$pid]), 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($newArrival[$pid]["regular_price"]) && $newArrival[$pid]["regular_price"] != "") : ?>
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($newArrival[$pid]), 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($newArrival[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>

View File

@ -162,12 +162,16 @@
<div class="ec-login-wrapper">
<div class="ec-login-container">
<div class="ec-login-form">
<?php
if (isset($_SESSION["loginError"])) {
echo '<div class="alert alert-danger" role="alert">';
echo $_SESSION["loginError"];
echo '</div>';
unset($_SESSION["loginError"]);
session_start();
if(isset($_GET["error"]) && $_GET["error"] == 1) {
echo "<div class='alert alert-danger' style='background:#FFCCCB;' id='alertDanger' role='alert'>Login failed. Please try again.</div>";
echo " <script>
setTimeout(function() {
document.getElementById('alertDanger').style.display = 'none';
}, 10000);
</script>";
}
?>
<form action="login_action.php" method="post">

View File

@ -19,10 +19,10 @@
if ($result > 0) {
$_SESSION["isVendor"] = true;
}
header("location: $url");
header("location: index.php");
} else {
$_SESSION["loginError"] = "Invalid email or password. Please try again.";
header("location: login.php");
// $_SESSION["loginError"] = "Invalid email or password. Please try again.";
header("location: login.php?error=1");
}

View File

@ -215,7 +215,8 @@ if (isset($_GET['id'])) {
right: 15px;
bottom: 0;
border-radius: 0 0 10px 10px;
}
}
/* 02-21-2024 Stacy added css for addtocart & wishlist */
</style>
</head>
@ -276,17 +277,17 @@ if (isset($_GET['id'])) {
<div class="single-pro-inner">
<!-- 02-20-2024 Stacy message sent pop-up -->
<?php
if (isset($_SESSION["SuccessfullySent"])) {
echo '<div class="alert alert-success" id="alertSuccess" role="alert"; content-align:center;>';
echo $_SESSION["SuccessfullySent"];
echo '</div>';
unset($_SESSION["SuccessfullySent"]);
echo " <script>
if (isset($_SESSION["SuccessfullySent"])) {
echo '<div class="alert alert-success" id="alertSuccess" role="alert"; content-align:center;>';
echo $_SESSION["SuccessfullySent"];
echo '</div>';
unset($_SESSION["SuccessfullySent"]);
echo " <script>
setTimeout(function() {
document.getElementById('alertSuccess').style.display = 'none';
}, 10000);
</script>";
}
}
?>
<!-- 02-20-2024 Stacy message sent pop-up -->
<div class="row">
@ -325,7 +326,8 @@ if (isset($_GET['id'])) {
$productImage = $i;
}
?>
<!-- <img class="img-responsive" src="<?php #echo $productImage; ?>" alt="" style="width: 100%; height: 100%; object-fit: cover; object-position: center center;"> -->
<!-- <img class="img-responsive" src="<?php #echo $productImage;
?>" alt="" style="width: 100%; height: 100%; object-fit: cover; object-position: center center;"> -->
<!-- 02-26-2024 Stacy updated img width & height -->
<img class="img-responsive" src="<?php echo $productImage; ?>" alt="" style="max/width: 90px; height: 120px; object-fit: cover; object-position: center center;">
</div>
@ -378,16 +380,16 @@ if (isset($_GET['id'])) {
<div class="ec-single-price">
<span class="ec-single-ps-title">As low as</span>
<?php
// 02-13-24 Jun Jihad Removed Logic to DIsplay Price Range of Variable Products
if (isset($product_details['sale_price']) && $product_details['sale_price'] > 0) {
echo '<s><span id="productPrice" class="old-price">' . $product_details['regular_price'] . '</span></s>';
echo '<span id="productNewPrice" class="new-price">' . $product_details['sale_price'] . '</span>';
} elseif (!isset($product_details['regular_price']) || $product_details['regular_price'] <= 0) {
echo '<span id="productPrice" class="new-price">Contact Seller for Price</span>';
} else {
echo '<span id="productPrice" class="new-price">' . $product_details['regular_price'] . '</span>';
}
// 02-13-24 Jun Jihad Removed Logic to DIsplay Price Range of Variable Products
// 02-13-24 Jun Jihad Removed Logic to DIsplay Price Range of Variable Products
if (isset($product_details['sale_price']) && $product_details['sale_price'] > 0) {
echo '<s><span id="productPrice" class="old-price">' . $product_details['regular_price'] . '</span></s>';
echo '<span id="productNewPrice" class="new-price">' . $product_details['sale_price'] . '</span>';
} elseif (!isset($product_details['regular_price']) || $product_details['regular_price'] <= 0) {
echo '<span id="productPrice" class="new-price">Contact Seller for Price</span>';
} else {
echo '<span id="productPrice" class="new-price">' . $product_details['regular_price'] . '</span>';
}
// 02-13-24 Jun Jihad Removed Logic to DIsplay Price Range of Variable Products
?>
</div>
<div class="ec-single-stoke">
@ -396,7 +398,7 @@ if (isset($_GET['id'])) {
</div>
</div>
<!-- 20240212 Jun Jihad Include Parent Product in the Variation Selection -->
<!-- 20240212 Jun Jihad Include Parent Product in the Variation Selection -->
<?php
if (isset($variation_details) && is_array($variation_details)) {
?>
@ -405,7 +407,7 @@ if (isset($_GET['id'])) {
<span>VARIATION</span>
<div class="ec-pro-variation-content">
<ul class="eccart-pro-items">
<?php
<?php
$main_product_image = isset($product_details["product_image"]) ? $product_details["product_image"] : 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
?>
<a href="javascript:void(0);" onclick="selectVariation(<?php echo htmlspecialchars(json_encode($product_details), ENT_QUOTES, 'UTF-8'); ?>)">
@ -478,29 +480,30 @@ if (isset($_GET['id'])) {
<div class="qty-plus-minuses" style="display:flex; overflow:visible;">
<!-- <div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="decrement()">-</div>
<input class="qty-inputs" style="width:100px; height:40px" type="number" name="ec_qtybtn" value="<?php #echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1"; ?>" id="qty-input" />
<input class="qty-inputs" style="width:100px; height:40px" type="number" name="ec_qtybtn" value="<?php #echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1";
?>" id="qty-input" />
<div class="qty-btn" style="color:#ffaa00; font-size:25px; padding-left:5px; cursor: pointer;" onclick="increment()">+</div> -->
<div class="ec-single-cart" style="display:flex; flex-direction:row; width:80%; overflow:visible; text-align:center; align-items:center; ">
<!-- 02-13-24 Jun Jihad Contact Seller will appear to Variable products with no price -->
<?php
<!-- 02-13-24 Jun Jihad Contact Seller will appear to Variable products with no price -->
<?php
if ($_SESSION["isLoggedIn"]) {
if ($product_details['product_type'] === "variable") {
echo '<div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="decrement()">-</div>';
echo '<input class="qty-inputs" style="width:110px; height:40px" type="number" name="ec_qtybtn" value="';
echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1";
echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1";
echo '" id="qty-input" />';
echo '<div class="qty-btn" style="color:#ffaa00; font-size:25px; padding-left:5px; cursor: pointer;" onclick="increment()">+</div>';
echo '<div style="display:flex; margin-left:45px;"><button type="button" class="btn btn-primary" id="contactSellerButton" style="background:#ffaa00; width:190px;" data-bs-toggle="modal" data-bs-target="#priceModal"><i class="fi-rr-envelope" style="font-size:20px; margin-bottom:-3px; margin-right:10px;"></i>Contact Seller</button>';
echo '<button class="btn btn-primary" id="addToCartButton" style="display:none">Add To Cart</button>';
echo '<div class="ec-single-wishlist">
<a class="ec-btn-group wishlist" title="Wishlist" onclick="wishlist()"><i class="fi fi-rr-heart" style="color:#B80F0A; font-size:20px;"></i></a>
</div></div>';
} else {
if (!empty($product_details['regular_price']) || !empty($product_details['sale_price'])) {
echo '<div class="qty-btn" style="color:#ffaa00; font-size:35px; padding-right:5px; cursor: pointer;" onclick="decrement()">-</div>';
echo '<input class="qty-inputs" style="width:100px; height:40px" type="number" name="ec_qtybtn" value="';
echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1";
echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1";
echo '" id="qty-input" />';
echo '<div class="qty-btn" style="color:#ffaa00; font-size:25px; padding-left:5px; cursor: pointer;" onclick="increment()">+</div>';
// echo '<div id="addToCartMessage" style="border:1px solid red;"></div>';
@ -516,30 +519,30 @@ if (isset($_GET['id'])) {
echo '<div class="login-button" style=""><p style="color:red; text-wrap:nowrap;">Please log in to your account.</p>';
echo '<a href="login.php" style="margin-left:-2px;"><button type="button" class="btn btn-primary" style="margin-left:-2px; margin-top:-20px; background:#ffaa00; border-radius:10px; letter-spacing:1px;" data-bs-toggle="modal">LOGIN</button></a></div>';
}
?>
<!-- <div class="ec-single-wishlist" style="border: 1px solid yellow;">
?>
<!-- <div class="ec-single-wishlist" style="border: 1px solid yellow;">
<a class="ec-btn-group wishlist" style="padding-left:40px;" title="Wishlist" onclick="wishlist()"><i class="fi fi-rr-heart"></i></a>
</div> -->
<!-- 02-22-2024 Stacy modified this block of code -->
<!-- 02-13-24 Jun Jihad Contact Seller will appear to Variable products with no price -->
<!-- 02-22-2024 Stacy modified this block of code -->
<!-- 02-13-24 Jun Jihad Contact Seller will appear to Variable products with no price -->
<!-- <?php
// if ($_SESSION["isLoggedIn"]) {
// if ($product_details['product_type'] === "variable") {
// echo '<button class="btn btn-primary" id="addToCartButton" disabled>Add To Cart</button>';
// echo '<button type="button" class="btn btn-primary" id="contactSellerButton" style="display:none" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
// } elseif ($product_details['regular_price'] && $product_details['regular_price'] !== "") {
// echo '<div id="addToCartMessage"></div>';
// echo '<button class="btn btn-primary" id="addToCartButton">Add To Cart</button>';
// } else {
// echo '<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
// }
// } else {
// echo '<p>Please log in to add to cart.</p>';
// }
?> -->
<!-- <?php
// if ($_SESSION["isLoggedIn"]) {
// if ($product_details['product_type'] === "variable") {
// echo '<button class="btn btn-primary" id="addToCartButton" disabled>Add To Cart</button>';
// echo '<button type="button" class="btn btn-primary" id="contactSellerButton" style="display:none" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
// } elseif ($product_details['regular_price'] && $product_details['regular_price'] !== "") {
// echo '<div id="addToCartMessage"></div>';
// echo '<button class="btn btn-primary" id="addToCartButton">Add To Cart</button>';
// } else {
// echo '<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
// }
// } else {
// echo '<p>Please log in to add to cart.</p>';
// }
?> -->
</div>
</div>
@ -594,10 +597,10 @@ if (isset($_GET['id'])) {
<form action="contact-seller-action.php" method="post">
<label for="">Enter product details such as color,size,materials,etc. and other specification requirements to receive an accurate quote</label>
<textarea name="message" id="" cols="30" rows="5"></textarea>
<input name="product_name" type="hidden" value='<?php echo $product_details['product_name']; ?>'/>
<input name="product_name" type="hidden" value='<?php echo $product_details['product_name']; ?>' />
<input class="qty-inputs" type="hidden" name="product_quantityf" value="<?php echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1"; ?>" id="qty-input" min="<?php echo (!empty($product_details['minimum_order'])) ? $product_details['minimum_order'] : "1"; ?>" />
<input name="product_id" type="hidden" value='<?php echo $product_details['_id']; ?>'/>
<input name="product_id" type="hidden" value='<?php echo $product_details['_id']; ?>' />
<!-- <input name="product_quantity" type="number"/> -->
<div class="modal-footer">
@ -774,11 +777,29 @@ if (isset($_GET['id'])) {
// April 3, 2024 Jun Jihad Apply Matrix
var productPrice;
var foundPrice = false;
// if (priceMatrix.length > 0) {
// for (var i = 0; i < priceMatrix.length; i++) {
// for (var j = 0; j < priceMatrix[i].length; j++) {
// if (quantityValue <= parseInt(priceMatrix[i][j].quantity)) {
// productPrice = parseFloat(priceMatrix[i][j].price);
// foundPrice = true;
// break;
// }
// }
// if (foundPrice) {
// break;
// }
// }
// }
if (priceMatrix.length > 0) {
for (var i = 0; i < priceMatrix.length; i++) {
for (var j = 0; j < priceMatrix[i].length; j++) {
if (quantityValue <= parseInt(priceMatrix[i][j].quantity)) {
var currentQuantity = parseFloat(priceMatrix[i][j].quantity);
var nextQuantity = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].quantity) : Infinity;
if (quantityValue >= currentQuantity && quantityValue < nextQuantity) {
productPrice = parseFloat(priceMatrix[i][j].price);
foundPrice = true;
break;
@ -789,10 +810,11 @@ if (isset($_GET['id'])) {
}
}
}
if (!foundPrice) {
productPrice = parseFloat(document.getElementById("productNewPrice") ? document.getElementById("productNewPrice").innerText : document.getElementById("productPrice").innerText);
}
}
var productData = {
product: {
product_image: document.getElementById("mainProductImage").getAttribute('src'),
@ -865,7 +887,7 @@ if (isset($_GET['id'])) {
shipping_fee: shippingFee,
};
console.log("Request data:", requestData);
console.log("Request data:", requestData);
// const token = '<?php echo $_SESSION["token"] ?>';
xhr.open("POST", "https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders", true);
xhr.setRequestHeader("Content-Type", "application/json", );
@ -875,7 +897,7 @@ if (isset($_GET['id'])) {
if (xhr.status === 201) {
var response = JSON.parse(xhr.responseText);
console.log("Response:", response);
console.log("Response:", response);
// Update the cart dynamically
var cartList = document.querySelector(".eccart-pro-items");
@ -945,24 +967,24 @@ if (isset($_GET['id'])) {
}
function updateOrder(orderId, existingItemId) {
var updateOrderXhr = new XMLHttpRequest();
// const token = '<?php echo $_SESSION["token"] ?>';
updateOrderXhr.open("PUT", `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}/items/${existingItemId}`, true);
updateOrderXhr.setRequestHeader("Content-Type", "application/json");
updateOrderXhr.setRequestHeader("Authorization", "Bearer " + token);
updateOrderXhr.onreadystatechange = function() {
if (updateOrderXhr.readyState === 4) {
if (updateOrderXhr.status === 200) {
var response = JSON.parse(updateOrderXhr.responseText);
console.log("Order updated:", response);
var updateOrderXhr = new XMLHttpRequest();
// const token = '<?php echo $_SESSION["token"] ?>';
updateOrderXhr.open("PUT", `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}/items/${existingItemId}`, true);
updateOrderXhr.setRequestHeader("Content-Type", "application/json");
updateOrderXhr.setRequestHeader("Authorization", "Bearer " + token);
updateOrderXhr.onreadystatechange = function() {
if (updateOrderXhr.readyState === 4) {
if (updateOrderXhr.status === 200) {
var response = JSON.parse(updateOrderXhr.responseText);
console.log("Order updated:", response);
var cartItem = document.getElementById(`order_${response._id}`);
var cartItem = document.getElementById(`order_${response._id}`);
if (cartItem) {
var updatedQuantity = response.items[0].quantity;
var totalAmount = response.items[0].price * updatedQuantity;
// If the cart item already exists, update its content using innerHTML
cartItem.innerHTML = `
if (cartItem) {
var updatedQuantity = response.items[0].quantity;
var totalAmount = response.items[0].price * updatedQuantity;
// If the cart item already exists, update its content using innerHTML
cartItem.innerHTML = `
<a href="shop-left-sidebar-col-4.php" class="sidekka_pro_img">
<img src="${response.items[0].product.product_image}" alt="product">
</a>
@ -980,74 +1002,73 @@ if (isset($_GET['id'])) {
<a href="#" class="removeCart" onclick="deleteOrder('${response._id}')">x</a>
</div>
`;
document.getElementById(`qty-input-${response.items[0]._id}`).value = updatedQuantity;
} else {
// If the cart item doesn't exist, create a new one
console.log("Error updating order:", updateOrderXhr.responseText);
}
document.getElementById(`qty-input-${response.items[0]._id}`).value = updatedQuantity;
} else {
// If the cart item doesn't exist, create a new one
console.log("Error updating order:", updateOrderXhr.responseText);
}
getLatestOrders();
updateCartItemCount();
document.getElementById("addToCartMessage").innerText = "Product added to cart!";
setTimeout(function() {
document.getElementById("addToCartMessage").innerText = "";
}, 1000);
} else {
// Handle error response from the server
console.log("Error response from the server");
console.log(xhr.responseText); // Log the server's response
}
}
};
var existingQuantity = parseInt(existingOrder.items[0].quantity, 10);
var newQuantity = parseInt(quantityValue, 10);
var updatedQuantity = existingQuantity + newQuantity;
getLatestOrders();
updateCartItemCount();
document.getElementById("addToCartMessage").innerText = "Product added to cart!";
setTimeout(function() {
document.getElementById("addToCartMessage").innerText = "";
}, 1000);
} else {
// Handle error response from the server
console.log("Error response from the server");
console.log(xhr.responseText); // Log the server's response
}
}
};
var existingQuantity = parseInt(existingOrder.items[0].quantity, 10);
var newQuantity = parseInt(quantityValue, 10);
var updatedQuantity = existingQuantity + newQuantity;
// Check if the updated quantity exceeds the previous price matrix
var newProductPrice = productPrice; // Assume the initial productPrice
var foundNewPrice = false;
if (priceMatrix.length > 0) {
for (var i = 0; i < priceMatrix.length; i++) {
for (var j = 0; j < priceMatrix[i].length; j++) {
if (updatedQuantity <= parseInt(priceMatrix[i][j].quantity)) {
newProductPrice = parseFloat(priceMatrix[i][j].price);
foundNewPrice = true;
break;
}
}
if (foundNewPrice) {
break;
}
}
}
// Check if the updated quantity exceeds the previous price matrix
var newProductPrice = productPrice;
var foundNewPrice = false;
if (priceMatrix.length > 0) {
for (var i = 0; i < priceMatrix.length; i++) {
for (var j = 0; j < priceMatrix[i].length; j++) {
var currentQuantity = parseFloat(priceMatrix[i][j].quantity);
var nextQuantity = (j < priceMatrix[i].length - 1) ? parseFloat(priceMatrix[i][j + 1].quantity) : Infinity;
if (updatedQuantity >= currentQuantity && updatedQuantity < nextQuantity) {
newProductPrice = parseFloat(priceMatrix[i][j].price);
foundNewPrice = true;
break;
}
}
if (foundNewPrice) {
break;
}
}
}
// Update product price if a new price is found in the price matrix
if (foundNewPrice) {
productPrice = newProductPrice;
}
if (foundNewPrice) {
productPrice = newProductPrice;
}
var updateData = {
quantity: updatedQuantity,
price: productPrice // Update the price for the item
};
var updateData = {
quantity: updatedQuantity,
price: productPrice // Update the price for the item
};
updateOrderXhr.send(JSON.stringify(updateData));
updateOrderXhr.send(JSON.stringify(updateData));
var patchTotalAmountXhr = new XMLHttpRequest();
patchTotalAmountXhr.open("PATCH", `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, true);
patchTotalAmountXhr.setRequestHeader("Content-Type", "application/json");
patchTotalAmountXhr.setRequestHeader("Authorization", "Bearer " + token);
// Patch the total amount of the order with the updated price and quantity
var patchTotalAmountXhr = new XMLHttpRequest();
patchTotalAmountXhr.open("PATCH", `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/orders/${orderId}`, true);
patchTotalAmountXhr.setRequestHeader("Content-Type", "application/json");
patchTotalAmountXhr.setRequestHeader("Authorization", "Bearer " + token);
var originalPrice = document.getElementById("productPrice").innerText;
var totalAmount = originalPrice * updatedQuantity;
console.log(originalPrice);
console.log(totalAmount);
var patchData = {
total_amount: totalAmount
};
var totalAmount = productPrice * updatedQuantity;
var patchData = {
total_amount: totalAmount
};
patchTotalAmountXhr.send(JSON.stringify(patchData));
}
patchTotalAmountXhr.send(JSON.stringify(patchData));
}
@ -1544,14 +1565,14 @@ if (isset($_GET['id'])) {
<div class="ec-pro-image">
<!-- <a href="shop-left-sidebar-col-4.php" class="image"> -->
<!-- 02-21-2024 Stacy changed link for image -->
<a class="image" href="product-left-sidebar.php?id=<?php echo $similar_products[$pid]["_id"] ?>">
<a class="image" href="product-left-sidebar.php?id=<?php echo $similar_products[$pid]["_id"] ?>">
<img class="main-image" src="<?php echo $similar_products[$pid]["product_image"] ?>" />
<img class="hover-image" src="<?php echo $similar_products[$pid]["product_image"] ?>" />
</a>
<!-- 02-21-2024 Stacy commented out -->
<!-- <span class="percentage">20%</span> -->
<!-- <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>
@ -1564,17 +1585,17 @@ if (isset($_GET['id'])) {
<?php if (isset($similar_products[$pid]["sale_price"]) && $similar_products[$pid]["sale_price"] > 0) : ?>
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($similar_products[$pid]), 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($similar_products[$pid]), 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($similar_products[$pid]["regular_price"]) && $similar_products[$pid]["regular_price"] != "") : ?>
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($similar_products[$pid]), 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($similar_products[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
<?php else : ($similar_products[$pid]["regular_price"] == "" || $similar_products[$pid]["regular_price"] == null) ?>
<a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('<?php echo htmlspecialchars(json_encode($similar_products[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
<?php endif; ?>
<!-- 02-29-2024 Stacy disabling hover add to cart if there's no price -->
<!-- <button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($similar_products[$pid]), 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($similar_products[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a> -->
</div>
@ -1583,10 +1604,12 @@ if (isset($_GET['id'])) {
</div>
<div class="ec-pro-content">
<!-- 02-21-2024 Stacy updated link for product name -->
<!-- <h5 class="ec-pro-title"><a href="shop-left-sidebar-col-4.php?id=<?php #echo $similar_products[$pid]["_id"] ?>"><?php #echo $similar_products[$pid]["product_name"] ?></a></h5> -->
<!-- <h5 class="ec-pro-title"><a href="shop-left-sidebar-col-4.php?id=<?php #echo $similar_products[$pid]["_id"]
?>"><?php #echo $similar_products[$pid]["product_name"]
?></a></h5> -->
<h5 class="ec-pro-title"><a href="product-left-sidebar.php?id=<?php echo $similar_products[$pid]["_id"]; ?>"><?php echo $similar_products[$pid]["product_name"] ?></a></h5>
<!-- 02-21-2024 Stacy updated link for product name -->
<!-- 02-20-2024 Stacy commented ratings -->
<!-- <div class="ec-pro-rating">
<i class="ecicon eci-star fill"></i>
@ -2010,8 +2033,8 @@ if (isset($_GET['id'])) {
<script src="assets/js/newjs.js"></script>
<!-- 02-21-2024 Stacy added js link -->
<?php
if ($_SESSION["is_test"]==true) {
<?php
if ($_SESSION["is_test"] == true) {
echo '<script src="assets/js/tester11.js"></script>';
} else {
echo '<script src="assets/js/produc3.js"></script>';

View File

@ -370,7 +370,77 @@ if ($_SESSION["userId"] <> "") {
<h3 class="ec-sidebar-title">Category</h3>
</div>
<div class="ec-sb-block-content">
<ul>
<form method="POST" action="shop-list-left-sidebar-action.php">
<ul>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Electronics" <?php echo (isset($_POST['category']) && in_array('Electronics', $_POST['category'])) || (isset($_GET['category']) && in_array('Electronics', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Electronics</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Solar" <?php echo (isset($_POST['category']) && in_array('Solar', $_POST['category'])) || (isset($_GET['category']) && in_array('Solar', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Solar</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="E-bike" <?php echo (isset($_POST['category']) && in_array('E-bike', $_POST['category'])) || (isset($_GET['category']) && in_array('E-bike', $_GET['category'])) ? 'checked' : ''; ?> /> <a>E-bike</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="E-vehicle" <?php echo (isset($_POST['category']) && in_array('E-vehicle', $_POST['category'])) || (isset($_GET['category']) && in_array('E-vehicle', $_GET['category'])) ? 'checked' : ''; ?> /> <a>E-vehicle</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Appliance" <?php echo (isset($_POST['category']) && in_array('Appliance', $_POST['category'])) || (isset($_GET['category']) && in_array('Appliance', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Appliance</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Smart Home" <?php echo (isset($_POST['category']) && in_array('Smart Home', $_POST['category'])) || (isset($_GET['category']) && in_array('Smart Home', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Smart Home</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Home" <?php echo (isset($_POST['category']) && in_array('Home', $_POST['category'])) || (isset($_GET['category']) && in_array('Home', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Home</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Apparel" <?php echo (isset($_POST['category']) && in_array('Apparel', $_POST['category'])) || (isset($_GET['category']) && in_array('Apparel', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Apparel</a><span class="checked"></span>
</div>
</li>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" name="category[]" value="Heavy Equipment" <?php echo (isset($_POST['category']) && in_array('Heavy Equipment', $_POST['category'])) || (isset($_GET['category']) && in_array('Heavy Equipment', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Heavy Equipment</a><span class="checked"></span>
</div>
</li>
<li>
<div style="padding-top:10px;">
<label for="minPrice" style="margin-bottom:-5px;">Min Price:</label>
<input style="height:40px" type="number" name="minPrice" id="minPrice" value="<?php echo isset($_POST['minPrice']) ? $_POST['minPrice'] : (isset($_GET['minPrice']) ? $_GET['minPrice'] : ''); ?>" />
</div>
</li>
<li>
<div>
<label for="maxPrice" style="margin-bottom:-5px;">Max Price:</label>
<input style="height:40px" type="number" name="maxPrice" id="maxPrice" value="<?php echo isset($_POST['maxPrice']) ? $_POST['maxPrice'] : (isset($_GET['maxPrice']) ? $_GET['maxPrice'] : ''); ?>" />
</div>
</li>
<li>
<div style="padding-top:10px;">
<button style="font-size:12px; height:30px; width:60px;" class="btn-primary" type="submit">Apply</button>
</div>
</li>
</ul>
<!-- <button type="submit">Apply</button> -->
</form>
<!-- <ul>
<li>
<div class="ec-sidebar-block-item">
<input type="checkbox" checked /> <a href="#">clothes</a><span class="checked"></span>
@ -422,7 +492,7 @@ if ($_SESSION["userId"] <> "") {
</div>
</li>
</ul>
</ul> -->
</div>
</div>
<!-- Sidebar Price Block -->

View File

@ -53,13 +53,13 @@ if ($_SESSION["userId"] <> "") {
.tab.active {
background-color: #ffffff;
/* Set your desired background color for the active tab */
color: #ffaa00;
color: #3474d4;
/* Set your desired text color for the active tab */
border: 1px solid #ffaa00
border: 1px solid #3474d4
/* Set your desired border color for the active tab */
}
.tab {
background-color: #ffaa00;
background-color: #3474d4;
color: #ffffff;
font-family: "Poppins, sans-serif";
font-weight: 400;
@ -79,10 +79,27 @@ if ($_SESSION["userId"] <> "") {
border: none;
margin-top: -30px;
}
/* .theadTitle {
background-color: #dddddd;
padding-top: -90px;
} */
.tableView {
td:nth-child(2) {
max-width: 250px;
}
td:nth-child(6) {
white-space: nowrap;
}
td:nth-child(7) {
white-space: nowrap;
}
}
.Title {
th:nth-child(4) {
white-space: nowrap;
}
th:nth-child(6) {
white-space: nowrap;
}
}
@media only screen and (max-width: 640px) {
#tableTitle {
@ -307,7 +324,7 @@ if ($_SESSION["userId"] <> "") {
<!-- Content for "all Orders" tab -->
<table class="table ec-table">
<thead>
<tr>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -348,7 +365,7 @@ if ($_SESSION["userId"] <> "") {
<img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
</td>
<!-- <img class="prod-img" src="<?php # echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td> -->
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -374,8 +391,8 @@ if ($_SESSION["userId"] <> "") {
<div id="toPay" class="tab-content">
<!-- Content for "To Pay" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -406,7 +423,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -429,8 +446,8 @@ if ($_SESSION["userId"] <> "") {
<div id="toShip" class="tab-content">
<!-- Content for "To Ship" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -463,7 +480,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -486,8 +503,8 @@ if ($_SESSION["userId"] <> "") {
<div id="toReceive" class="tab-content">
<!-- Content for "To Receive" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -517,29 +534,25 @@ if ($_SESSION["userId"] <> "") {
<?php
$jsonorder = json_encode($order);
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td>
<!-- <?php if (isset($order['product_image'])) : ?>
<img src="<?php echo $order['items'][0]['product']['product_image']; ?>" class="prod-img">
<?php else : ?>
<img src="https://api.obanana.com/images/storage/web_images/1708588564876-viber_image_2024-02-22_15-54-42-498.png" class="prod-img">
<?php endif; ?> -->
<img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
<tr class="tableView">
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product">
</td>
<td><span><?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>
<td><span><?php echo $order['status']; ?></span></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>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['items'][0]['price']; ?></span></td>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['total_amount'] ?></span></td>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['status']; ?></span></td>
<!-- <td><span><?php # echo $order['tracking_number']; ?></span></td>
<td><span><?php # echo $order['courier_name']; ?></span></td> -->
<td><span><?php echo date("F j, Y", strtotime($order['updatedAt'])); ?></span></td>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo date("F j, Y", strtotime($order['updatedAt'])); ?></span></td>
<td>
<span class="tbl-btn">
<a class="btn btn-lg btn-primary" onclick="updateCompletedStatus('<?php echo $order['_id']; ?>')">Received</a>
</span>
</td>
</tr>
<?php
}
}
@ -554,8 +567,8 @@ if ($_SESSION["userId"] <> "") {
<div id="completed" class="tab-content">
<!-- Content for "Completed" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -588,7 +601,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -985,9 +998,11 @@ if ($_SESSION["userId"] <> "") {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1007,9 +1022,11 @@ if ($_SESSION["userId"] <> "") {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1031,9 +1048,11 @@ if ($_SESSION["userId"] <> "") {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1055,9 +1074,11 @@ if ($_SESSION["userId"] <> "") {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1079,9 +1100,11 @@ if ($_SESSION["userId"] <> "") {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>

View File

@ -54,13 +54,13 @@ if ($_SESSION["userId"] <> "") {
.tab.active {
background-color: #ffffff;
/* Set your desired background color for the active tab */
color: #ffaa00;
color: #3474d4;
/* Set your desired text color for the active tab */
border: 1px solid #ffaa00
border: 1px solid #3474d4
/* Set your desired border color for the active tab */
}
.tab {
background-color: #ffaa00;
background-color: #3474d4;
color: #ffffff;
font-family: "Poppins, sans-serif";
font-weight: 400;
@ -80,10 +80,27 @@ if ($_SESSION["userId"] <> "") {
border: none;
margin-top: -30px;
}
/* .theadTitle {
background-color: #dddddd;
padding-top: -90px;
} */
.tableView {
td:nth-child(2) {
max-width: 250px;
}
td:nth-child(6) {
white-space: nowrap;
}
td:nth-child(7) {
white-space: nowrap;
}
}
.Title {
th:nth-child(4) {
white-space: nowrap;
}
th:nth-child(6) {
white-space: nowrap;
}
}
@media only screen and (max-width: 640px) {
#tableTitle {
@ -321,8 +338,8 @@ if ($_SESSION["userId"] <> "") {
<div id="allRefunds" class="tab-content active">
<!-- Content for "all Orders" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -357,7 +374,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -382,8 +399,8 @@ if ($_SESSION["userId"] <> "") {
<div id="toApprove" class="tab-content">
<!-- Content for "To Approve" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -416,7 +433,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -441,8 +458,8 @@ if ($_SESSION["userId"] <> "") {
<div id="toShip" class="tab-content">
<!-- Content for "To Ship" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -475,7 +492,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -500,8 +517,8 @@ if ($_SESSION["userId"] <> "") {
<div id="toReceive" class="tab-content">
<!-- Content for "To Receive" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -534,7 +551,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -562,8 +579,8 @@ if ($_SESSION["userId"] <> "") {
<div id="toRefund" class="tab-content">
<!-- Content for "To Refund" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -596,7 +613,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -624,8 +641,8 @@ if ($_SESSION["userId"] <> "") {
<div id="returnComplete" class="tab-content">
<!-- Content for "Return Complete" tab -->
<table class="table ec-table">
<thead class="theadTitle">
<tr>
<thead>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -657,7 +674,7 @@ if ($_SESSION["userId"] <> "") {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -932,27 +949,33 @@ if ($_SESSION["userId"] <> "") {
if (jsonObject.return_order.status === 'To Approve') {
modal.innerHTML = `
<div class="modal-header" style="height:5px;">
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<div class="modal-header" style="height:5px;">
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
<li class="fs-6"><b>Quantity:</b> ${jsonObject.items[0].quantity}</li>
<li class="fs-6"><b>Unit Price:</b> ${jsonObject.items[0].price}</li>
<li class="fs-6"><b>Price:</b> ${jsonObject.total_amount}</li>
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>
</div>`;
<div class="row pt-3">
<div class="col-md-6">
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
<li class="fs-6"><b>Quantity:</b> ${jsonObject.items[0].quantity}</li>
<li class="fs-6"><b>Unit Price:</b> ${jsonObject.items[0].price}</li>
<li class="fs-6"><b>Price:</b> ${jsonObject.total_amount}</li>
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:auto;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>
</div>`;
}
if (jsonObject.return_order.status === 'To Ship') {
@ -961,9 +984,11 @@ if ($_SESSION["userId"] <> "") {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -973,7 +998,11 @@ if ($_SESSION["userId"] <> "") {
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>
@ -986,9 +1015,11 @@ if ($_SESSION["userId"] <> "") {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -998,7 +1029,11 @@ if ($_SESSION["userId"] <> "") {
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>
@ -1011,9 +1046,11 @@ if ($_SESSION["userId"] <> "") {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1023,7 +1060,11 @@ if ($_SESSION["userId"] <> "") {
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>
@ -1036,9 +1077,11 @@ if ($_SESSION["userId"] <> "") {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}" alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1048,7 +1091,11 @@ if ($_SESSION["userId"] <> "") {
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>

View File

@ -116,6 +116,9 @@ $array = json_decode($result, true);
<li><a href="vendor-dashboard.php">Dashboard</a></li>
<li><a href="vendor-uploads-add-product-action.php">Upload Product</a></li>
<li><a href="vendor-settings.php">Settings (Edit)</a></li>
<li><a href="vendor-refund-history.php">Vendor Refund History</a></li>
<li><a href="vendor-payments.php">Payments</a></li>
<li><a href="vendor-payouts.php">Payouts</a></li>
</ul>
</div>
</div>

View File

@ -268,7 +268,7 @@ if (is_array($vendorOrderss)) {
<td><span><?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 $item['price']; ?></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>

View File

@ -71,13 +71,13 @@ if (is_array($vendorOrderss)) {
.tab.active {
background-color: #ffffff;
/* Set your desired background color for the active tab */
color: #ffaa00;
color: #3474d4;
/* Set your desired text color for the active tab */
border: 1px solid #ffaa00
border: 1px solid #3474d4
/* Set your desired border color for the active tab */
}
.tab {
background-color: #ffaa00;
background-color: #3474d4;
color: #ffffff;
font-family: "Poppins, sans-serif";
font-weight: 400;
@ -97,10 +97,27 @@ if (is_array($vendorOrderss)) {
border: none;
margin-top: -30px;
}
/* .theadTitle {
background-color: #dddddd;
padding-top: -90px;
} */
.tableView {
td:nth-child(2) {
max-width: 250px;
}
td:nth-child(6) {
white-space: nowrap;
}
td:nth-child(7) {
white-space: nowrap;
}
}
.Title {
th:nth-child(4) {
white-space: nowrap;
}
th:nth-child(6) {
white-space: nowrap;
}
}
@media only screen and (max-width: 640px) {
#tableTitle {
@ -295,11 +312,11 @@ if (is_array($vendorOrderss)) {
</div> -->
<!-- 03-26-2024 Stacy added tab for all orders -->
<div id="allRefunds" class="tab-content">
<div id="allRefunds" class="tab-content active">
<!-- Content for "All Refunds" tab -->
<table class="table ec-table">
<thead>
<tr>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -330,7 +347,7 @@ if (is_array($vendorOrderss)) {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -354,7 +371,7 @@ if (is_array($vendorOrderss)) {
<!-- Content for "To Approve" tab -->
<table class="table ec-table">
<thead>
<tr>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -381,19 +398,19 @@ if (is_array($vendorOrderss)) {
<?php
$jsonorder = json_encode($order);
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?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>
<td><span><?php echo $order['return_order']['status']; ?></span></td>
<tr class="tableView">
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></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>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['items'][0]['price']; ?></span></td>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['total_amount'] ?></span></td>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['return_order']['status']; ?></span></td>
<!-- <td><span><?php # echo $order['return_order']['reason']; ?></span></td>
<td><img class="prod-img" src="<?php # echo $order['return_order']['image']; ?>" alt="product"></td> -->
<td><span><?php echo date("F j, Y", strtotime($order['updatedAt'])); ?></span></td>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo date("F j, Y", strtotime($order['updatedAt'])); ?></span></td>
<td>
<span class="tbl-btn">
<a class="btn btn-lg btn-primary" onclick="updateRefundShipStatus('<?php echo $order['_id']; ?>', '<?php echo $order['return_order']['image']; ?>', '<?php echo $order['return_order']['reason']; ?>')">Approve Refund</a>
<a class="btn btn-lg btn-primary" style="white-space: nowrap;" onclick="updateRefundShipStatus('<?php echo $order['_id']; ?>', '<?php echo $order['return_order']['image']; ?>', `<?php echo htmlspecialchars($order['return_order']['reason'], ENT_QUOTES); ?>`)">Approve Refund</a>
</span>
</td>
<!-- <td><span class="tbl-btn"><a class="btn btn-lg btn-primary" href="#">View</a></span></td> -->
@ -411,7 +428,7 @@ if (is_array($vendorOrderss)) {
<!-- Content for "To Ship" tab -->
<table class="table ec-table">
<thead>
<tr>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -440,7 +457,7 @@ if (is_array($vendorOrderss)) {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -464,7 +481,7 @@ if (is_array($vendorOrderss)) {
<!-- Content for "To Receive" tab -->
<table class="table ec-table">
<thead>
<tr>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -490,16 +507,16 @@ if (is_array($vendorOrderss)) {
<?php
$jsonorder = json_encode($order);
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?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>
<td><span><?php echo $order['return_order']['status']; ?></span></td>
<tr class="tableView">
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></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>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['items'][0]['price']; ?></span></td>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['total_amount'] ?></span></td>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo $order['return_order']['status']; ?></span></td>
<!-- <td><span><?php # echo $order['return_order']['reason']; ?></span></td>
<td><img class="prod-img" src="<?php # echo $order['return_order']['image']; ?>" alt="product"></td> -->
<td><span><?php echo date("F j, Y", strtotime($order['updatedAt'])); ?></span></td>
<td data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails"><span><?php echo date("F j, Y", strtotime($order['updatedAt'])); ?></span></td>
<td>
<span class="tbl-btn">
<a class="btn btn-lg btn-primary" onclick="updateRefundReceiveStatus('<?php echo $order['_id']; ?>', '<?php echo $order['return_order']['image']; ?>', '<?php echo $order['return_order']['reason']; ?>')">Received</a>
@ -518,7 +535,7 @@ if (is_array($vendorOrderss)) {
<!-- Content for "To Refund" tab -->
<table class="table ec-table">
<thead>
<tr>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -546,7 +563,7 @@ if (is_array($vendorOrderss)) {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -573,7 +590,7 @@ if (is_array($vendorOrderss)) {
<!-- Content for "Return Complete" tab -->
<table class="table ec-table">
<thead>
<tr>
<tr class="Title">
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Quantity</th>
@ -601,7 +618,7 @@ if (is_array($vendorOrderss)) {
?>
<tr class="tableView" data-value=' <?php echo $jsonorder; ?>' data-bs-toggle="modal" data-bs-target="#productDetails">
<td><img class="prod-img" src="<?php echo $order['items'][0]['product']['product_image']; ?>" alt="product"></td>
<td><span><?php echo $order['items'][0]['product']['name']; ?></span></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>
@ -867,7 +884,7 @@ if (is_array($vendorOrderss)) {
if (data && data !== "") {
// Update the status in the table without reloading the page
// document.querySelector(`[data-order-id="${orderId}"] .order-status`).innerText = 'COMPLETED';
// location.reload();
location.reload();
} else {
alert('Failed to update order status');
@ -973,9 +990,12 @@ if (is_array($vendorOrderss)) {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}"
alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -985,7 +1005,11 @@ if (is_array($vendorOrderss)) {
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>
@ -998,9 +1022,12 @@ if (is_array($vendorOrderss)) {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}"
alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1010,7 +1037,11 @@ if (is_array($vendorOrderss)) {
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>
@ -1023,9 +1054,12 @@ if (is_array($vendorOrderss)) {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}"
alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1035,7 +1069,11 @@ if (is_array($vendorOrderss)) {
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>
@ -1048,9 +1086,12 @@ if (is_array($vendorOrderss)) {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}"
alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1060,7 +1101,11 @@ if (is_array($vendorOrderss)) {
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>
@ -1073,9 +1118,12 @@ if (is_array($vendorOrderss)) {
<h5 class="modal-title fs-5 font-weight-bold">${jsonObject.items[0].product.name}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="row pt-3" style="display:flex; justify-content:center; margin-left:20px;">
<div class="row pt-3">
<div class="col-md-6">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%; padding-left:20px;" src="${jsonObject.items[0].product.product_image}" alt="product" />
<a href="${jsonObject.items[0].product.product_image}" target="_blank">
<img class="image-thumb-preview pt-3 pb-3" style="width:100%; height:100%;" src="${jsonObject.items[0].product.product_image}"
alt="product" />
</a>
</div>
<div class="col-md-6" style="margin:auto;">
<ul>
@ -1085,7 +1133,11 @@ if (is_array($vendorOrderss)) {
<li class="fs-6"><b>Refund Status:</b> ${jsonObject.return_order.status}</li>
<li class="fs-6"><b>Refund Reason:</b> ${jsonObject.return_order.reason}</li>
<li class="fs-6"><b>Refund Proof:</b></li>
<li class="fs-6 pl-3"><img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product"></li>
<li class="fs-6 pl-3">
<a href="${jsonObject.return_order.image}" target="_blank">
<img class="prod-img" style="width:50%; height:50%;" src="${jsonObject.return_order.image}" alt="product">
</a>
</li>
<li class="fs-6"><b>Date:</b> ${formattedDate}</li>
</ul>
</div>

View File

@ -56,11 +56,36 @@ if ($_SESSION["userId"] <> "") {
<link rel="stylesheet" href="assets/css/style2.css" />
<link rel="stylesheet" href="assets/css/responsive.css" />
<!-- FONTAWESOME -->
<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" />
<!-- Background css -->
<link rel="stylesheet" id="bg-switcher-css" href="assets/css/backgrounds/bg-4.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@latest/dist/css/select2.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@latest/dist/js/select2.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<style>
#edit_modal .cover-upload:after{
background-color: orange;
}
.ec-user-account .ec-vendor-block-bg {
width: 100%;
height: 200px;
background-image: none;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-blend-mode: overlay;
background-color: rgba(0, 0, 0, 0.6);
border-radius: 5px;
}
#editDelete:hover i{
color: #ffaa00;
cursor: pointer;
}
</style>
</head>
<body class="shop_page">
@ -280,7 +305,8 @@ if ($_SESSION["userId"] <> "") {
<!-- <?php var_dump($vendorData) ?> -->
<?php foreach ($vendorLoginIdjson['results'] as $vendor_index => $vendor) { ?>
<?php foreach ($vendor['address'] as $address_index => $address) { ?>
<div class="card mb-3">
<!-- added id -->
<div class="card mb-3" id="form-check-<?php echo $address_index ?>">
<div class="card-body">
<div class="selectCon">
<div class="selectWrap" style="display: flex; justify-content: center; align-items: center; width: 50%;">
@ -290,7 +316,7 @@ if ($_SESSION["userId"] <> "") {
</label>
</div>
<div class="selectWrap" style="display: flex; justify-content: center; align-items: center; width: 50%;">
<div class="selectWrap" style="display: flex; justify-content: center; align-items: center; width: 50%; margin-left:-20px;">
<input type="radio" style="padding-left: 0px !important; margin: 0px 0px !important;" name="selectedShippingAddress[<?php echo $vendor_index; ?>]" id="shipping_address_<?php echo $vendor_index; ?>_<?php echo $address_index; ?>" value="<?php echo $vendor_index; ?>_<?php echo $address_index; ?>" class="form-check-input" onchange="updateAddressShipping('<?php echo $vendor['_id']; ?>', <?php echo $address_index; ?>, true)" <?php echo $address["shipping"] ? 'checked' : ''; ?>>
<label class="form-check-label" style="margin: 0px 10px !important;" for="shipping_address_<?php echo $vendor_index; ?>_<?php echo $address_index; ?>">
Shipping Address
@ -299,9 +325,25 @@ if ($_SESSION["userId"] <> "") {
</div>
<!-- Stacy modified this block of code -->
<div class="container">
<div class="row">
<div class="col-md-12 mx-auto"> <!-- Adjust the column size as needed -->
<div id="editDelete" style="display:flex; float:right; width:20px; margin-right:-10px;" >
<?php
$address['id'] =$address_index;
$jsonAddress = json_encode($address)?>
<a href="javascript:0" data-bs-toggle="modal" data-value=' <?php echo $jsonAddress; ?>' data-bs-target="#thirdModal">
<i class="fa-regular fa-pen-to-square" style="font-size:15px; float:right;"></i></a>
<!-- <i class="fa-regular fa-trash-can" style="font-size:15px; float:right;"></i> -->
</div>
<div id="editDelete" style="display:flex; float:right; width:20px; margin-top:20px; margin-right:-20px; margin-top:30px;">
<!-- <i class="fa-solid fa-pen" style="font-size:15px; float:right;"></i></a> -->
<i onclick="deleteAddress('<?php echo $vendor['_id']; ?>', <?php echo $address_index; ?>, true)"
class="fa-regular fa-trash-can" style="font-size:15px; float:right;"></i>
</div>
<label class="form-check-label" for="address_<?php echo $vendor_index; ?>_<?php echo $address_index; ?>">
<?php echo $address['first_name']; ?> <?php echo $address['last_name']; ?><br>
<?php echo $address['address_1']; ?> <?php echo $address['address_2']; ?>
@ -309,6 +351,7 @@ if ($_SESSION["userId"] <> "") {
<?php echo $address['province']; ?> <?php echo $address['country']; ?><br>
Phone: <?php echo $address['phone']; ?>
</label>
</div>
</div>
</div>
@ -323,6 +366,7 @@ if ($_SESSION["userId"] <> "") {
</div>
</div>
<!-- secondModal -->
<div class="modal fade" id="secondModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-sm" role="document" style="max-width: 800px;">
<div class="modal-content">
@ -379,13 +423,99 @@ if ($_SESSION["userId"] <> "") {
</div>
</div>
<!-- Stacy added thirdModal -->
<div class="modal fade" id="thirdModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-sm" role="document" style="max-width: 800px;">
<div class="modal-content">
<div class="modal-body" style="overflow-y: auto; max-height: 90vh;">
<form>
<div class="form-group">
<label for="addressFirstName" class="text-dark font-weight-medium pt-3 mb-2">First Name</label>
<input type="text" class="form-control"
id="addressFirstName2"
value="<?php echo $address['first_name']; ?>">
<!-- <label for="addressFirstName" class="text-dark font-weight-medium pt-3 mb-2">First Name</label>-->
<input type="hidden" class="form-control" id="addressId" >
</div>
<div class="form-group">
<label for="addressLastName" class="text-dark font-weight-medium pt-3 mb-2">Last Name</label>
<input type="text" class="form-control" id="addressLastName2" value="<?php echo $address['last_name']; ?>">
<!-- <label for="addressLastName" class="text-dark font-weight-medium pt-3 mb-2">Last Name</label>
<input type="text" class="form-control" id="addressLastName"> -->
</div>
<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']; ?>">
<!-- <label for="addressContact" class="text-dark font-weight-medium pt-3 mb-2">Contact Number</label>
<input type="number" class="form-control" id="addressContact"> -->
</div>
<div class="form-group">
<label for="addressBuilding" class="text-dark font-weight-medium pt-3 mb-2">Building,Number</label>
<input type="text" class="form-control" id="addressBuilding2" value="<?php echo $address['address_1']; ?>">
<!-- <label for="addressBuilding" class="text-dark font-weight-medium pt-3 mb-2"> Building,Number </label>
<input type="text" class="form-control" id="addressBuilding"> -->
</div>
<div class="form-group">
<label for="addressStreet" class="text-dark font-weight-medium pt-3 mb-2">Street </label>
<input type="text" class="form-control" id="addressStreet2" value="<?php echo $address['address_2']; ?>">
<!-- <label for="addressStreet" class="text-dark font-weight-medium pt-3 mb-2"> Street </label>
<input type="text" class="form-control" id="addressStreet"> -->
</div>
<div class="form-group">
<label for="provinceSelect2">Province</label>
<select class="form-select" id="provinceSelect2">
<option id="provinceSelect2Opt" value="<?php echo $address['province']; ?>" >Select Province</option>
</select>
<!-- <label for="provinceSelect">Province</label>
<select class="form-select" id="provinceSelect">
<option value="" disabled selected hidden>Select Province</option>
</select> -->
</div>
<div class="form-group">
<label for="citySelect2">Municipality/City</label>
<select class="form-select" id="citySelect2" required>
<option value="" id="citySelect2Opt" selected hidden>Select Municipality/City</option>
</select>
</div>
<div class="form-group">
<label for="barangaySelect2">Barangay</label>
<select class="form-select" id="barangaySelect2" required>
<option value="" id="barangaySelect2Opt" selected hidden>Select Barangay</option>
</select>
</div>
<div class="form-group">
<label for="addressCountry2" class="text-dark font-weight-medium pt-3 mb-2">Country</label>
<input type="text" class="form-control" id="addressCountry2">
</div>
<button type="button" class="btn btn-primary" id="submitBtn2">Submit</button>
</form>
</div>
</div>
</div>
</div>
<!-- Bank -->
<div class="modal fade" id="vendorBankModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-sm" role="document" style="max-width: 800px;">
<div class="modal-content">
<div class="modal-body" style="overflow-y: auto; max-height: 90vh;">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#secondBankModal">Add New Bank</button>
<!-- Display a list of addresses and let the user choose -->
<!-- Display a list of banks and let the user choose -->
<form id="BankForm">
<!-- <?php var_dump($vendorData) ?> -->
<?php foreach ($vendorLoginIdjson['results'] as $vendor_index => $vendor) { ?>
@ -495,6 +625,208 @@ if ($_SESSION["userId"] <> "") {
});
}
</script>
<script>
// function for deleting address
const vendorid = `<?php echo $_SESSION["LoggedInVendorId"]; ?>`;
function deleteAddress(vendorid, addressIndex) {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid)
.then(response => response.json())
.then(data => {
let existingAddresses = data.address || [];
if (addressIndex >= 0 && addressIndex < existingAddresses.length) {
existingAddresses.splice(addressIndex, 1);
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
address: existingAddresses
}),
})
.then(response => {
if (response.ok) {
location.reload();
// filter the delete action
document.getElementById('form-check-' + addressIndex).remove();
} else {
console.error('Failed to submit data');
alert('Failed to submit data');
}
})
.catch(error => {
console.error('Error:', error);
alert('Error submitting data');
});
} else {
console.log("Invalid address index.");
}
})
.catch(error => {
console.error('Error:', error);
alert('Error fetching vendor data');
});
}
</script>
<script>
// added for thirdModal
$('#thirdModal').on('shown.bs.modal', function (event) {
var jsonString = $(event.relatedTarget).data('value');
var jsonObject = JSON.parse(jsonString);
console.log(jsonObject)
// document.getElementById("addressFirstName2").value('mmmm');
// $('#addressFirstName2').setAttribute('value','My default value');
// shows inputed data by the vendor
document.querySelector('input[id="addressFirstName2"]').value = jsonObject.first_name;
document.querySelector('input[id="addressLastName2"]').value = jsonObject.last_name;
document.querySelector('input[id="addressContact2"]').value = jsonObject.phone;
document.querySelector('input[id="addressBuilding2"]').value = jsonObject.address_1;
document.querySelector('input[id="addressStreet2"]').value = jsonObject.address_2;
document.querySelector('option[id="provinceSelect2Opt"]').text = jsonObject.province;
document.querySelector('option[id="provinceSelect2Opt"]').value = jsonObject.province;
document.querySelector('option[id="citySelect2Opt"]').text = jsonObject.city;
document.querySelector('option[id="citySelect2Opt"]').value = jsonObject.city;
document.querySelector('option[id="barangaySelect2Opt"]').text = jsonObject.barangay;
document.querySelector('option[id="barangaySelect2Opt"]').value = jsonObject.barangay;
document.querySelector('input[id="addressCountry2"]').value = jsonObject.country;
document.querySelector('input[id="addressId"]').value = jsonObject.id;
console.log('id ' + jsonObject.id)
const provinceSelect = $('#provinceSelect2'); // Use jQuery to select the element
const citySelect = $('#citySelect2'); // Use jQuery to select the element
const barangaySelect = $('#barangaySelect2'); // Use jQuery to select the element
// Initialize Select2 on the provinceSelect, citySelect, and barangaySelect elements
provinceSelect.select2({
dropdownParent: $('#thirdModal'),
containerCssClass: 'select2-zindex-high' // Optional, add a custom class for styling
});
citySelect.select2({
dropdownParent: $('#thirdModal'),
containerCssClass: 'select2-zindex-high' // Optional, add a custom class for styling
});
barangaySelect.select2({
dropdownParent: $('#thirdModal'),
containerCssClass: 'select2-zindex-high' // Optional, add a custom class for styling
});
// Fetch provinces data
fetch('https://psgc.gitlab.io/api/provinces')
.then(response => {
if (response.ok) {
return response.json();
} else {
console.error('Failed to fetch provinces');
throw new Error('Failed to fetch provinces');
}
})
.then(provincesData => {
// Iterate through the provinces data and add options
provincesData.forEach(province => {
const option = new Option(province.name, province.code);
provinceSelect.append(option);
});
// Add an extra option manually
const extraOption = new Option('Metro Manila', '130000000');
provinceSelect.append(extraOption);
// Add event listener to provinceSelect
provinceSelect.on('change', function() {
// Clear existing options in citySelect and barangaySelect
citySelect.html('<option value="" disabled selected hidden>Select City</option>');
barangaySelect.html('<option value="" disabled selected hidden>Select Barangay</option>');
// Fetch and update cities/municipalities based on the selected province
updateCities();
});
})
.catch(error => {
console.error('Error:', error);
});
// Function to update city/municipality options based on the selected province
function updateCities() {
const selectedProvinceCode = provinceSelect.val(); // Use val() to get the selected value with Select2
if (selectedProvinceCode) {
let citiesEndpoint;
if (selectedProvinceCode === '130000000') {
// Check if Metro Manila is selected
citiesEndpoint = 'https://psgc.gitlab.io/api/regions/130000000/cities-municipalities/';
} else {
citiesEndpoint = `https://psgc.gitlab.io/api/provinces/${selectedProvinceCode}/cities-municipalities/`;
}
fetch(citiesEndpoint)
.then(response => {
if (response.ok) {
return response.json();
} else {
console.error('Failed to fetch cities/municipalities');
throw new Error('Failed to fetch cities/municipalities');
}
})
.then(citiesData => {
// Iterate through the cities data and add options
citiesData.forEach(city => {
const option = new Option(city.name, city.code);
citySelect.append(option);
});
})
.catch(error => {
console.error('Error:', error);
});
}
}
// Add event listener to citySelect
citySelect.on('change', function() {
// Clear existing options in barangaySelect
barangaySelect.html('<option value="" disabled selected hidden>Select Barangay</option>');
// Fetch and update barangays based on the selected city/municipality
const selectedCityCode = citySelect.val();
if (selectedCityCode) {
fetch(`https://psgc.gitlab.io/api/cities-municipalities/${selectedCityCode}/barangays/`)
.then(response => {
if (response.ok) {
return response.json();
} else {
console.error('Failed to fetch barangays');
throw new Error('Failed to fetch barangays');
}
})
.then(barangaysData => {
// Iterate through the barangays data and add options
barangaysData.forEach(barangay => {
const option = new Option(barangay.name, barangay.code);
barangaySelect.append(option);
});
})
.catch(error => {
console.error('Error:', error);
});
}
});
// document.querySelector('input[id="addressFirstName2"]').value = jsonObject.last_name;
});
</script>
<script>
const vendorid = `<?php echo $_SESSION["LoggedInVendorId"]; ?>`;
document.addEventListener('DOMContentLoaded', function() {
@ -606,6 +938,7 @@ if ($_SESSION["userId"] <> "") {
$('#submitBtn').on('click', function() {
console.log('clickkkkkkkk')
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid)
.then(response => response.json())
.then(data => {
@ -663,6 +996,93 @@ if ($_SESSION["userId"] <> "") {
});
// Added function for editing the address
$('#submitBtn2').on('click', function() {
// function updateAddress(){
// Retrieve existing addresses from the API
// fetch('https://api.obanana.shop/api/v1/customers/65482e8d209ff8d348bd30fd')
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid)
.then(response => response.json())
.then(data => {
// Get the existing addresses array
const existingAddresses = data.address || [];
// Get the new address details
const firstName = $('#addressFirstName2').val();
const lastName = $('#addressLastName2').val();
const contact = $('#addressContact2').val();
const buildingNumber = $('#addressBuilding2').val();
const street = $('#addressStreet2').val();
const province = $('#provinceSelect2 :selected').text();
const city = $('#citySelect2 :selected').text();
const barangay = $('#barangaySelect2 :selected').text();
const country = $('#addressCountry2').val();
const id = $('#addressId').val();
console.log('clickkkkkkkk'+ id)
// Create a new address object
const newAddress = {
first_name: firstName,
last_name: lastName,
phone: contact,
address_1: buildingNumber,
address_2: street,
city: city,
province: province,
barangay: barangay,
country: country,
};
// Add the new address to the existing addresses
// existingAddresses.push(newAddress);
// var newAddresses= existingAddresses.filter((e,i)=>i!==id)
let existingAddress = existingAddresses
existingAddress[id]={
first_name: firstName,
last_name: lastName,
phone: contact,
address_1: buildingNumber,
address_2: street,
city: city,
province: province,
barangay: barangay,
country: country,
};
console.log( existingAddress[id])
// Make a PATCH request to update the addresses array
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
address: existingAddress
}),
});
})
.then(response => {
if (response.ok) {
// Handle success (e.g., show a success message)
location.reload();
} else {
// Handle error
console.error('Failed to submit data');
alert('Failed to submit data');
}
})
.catch(error => {
// Handle network or other errors
console.error('Error:', error);
alert('Error submitting data');
});
});
$('#submitBankBtn').on('click', function() {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid)
@ -754,7 +1174,7 @@ if ($_SESSION["userId"] <> "") {
if (!updateResponse.ok) {
throw new Error(`Failed to update address: ${updateResponse.status}`);
}
console.log(`Address updated successfully for customer ${vendorid}`);
console.log(`Address updated successfully for vendor ${vendorid}`);
} catch (error) {
console.error('Error updating address:', error.message);
}
@ -771,7 +1191,7 @@ if ($_SESSION["userId"] <> "") {
});
if (!response.ok) {
throw new Error(`Failed to fetch customer data: ${response.status}`);
throw new Error(`Failed to fetch vendor data: ${response.status}`);
}
// console.log(customerId + " ." + addressIndex + "." +isBilling + "." + isShipping)
const vendorsData = await response.json();
@ -828,7 +1248,7 @@ if ($_SESSION["userId"] <> "") {
sProvinceElement.textContent = vendorsData.address[addressIndex].province;
sCountryElement.textContent = vendorsData.address[addressIndex].country;
}
console.log(`Address updated successfully for customer ${vendorid}`);
console.log(`Address updated successfully for vendor ${vendorid}`);
} catch (error) {
console.error('Error updating address:', error.message);
}
@ -937,188 +1357,188 @@ if ($_SESSION["userId"] <> "") {
</div>
<script>
function uploadVendorProfileImage() {
var vendorid = '<?php echo $_SESSION["LoggedInVendorId"] ?>';
var file = document.getElementById('imageUpload').files[0];
if (file) {
const reader = new FileReader();
var vendorid = '<?php echo $_SESSION["LoggedInVendorId"] ?>';
var file = document.getElementById('imageUpload').files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = new Image();
img.onload = function() {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const maxWidth = 1200;
const maxHeight = 1000;
const aspectRatio = img.width / img.height;
let newWidth = img.width;
let newHeight = img.height;
reader.onload = function(event) {
const img = new Image();
img.onload = function() {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const maxWidth = 1200;
const maxHeight = 1000;
const aspectRatio = img.width / img.height;
let newWidth = img.width;
let newHeight = img.height;
if (img.width > maxWidth) {
newWidth = maxWidth;
newHeight = newWidth / aspectRatio;
}
if (img.width > maxWidth) {
newWidth = maxWidth;
newHeight = newWidth / aspectRatio;
}
if (newHeight > maxHeight) {
newHeight = maxHeight;
newWidth = newHeight * aspectRatio;
}
if (newHeight > maxHeight) {
newHeight = maxHeight;
newWidth = newHeight * aspectRatio;
}
canvas.width = newWidth;
canvas.height = newHeight;
ctx.drawImage(img, 0, 0, newWidth, newHeight);
canvas.width = newWidth;
canvas.height = newHeight;
ctx.drawImage(img, 0, 0, newWidth, newHeight);
canvas.toBlob((blob) => {
const resizedFile = new File([blob], file.name, {
type: 'image/jpeg'
});
canvas.toBlob((blob) => {
const resizedFile = new File([blob], file.name, {
type: 'image/jpeg'
});
var formData = new FormData();
formData.append('image_id', vendorid);
formData.append('category', 'vendor');
formData.append('image', resizedFile);
var formData = new FormData();
formData.append('image_id', vendorid);
formData.append('category', 'vendor');
formData.append('image', resizedFile);
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
.then(response => {
if (response.ok) {
return response.json();
} else {
console.error('File upload failed');
throw new Error('File upload failed');
}
})
.then(result => {
const filename = encodeURI(result.filename);
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
.then(response => {
if (response.ok) {
return response.json();
} else {
console.error('File upload failed');
throw new Error('File upload failed');
}
})
.then(result => {
const filename = encodeURI(result.filename);
const payload = {
vendor_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/vendor_uploads/${filename}`,
};
const payload = {
vendor_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/vendor_uploads/${filename}`,
};
console.log('Payload:', payload);
console.log('Payload:', payload);
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
})
.then(secondResponse => {
if (secondResponse.ok) {
console.log('Second request successful');
location.reload();
} else {
console.error('Second request failed');
}
})
.catch(error => {
console.error('Error during fetch:', error);
});
}, 'image/jpeg');
};
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
})
.then(secondResponse => {
if (secondResponse.ok) {
console.log('Second request successful');
location.reload();
} else {
console.error('Second request failed');
}
})
.catch(error => {
console.error('Error during fetch:', error);
});
}, 'image/jpeg');
};
img.src = event.target.result;
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
}
}
reader.readAsDataURL(file);
}
}
function uploadProfileBanner() {
var vendorid = '<?php echo $_SESSION["LoggedInVendorId"] ?>';
var file = document.getElementById('thumbUpload01').files[0];
if (file) {
const reader = new FileReader();
function uploadProfileBanner() {
var vendorid = '<?php echo $_SESSION["LoggedInVendorId"] ?>';
var file = document.getElementById('thumbUpload01').files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = new Image();
img.onload = function() {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const maxWidth = 1200;
const maxHeight = 1000;
const aspectRatio = img.width / img.height;
let newWidth = img.width;
let newHeight = img.height;
reader.onload = function(event) {
const img = new Image();
img.onload = function() {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const maxWidth = 1200;
const maxHeight = 1000;
const aspectRatio = img.width / img.height;
let newWidth = img.width;
let newHeight = img.height;
if (img.width > maxWidth) {
newWidth = maxWidth;
newHeight = newWidth / aspectRatio;
}
if (img.width > maxWidth) {
newWidth = maxWidth;
newHeight = newWidth / aspectRatio;
}
if (newHeight > maxHeight) {
newHeight = maxHeight;
newWidth = newHeight * aspectRatio;
}
if (newHeight > maxHeight) {
newHeight = maxHeight;
newWidth = newHeight * aspectRatio;
}
canvas.width = newWidth;
canvas.height = newHeight;
ctx.drawImage(img, 0, 0, newWidth, newHeight);
canvas.width = newWidth;
canvas.height = newHeight;
ctx.drawImage(img, 0, 0, newWidth, newHeight);
canvas.toBlob((blob) => {
const resizedFile = new File([blob], file.name, {
type: 'image/jpeg'
});
canvas.toBlob((blob) => {
const resizedFile = new File([blob], file.name, {
type: 'image/jpeg'
});
var formData = new FormData();
formData.append('image_id', vendorid + '_banner');
formData.append('category', 'vendor');
formData.append('image', resizedFile);
var formData = new FormData();
formData.append('image_id', vendorid + '_banner');
formData.append('category', 'vendor');
formData.append('image', resizedFile);
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
.then(response => {
if (response.ok) {
return response.json();
} else {
console.error('File upload failed');
throw new Error('File upload failed');
}
})
.then(result => {
const filename = encodeURI(result.filename);
// const filename = result.filename;
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/upload_image', {
method: 'POST',
body: formData
})
.then(response => {
if (response.ok) {
return response.json();
} else {
console.error('File upload failed');
throw new Error('File upload failed');
}
})
.then(result => {
const filename = encodeURI(result.filename);
// const filename = result.filename;
const payload = {
vendor_banner: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/vendor_uploads/${filename}`,
const payload = {
vendor_banner: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/vendor_uploads/${filename}`,
};
};
console.log('Payload:', payload);
console.log('Payload:', payload);
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
})
.then(secondResponse => {
if (secondResponse.ok) {
console.log('Second request successful');
location.reload();
} else {
console.error('Second request failed');
}
})
.catch(error => {
console.error('Error during fetch:', error);
});
}, 'image/jpeg');
};
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/vendors/' + vendorid, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
})
.then(secondResponse => {
if (secondResponse.ok) {
console.log('Second request successful');
location.reload();
} else {
console.error('Second request failed');
}
})
.catch(error => {
console.error('Error during fetch:', error);
});
}, 'image/jpeg');
};
img.src = event.target.result;
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
}
}
reader.readAsDataURL(file);
}
}
</script>
<div class="ec-vendor-upload-detail">