Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

final #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SKINCARE/scincare.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
<a href="#">Login/Register</a>
</div>
<div id="cart">
<a href="#">🖤</a>
<a href="">🖤</a>
<a href="#"><i class="fa-solid fa-bag-shopping"></i></a>
<a href=""><img src="https://in.sugarcosmetics.com/desc-images/discountIcon.svg" alt="404error" /></a>
</div>
</div>
<nav>
<div class="nav1">
<a href="#">MAKEUP</a>
<a href="">MAKEUP</a>
<div class="dropdown1">
<a href="#">LIPS</a>
<a href="#">FACE</a>
Expand Down
5 changes: 5 additions & 0 deletions SugarCosmetics01-main/sugarCosmeticWeb/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"AQUAHOLIC"
]
}
257 changes: 257 additions & 0 deletions SugarCosmetics01-main/sugarCosmeticWeb/CartPage/cart.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;800&family=Quicksand:wght@300;400;500;600&family=Secular+One&display=swap");

* {
bottom: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Quicksand", sans-serif;
background-color: #f5f5f5;
}
#cart-home {
width: 100%;
height: 70px;
padding-left: 10px;
}
#cart-home > p {
font-size: 17px;
color: #a19d9a;
}
#cart-home > p > span {
margin: 0px 4px;
}
/* main container item container css */
#item_container {
position: relative;
width: 100%;
/* height: ; */
}
/* Empty container css */
#empty_container {
top: 0;
width: 100%;
height: 60vh;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
position: absolute;
}
#empty_container > div {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#empty_container > div:nth-child(1) > img {
width: 15%;
}
#empty_container > div:nth-child(2) > p {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #a19d9a;
}
#empty_container > div:nth-child(3) {
width: 100%;
}
#empty_container > div:nth-child(3) > button {
width: 12%;
text-transform: uppercase;
font-size: 16px;
letter-spacing: 0.5px;
font-style: normal;
font-weight: 400;
padding: 8px 10px;
text-align: center;
background-color: #fc2779;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
/* checkout cartpage css */
#checkOut_container {
width: 98%;
height: 100%;
margin: auto;
background: #fff;
border-radius: 10px;
display: none;
}
#uperBar {
width: 95%;
margin: auto;
display: flex;
justify-content: space-between;
align-items: center;
}
#leftBar,
#rightBar {
display: flex;
width: 45%;
justify-content: space-between;
align-items: center;
}
#leftBar > p,
#rightBar > p {
display: flex;
color: #6b6b6b;
font-size: 16px;
}
#leftBar > p > span,
#rightBar > p > span {
margin-left: 6px;
}
#leftBar > p:last-child {
text-decoration: underline;
}
/* mid part css */
#midOfcont {
width: 95%;
display: flex;
justify-content: space-between;
margin: auto;
}
#right_mid {
width: 45%;
background-color: #f5f5f5;
height: 380px;
}
#promoDiv {
padding: 20px 3px 9px 4px;
}
#promoapply {
display: flex;
align-items: center;
}
#promoapply > p {
display: flex;
align-items: center;
margin-right: 30px;
}
#promoapply > p > span {
margin-left: 8px;
}
#promoapply > label > input {
padding: 7px 9px;
width: 150px;
outline: none;
border: none;
background: #fff;
box-shadow: rgba(0, 0, 0, 0.4) 0px 30px 90px;
}
#promoapply > label > button {
margin-left: -4px;
padding: 5px 9px;
border-radius: 4px;
border: none;
background: #000;
color: #fff;
cursor: pointer;
}
#detailCost {
background: #fff;
width: 95%;
margin: auto;
padding: 7px 5px;
}
#detailCost > p {
display: flex;
align-items: center;
}
#detailCost > p > img {
margin-right: 7px;
}
#detailCost > p > span:last-child {
margin-left: 30px;
}
#endBtns {
width: 96%;
display: flex;
align-items: center;
margin: auto;
border: 0.5px solid #a5a5a5;
height: 38px;
margin-bottom: 10px;
margin-top: 10px;
}
#endBtns > p:last-child {
width: 70%;
background-color: #000;
color: #fff;
text-align: center;
padding: 8px 0px;
border-radius: 5px;
cursor: pointer;
}
#endBtns > p:first-child {
width: 30%;
text-align: center;
padding: 8px 0px;
}
#endBtns > p:first-child > a {
color: #6d6d6c;
font-size: 14px;
}

/* items display section style with css */

