forked from web-development-session-content/playo-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pay.html
477 lines (369 loc) · 13.3 KB
/
pay.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
<!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="./styles/footer.css">
<title>Playo: Pay with razor pay</title>
<style>
body{
/* display: flex;
justify-content: center;
background-color: #EEEFEF; */
margin: 0;
padding: 0;
}
#header{
width: 100%;
height: 66px;
}
/* Navbar start */
#navbar{
height: 66px;
background-color: #FEFFFE;
width: 100%;
}
body{
margin: auto;
}
#logo{
width: 100px;
height: 45px;
margin-left: -60%;
}
#pplogo{
width: 35px;
height: 35px;
}
#explorenavbar{
display: flex;
padding-top: 10px;
width: 100%;
height: 100%;
box-shadow: rgba(0, 0, 0, 0.185) 0px 3px 5px;
}
#dropdownarrow{
width: 12px;
height: 8px;
padding-top: 20px;
margin-left: 1%;
}
#logodiv{
margin-left: 9.5%;
margin-top: 10px;
}
#nav2div{
margin-left: 67.5%; margin-top: 5px;
display: flex; margin-top: 10px;
}
.loginp{
margin-left: 10px;
line-height: 10px;
font-size: 14px;
font-family: Arial, Helvetica, sans-serif;
color: #5c5c5c;
}
#nav2div:hover{
cursor: pointer;
}
/* popup styling */
*{
box-sizing: border-box;
}
#modal_container{
border: 1px solid green;
position: fixed;
display: flex;
align-items: center;
justify-content: center;
top: 0;
left: 0;
height: 100vh;
width: 100%;
background-color: rgba(0, 0, 0, 0.3);
z-index: 1;
opacity: 0;
pointer-events: none;
}
button{
border: 0;
border-radius: 5px;
color: white;
font-size: 14px;
padding: 10px 25px;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
background-color: green;
}
#close{
height: 27px;
position: absolute;
right: 20%;
top: 17.5%;
border: 2px solid white;
border-radius: 50%;
cursor: pointer;
}
#modal_container.show{
opacity: 1;
pointer-events: auto;
}
#modal{
display: flex;
background-color: white;
margin-left: -1.5%;
margin-top: -7%;
border-radius: 5px;
width: 59.3%;
height: 290px;
max-width: 100%;
}
#login_left_div{
width: 40%;
background-color: #fdbd51;
}
#login_right_div{
width: 48.5%;
height: 80%;
margin-left: 5%;
margin-top: 3.7%;
text-align: center;
font-family: Lato, sans-serif;
}
#input{
color: #5c5c5c;
padding: 0;
font-size: 14px;
border-bottom: 1px solid rgb(160, 160, 160);
border-bottom-width: 50%;
border-image: initial;
border-left: none;
border-right: none;
border-top: none;
outline: none;
padding: 4px;
padding-bottom: 8px !important;
vertical-align: baseline;
text-align: left;
width: 100%;
}
#input::-webkit-outer-spin-button,
#input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
#entermobile{
font-size: 16px;
line-height: 16px;
color: #808080;
font-weight: 400;
margin-bottom: 50px;
}
#user_phone_div{
margin-bottom: 12px;
display: flex;
}
#sendOTP{
width: 100%;
height: 20%;
background-color: rgb(133, 199, 133);
}
#countryDrop{
margin: 0;
padding: 0;
cursor: pointer;
color: #424242;
vertical-align: baseline;
margin-left: 10px;
width: 9%;
}
/* Navbar End */
#rzp-button1{
width: 200px;
height: 50px;
background-color: #679F00;
/* border: 1px solid white; */
border-radius: 10px;
color: white;
font-size: 17px;
}
#rzp-button1:hover{
cursor: pointer;
}
#payDiv{
width: 100%;
height: 400px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
#footer{
width: 100%;
height: 281px;
}
</style>
</head>
<body>
<div id="outermost_container">
<!-- navbar start -->
<div id="header">
<div id="explorenavbar">
<div id="logodiv" >
<img id="logo" src="https://playo-website.imgix.net/company/logo1.png?auto=compress,format" alt="playo logo">
</div>
<div id="nav2div">
<img id="pplogo" src="https://playo-website.gumlet.net/playo_functional/Icons/user_blank.svg" alt="">
<p id="myBtn" class="loginp">Login/Signup</p>
<img id="dropdownarrow" src="https://playo-website.gumlet.net/playo_functional/Icons/arrow_light.svg" alt="arrow">
</div>
<!-- popupwindow -->
<div id="modal_container">
<div id="modal">
<img id="close" src="https://playo-website.gumlet.net/playo_functional/Icons/closeButton.svg" alt="">
<div id="login_left_div">
<img width="100%" src="https://playo-website.gumlet.net/icons/login-graphics.png?auto=compress,format" alt="">
</div>
<div id="login_right_div">
<p id="entermobile">Enter Your Mobile Number</p>
<div id="user_phone_div">
<div>
<div id="countrySpan">
<span>
<div id="selectCallingCode">
<span style="font-size: 14px; color: #424242;" id="rem1">IND</span>
<span style="font-size: 14px; color: #424242;" id="rem2">+91</span>
<img id="countryDrop" src="https://s3.ap-south-1.amazonaws.com/playo-website/booking/selectCountry.svg" alt="dropdown">
</div>
</span>
</div>
</div>
<span>
<input id="input" type="number" placeholder="Mobile Number *" value="">
<hr style="margin-top: -1px; margin-left: -65%; width: 220%;">
</span>
</div>
<button id="sendOTP" style="font-size: 1em;">SEND OTP</button>
<button id="giveOTP" style="font-size: 1em;" >Enter OTP</button>
</div>
</div>
</div>
</div>
</div>
<!-- navbar end -->
<div id="payDiv">
<button id="rzp-button1">Pay with Razor pay</button>
</div>
<div id="footer"></div>
</div>
</body>
</html>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script></script>
<script type="module">
//Login and pop up full functionalities start
document.querySelector("#logo").addEventListener("click", ()=>{
window.location.href = "index.html";
})
// navbar popup functionality
document.querySelector("#giveOTP").style.visibility = "hidden";
const open = document.getElementById("nav2div");
const modal_container = document.getElementById("modal_container");
const close = document.getElementById("close");
open.addEventListener("click", ()=>{
modal_container.classList.add("show")
});
close.addEventListener("click", ()=>{
modal_container.classList.remove("show")
});
//If user is logged in
login()
function login(){
console.log("test")
let loginStatus = localStorage.getItem("login")
console.log(typeof(loginStatus))
if(loginStatus === "true"){
let ph = localStorage.getItem("mobileNumber");
console.log(ph)
document.querySelector("#myBtn").textContent = ph;
open.addEventListener("click", ()=>{
modal_container.classList.remove("show")
window.location.href = "login_profile.html";
})
}
else{
return false;
}
}
//When user add mobile number to it
document.querySelector("#sendOTP").addEventListener("click", ()=>{
let mobNo = document.querySelector("#input").value;
if(mobNo.length != 10){
alert("Please Give correct Mobile Number");
}
else{
localStorage.setItem("mobileNumber", mobNo);
// modal_container.style.visibility = "hidden";
// document.querySelector(".loginp")
document.querySelector("#entermobile").textContent = `We have sent an OTP to ${mobNo}`;
document.querySelector("#rem1").style.visibility = "hidden";
document.querySelector("#rem2").style.visibility = "hidden";
document.querySelector("#countryDrop").style.visibility = "hidden";
document.querySelector("#input").value = null;
document.querySelector("#input").placeholder = "Enter OTP"
document.querySelector("input").style.textAlign = "center";
document.querySelector("#sendOTP").style.visibility = "hidden";
document.querySelector("#giveOTP").style.visibility = "visible";
document.querySelector("#giveOTP").addEventListener("click", ()=>{
let otp = document.querySelector("input").value;
if(otp == "123456"){
// alert("success");
modal_container.classList.remove("show")
document.querySelector("#myBtn").textContent = mobNo;
localStorage.setItem("login", true);
open.addEventListener("click", ()=>{
modal_container.classList.remove("show")
window.location.href = "login_profile.html";
login()
})
}
else{
alert("Wrong OTP");
document.querySelector("#entermobile").textContent = `Enter Your mobile number`;
document.querySelector("#rem1").style.visibility = "visible";
document.querySelector("#rem2").style.visibility = "visible";
document.querySelector("#countryDrop").style.visibility = "visible";
document.querySelector("#input").value = null;
document.querySelector("#input").placeholder = "Enter Mobile Number"
document.querySelector("#sendOTP").style.visibility = "visible";
document.querySelector("#giveOTP").style.visibility = "hidden";
}
})
}
})
//Login and pop up full functionalities end
// importing footer part
import footer from "./components/footer.js";
let footer_div = document.getElementById("footer");
footer_div.innerHTML = footer();
let price = localStorage.getItem("finalPrice") * 100
var options = {
"key": "rzp_test_VhRZKygRJUvXe9", // Enter the Key ID generated from the Dashboard
"amount": price, // Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise
"currency": "INR",
"name": "Playo",
"description": "Test Payment",
"image": "https://blog.playo.co/wp-content/uploads/2018/04/Playo-dp-gradient4-1.png",
// "order_id": "order_Ef80WJDPBmAeNt", //Pass the `id` obtained in the previous step
// "account_id": "acc_Ef7ArAsdU5t0XL",
"handler": function (response){
alert(response.razorpay_payment_id);
alert(response.razorpay_order_id);
alert(response.razorpay_signature)
}
};
var rzp1 = new Razorpay(options);
document.getElementById('rzp-button1').onclick = function(e){
rzp1.open();
e.preventDefault();
}
</script>