-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardDetails.html
160 lines (125 loc) · 6.68 KB
/
CardDetails.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
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap" rel="stylesheet">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<link rel="stylesheet" href="CSS/creditdetails.css">
<title>Credit Card</title>
</head>
<body class="text-center" style="background-color: #F5F6F9;">
<div class="row row-centered">
<div id="card_title" class="heading col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 col-xxl-12">
Card Details
</div>
</div>
<div id="main_card" class="mx-auto card-background-container col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 col-xxl-12">
<div class="row-centered">
<div class="mt-4 column col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 col-xxl-12">
<img id="card_img" style=" box-shadow: 0px 0px 25px 10px #A1A8BA; border-radius: 10px;" src="Credit Card.png" alt="" width="400px">
</div>
</div>
<div class="input-field-container mt-4 ">
<input type="text" id="card_number_textbox"
maxlength="16"
onkeypress="return (event.charCode !=8 && event.charCode ==0 || ( event.charCode == 46 || (event.charCode >= 48 && event.charCode <= 57)))"
class="input-amount" placeholder="Card Number" autofocus>
<div class="error-message" id="card_number_error_message">
Card number is required !
</div>
</div>
<div style="display: flex; flex-direction: row; ">
<div class="input-field-container mt-2" style="width: 240px; margin-right: 0px;">
<input type="text" id="expiry_date_textbox" class="input-amount" placeholder="Expiry Date">
<div class="error-message" id="expiry_date_error_message">
Expiry date is required !
</div>
</div>
<div class="input-field-container mt-2" style="width: 150px; margin-left: 10px;">
<input type="text" id="cvv_textbox" class="input-amount" placeholder="CVV"
maxlength="3"
onkeypress="return (event.charCode !=8 && event.charCode ==0 || ( event.charCode == 46 || (event.charCode >= 48 && event.charCode <= 57)))">
<div class="error-message" id="cvv_error_message">
Cvv is required !
</div>
</div>
</div>
<div class="input-field-container mt-2 ">
<input type="text" id="card_holder_name_textbox" class="input-amount" placeholder="Card Holder Name"
onkeypress='return ((event.charCode >= 65 && event.charCode <= 90) || (event.charCode >= 97 && event.charCode <= 122) || (event.charCode == 32))'>
<div class="error-message" id="card_holder_name_error_message">
Card holder name is required !
</div>
</div>
<button id="pay_button" class="mt-3 mb-3" onclick="pay()">Pay</button>
</div>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4"
crossorigin="anonymous"></script>
<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
-->
</body>
<script>
let card = document.getElementById("main_card");
let card_title = document.getElementById("card_title");
let card_img = document.getElementById("card_img");
let button = document.getElementById("pay_button");
if (localStorage.getItem("screen") == "Debit") {
card.style.backgroundColor = "#F5DECB";
card_title.innerHTML = "Debit Card";
card_img.setAttribute("src", "Debit card.png");
button.style.backgroundColor = "#F48A28";
} else {
}
function pay() {
let cardNumber = document.getElementById("card_number_textbox").value;
let expiryDate = document.getElementById("expiry_date_textbox").value;
let cvv = document.getElementById("cvv_textbox").value;
let cardHolderName = document.getElementById("card_holder_name_textbox").value;
if (validateFields()) {
window.location.href = "verificationScreen.html";
}
}
function validateFields () {
let valid = true;
let cardNumber = document.getElementById("card_number_textbox").value;
let expiryDate = document.getElementById("expiry_date_textbox").value;
let cvv = document.getElementById("cvv_textbox").value;
let cardHolderName = document.getElementById("card_holder_name_textbox").value;
let cardNumberError = document.getElementById("card_number_error_message");
let expiryError = document.getElementById("expiry_date_error_message");
let cvvError = document.getElementById("cvv_error_message");
let cardHolderNameError = document.getElementById("card_holder_name_error_message");
if (cardNumber == "") {
cardNumberError.style.display = "block";
valid = false;
} else cardNumberError.style.display = "none";
if (expiryDate == "") {
expiryError.style.display = "block";
valid = false;
}
else expiryError.style.display = "none";
if (cvv == "") {
cvvError.style.display = "block";
valid = false;
}
else cvvError.style.display = "none";
if (cardHolderName == "") {
cardHolderNameError.style.display = "block";
valid = false;
}
else cardHolderNameError.style.display = "none";
return valid;
}
</script>
</html>