-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.html
456 lines (404 loc) · 22.7 KB
/
card.html
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Card Generator</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!--<link rel="stylesheet" href="https://unpkg.com/dropzone@5/dist/min/dropzone.min.css" type="text/css" />-->
<link rel="stylesheet" href="css/style.css?v=<?php echo time(); ?>">
<!-- jsPDF Library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<!-- html2pdf Library (if needed) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
<style>
.tabcontent
{
padding: 30px 20px;
}
.card
{
margin:auto;
height: fit-content;
}
.form
{
text-align: center;
}
.inner-form
{
border-radius: 15px;
border: 2px dashed #000;
padding-top:48px;
padding-bottom: 48px;
margin-bottom: 20px;
}
form p
{
font-size: 13px;
color: #000;
opacity: 0.5;
}
.form form input[type="file"]
{
display: block;
margin: auto;
width: 120px;
}
.form form input[type="file"]::file-selector-button
{
color:#000;
background:transparent;
padding:10px 15px;
border-radius:7px;
border:1px solid #ccc;
}
.label
{
font-size: 17px;
font-weight: 700;
text-transform:capitalize;
}
.tablink
{
border:1px solid #e4464f;
background:transparent !important;
color:#000;
border-radius:6px;
margin-right:20px;
}
.tablink:focus
{
outline:1px solid transparent !important;
}
.tablink:last-child
{
margin-right:0px;
}
.tablink.active
{
outline:1px solid transparent;
background:#e4464f !important;
color:#fff;
}
.logo img
{
max-width: 200px;
margin: 20px auto 20px;
display: block;
}
button#download-csv
{
background: #e4464f !important;
border: 0;
}
#loading-message
{
display:none;
}
.card-image
{
opacity: 0.4;
}
/* The Modal (background) */
.modal {
display: none;
/* Hidden by default */
position: fixed;
/* Stay in place */
z-index: 1;
/* Sit on top */
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
overflow: auto;
/* Enable scroll if needed */
background-color: rgba(0, 0, 0, 0.4);
/* Black w/ opacity */
padding-top: 60px;
}
/* Modal Content/Box */
.modal-content {
background-color: #fefefe;
margin: 5% auto;
/* 15% from the top and centered */
padding: 20px;
border: 1px solid #e4464f;
width: 80%;
/* Could be more or less, depending on screen size */
max-width: 500px;
text-align: center;
border-radius: 10px;
}
/* The Close Button */
.close {
color: #e4464f;
float: right;
font-size: 28px;
font-weight: bold;
align-self: flex-end;
}
.close:hover,
.close:focus {
color: #e4464f;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<section>
<div class="container">
<div class="logo">
<img src="/studentcard/images/logo.png" class="img-fluid" alt=""/>
</div>
<div class="row justify-content-center">
<!-- <button class="tablink" onclick="openPage('Manually', this, '')">Manually</button>
<button class="tablink" id="defaultOpen" onclick="openPage('CSV', this, '')">CSV</button>-->
<button class="tablink" onclick="openPage('Manually', this, '')">Manually</button>
<button class="tablink" id="defaultOpen" onclick="openPage('CSV', this, '')">CSV</button>
</div>
<div class="row justify-content-center">
<div id="Manually" class="tabcontent" style="width:100%;">
<div class="row">
<div class="col-md-6">
<!--<h3>Enter Student Information</h3>-->
<!--create two tabs,one is 'manual' and one is 'by csv' -->
<form id="student-form">
<div class="form-group">
<label for="student-name">Student Name</label>
<input type="text" class="form-control" id="student-name" required />
</div>
<div class="form-group">
<label for="blood-type">Blood Type</label>
<input type="text" class="form-control" id="blood-type" required />
</div>
<div class="form-group">
<label for="father-name">Father's Name</label>
<input type="text" class="form-control" id="father-name" required />
</div>
<div class="form-group">
<label for="mother-name">Mother's Name</label>
<input type="text" class="form-control" id="mother-name" required />
</div>
<!-- HTML Form -->
<div class="form-group">
<label for="address-name">Address</label>
<input type="text" class="form-control" id="address-name" required />
</div>
<div class="form-group">
<label for="student-image">Upload Student Image</label>
<input type="file" class="form-control-file" id="student-image" accept="image/*" required />
</div>
<button id="download-button" class="btn btn-primary">
Download Card Image
</button>
</form>
</div>
<div class="col-md-6">
<h3>Student Card Preview</h3>
<div class="card">
<div id="card-preview">
<svg data-name="Layer 1" id="student-card-svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 141.7323 212.5984">
<rect width="141.7323" height="212.5984" fill="#fff" />
<circle cx="69.2" cy="73.3" r="33.7" fill="#3b465a" />
<rect y="54.1" width="141.7" height="38.39" fill="#fff" />
<rect y="56" width="141.7" height="34.55" fill="#e2464f" />
<circle cx="69.2" cy="73.3" r="31.4" fill="#fff" />
<circle cx="69.2" cy="73.3" r="26.1" fill="#e2464f" />
<!-- School Detail -->
<path
d="M97.9,14.8c0-.7.7-1,1.7-1s1.4.3,1.4.8v.6h2.5V14c0-1.9-2.4-2.4-4-2.4s-4.4,1-4.4,3.3,6,3.7,6,5.3-.7,1.1-1.5,1.1a5,5,0,0,1-3.4-1.6l-1.4,1.8a6.2,6.2,0,0,0,4.8,2.1,5.5,5.5,0,0,0,2.6-.6,1.4,1.4,0,0,1,1.4-1.4h0a3.7,3.7,0,0,0,.4-1.5C104,16.3,97.9,16.6,97.9,14.8Z"
transform="translate(0)" fill="#e2464f" />
<path
d="M32.2,7.1a8.1,8.1,0,0,1,8.2,8.1,8.3,8.3,0,1,1-16.5,0A8.1,8.1,0,0,1,32.2,7.1Zm0,13.7a5.3,5.3,0,0,0,5.1-5.6,5.2,5.2,0,1,0-10.3,0A5.3,5.3,0,0,0,32.2,20.8Z"
transform="translate(0)" fill="#e2464f" />
<path
d="M42.8,10.4c0-.4-.1-.5-.5-.5h-.9V7.4h2.8c1.1,0,1.6.4,1.6,1.5V20.3a.5.5,0,0,0,.5.5h3.4c.4,0,.5-.2.5-.5v-.9h2.7v2.4c0,1-.4,1.5-1.5,1.5h-7c-1.1,0-1.6-.5-1.6-1.5Z"
transform="translate(0)" fill="#e2464f" />
<path
d="M59.1,11.6c3.2,0,5,2.4,5,5.4v1.1H56.2a3.2,3.2,0,0,0,3.4,3,5.5,5.5,0,0,0,3.2-1.2L64,21.8a7,7,0,0,1-4.6,1.8,5.9,5.9,0,0,1-6.2-6A5.7,5.7,0,0,1,59.1,11.6Zm2.1,4.5a2.2,2.2,0,0,0-2.1-2.3,2.9,2.9,0,0,0-2.9,2.3Z"
transform="translate(0)" fill="#e2464f" />
<path
d="M82.7,11.6c3.2,0,5,2.4,5,5.4v1.1H79.8a3.2,3.2,0,0,0,3.4,3,5.5,5.5,0,0,0,3.2-1.2l1.2,1.9A7,7,0,0,1,83,23.6a5.9,5.9,0,0,1-6.2-6A5.7,5.7,0,0,1,82.7,11.6Zm2.1,4.5a2.2,2.2,0,0,0-2.1-2.3,2.9,2.9,0,0,0-2.9,2.3Z"
transform="translate(0)" fill="#e2464f" />
<path
d="M90,10.3a.5.5,0,0,0-.5-.5h-.9V7.4h2.7c1,0,1.5.4,1.5,1.5V20.4a.5.5,0,0,0,.5.5h.9v2.4H91.5c-1.1,0-1.5-.5-1.5-1.5Z"
transform="translate(0)" fill="#e2464f" />
<path
d="M73.3,9.2h-.7l-2.2,7.7s-1.8-6.5-2.2-7.7h-.7a22.5,22.5,0,0,1-2.1,8.1,18.8,18.8,0,0,1,4.1,9h.8V18.9c-.3-.1-.6-.3-.6-.6a.7.7,0,0,1,1.4,0c0,.3-.3.5-.6.6v7.4h.8a18.8,18.8,0,0,1,4.1-9A22.5,22.5,0,0,1,73.3,9.2Z"
transform="translate(0)" fill="#3b465a" />
<text transform="translate(52.9 33.2)" font-size="6.76" fill="#231f20"
font-family="ArialMT, Arial" letter-spacing="0.44em">
School
</text>
<text transform="translate(14.6 207.2)" font-size="8" fill="#e2464f"
font-family="ArialMT, Arial" letter-spacing="0.44em">
<tspan x="1" y="0">www.olevels.com</tspan>
</text>
<!-- End School Detail -->
<circle cx="103.6" cy="23" r="0.8" fill="#e2464f" />
<path
d="M104.4,16.8v5.1A1.4,1.4,0,0,1,105,23h0v.3h-.1c0,.1-.1.1-.1.2h0v.2h13.1V16.8Zm2.8,5.7a1.9,1.9,0,0,1-1.9-2,1.8,1.8,0,0,1,1.9-1.9c.5,0,1.4.2,1.4.9v.4H108v-.2c0-.3-.5-.4-.8-.4a1.2,1.2,0,0,0-1.2,1.2,1.3,1.3,0,0,0,1.2,1.3,1.9,1.9,0,0,0,1.2-.5l.3.5A1.9,1.9,0,0,1,107.2,22.5Zm3.5,0a1.9,1.9,0,0,1-1.9-2,1.9,1.9,0,1,1,3.8,0A1.9,1.9,0,0,1,110.7,22.5Zm6.3-.1h-.6c-.2,0-.3-.1-.3-.4V20.4a1.1,1.1,0,0,1,0-.6h-.1l-.2.6-.6,1.4h-.5l-.6-1.4-.2-.6h-.1a1.1,1.1,0,0,1,0,.6V22c0,.3-.1.4-.3.4h-.6v-.6h.1c.1,0,.1,0,.1-.1l.3-3h.7l.8,1.8a1.3,1.3,0,0,1,.1.5h.1a2,2,0,0,0,.1-.5l.8-1.8h.7l.3,3c0,.1,0,.1.1.1h.1Zm-6.3-3.1a1.2,1.2,0,0,0-1.2,1.2,1.2,1.2,0,1,0,2.4,0A1.2,1.2,0,0,0,110.7,19.3Z"
transform="translate(0)" fill="#e2464f" />
<text id="student-name-text" data-name="Your Name Here" text-anchor="middle"
transform="translate(75 133)" font-size="13" fill="#e2464f"
font-family="BebasNeue-Regular, Bebas Neue">
<tspan x="-5" y="0">Your Name Here</tspan>
</text>
<circle cx="69.2" cy="73.3" r="22.8" fill="#fff" />
<clipPath id="imageClip">
<circle cx="69.2" cy="73.3" r="22.8" />
</clipPath>
<image id="student-image-svg" xlink:href="" x="46.4" y="50.5" width="45.6" height="45.6"
clip-path="url(#imageClip)" />
<!-- Blood Detail -->
<text transform="translate(20 146) scale(1.13 1)" font-size="6" fill="#231f20"
font-family="Arial-BoldMT, Arial" font-weight="700">
<tspan xml:space="preserve">Blood</tspan>
</text>
<text transform="translate(49 146) scale(1.13 1)" font-size="6" fill="#231f20"
font-family="Arial-BoldMT, Arial" font-weight="700">
:
</text>
<text id="blood-name-text" data-name="Your Blood Group Here"
transform="translate(50 146) scale(1.13 1)" font-size="6" fill="#231f20"
font-family="Arial-BoldMT, Arial" font-weight="700">
<tspan x="3.6" y="0">Your Blood Group Here</tspan>
</text>
<!-- End Blood Detail -->
<!-- Father Detail -->
<text transform="translate(20 156) scale(1.13 1)" font-size="6" fill="#231f20"
font-family="Arial-BoldMT, Arial" font-weight="700">
Father
</text>
<text transform="translate(49 156) scale(1.13 1)" font-size="6" fill="#231f20"
font-family="Arial-BoldMT, Arial" font-weight="700">
:
</text>
<text id="father-name-text" transform="translate(50 156) scale(1.13 1)" font-size="6"
fill="#231f20" font-family="Arial-BoldMT, Arial" font-weight="700">
<tspan x="3.6" y="0">Your Father Name Here</tspan>
</text>
<!-- Mother Detail -->
<text transform="translate(20 166) scale(1.13 1)" font-size="6" fill="#231f20"
font-family="Arial-BoldMT, Arial" font-weight="700">
Mother
</text>
<text transform="translate(49 166) scale(1.13 1)" font-size="6" fill="#231f20"
font-family="Arial-BoldMT, Arial" font-weight="700">
:
</text>
<text id="mother-name-text" transform="translate(50 166) scale(1.13 1)" font-size="6"
fill="#231f20" font-family="Arial-BoldMT, Arial" font-weight="700">
<tspan x="3.6" y="0">Your Mother Name Here</tspan>
</text>
<!-- End Mother Detail -->
<text transform="translate(20 177) scale(1.13 1)" font-size="6" fill="#231f20"
font-family="Arial-BoldMT, Arial" font-weight="700">
Address
</text>
<text transform="translate(50 177) scale(1.13 1)" font-size="6" fill="#231f20"
font-family="Arial-BoldMT, Arial" font-weight="700">
:
</text>
<rect x="69.2" height="47.16" fill="#e2464f" />
<text id="address-name-text" transform="translate(50 177) scale(1.13 1)" font-size="6"
fill="#231f20" font-family="Arial-BoldMT, Arial" font-weight="700">
<tspan x="3.6" y="0">Your Address Here</tspan>
</text>
</svg>
</div>
</div>
</div>
</div>
</div>
<div id="CSV" class="tabcontent">
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-md-4">
<div class="form">
<form id="student-form">
<div class="inner-form">
<div class="form-group">
<label class="label" for="upload-csv">Choose a file or drag & drop it
here</label>
<p>XLS Format Only</p>
<input type="file" id="csv-file" accept=".csv" />
</div>
</div>
<button id="download-csv" class="btn btn-primary" type="button" style="display:none;">
<span id="download-text">Download Your File</span>
<span id="loading-message">please wait...</span>
</button>
</form>
</div>
</div>
<div class="col-md-8">
<div id="card-preview-container">
<img id="card-image" class="img-fluid card-image" src="images/cards_sketch.jpg" alt="Card Image"
style="display:block;" />
<!-- Image is hidden initially -->
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal Structure -->
<div id="cardLimitModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<h2>Card Limit Exceeded</h2>
<p id="modal-message"></p>
</div>
</div>
</div>
</section>
<script src="scripts/script.js?v=12"></script>
<script src="https://unpkg.com/dropzone@5/dist/min/dropzone.min.js"></script>
<script>
function openPage(pageName, elmnt, color) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].style.backgroundColor = "";
tablinks[i].classList.remove("active");
}
document.getElementById(pageName).style.display = "block";
elmnt.style.backgroundColor = color;
elmnt.classList.add("active");
}
// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();
</script>
<script>
// Dropzone.discover();
document.addEventListener('dragover', (e) => {
e.preventDefault();
});
document.addEventListener('drop', (e) => {
e.preventDefault();
const files = e.dataTransfer.files;
if (files.length > 0) {
const fileInput = document.getElementById('csv-file');
fileInput.files = files;
const event = new Event('change', { bubbles: true });
fileInput.dispatchEvent(event);
openPage("CSV", document.getElementById("csv-tab-btn"), '#a6a6a6')
console.log(fileInput.files);
}
});
</script>
</body>
</html>