#left_mid {
display: grid;
grid-template-columns: repeat(1, 1fr);
width: 45%;
column-gap: 30px;
background-color: #f5f5f5;
}
#left_mid > div {
width: 95%;
display: flex;
justify-content: space-around;
align-items: center;
margin: auto;
padding: 10px 0px;
}
#left_mid > div > div {
display: flex;
align-items: center;
margin: 10px 0px;
font-size: 18px;
padding: 0px 10px;
font-weight: 600;
color: #5f5f5f;
}
#left_mid > div:nth-of-type(even) {
background-color: #d1d1d1;
}
#left_mid > div:nth-of-type(odd) {
background-color: #f2f2f2;
}
#left_mid > div > div > img {
height: 80px;
width: 80px;
}
#left_mid > div > div:nth-child(3) {
background-color: #5f5f5f;
color: #000;
cursor: pointer;
font-size: 14px;
padding: 8px 5px;
border-radius: 9px;
}
#left_mid > div > div:last-child {
font-size: 16px;
width: 20%;
}

@media all and (min-width: 300px) and (max-width: 800px) {
#midOfcont {
display: block;
}
#right_mid {
width: 100%;
background-color: #f5f5f5;
}
}
103 changes: 103 additions & 0 deletions SugarCosmetics01-main/sugarCosmeticWeb/CartPage/cart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
let cartItemsData = JSON.parse(localStorage.getItem("cartItems")) || [];

let itemCount = localStorage.getItem("itemsInCart") || 0;

if (cartItemsData.length === 0) {
document.querySelector("#item_container").style.height = "60vh";
document.querySelector("#empty_container").style.display = "flex";
} else {
document.querySelector("#checkOut_container").style.display = "block";
}
let totalPaybleAmount = 0;
let discount = 0;
let shipingCharge = 0;
let cartSubtotal = 0;
displayCartItems(cartItemsData);

function displayCartItems(cartItemsData) {
document.querySelector("#left_mid").innerHTML = "";
cartItemsData.forEach(function (ele, index) {
let mainCard = document.createElement("div");

// creating the imgbox
let imgCard = document.createElement("div");
let itemImg = document.createElement("img");
itemImg.src = ele.image;

//creating name box
let nameCard = document.createElement("div");
nameCard.innerText = ele.name;

//creating delete item box
let deleteCard = document.createElement("div");
deleteCard.innerText = "Remove";
deleteCard.addEventListener("click", function () {
removeItem(index);
});

//creating price box
let priceCard = document.createElement("div");
priceCard.innerText = "Rs." + " " + ele.price;

cartSubtotal += ele.price;

// apppending all element to respective parent
imgCard.append(itemImg);
mainCard.append(imgCard, nameCard, deleteCard, priceCard);
document.querySelector("#left_mid").append(mainCard);
});
}

// ?creating remove item function
function removeItem(index) {
cartItemsData.splice(index, 1);
localStorage.setItem("cartItems", JSON.stringify(cartItemsData));
displayCartItems(cartItemsData);

// remainingItem count
itemCount--;
localStorage.setItem("itemsInCart", itemCount);
window.location.reload();
}

// All amount and maths here
if (cartSubtotal > 499) {
shipingCharge = 0;
} else {
shipingCharge = 49;
}
totalPaybleAmount = shipingCharge + cartSubtotal - discount;
document.getElementById("da").innerText = "Rs." + " " + discount;
document.getElementById("sc").innerText = "Rs." + " " + shipingCharge;
document.getElementById("cst").innerText = "Rs." + " " + cartSubtotal;
let priceDisplayed = document.querySelector("#priceDisplay");
priceDisplayed.innerText = totalPaybleAmount;
document.getElementById("ap").innerText = "Rs." + " " + totalPaybleAmount;

// calculating the discount through promo

document.querySelector("#apply").addEventListener("click", function () {
let promo = document.querySelector("input").value;
if (promo === "team50" && cartSubtotal > 1500) {
discount = cartSubtotal * 0.5;
console.log(promo, cartSubtotal, discount);
} else if (promo === "team30" && cartSubtotal > 600) {
discount = (cartSubtotal * 0.3).toFixed(2);
} else {
alert("not applicable");
}
document.getElementById("da").innerText = "Rs." + " " + discount;
totalPaybleAmount = shipingCharge + cartSubtotal - discount;
document.getElementById("ap").innerText = "Rs." + " " + totalPaybleAmount;
document.querySelector("#priceDisplay").innerText = totalPaybleAmount;
});

document.querySelector("#gotoHome").addEventListener("click", function () {
window.location.href = "../index.html";
});

// creating the gateway of payments
document.getElementById("paylast").addEventListener("click", function () {
let total = priceDisplayed.innerText;
localStorage.setItem("totalPayment", total);
});
Loading