forked from KalashThakur/straberrynet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbag.html
211 lines (187 loc) · 6.35 KB
/
bag.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!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">
<link rel="stylesheet" href="./style/header.css">
<link rel="stylesheet" href="./style/bag.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined" rel="stylesheet">
<!-- <link rel="stylesheet" href="./style/signup.css"> -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lato&display=swap" rel="stylesheet">
<!-- <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined" rel="stylesheet"> -->
<title>Document</title>
</head>
<body>
<!-- this is our header -->
<div id="bag-lg"></div>
<div id="bag-header"></div>
<div id="main-div-bag">
<div id="main-div-bag-left">
<div id="shoping-bag">
<h3>SHOPPING BAG</h3>
</div>
<div id="dilvery-box">
<div>
Deliver To :
<div id="flag-img"></div>
<div>
<select>
<option>India</option>
<option>Pak</option>
<option>Shrilanka</option>
<option>Nepal</option>
<option>Bangladesh</option>
</select>
</div>
</div>
</div>
<div id="show-bag-item"> </div>
</div>
<div id="bag-right-div">
<div id="main-div-bag-right"></div>
<div id="gust-checkout">
<div id="gust-checkout-text">
<h3>OR</h3>
<p>GUEST CHECKOUT</p>
</div>
<div id="gust-inputbox">
<input type="text " placeholder="Email address" />
</div>
<div id="gust-input-button">
<button class="gust-button">CONTINUE AS GUEST</button>
</div>
</div>
</div>
</div>
<div id="totalPrice">
<p id="toatalItem"></p>
<p id="ExtraOffer" onclick="checkoutpage()">Go TO CHECKOUT PAGE</p>
<p></p>
</div>
<div id="bag-footer"></div>
</body>
</html>
<script>
const checkoutpage = () => {
window.location.href = "checkout.html";
};
</script>
<!-- <script src="/script/bag.js"></script>/ -->
<script type="module">
// let bagSing = document.getElementById("bag-lg");
// bagSing.innerHTML=singupPankaj();
import { navbar, footer } from "./components/header.js";
console.log(navbar);
let header = document.getElementById("bag-header");
header.innerHTML = navbar();
// link navbar on click
document.querySelector("#skincare").addEventListener("click",()=>{
pankaj();
})
const pankaj = ()=>{
window.location.href="catg.html"
}
document.querySelector("#haircare").addEventListener("click",()=>{
haircare();
})
const haircare = ()=>{
window.location.href="catghaircare.html"
}
document.querySelector("#menskincare").addEventListener("click",()=>{
menskincare();
})
const menskincare = ()=>{
window.location.href="catgmensskincare.html"
}
document.querySelector("#prefume").addEventListener("click",()=>{
prefume();
})
const prefume = ()=>{
window.location.href="catg perfume.html"
}
let bagfooter = document.getElementById("bag-footer");
// bagfooter.innerHTML=footer();
bagfooter.style.marginTop = "20px";
import showDataOnbag from "./script/bag.js";
console.log(showDataOnbag);
let showData = JSON.parse(localStorage.getItem("cart_item")) || [];
let showitemInBag = document.getElementById("show-bag-item");
showitemInBag = showDataOnbag(showData, showitemInBag);
import singupPankaj from "./newlogin.js";
console.log(singupPankaj);
let loginData = document.getElementById("main-div-bag-right");
loginData.innerHTML = singupPankaj();
document.getElementById("onclick").addEventListener("click", () => {
showTotal();
});
// toatal rupees
const showTotal = () => {
var qu = document.getElementById("quant").value;
var total = showData.reduce(function (acc, elem) {
return acc + elem.price * qu;
}, 0);
document.getElementById("toatalItem").innerText =
"Total Payment" + ":" + total;
};
showTotal();
document.querySelector("#userSign").addEventListener("click", () => {
signin();
});
document.querySelector("#newHere").addEventListener("click", () => {
newhere();
});
function signin() {
console.log("hy");
document.querySelector(".div1").style.display = "block";
document.querySelector(".div2").style.display = "none";
}
function newhere() {
document.querySelector(".div1").style.display = "none";
document.querySelector(".div2").style.display = "block";
}
// storing the user's email in local storage
document.getElementById("email").value = localStorage.getItem("userEmail");
let userStack = JSON.parse(localStorage.getItem("userDatabase")) || [];
// storing user data
function addUser(event) {
event.preventDefault();
let name = document.getElementById("name").value;
let email = document.getElementById("email").value;
let password = document.getElementById("password").value;
let userData = {
name: name,
email: email,
password: password,
};
userStack.push(userData);
localStorage.setItem("userDatabase", JSON.stringify(userStack));
alert("register sucessfull");
}
function puneethspl() {
let email = document.getElementById("useremail").value;
let password = document.getElementById("userpass").value;
let SingData = JSON.parse(localStorage.getItem("userDatabase")) || [];
var flag = false;
for (let i = 0; i < SingData.length; i++) {
if (SingData[i].email == email && SingData[i].password == password) {
flag = true;
}
}
if (flag == true) {
//document.querySelector("input[type='submit']").addEventListener("click",function(){
alert("Login successful");
// window.location.href="index.html";
for (let i = 0; i < SingData.length; i++) {
loginData.innerHTML = SingData[i].name;
}
// })
} else {
alert("Invalid");
}
}
document.getElementById("submit").addEventListener("click", addUser);
document.getElementById("btt").addEventListener("click", puneethspl);
</script>