-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcards.html
More file actions
97 lines (90 loc) · 3.56 KB
/
Copy pathcards.html
File metadata and controls
97 lines (90 loc) · 3.56 KB
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
<!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">
<title>Recharge Cards</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
</head>
<body style="background: linear-gradient(to left, orange, yellow);">
<div class="col-md-8 mx-auto border shadow rounded-5 bg-white mt-5 p-3" style="border-radius: 25px;">
<h3 class="text-center border-bottom p-2">Buy Recharge Card</h3>
<label for="net" class="font-weight-bold">Network</label>
<select name="net" id="" class="custom-select custom-select-lg network" >
<option value="">Select Network</option>
<option value="MTN">MTN</option>
<option value="AIRTEL">AIRTEL</option>
<option value="ETISALAT">ETISALAT</option>
<option value="GLO">GLO</option>
</select>
<label for="amt" class="font-weight-bold mt-3">Amount</label>
<select name="" id="amt" class="custom-select custom-select-lg amount">
<option value="0">Select Amount</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
<label for="pin" class="font-weight-bold mt-5">Card Pin</label>
<input type="text" class="form-control custom-select-lg" id="pin" placeholder="Pin" readonly>
<div class="mt-3">
<button class="btn btn-warning btn-lg" id="generate">Generate</button>
<!-- <button class="btn btn-primary btn-lg" id="save">Save</button> -->
</div>
</div>
<div class="table-responsive col-md-11 mx-auto">
<table class="table table-striped table-hover mt-3">
<thead>
<tr>
<th>S/N</th>
<th>Network</th>
<th>Amount</th>
<th>Card Pin</th>
<th>Recharge Code</th>
<th>Status</th>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
<script>
let cards = []
obj = ''
let amount = document.querySelector('.amount')
let network = document.querySelector('.network')
let codes = {MTN : '*555*', GLO: '*123*', ETISALAT: '*910*', AIRTEL:'*126*'}
// let card_pin = Math.floor(Math.random() * 126747727279);
generate.addEventListener('click', function () {
pin.value = Math.floor(Math.random() * 126747727279)
let obj= {
network: network.value,
amount : amount.value,
pin: pin.value,
recharge: `${codes[network.value]}${pin.value}#`
}
cards.push(obj)
console.log(cards);
display()
})
// save.addEventListener('click',()=>{
// })
function display() {
tbody.innerHTML = ''
cards.forEach((key, i)=> {
tbody.innerHTML += `
<tr>
<td>${i+1}</td>
<td>${key.network}</td>
<td>${key.amount}</td>
<td>${key.pin}</td>
<td>${key.recharge}</td>
<td>Used</td>
</tr>
`
})
}
</script>
</body>
</html>