obanana_b2b_test/user-profile.php

1508 lines
82 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
include "functions.php";
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
} else {
$_SESSION["isLoggedIn"] = false;
header("location: login.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<title>oBanana B2B - Elevate Your Business</title>
<meta name="keywords" content="apparel, catalog, clean, ecommerce, ecommerce HTML, electronics, fashion, html eCommerce, html store, minimal, multipurpose, multipurpose ecommerce, online store, responsive ecommerce template, shops" />
<meta name="description" content="Best ecommerce html template for single and multi vendor store.">
<meta name="author" content="ashishmaraviya">
<!-- site Favicon -->
<link rel="icon" href="assets/images/favicon/favicon.png" sizes="32x32" />
<link rel="apple-touch-icon" href="assets/images/favicon/favicon.png" />
<meta name="msapplication-TileImage" content="assets/images/favicon/favicon.png" />
<!-- css Icon Font -->
<link rel="stylesheet" href="assets/css/vendor/ecicons.min.css" />
<!-- css All Plugins Files -->
<link rel="stylesheet" href="assets/css/plugins/animate.css" />
<link rel="stylesheet" href="assets/css/plugins/swiper-bundle.min.css" />
<link rel="stylesheet" href="assets/css/plugins/jquery-ui.min.css" />
<link rel="stylesheet" href="assets/css/plugins/countdownTimer.css" />
<link rel="stylesheet" href="assets/css/plugins/slick.min.css" />
<link rel="stylesheet" href="assets/css/plugins/bootstrap.css" />
<!-- Main Style -->
<link rel="stylesheet" href="assets/css/style.css" />
<link rel="stylesheet" href="assets/css/style2.css" />
<link rel="stylesheet" href="assets/css/responsive.css" />
<!-- 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>
<script>
function updateCartItemCount() {
$.get("cartitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data, status) {
if (data != "") {
console.log("Data: " + data + "\nStatus: " + status);
document.getElementById("cartItemCount").innerHTML = data;
}
});
}
function updateWishItemCount() {
$.get("wishlistitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data) {
if (data != "") {
document.getElementById("wishItemCount").innerHTML = data;
}
});
}
</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" onload="updateCartItemCount(); updateWishItemCount()">
<div id="ec-overlay">
<div class="ec-ellipsis">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<!-- Header start -->
<?php include "header.php" ?>
<!-- Header End -->
<!-- ekka Cart Start -->
<!-- ekka Cart End -->
<!-- Category Sidebar start -->
<?php include "category-slider.php" ?>
<!-- Ec breadcrumb start -->
<div class="sticky-header-next-sec ec-breadcrumb section-space-mb">
<div class="container">
<div class="row">
<div class="col-12">
<div class="row ec_breadcrumb_inner">
<div class="col-md-6 col-sm-12">
<h2 class="ec-breadcrumb-title">User Profile</h2>
</div>
<div class="col-md-6 col-sm-12">
<!-- ec-breadcrumb-list start -->
<ul class="ec-breadcrumb-list">
<li class="ec-breadcrumb-item"><a href="index.php">Home</a></li>
<li class="ec-breadcrumb-item active">Profile</li>
</ul>
<!-- ec-breadcrumb-list end -->
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Ec breadcrumb end -->
<!-- User profile section -->
<section class="ec-page-content ec-vendor-uploads ec-user-account section-space-p">
<div class="container">
<div class="row">
<!-- Sidebar Area Start -->
<div class="ec-shop-leftside ec-vendor-sidebar col-lg-3 col-md-12">
<div class="ec-sidebar-wrap ec-border-box">
<!-- Sidebar Category Block -->
<div class="ec-sidebar-block">
<div class="ec-vendor-block">
<!-- <div class="ec-vendor-block-bg"></div>
<div class="ec-vendor-block-detail">
<img class="v-img" src="assets/images/user/1.jpg" alt="vendor image">
<h5>Mariana Johns</h5>
</div> -->
<?php include 'user-profile-tabs.php' ?>
</div>
</div>
</div>
</div>
<div class="ec-shop-rightside col-lg-9 col-md-12">
<div class="ec-vendor-dashboard-card ec-vendor-setting-card">
<div class="ec-vendor-card-body">
<div class="row">
<div class="col-md-12">
<div class="ec-vendor-block-profile">
<div class="ec-vendor-block-img space-bottom-30 ">
<div class="ec-vendor-block-bg" style="background-color: orange; background-image: url(<?php echo $customer_data['customer_banner'] ?>) !important;">
<a href="#" class="btn btn-lg btn-primary" data-link-action="editmodal" title="Edit Detail" data-bs-toggle="modal" data-bs-target="#edit_modal">Edit Detail</a>
</div>
<div class="ec-vendor-block-detail">
<?php
$customer_image = isset($customer_data[0]['customer_image']) ? $customer_data[0]['customer_image'] : 'https://yourteachingmentor.com/wp-content/uploads/2020/12/istockphoto-1223671392-612x612-1.jpg';
?>
<img class="v-img" src=<?php echo $customer_image ?> alt="vendor image">
<h5 class="name"><?php echo $customer_data[0]['first_name'] ?> <?php echo $customer_data[0]['last_name'] ?></h5>
</div>
</div>
<h5>Account Information </h5>
<div class="row">
<div class="col-md-6 col-sm-12">
<div class="ec-vendor-detail-block ec-vendor-block-email space-bottom-30">
<h6>E-mail address </h6>
<ul>
<li><strong> </strong><?php echo $customer_data[0]['user_email'] ?></li>
</ul>
</div>
</div>
<div class="col-md-6 col-sm-12">
<div class="ec-vendor-detail-block ec-vendor-block-contact space-bottom-30">
<h6>Contact number</h6>
<ul>
<li><strong><?php echo $customer_data[0]['phone_number'] ?></li>
</ul>
</div>
</div>
<div class="col-md-12 col-sm-12">
<div class="ec-vendor-detail-block ec-vendor-block-contact space-bottom-30">
<h6>Address <button type="button" class="btn btn-primary" id="addressModalBtn" data-bs-toggle="modal" data-bs-target="#addressModal">My Addresses</button></h6>
<div class="shipping">
<?php foreach ($customer_data[0]['address'] as $address) : ?>
<?php if ($address['shipping']) : ?>
<div class="sName">
<span>Name:
<span id="selectedFName"><?php echo $address['first_name']; ?></span>
<span id="selectedLName"> <?php echo $address['last_name']; ?></span>
</span>
</div>
<div class="sContact">
<span id="selectedContact">Contact #: <?php echo $address['phone']; ?></span>
</div>
<div class="sAddress">
<span>Address:
<span id="sBuilding"><?php echo $address['address_1']; ?></span>
<span id="sStreet"><?php echo $address['address_2']; ?></span>
<span id="sBarangay"><?php echo $address['barangay']; ?></span>
<span id="sCity"><?php echo $address['city']; ?></span>
<span id="sProvince"><?php echo $address['province']; ?></span>
<span id="sCountry"><?php echo $address['country']; ?></span>
</span>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="addressModal" 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="#secondModal">Add New Address</button>
<!-- Display a list of addresses and let the user choose -->
<form id="addressForm">
<?php foreach ($customer_data as $customer_index => $customer) { ?>
<?php foreach ($customer['address'] as $address_index => $address) { ?>
<!-- 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%;">
<input type="radio" style="padding-left: 0px !important; margin: 0px 0px !important;" name="selectedBillingAddress[<?php echo $customer_index; ?>]" id="billing_address_<?php echo $customer_index; ?>_<?php echo $address_index; ?>" value="<?php echo $customer_index; ?>_<?php echo $address_index; ?>" class="form-check-input" onchange="updateAddressBilling('<?php echo $customer['_id']; ?>', <?php echo $address_index; ?>, true)" <?php echo $address["billing"] ? 'checked' : ''; ?>>
<label class="form-check-label" style="margin: 0px 10px !important;" for="billing_address_<?php echo $customer_index; ?>_<?php echo $address_index; ?>">
Billing Address
</label>
</div>
<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 $customer_index; ?>]" id="shipping_address_<?php echo $customer_index; ?>_<?php echo $address_index; ?>" value="<?php echo $customer_index; ?>_<?php echo $address_index; ?>" class="form-check-input" onchange="updateAddressShipping('<?php echo $customer['_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 $customer_index; ?>_<?php echo $address_index; ?>">
Shipping Address
</label>
</div>
</div>
<!-- 03-01-2024 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 $customer['_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 $customer_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']; ?>
<?php echo $address['barangay']; ?>, <?php echo $address['city']; ?>,
<?php echo $address['province']; ?> <?php echo $address['country']; ?><br>
Phone: <?php echo $address['phone']; ?>
</label>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<?php } ?>
</form>
</div>
</div>
</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">
<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="addressFirstName">
</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="addressLastName">
</div>
<div class="form-group">
<label for="addressContact" class="text-dark font-weight-medium pt-3 mb-2">Contact Number</label>
<input type="number" class="form-control" id="addressContact">
</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="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="addressStreet">
</div>
<div class="form-group">
<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="citySelect">Municipality/City</label>
<select class="form-select" id="citySelect" required>
<option value="" disabled selected hidden>Select Municipality/City</option>
</select>
</div>
<div class="form-group">
<label for="barangaySelect">Barangay</label>
<select class="form-select" id="barangaySelect" required>
<option value="" disabled selected hidden>Select Barangay</option>
</select>
</div>
<div class="form-group">
<label for="addressCountry" class="text-dark font-weight-medium pt-3 mb-2">Country</label>
<input type="text" class="form-control" id="addressCountry" >
</div>
<button type="button" class="btn btn-primary" id="submitBtn">Submit</button>
</form>
</div>
</div>
</div>
</div>
<!-- 03-01-2024 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>
<script>
// var myElement = document.getElementById('myElement');
// myElement.style.backgroundImage = 'red';
function editUser() {
// var fileInput = document.getElementById('fileInput' + vendorId);
// var file = fileInput.files[0];
const customerId = `<?php echo $customer_data[0]['_id']; ?>`;
const firstName = document.getElementById('first_name-').value;
const lastName = document.getElementById('last_name-').value;
const username = document.getElementById('username-').value;
const phone = document.getElementById('phone-').value;
// If no file selected, only update the email
fetch(`https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/${customerId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
first_name: firstName,
last_name: lastName,
user_login: username,
phone_number: phone,
})
})
.then(response => {
if (response.ok) {
console.log('Email update successful');
location.reload();
// Handle any other actions after the successful email update
} else {
console.error('Email update failed');
// Handle errors or display a message to the user
}
})
.catch(error => {
console.error('Error during fetch:', error);
// Handle network or other errors
});
}
</script>
<script>
// function for delete
function deleteAddress(customerId, addressIndex) {
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId)
.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/customers/' + customerId, {
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 customer data');
});
}
</script>
<script>
// 03-04-2024 added
$('#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 customer
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;
});
const customerId = '<?php echo $customer_data[0]['_id']; ?>';
document.addEventListener('DOMContentLoaded', function() {
// Get the select elements
const provinceSelect = $('#provinceSelect'); // Use jQuery to select the element
const citySelect = $('#citySelect'); // Use jQuery to select the element
const barangaySelect = $('#barangaySelect'); // Use jQuery to select the element
// Initialize Select2 on the provinceSelect, citySelect, and barangaySelect elements
provinceSelect.select2({
dropdownParent: $('#secondModal'),
containerCssClass: 'select2-zindex-high' // Optional, add a custom class for styling
});
citySelect.select2({
dropdownParent: $('#secondModal'),
containerCssClass: 'select2-zindex-high' // Optional, add a custom class for styling
});
barangaySelect.select2({
dropdownParent: $('#secondModal'),
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);
});
}
});
$('#submitBtn').on('click', function() {
// Retrieve existing addresses from the API
// fetch('https://api.obanana.shop/api/v1/customers/65482e8d209ff8d348bd30fd')
console.log('clickkkkkkkk')
fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId)
.then(response => response.json())
.then(data => {
// Get the existing addresses array
const existingAddresses = data.address || [];
// Get the new address details
const firstName = $('#addressFirstName').val();
const lastName = $('#addressLastName').val();
const contact = $('#addressContact').val();
const buildingNumber = $('#addressBuilding').val();
const street = $('#addressStreet').val();
const province = $('#provinceSelect :selected').text();
const city = $('#citySelect :selected').text();
const barangay = $('#barangaySelect :selected').text();
const country = $('#addressCountry').val();
// 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);
// Make a PATCH request to update the addresses array
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
address: existingAddresses
}),
});
})
.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');
});
});
});
// Added function for edit
$('#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/customers/' + customerId)
.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/customers/' + customerId, {
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');
});
});
</script>
<script>
async function updateAddressBilling(customerId, addressIndex, isBilling) {
try {
const apiUrl = `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/${customerId}`;
const response = await fetch(apiUrl, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`Failed to fetch customer data: ${response.status}`);
}
// console.log(customerId + " ." + addressIndex + "." +isBilling + "." + isShipping)
const customerData = await response.json();
// Iterate through addresses and update billing/shipping flags
customerData.address.forEach((address, index) => {
if (index === addressIndex) {
if (isBilling !== undefined) {
address.billing = isBilling;
const radioButtonId = `#billing_address_${customerId}_${addressIndex}`;
$(radioButtonId).prop('checked', isBilling);
}
// if (isShipping !== undefined) {
// address.shipping = isShipping;
// }
} else {
// Set other addresses to false
address.billing = false;
// address.shipping = false;
}
});
// Send a PATCH request to update the customer data
const updateResponse = await fetch(apiUrl, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
address: customerData.address
}),
});
if (!updateResponse.ok) {
throw new Error(`Failed to update address: ${updateResponse.status}`);
}
console.log(`Address updated successfully for customer ${customerId}`);
} catch (error) {
console.error('Error updating address:', error.message);
}
}
async function updateAddressShipping(customerId, addressIndex, isShipping) {
try {
// const customerId = `<?php #echo $customer_data[0]['_id']; ?>`;
const apiUrl = `https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/${customerId}`;
const response = await fetch(apiUrl, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`Failed to fetch customer data: ${response.status}`);
}
// console.log(customerId + " ." + addressIndex + "." +isBilling + "." + isShipping)
const customerData = await response.json();
// Iterate through addresses and update billing/shipping flags
customerData.address.forEach((address, index) => {
if (index === addressIndex) {
// if (isBilling !== undefined) {
// address.billing = isBilling;
// }
if (isShipping !== undefined) {
address.shipping = isShipping;
}
} else {
// Set other addresses to false
// address.billing = false;
address.shipping = false;
}
});
// Send a PATCH request to update the customer data
const updateResponse = await fetch(apiUrl, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
address: customerData.address
}),
});
if (!updateResponse.ok) {
throw new Error(`Failed to update address: ${updateResponse.status}`);
}
const selectedShippingElement = document.getElementById('selectedFName');
const selectedLNameElement = document.getElementById('selectedLName');
const selectedContactElement = document.getElementById('selectedContact');
const sBuildingElement = document.getElementById('sBuilding');
const sStreetElement = document.getElementById('sStreet');
const sBarangayElement = document.getElementById('sBarangay');
const sCityElement = document.getElementById('sCity');
const sProvinceElement = document.getElementById('sProvince');
const sCountryElement = document.getElementById('sCountry');
if (selectedShippingElement) {
selectedShippingElement.textContent = customerData.address[addressIndex].first_name;
// Update other address details similarly
selectedLNameElement.textContent = customerData.address[addressIndex].last_name;
selectedContactElement.textContent = 'Contact #: ' + customerData.address[addressIndex].phone;
sBuildingElement.textContent = customerData.address[addressIndex].address_1;
sStreetElement.textContent = customerData.address[addressIndex].address_2;
sBarangayElement.textContent = customerData.address[addressIndex].barangay;
sCityElement.textContent = customerData.address[addressIndex].city;
sProvinceElement.textContent = customerData.address[addressIndex].province;
sCountryElement.textContent = customerData.address[addressIndex].country;
}
console.log(`Address updated successfully for customer ${customerId}`);
// location.reload();
// header("location: user-profile.php");
} catch (error) {
console.error('Error updating address:', error.message);
}
}
</script>
</section>
<!-- End User profile section -->
<!-- Footer Start -->
<?php include "footer.php" ?>
<!-- Footer Area End -->
<!-- Modal -->
<div class="modal fade" id="edit_modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<div class="ec-vendor-block-img space-bottom-30">
<div class="ec-vendor-block-bg cover-upload" style="background-color: orange;">
<div class="thumb-upload">
<!-- <div class="thumb-edit">
<input type='file' id="thumbUpload01" class="ec-image-upload"
accept=".png, .jpg, .jpeg" />
<label><i class="fi-rr-edit"></i></label>
</div> -->
<div class="thumb-preview ec-preview">
<div class="image-thumb-preview">
<!-- <img class="image-thumb-preview ec-image-preview v-img" src=<?php echo $customer_data[0]['customer_image'] ?> alt="edit" /> -->
</div>
</div>
</div>
</div>
<div class="ec-vendor-block-detail">
<div class="thumb-upload">
<div class="thumb-edit">
<input type='file' id="imageUpload" class="ec-image-upload" accept=".png, .jpg, .jpeg" onchange="uploadProfileImage()" />
<label><i class="fi-rr-edit"></i></label>
</div>
<div class="thumb-preview ec-preview">
<div class="image-thumb-preview">
<?php
$customer_image = isset($customer_data[0]['customer_image']) ? $customer_data[0]['customer_image'] : 'https://yourteachingmentor.com/wp-content/uploads/2020/12/istockphoto-1223671392-612x612-1.jpg';
?>
<img class="image-thumb-preview ec-image-preview v-img" src=<?php echo $customer_image ?> alt="edit" />
</div>
</div>
</div>
</div>
<script>
function uploadProfileImage() {
var customerId = '<?php echo $_SESSION['customerId'] ?>';
var file = document.getElementById('imageUpload').files[0];
if (file) {
var formData = new FormData();
formData.append('image_id', customerId);
formData.append('category', 'customer');
formData.append('image', file);
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 = result.filename;
const payload = {
customer_image: `https://<?php echo $_SESSION["data_endpoint"]; ?>/images/storage/customer_uploads/${filename}`,
};
console.log('Payload:', payload);
return fetch('https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId, {
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);
});
}
}
</script>
<div class="ec-vendor-upload-detail">
<form class="row g-3">
<!-- <div class="col-md-6 space-t-15">
<label class="form-label">First name</label>
<input type="text" class="form-control">
</div> -->
<div class="form-group">
<label for="first_name-" class="text-dark font-weight-medium pt-3 mb-2">First Name</label>
<input type="text" class="form-control" id="first_name-" value="<?php echo $customer_data[0]['first_name'] ?>">
</div>
<div class="form-group">
<label for="last_name-" class="text-dark font-weight-medium pt-3 mb-2">Last Name</label>
<input type="text" class="form-control" id="last_name-" value="<?php echo $customer_data[0]['last_name'] ?>">
</div>
<div class="form-group">
<label for="username-" class="text-dark font-weight-medium pt-3 mb-2">Username</label>
<input type="text" class="form-control" id="username-" value="<?php echo $customer_data[0]['user_login'] ?>">
</div>
<div class="form-group">
<label for="phone-" class="text-dark font-weight-medium pt-3 mb-2">Contact Number</label>
<input type="text" class="form-control" id="phone-" value="<?php echo $customer_data[0]['phone_number'] ?>">
</div>
<!-- <div class="col-md-12 space-t-15">
<button type="submit" class="btn btn-primary">Update</button>
<a href="#" class="btn btn-lg btn-secondary qty_close" data-bs-dismiss="modal"
aria-label="Close">Close</a>
</div> -->
</form>
<button type="button" class="btn btn-primary btn-pill my-3" onclick="editUser()">Upload</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal end -->
<!-- Footer navigation panel for responsive display -->
<div class="ec-nav-toolbar">
<div class="container">
<div class="ec-nav-panel">
<div class="ec-nav-panel-icons">
<a href="#ec-mobile-menu" class="navbar-toggler-btn ec-header-btn ec-side-toggle"><i class="fi-rr-menu-burger"></i></a>
</div>
<div class="ec-nav-panel-icons">
<a href="#ec-side-cart" class="toggle-cart ec-header-btn ec-side-toggle"><i class="fi-rr-shopping-bag"></i><span class="ec-cart-noti ec-header-count cart-count-lable">3</span></a>
</div>
<div class="ec-nav-panel-icons">
<a href="index.php" class="ec-header-btn"><i class="fi-rr-home"></i></a>
</div>
<div class="ec-nav-panel-icons">
<a href="wishlist.html" class="ec-header-btn"><i class="fi-rr-heart"></i><span class="ec-cart-noti">4</span></a>
</div>
<div class="ec-nav-panel-icons">
<a href="login.php" class="ec-header-btn"><i class="fi-rr-user"></i></a>
</div>
</div>
</div>
</div>
<!-- Footer navigation panel for responsive display end -->
<!-- raymart remove popup feb 20 2024 -->
<!-- Recent Purchase Popup -->
<!-- <div class="recent-purchase">
<img src="assets/images/product-image/1.jpg" alt="payment image">
<div class="detail">
<p>Someone in new just bought</p>
<h6>stylish baby shoes</h6>
<p>10 Minutes ago</p>
</div>
<a href="javascript:void(0)" class="icon-btn recent-close">×</a>
</div> -->
<!-- Recent Purchase Popup end -->
<!-- Cart Floating Button -->
<div class="ec-cart-float">
<a href="#ec-side-cart" class="ec-header-btn ec-side-toggle">
<div class="header-icon"><i class="fi-rr-shopping-basket"></i>
</div>
<span class="ec-cart-count cart-count-lable">3</span>
</a>
</div>
<!-- Cart Floating Button end -->
<!-- Whatsapp -->
<div class="ec-style ec-right-bottom">
<!-- Start Floating Panel Container -->
<div class="ec-panel">
<!-- Panel Header -->
<div class="ec-header">
<strong>Need Help?</strong>
<p>Chat with us on WhatsApp</p>
</div>
<!-- Panel Content -->
<div class="ec-body">
<ul>
<!-- Start Single Contact List -->
<li>
<a class="ec-list" data-number="918866774266" data-message="Please help me! I have got wrong product - ORDER ID is : #654321485">
<div class="d-flex bd-highlight">
<!-- Profile Picture -->
<div class="ec-img-cont">
<img src="assets/images/whatsapp/profile_01.jpg" class="ec-user-img" alt="Profile image">
<span class="ec-status-icon"></span>
</div>
<!-- Display Name & Last Seen -->
<div class="ec-user-info">
<span>Sahar Darya</span>
<p>Sahar left 7 mins ago</p>
</div>
<!-- Chat iCon -->
<div class="ec-chat-icon">
<i class="fa fa-whatsapp"></i>
</div>
</div>
</a>
</li>
<!--/ End Single Contact List -->
<!-- Start Single Contact List -->
<li>
<a class="ec-list" data-number="918866774266" data-message="Please help me! I have got wrong product - ORDER ID is : #654321485">
<div class="d-flex bd-highlight">
<!-- Profile Picture -->
<div class="ec-img-cont">
<img src="assets/images/whatsapp/profile_02.jpg" class="ec-user-img" alt="Profile image">
<span class="ec-status-icon ec-online"></span>
</div>
<!-- Display Name & Last Seen -->
<div class="ec-user-info">
<span>Yolduz Rafi</span>
<p>Yolduz is online</p>
</div>
<!-- Chat iCon -->
<div class="ec-chat-icon">
<i class="fa fa-whatsapp"></i>
</div>
</div>
</a>
</li>
<!--/ End Single Contact List -->
<!-- Start Single Contact List -->
<li>
<a class="ec-list" data-number="918866774266" data-message="Please help me! I have got wrong product - ORDER ID is : #654321485">
<div class="d-flex bd-highlight">
<!-- Profile Picture -->
<div class="ec-img-cont">
<img src="assets/images/whatsapp/profile_03.jpg" class="ec-user-img" alt="Profile image">
<span class="ec-status-icon ec-offline"></span>
</div>
<!-- Display Name & Last Seen -->
<div class="ec-user-info">
<span>Nargis Hawa</span>
<p>Nargis left 30 mins ago</p>
</div>
<!-- Chat iCon -->
<div class="ec-chat-icon">
<i class="fa fa-whatsapp"></i>
</div>
</div>
</a>
</li>
<!--/ End Single Contact List -->
<!-- Start Single Contact List -->
<li>
<a class="ec-list" data-number="918866774266" data-message="Please help me! I have got wrong product - ORDER ID is : #654321485">
<div class="d-flex bd-highlight">
<!-- Profile Picture -->
<div class="ec-img-cont">
<img src="assets/images/whatsapp/profile_04.jpg" class="ec-user-img" alt="Profile image">
<span class="ec-status-icon ec-offline"></span>
</div>
<!-- Display Name & Last Seen -->
<div class="ec-user-info">
<span>Khadija Mehr</span>
<p>Khadija left 50 mins ago</p>
</div>
<!-- Chat iCon -->
<div class="ec-chat-icon">
<i class="fa fa-whatsapp"></i>
</div>
</div>
</a>
</li>
<!--/ End Single Contact List -->
</ul>
</div>
</div>
<!--/ End Floating Panel Container -->
<!-- Start Right Floating Button-->
<div class="ec-right-bottom">
<div class="ec-box">
<div class="ec-button rotateBackward">
<img class="whatsapp" src="assets/images/common/whatsapp.png" alt="whatsapp icon" />
</div>
</div>
</div>
<!--/ End Right Floating Button-->
</div>
<!-- Whatsapp end -->
<!-- Feature tools -->
<div class="ec-tools-sidebar-overlay"></div>
<div class="ec-tools-sidebar">
<div class="tool-title">
<h3>Features</h3>
</div>
<a href="#" class="ec-tools-sidebar-toggle in-out">
<img alt="icon" src="assets/images/common/settings.png" />
</a>
<div class="ec-tools-detail">
<div class="ec-tools-sidebar-content ec-change-color ec-color-desc">
<h3>Color Scheme</h3>
<ul class="bg-panel">
<li class="active" data-color="01"><a href="#" class="colorcode1"></a></li>
<li data-color="02"><a href="#" class="colorcode2"></a></li>
<li data-color="03"><a href="#" class="colorcode3"></a></li>
<li data-color="04"><a href="#" class="colorcode4"></a></li>
<li data-color="05"><a href="#" class="colorcode5"></a></li>
</ul>
</div>
<div class="ec-tools-sidebar-content">
<h3>Backgrounds</h3>
<ul class="bg-panel">
<li class="bg"><a class="back-bg-1" id="bg-1">Background-1</a></li>
<li class="bg"><a class="back-bg-2" id="bg-2">Background-2</a></li>
<li class="bg"><a class="back-bg-3" id="bg-3">Background-3</a></li>
<li class="bg"><a class="back-bg-4" id="bg-4">Default</a></li>
</ul>
</div>
<div class="ec-tools-sidebar-content">
<h3>Full Screen mode</h3>
<div class="ec-fullscreen-mode">
<div class="ec-fullscreen-switch">
<div class="ec-fullscreen-btn">Mode</div>
<div class="ec-fullscreen-on">On</div>
<div class="ec-fullscreen-off">Off</div>
</div>
</div>
</div>
<div class="ec-tools-sidebar-content">
<h3>Dark mode</h3>
<div class="ec-change-mode">
<div class="ec-mode-switch">
<div class="ec-mode-btn">Mode</div>
<div class="ec-mode-on">On</div>
<div class="ec-mode-off">Off</div>
</div>
</div>
</div>
<div class="ec-tools-sidebar-content">
<h3>RTL mode</h3>
<div class="ec-change-rtl">
<div class="ec-rtl-switch">
<div class="ec-rtl-btn">Rtl</div>
<div class="ec-rtl-on">On</div>
<div class="ec-rtl-off">Off</div>
</div>
</div>
</div>
<div class="ec-tools-sidebar-content">
<h3>Clear local storage</h3>
<a class="clear-cach" href="javascript:void(0)">Clear Cache & Default</a>
</div>
</div>
</div>
<!-- Feature tools end -->
<!-- Vendor JS -->
<!-- <script src="assets/js/vendor/jquery-3.5.1.min.js"></script> -->
<script src="assets/js/vendor/popper.min.js"></script>
<script src="assets/js/vendor/bootstrap.min.js"></script>
<script src="assets/js/vendor/jquery-migrate-3.3.0.min.js"></script>
<script src="assets/js/vendor/modernizr-3.11.2.min.js"></script>
<!--Plugins JS-->
<script src="assets/js/plugins/swiper-bundle.min.js"></script>
<script src="assets/js/plugins/countdownTimer.min.js"></script>
<script src="assets/js/plugins/scrollup.js"></script>
<script src="assets/js/plugins/jquery.zoom.min.js"></script>
<script src="assets/js/plugins/slick.min.js"></script>
<script src="assets/js/plugins/infiniteslidev2.js"></script>
<script src="assets/js/vendor/jquery.magnific-popup.min.js"></script>
<script src="assets/js/plugins/jquery.sticky-sidebar.js"></script>
<script src="assets/js/plugins/nouislider.js"></script>
<!-- Main Js -->
<script src="assets/js/vendor/index.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>