-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
177 lines (154 loc) · 6.42 KB
/
script.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
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
// Function to show a specific service and hide others
function showService(serviceId) {
// Hide all services first
const services = document.querySelectorAll('.service');
services.forEach(service => {
service.classList.remove('active');
});
// Show the selected service
const selectedService = document.getElementById(serviceId);
selectedService.classList.add('active');
}
// Data Top Up - Populating Data Plans based on Network
const dataNetworkSelect = document.getElementById('data-network');
const dataPlanSelect = document.getElementById('data-plan');
dataNetworkSelect.addEventListener('change', () => {
dataPlanSelect.innerHTML = ''; // Clear previous options
const selectedNetwork = dataNetworkSelect.value;
let dataPlans = [];
switch (selectedNetwork) {
case 'mtn':
dataPlans = [
{ value: '50mb', text: '50MB - 50 Naira' },
{ value: '100mb', text: '100MB (1 Day) - 150 Naira' },
{ value: '500mb', text: '500MB - 200 Naira' },
{ value: '1gb', text: '1GB - 300 Naira' },
{ value: '2gb', text: '2GB - 585 Naira' },
{ value: '3gb', text: '3GB - 875 Naira' },
{ value: '5gb', text: '5GB - 1500 Naira' },
{ value: '10gb', text: '10GB - 3050 Naira' },
{ value: '15gb', text: '15GB - 4400 Naira' },
{ value: '20gb', text: '20GB - 6000 Naira' },
{ value: '40gb', text: '40GB - 11300 Naira' },
];
break;
case 'airtel':
dataPlans = [
{ value: '500mb', text: '500MB - 170 Naira' },
{ value: '1gb', text: '1GB - 300 Naira' },
{ value: '2gb', text: '2GB - 600 Naira' },
{ value: '5gb', text: '5GB - 2450 Naira' },
{ value: '10gb', text: '10GB - 2900 Naira' },
{ value: '20gb', text: '20GB - 6800 Naira' },
];
break;
case 'glo':
dataPlans = [
{ value: '500mb', text: '500MB - 170 Naira' },
{ value: '1gb', text: '1GB - 300 Naira' },
{ value: '2gb', text: '2GB - 600 Naira' },
{ value: '3gb', text: '3GB - 890 Naira' },
{ value: '5gb', text: '5GB - 1450 Naira' },
{ value: '10gb', text: '10GB - 2950 Naira' },
];
break;
case '9mobile':
dataPlans = [
{ value: '500mb', text: '500MB - 170 Naira' },
{ value: '1gb', text: '1GB - 300 Naira' },
{ value: '1.5gb', text: '1.5GB - 350 Naira' },
{ value: '2gb', text: '2GB - 600 Naira' },
{ value: '3gb', text: '3GB - 750 Naira' },
{ value: '5gb', text: '5GB - 2000 Naira' },
{ value: '10gb', text: '10GB - 3050 Naira' },
{ value: '20gb', text: '20GB - 5300 Naira' },
{ value: '30gb', text: '30GB - 7300 Naira' },
{ value: '40gb', text: '40GB - 11000 Naira' },
];
break;
}
dataPlans.forEach(plan => {
const option = document.createElement('option');
option.value = plan.value;
option.text = plan.text;
dataPlanSelect.add(option);
});
});
// Cable Subscription - Populating Cable Plans based on Cable Name
const cableNameSelect = document.getElementById('cable-name');
const cablePlanSelect = document.getElementById('cable-plan');
cableNameSelect.addEventListener('change', () => {
cablePlanSelect.innerHTML = ''; // Clear previous options
const selectedCableName = cableNameSelect.value;
let cablePlans = [];
switch (selectedCableName) {
case 'gotv':
cablePlans = [
{ value: 'gotv-smallie', text: 'GOTV Smallie - 1700 Naira' },
{ value: 'gotv-jinja', text: 'GOTV Jinja - 3400 Naira' },
{ value: 'gotv-jolli', text: 'GOTV Jolli - 4950 Naira' },
{ value: 'gotv-max', text: 'GOTV Max - 7300 Naira' },
{ value: 'gotv-supermax', text: 'GOTV Supermax - 9700 Naira' },
];
break;
case 'dstv':
cablePlans = [
{ value: 'dstv-padi', text: 'DSTV Padi - 3700 Naira' },
{ value: 'dstv-yanga', text: 'DSTV Yanga - 5200 Naira' },
{ value: 'dstv-confam', text: 'DSTV Confam - 9500 Naira' },
{ value: 'dstv-compact', text: 'DSTV Compact - 25700 Naira' },
{ value: 'dstv-compactplus', text: 'DSTV Compact Plus - 35000 Naira' },
{ value: 'dstv-premium', text: 'DSTV Premium - 47000 Naira' },
];
break;
case 'startime':
cablePlans = [
{ value: 'startime-nova', text: 'Startime Nova - 2700 Naira' },
{ value: 'startime-basic', text: 'Startime Basic - 4400 Naira' },
{ value: 'startime-smart', text: 'Startime Smart - 5300 Naira' },
{ value: 'startime-classic', text: 'Startime Classic - 6000 Naira' },
{ value: 'startime-super', text: 'Startime Super - 9000 Naira' },
];
break;
}
cablePlans.forEach(plan => {
const option = document.createElement('option');
option.value = plan.value;
option.text = plan.text;
cablePlanSelect.add(option);
});
});
// Purchase Functions
function purchaseData() {
const network = document.getElementById('data-network').value;
const dataPlan = document.getElementById('data-plan').value;
const mobileNumber = document.getElementById('data-mobile-number').value;
const message = `Data Purchase: Network - ${network}, Plan - ${dataPlan}, Mobile Number - ${mobileNumber}`;
sendWhatsAppMessage(message);
}
function purchaseCable() {
const cableName = document.getElementById('cable-name').value;
const iucNumber = document.getElementById('iuc-number').value;
const cablePlan = document.getElementById('cable-plan').value;
const message = `Cable Purchase: Cable Name - ${cableName}, IUC Number - ${iucNumber}, Plan - ${cablePlan}`;
sendWhatsAppMessage(message);
}
function purchaseResult() {
const examType = document.getElementById('exam-type').value;
const quantity = document.getElementById('quantity').value;
const message = `Result Purchase: Exam Type - ${examType}, Quantity - ${quantity}`;
sendWhatsAppMessage(message);
}
function purchaseAirtime() {
const mobileNumber = document.getElementById('airtime-mobile-number').value;
const airtimeAmount = document.getElementById('airtime-amount').value;
const message = `Airtime Purchase: Mobile Number - ${mobileNumber}, Amount - ${airtimeAmount}`;
sendWhatsAppMessage(message);
}
// Function to send WhatsApp messages
function sendWhatsAppMessage(message) {
const encodedMessage = encodeURIComponent(message);
const phoneNumber = '23407067479043'; // Replace with your WhatsApp phone number
const url = `https://wa.me/${phoneNumber}?text=${encodedMessage}`;
window.open(url, '_blank');
}