-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoffline.html
More file actions
141 lines (124 loc) · 4.34 KB
/
offline.html
File metadata and controls
141 lines (124 loc) · 4.34 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Offline Class Registration - CoreFit</title>
<style>
body {
font-family: Arial, sans-serif;
background: #0f172a;
color: white;
text-align: center;
padding: 20px;
}
h1 {
color: #facc15;
}
form {
background: #1e293b;
padding: 20px;
border-radius: 10px;
max-width: 400px;
margin: auto;
}
input, select, button {
width: 90%;
margin: 10px 0;
padding: 10px;
border-radius: 8px;
border: none;
font-size: 1em;
}
button {
background: #facc15;
color: black;
cursor: pointer;
}
#payment-section {
margin-top: 20px;
display: none;
}
#qr {
margin-top: 15px;
}
.amount {
font-size: 1.2em;
font-weight: bold;
color: #22c55e;
}
</style>
</head>
<body>
<a href="home.html" class="return-link">⬅ Back to Homepage</a>
<h1>🏋️ Offline Class Registration</h1>
<form id="offlineForm">
<input type="text" id="name" placeholder="Full Name" required>
<input type="email" id="email" placeholder="Email" required>
<input type="tel" id="phone" placeholder="Phone Number" required>
<label for="date">Preferred Date:</label>
<input type="date" id="date" required>
<input type="text" id="timing" placeholder="Preferred Timing (e.g., 6PM - 7PM)" required>
<label for="location">Select Branch:</label>
<select id="location" required>
<option value="">--Choose Location--</option>
<option value="Home">Home</option>
<option value="Bootcamps">Bootcamps</option>
<option value="Outdoors">Outdoors</option>
</select>
<label for="plan">Select Plan:</label>
<select id="plan" required>
<option value="">--Choose a Plan--</option>
<option value="Basic:799">Basic - ₹799</option>
<option value="Standard:1499">Standard - ₹1499</option>
<option value="Premium:2499">Premium - ₹2499</option>
</select>
<button type="submit">Register & Pay</button>
</form>
<div id="payment-section">
<p>You have selected the <span id="selectedPlan"></span> plan.</p>
<p class="amount">Please pay: ₹<span id="price"></span></p>
<div id="qr"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/qrcode/build/qrcode.min.js"></script>
<script>
const form = document.getElementById("offlineForm");
const qrDiv = document.getElementById("qr");
const paymentSection = document.getElementById("payment-section");
const selectedPlan = document.getElementById("selectedPlan");
const priceEl = document.getElementById("price");
form.addEventListener("submit", async (e) => {
e.preventDefault();
const name = document.getElementById("name").value;
const email = document.getElementById("email").value;
const phone = document.getElementById("phone").value;
const date = document.getElementById("date").value;
const timing = document.getElementById("timing").value;
const location = document.getElementById("location").value;
const planData = document.getElementById("plan").value;
if (!planData) {
alert("Please select a plan");
return;
}
const [plan, amount] = planData.split(":");
// Show selected plan and price
selectedPlan.textContent = plan;
priceEl.textContent = amount;
// Generate QR Code with UPI link (replace with your UPI ID)
const upiID = "9354543672@pthdfc";
const upiLink = `upi://pay?pa=${upiID}&pn=CoreFit&am=${amount}&cu=INR`;
qrDiv.innerHTML = "";
QRCode.toCanvas(document.createElement("canvas"), upiLink, (err, canvas) => {
if (!err) qrDiv.appendChild(canvas);
});
paymentSection.style.display = "block";
// Save offline registration details in backend
await fetch("http://localhost:5000/api/offline-register", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name, email, phone, date, timing, location, plan, amount })
});
});
</script>
</body>
</html>