Repository navigation
Expand file tree
/
Copy pathmerchandise.html
More file actions
349 lines (294 loc) · 14.2 KB
/
Copy pathmerchandise.html
File metadata and controls
349 lines (294 loc) · 14.2 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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<!doctype html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Merchandise — UITS Cyber Security Wing</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@600;800&family=Inter:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="icon" href="assets/images/logo.svg">
<style>
.text-neon { color: #0ff; font-weight: 700; }
.btn-outline-neon { border-color: #0ff; color: #0ff; background: transparent; }
.btn-neon { background: linear-gradient(90deg,#0ff,#0af); color: #000; }
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark sticky-top border-bottom border-secondary-subtle bg-body">
<div class="container">
<a class="navbar-brand fw-bold d-flex align-items-center gap-2" href="index.html">
<img src="assets/images/logo.svg" width="28" height="28" alt="logo">
<span>UITS Cyber Security Wing</span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navContent">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0 align-items-lg-center">
<li class="nav-item"><a class="nav-link" href="index.html">Home</a></li>
<li class="nav-item"><a class="nav-link" href="about.html">About</a></li>
<li class="nav-item"><a class="nav-link" href="verify.html">Certification Verification</a></li>
<li class="nav-item"><a class="nav-link" href="halloffame.html">Hall of Fame</a></li>
<li class="nav-item"><a class="nav-link" href="blog.html">Blog</a></li>
<li class="nav-item"><a class="nav-link" href="bootcamp.html">Boot Camp</a></li>
<li class="nav-item"><a class="nav-link active" href="merchandise.html">Merchandise</a></li>
</ul>
</div>
</div>
</nav>
<section class="py-5 container">
<h1 class="fw-bold mb-3">Official Merchandise</h1>
<p class="text-secondary">Support our community and show your cybersecurity spirit.</p>
<p style="color: red; font-weight: bold;">For UITS Cyber Security Wing members only!</p>
<marquee style="color: red; font-weight: bold; font-family: cursive;">Orders for the 𝐔𝐈𝐓𝐒𝐒𝐄𝐂 𝐏𝐫𝐞𝐦𝐢𝐮𝐦 𝐇𝐨𝐨𝐝𝐢𝐞 is closed for this session!</marquee>
<div id="merchList" class="row g-4 mt-4"></div>
</section>
<footer class="mt-5 pt-5 border-top border-secondary-subtle bg-body">
<div class="container pb-4 text-center text-secondary small">
© 2022-2025 UITS Cyber Security Wing
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", () => {
const merchList = document.getElementById("merchList");
const modalEl = document.getElementById("purchaseModal");
const modal = modalEl ? new bootstrap.Modal(modalEl) : null;
const purchaseBtn = document.getElementById("modalPurchaseBtn");
if (purchaseBtn) purchaseBtn.disabled = true;
// FALLBACK DATA
const fallbackData = {
merchandise: [
{ id: 1, name: "Hoodie", description: "Comfortable hoodie with DTF", price: "BDT 599", image: "assets/images/hoodie.jpg" },
{ id: 2, name: "Keyring & Badge", description: "Metal keyring and enamel badge", price: "BDT 120", image: "assets/images/keyring.jpg" },
{ id: 3, name: "Limited Edition Poster", description: "Coming soon - limited run", price: "BDT 0", image: "assets/images/poster.jpg" }
]
};
fetch("merchandise.json")
.then(res => res.ok ? res.json() : fallbackData)
.then(data => renderMerch(data))
.catch(_ => renderMerch(fallbackData));
function renderMerch(data) {
merchList.innerHTML = "";
data.merchandise.forEach(item => {
const card = document.createElement("div");
card.className = "col-md-4 col-lg-3";
card.innerHTML = `
<div class="card bg-body-secondary border-secondary h-100">
<img src="${item.image}" class="card-img-top" alt="${item.name}" onerror="this.style.opacity=0.6">
<div class="card-body">
<h5 class="card-title fw-bold">${item.name}</h5>
<p class="card-text text-secondary">${item.description}</p>
<p class="fw-bold text-neon">${item.price}</p>
${
item.id === 1
? `<span class="badge bg-primary mt-2">Ended for this season</span>`
: item.id === 3
? `<span class="badge bg-danger mt-2">Coming Soon</span>`
: `<button class="btn btn-outline-neon btn-sm mt-2" onclick="openPurchaseForm('${item.name}', ${item.id})">Purchase</button>`
}
</div>
</div>`;
merchList.appendChild(card);
});
}
// OPEN PURCHASE FORM
window.openPurchaseForm = function(productName, productId) {
document.getElementById("productName").value = productName;
document.getElementById("productId").value = productId;
const sizeField = document.querySelector("[name='size']").closest(".col-md-6");
const usernameField = document.querySelector("[name='username']").closest(".col-md-6");
const bKashLabel = document.querySelector("#mobile_number_field label:first-of-type");
purchaseBtn.disabled = true;
if (productId === 2 || productId === 3) {
sizeField.classList.add("d-none");
usernameField.classList.add("d-none");
document.querySelector("[name='size']").required = false;
document.querySelector("[name='username']").required = false;
} else {
sizeField.classList.remove("d-none");
usernameField.classList.remove("d-none");
document.querySelector("[name='size']").required = true;
document.querySelector("[name='username']").required = true;
}
if (bKashLabel) {
bKashLabel.textContent = productId === 2 ? "Send BDT 120 to 01572169652" : "Send BDT 599 to 01572169652";
}
modal.show();
updateSubmitState();
};
// SUBMIT ORDER
window.submitOrder = function() {
const form = document.getElementById("orderForm");
if (purchaseBtn.disabled) return alert("Please fill all required fields.");
purchaseBtn.disabled = true;
const formData = new FormData(form);
fetch("https://script.google.com/macros/s/AKfycbypXpobO3D84AlQwt0hZVWYd-hGA9jpi5wGeheJULqwc-Su1lqD5yLe3KQEIa9gWZRWzg/exec", {
method: "POST",
body: formData
});
setTimeout(() => {
alert("Order placed successfully! We will confirm your payment manually.\nFurther details will be sent to your email.");
form.reset();
modal.hide();
purchaseBtn.disabled = true;
}, 800);
};
// PAYMENT METHOD HANDLING
const paymentSelect = document.getElementById("payment_method");
paymentSelect.addEventListener("change", function () {
const val = this.value;
const fields = {
mobile_number_field: document.getElementById("mobile_number_field"),
mobile_trx_field: document.getElementById("mobile_trx_field"),
bank_name_field: document.getElementById("bank_name_field"),
bank_ac_field: document.getElementById("bank_ac_field"),
cash_receiver_field: document.getElementById("cash_receiver_field")
};
Object.values(fields).forEach(f => f.classList.add("d-none"));
document.querySelector("[name='bkash_number']").required = false;
document.querySelector("[name='bkash_trx']").required = false;
if (val === "mobile") {
fields.mobile_number_field.classList.remove("d-none");
fields.mobile_trx_field.classList.remove("d-none");
document.querySelector("[name='bkash_number']").required = true;
document.querySelector("[name='bkash_trx']").required = true;
}
if (val === "bank") {
fields.bank_name_field.classList.remove("d-none");
fields.bank_ac_field.classList.remove("d-none");
}
if (val === "cash") {
fields.cash_receiver_field.classList.remove("d-none");
document.querySelector("[name='cash_receiver']").required = true;
} else {
document.querySelector("[name='cash_receiver']").required = false;
}
updateSubmitState();
});
// VALIDATION
function updateSubmitState() {
const form = document.getElementById("orderForm");
const requiredFields = form.querySelectorAll("input:required, select:required");
let allFilled = true;
requiredFields.forEach(f => {
if (!f.closest(".d-none") && !f.value.trim()) {
allFilled = false;
}
});
purchaseBtn.disabled = !allFilled;
purchaseBtn.textContent = allFilled ? "Submit Order" : "Fill all information";
}
document.querySelectorAll("#orderForm input, #orderForm select")
.forEach(i => i.addEventListener("input", updateSubmitState));
});
</script>
<!-- PURCHASE MODAL -->
<div class="modal fade" id="purchaseModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content bg-body-secondary border-secondary">
<div class="modal-header">
<h5 class="modal-title">Purchase Merchandise</h5>
<button class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<form id="orderForm">
<input type="hidden" id="productName" name="productName">
<input type="hidden" id="productId" name="productId">
<div class="row g-3">
<div class="col-md-6">
<label class="form-label">Full Name</label>
<input type="text" class="form-control" name="name" required>
</div>
<div class="col-md-6">
<label class="form-label">Email</label>
<input type="email" class="form-control" name="email" required>
</div>
<div class="col-md-6">
<label class="form-label">Phone Number</label>
<input type="number" class="form-control" name="phone" required>
</div>
<div class="col-md-6">
<label class="form-label">Student ID</label>
<input type="number" class="form-control" name="student_id" required>
</div>
<div class="col-md-6">
<label class="form-label">Batch(Section)</label>
<input type="text" class="form-control" name="batch" required>
</div>
<div class="col-md-6">
<label class="form-label">Department</label>
<input type="text" class="form-control" name="department" required>
</div>
<div class="col-md-6">
<label class="form-label">Username or Name for DTF on Hoodie</label>
<input type="text" class="form-control" name="username" required>
</div>
<!-- PAYMENT METHOD -->
<div class="col-md-6">
<label class="form-label">Payment Method</label>
<select class="form-control" name="payment_method" id="payment_method" required>
<option value="">Select</option>
<option value="mobile">Mobile Banking (bKash)</option>
<option value="bank">Bank Account</option>
<option value="cash">Cash Payment</option>
</select>
</div>
<!-- MOBILE BANKING -->
<div class="col-md-6 d-none" id="mobile_number_field">
<label class="form-label">Send BDT 599 to 01572169652</label><br>
<label class="form-label">Your bKash Mobile Number</label>
<input type="text" class="form-control" name="bkash_number">
</div>
<div class="col-md-6 d-none" id="mobile_trx_field">
<label class="form-label"><a href="https://docs.google.com/document/d/1bDyXTVkNpO48H-IrHZh5JW--O3i_vsv9UVnQONEHnEU/edit?usp=sharing">Check the Terms & Conditions</a></label><br>
<label class="form-label">bKash Transaction ID</label>
<input type="text" class="form-control" name="bkash_trx">
</div>
<!-- BANK -->
<div class="col-md-6 d-none" id="bank_name_field">
<label class="form-label" style="color:red;">Not Available Yet!</label><br>
<label class="form-label">Account Holder Name</label>
<input type="text" class="form-control" name="bank_name" disabled>
</div>
<div class="col-md-6 d-none" id="bank_ac_field">
<label class="form-label"><a href="https://docs.google.com/document/d/1bDyXTVkNpO48H-IrHZh5JW--O3i_vsv9UVnQONEHnEU/edit?usp=sharing">Check the Terms & Conditions</a></label><br>
<label class="form-label">Account Number</label>
<input type="text" class="form-control" name="bank_ac" disabled>
</div>
<!-- CASH PAYMENT RECEIVER -->
<div class="col-md-6 d-none" id="cash_receiver_field">
<label class="form-label">Choose the executive you will be giving cash to</label>
<select class="form-control" name="cash_receiver">
<option value="">Select</option>
<option value="Rudra Das">Rudra Das</option>
<option value="Mohammed Masud">Mohammed Masud</option>
<option value="Reyazul Islam">Reyazul Islam</option>
</select>
</div>
<!-- SIZE -->
<div class="col-md-6">
<label class="form-label">Size</label>
<select class="form-control" name="size" required>
<option value="">Select</option>
<option value="S">S</option>
<option value="M">M</option>
<option value="L">L</option>
<option value="XL">XL</option>
<option value="2XL">2XL</option>
<option value="3XL">3XL</option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button id="modalPurchaseBtn" class="btn btn-neon" type="button" onclick="submitOrder()">Submit Order</button>
</div>
</div>
</div>
</div>
</body>
</html>