-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheckout.js
55 lines (37 loc) · 1.49 KB
/
Checkout.js
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
/*اكواد الطباعة*/
let total = 0;
if(localStorage.getItem("Total")!=null){
total = localStorage.getItem("Total");
localStorage.removeItem("Total");
}
for(let [key, value] of Object.entries(localStorage)){
document.getElementById("order").innerHTML += `<span class="keys"> <div>${key} </div> <div>${value}</div> </span>`;
}
document.getElementById("order").innerHTML += `<span class="keys"> <div> <b>Total</b> </div> <div>${total} </div> </span>`;
document.getElementById("order").innerHTML += `<hr>`;
/*-------------------------------------------------------------*/
/* اكواد الكتابة*/
const btn = document.querySelector(".proceed");
let inputs = document.querySelectorAll(".input");
btn.addEventListener("click", (e)=> {
let x =1;
for(let i =0; i< inputs.length; i++){
if(!inputs[i].checkValidity() || inputs[i].value == ""){
x=0;
break;
}
}
if(x==1){
for(let i =0; i< inputs.length; i++){
document.querySelector(".order").innerHTML += `<span class="keys"> <div>${inputs[i].name} </div> <div>${inputs[i].value}</div> </span>`;
}
document.querySelector(".order").disabled = true;
document.querySelector(".proceed").style.backgroundColor="#3C2A21";
document.querySelector(".proceed").style.color="#F5D9A9";
alert("Payment Suceeded");
}
else{
alert("Wrong or empty inputs")
}
}
);