-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
516 lines (463 loc) · 19.5 KB
/
index.html
File metadata and controls
516 lines (463 loc) · 19.5 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
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
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Volunteer Form</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="Images/FaRLogo.jpg">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background: linear-gradient(135deg, #FFF3E0 0%, #A5D6A7 100%);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 20px;
}
.form-container {
width: 100%;
max-width: 500px;
background-color: #fdf4eb;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
overflow: hidden;
transition: all 0.3s ease-in-out;
}
.form-container:hover {
transform: translateY(-5px);
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}
.form-header {
color: #d88e49;
padding: 30px;
text-align: center;
}
.form-header img {
max-width: 240px;
margin-bottom: 15px;
}
.form-header h1 {
font-size: 24px;
font-weight: 600;
margin-bottom: 5px;
}
.form-header p {
font-size: 14px;
opacity: 0.8;
}
form {
padding: 30px;
}
.form-group {
margin-bottom: 25px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #333;
}
input[type="text"],
input[type="email"],
textarea {
width: 100%;
padding: 12px;
border: 1px solid #e1e1e1;
border-radius: 8px;
font-size: 14px;
transition: border-color 0.3s ease;
}
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
border-color: #d88e49;
outline: none;
}
textarea {
height: 120px;
resize: vertical;
}
.button-container {
text-align: center;
}
button[type="submit"] {
background: #d88e49;
color: white;
border: none;
padding: 12px 30px;
border-radius: 25px;
cursor: pointer;
font-size: 16px;
font-weight: 500;
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}
button[type="submit"]:hover {
transform: translateY(-2px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}
button[type="submit"]:disabled {
background: #cccccc;
cursor: not-allowed;
box-shadow: none;
}
@media (max-width: 600px) {
.form-container {
max-width: 100%;
}
.form-header {
padding: 20px;
}
form {
padding: 20px;
}
}
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 400px;
border-radius: 10px;
text-align: center;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
#closeAlert {
background: #d88e49;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-top: 15px;
transition: all 0.3s ease;
}
#closeAlert:hover {
transform: translateY(-2px);
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
#acceptInitialWarning {
background: #d88e49;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-top: 15px;
transition: all 0.3s ease;
}
#acceptInitialWarning:hover {
transform: translateY(-2px);
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
#initialWarningModal {
display: block;
}
.radio-group {
display: flex;
flex-direction: column;
gap: 12px;
margin-top: 10px;
}
.radio-option {
display: flex;
align-items: center;
gap: 10px;
}
.radio-option input[type="radio"] {
width: 18px;
height: 18px;
cursor: pointer;
}
.radio-option label {
margin: 0;
cursor: pointer;
}
.subtitle {
display: block;
color: #d88e49;
font-size: 12px;
margin-top: 2px;
margin-bottom: 8px;
}
input[type="checkbox"]:checked,
input[type="radio"]:checked {
accent-color: #9bb03d;
}
</style>
</head>
<body>
<div class="form-container">
<div class="form-header">
<img src="Images/longlogo.png" alt="FaR Team Logo">
<p>¡Buscamos Voluntarios!</p>
</div>
<form id="myForm">
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="name">Nombre</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label>¿Para qué posición querés aplicar?</label>
<span class="subtitle">(Podés elegir más de una)</span>
<div class="radio-group">
<div class="radio-option">
<input type="checkbox" id="Productor Musical" name="positions[]" value="Productor Musical">
<label for="Productor Musical">Productor Musical</label>
</div>
<div class="radio-option">
<input type="checkbox" id="Modelador 3D" name="positions[]" value="Modelador 3D">
<label for="Modelador 3D">Modelador 3D</label>
</div>
<div class="radio-option">
<input type="checkbox" id="Animador 3D" name="positions[]" value="Animador 3D">
<label for="Animador 3D">Animador 3D</label>
</div>
<div class="radio-option">
<input type="checkbox" id="Artista 2D" name="positions[]" value="Artista 2D">
<label for="Artista 2D">Artista 2D</label>
</div>
<div class="radio-option">
<input type="checkbox" id="Programador" name="positions[]" value="Programador">
<label for="Programador">Programador</label>
</div>
<div class="radio-option">
<input type="checkbox" id="Web Developer" name="positions[]" value="Programador">
<label for="Web Developer">Web Developer</label>
</div>
<div class="radio-option">
<input type="checkbox" id="Game Producer" name="positions[]" value="Programador">
<label for="Game Producer">Game Producer</label>
</div>
<div class="radio-option">
<input type="checkbox" id="Game Designer" name="positions[]" value="Programador">
<label for="Game Designer">Game Designer</label>
</div>
</div>
</div>
<div class="form-group">
<label for="portfolio">Dejanos tu portfolio</label>
<span class="subtitle">(O tu muestra de trabajo de preferencia)</span>
<input type="text" id="portfolio" name="porfolio" required>
</div>
<div class="form-group">
<label>¿Cómo preferís que te contactemos?</label>
<div class="radio-group">
<div class="radio-option">
<input type="radio" id="discord" name="contact_method" value="discord">
<label for="discord">Discord</label>
</div>
<div class="radio-option">
<input type="radio" id="Twitter" name="contact_method" value="whatsapp">
<label for="Twitter">twitter</label>
</div>
<div class="radio-option">
<input type="radio" id="mail" name="contact_method" value="telegram">
<label for="mail">Mail</label>
</div>
<div class="radio-option">
<input type="radio" id="otro" name="contact_method" value="telegram">
<label for="otro">Otro (Especificar)</label>
</div>
</div>
<div id="contact_details_container" style="display: none; margin-top: 10px;">
<input type="text" id="contact_details" name="contact_details" placeholder="Ingresa tu usuario">
</div>
</div>
<div class="form-group">
<div class="radio-option">
<input type="checkbox" id="voluntaryAcknowledgment" name="voluntaryAcknowledgment" required>
<label for="voluntaryAcknowledgment">Aceptando esto reconocés que entendés que se trata de un trabajo voluntario, no remunerado, por experiencia.</label>
</div>
</div>
<div class="button-container">
<button type="submit" id="submitButton" disabled>Enviar</button>
</div>
</form>
</div>
<div id="initialWarningModal" class="modal">
<div class="modal-content">
<p>Aceptando esto reconocés que entendés que se trata de un trabajo voluntario, no remunerado, por experiencia.</p>
<button id="acceptInitialWarning">Aceptar</button>
</div>
</div>
<div id="customAlert" class="modal">
<div class="modal-content">
<p id="alertMessage"></p>
<button id="closeAlert">Cerrar</button>
</div>
</div>
<script>
const form = document.getElementById('myForm');
const submitButton = document.getElementById('submitButton');
const requiredInputs = form.querySelectorAll('input[required]');
const initialWarningModal = document.getElementById('initialWarningModal');
const acceptInitialWarningButton = document.getElementById('acceptInitialWarning');
const voluntaryAcknowledgmentCheckbox = document.getElementById('voluntaryAcknowledgment');
const contactDetailsContainer = document.getElementById('contact_details_container');
function checkFormValidity() {
let isValid = true;
requiredInputs.forEach(input => {
if (!input.value.trim()) {
isValid = false;
}
});
const positionCheckboxes = document.querySelectorAll('input[name="positions[]"]');
const hasSelectedPosition = Array.from(positionCheckboxes).some(checkbox => checkbox.checked);
if (!hasSelectedPosition) {
isValid = false;
}
const contactMethod = document.querySelector('input[name="contact_method"]:checked');
const contactDetails = document.getElementById('contact_details'); // This is contactDetailsInput in other parts of the script
if (!contactMethod || (contactDetailsContainer.style.display === 'block' && !contactDetails.value.trim())) {
isValid = false;
}
const acknowledgment = document.getElementById('voluntaryAcknowledgment');
if (!acknowledgment.checked) {
isValid = false;
}
submitButton.disabled = !isValid;
}
requiredInputs.forEach(input => {
input.addEventListener('input', checkFormValidity);
});
acceptInitialWarningButton.addEventListener('click', () => {
initialWarningModal.style.display = 'none';
voluntaryAcknowledgmentCheckbox.checked = true;
const event = new Event('change', { bubbles: true });
voluntaryAcknowledgmentCheckbox.dispatchEvent(event);
});
function showCustomAlert(message) {
const modal = document.getElementById('customAlert');
const alertMessage = document.getElementById('alertMessage');
const closeButton = document.getElementById('closeAlert');
alertMessage.textContent = message;
modal.style.display = 'block';
closeButton.onclick = function() {
modal.style.display = 'none';
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = 'none';
}
}
}
function submitToDiscord(formData) {
const webhookUrl = "https://discord.com/api/webhooks/1298670786856620083/kTx0pHFbAkb1DdAGMA4NvgY-oT3WeADZKx5Uz37TXoH1Iz8e9As074bfRSvFTBEZvojN";
const selectedPositions = Array.from(document.querySelectorAll('input[name="positions[]"]:checked'))
.map(checkbox => checkbox.value)
.join(", ");
const contactMethod = document.querySelector('input[name="contact_method"]:checked');
const contactDetails = document.getElementById('contact_details').value;
const fields = [
{ name: "Correo", value: formData.get('email'), inline: false },
{ name: "Nombre", value: formData.get('name'), inline: false },
{ name: "Posiciones", value: selectedPositions || "No seleccionó ninguna posición.", inline: false },
{ name: "Portfolio", value: formData.get('porfolio'), inline: false },
{ name: "Método de Contacto", value: contactMethod ? contactMethod.value : "No especificado", inline: true },
{ name: "Detalles de Contacto", value: contactDetails || "No proporcionados", inline: true },
{ name: "Aceptó Trabajo Voluntario", value: "✅", inline: false }
];
const payload = {
content: `Nueva respuesta al formulario de ` + formData.get('name') + ":",
embeds: [
{
title: "Formulario de Voluntarios",
color: 8988319,
fields: fields,
timestamp: new Date().toISOString(),
footer: {
text: "F.A.R. Team",
}
}
]
};
fetch(webhookUrl, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
console.log("Form submitted successfully");
showCustomAlert("Formulario enviado con éxito!");
form.reset();
contactDetailsContainer.style.display = 'none';
submitButton.disabled = true;
})
.catch(error => {
console.error('Error:', error);
showCustomAlert("Hubo un error al enviar el formulario. Por favor, inténtalo de nuevo.");
});
} form.addEventListener('submit', (e) => {
e.preventDefault();
const formData = new FormData(form);
submitToDiscord(formData);
});
const contactMethodRadios = document.querySelectorAll('input[name="contact_method"]');
const contactDetailsInput = document.getElementById('contact_details');
contactMethodRadios.forEach(radio => {
radio.addEventListener('change', () => {
contactDetailsContainer.style.display = 'block';
const methodName = radio.id;
let placeholder = '';
switch(methodName) {
case 'discord':
placeholder = 'Ingresa tu usuario de Discord';
contactDetailsInput.value = '';
break;
case 'Twitter':
placeholder = 'Ingresa tu usuario de Twitter';
contactDetailsInput.value = '';
break;
case 'mail':
placeholder = 'Ingresa tu correo electrónico';
contactDetailsInput.value = document.getElementById('email').value;
break;
case 'otro':
placeholder = 'Especifica tu método de contacto preferido';
contactDetailsInput.value = '';
break;
}
contactDetailsInput.placeholder = placeholder;
contactDetailsInput.required = true;
checkFormValidity();
});
});
document.querySelectorAll('input[name="positions[]"]').forEach(checkbox => {
checkbox.addEventListener('change', checkFormValidity);
});
document.getElementById('voluntaryAcknowledgment').addEventListener('change', checkFormValidity);
document.getElementById('contact_details').addEventListener('input', checkFormValidity);
</script>
</body>
</html>