-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
514 lines (444 loc) · 21 KB
/
index.html
File metadata and controls
514 lines (444 loc) · 21 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
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>טופס פינוי בניין</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
direction: rtl;
}
.container {
max-width: 600px;
margin: 0 auto;
background: white;
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.header {
background: linear-gradient(45deg, #ff6b6b, #feca57);
color: white;
padding: 30px;
text-align: center;
position: relative;
}
.header::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="3" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="70" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="30" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
}
.header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
position: relative;
z-index: 1;
}
.header p {
font-size: 1.1rem;
opacity: 0.95;
position: relative;
z-index: 1;
}
.form-container {
padding: 40px;
}
.form-group {
margin-bottom: 25px;
position: relative;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: #333;
font-size: 1rem;
}
.form-group input {
width: 100%;
padding: 15px 20px;
border: 2px solid #e1e8ed;
border-radius: 12px;
font-size: 1rem;
transition: all 0.3s ease;
background: #f8f9fa;
}
.form-group input:focus {
outline: none;
border-color: #667eea;
background: white;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
transform: translateY(-2px);
}
.form-group input:hover {
border-color: #667eea;
background: white;
}
.phone-section {
background: #f8f9fa;
border-radius: 15px;
padding: 25px;
margin: 30px 0;
border: 1px solid #e9ecef;
}
.phone-section h3 {
color: #495057;
margin-bottom: 20px;
font-size: 1.3rem;
text-align: center;
}
.submit-btn {
background: linear-gradient(45deg, #667eea, #764ba2);
color: white;
padding: 18px 40px;
border: none;
border-radius: 50px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
width: 100%;
margin-top: 20px;
transition: all 0.3s ease;
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}
.submit-btn:hover {
transform: translateY(-3px);
box-shadow: 0 15px 30px rgba(102, 126, 234, 0.4);
}
.submit-btn:active {
transform: translateY(-1px);
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.watermark {
position: fixed;
bottom: 10px;
left: 10px;
background: rgba(255, 165, 0, 0.2);
color: #ff8c00;
padding: 5px 10px;
border-radius: 15px;
font-size: 0.7rem;
font-weight: 500;
backdrop-filter: blur(10px);
z-index: 1000;
pointer-events: none;
user-select: none;
border: 1px solid rgba(255, 165, 0, 0.3);
}
@media (max-width: 600px) {
.form-row {
grid-template-columns: 1fr;
}
.container {
margin: 10px;
}
.form-container {
padding: 20px;
}
.header {
padding: 20px;
}
.header h1 {
font-size: 2rem;
}
.watermark {
font-size: 0.6rem;
padding: 3px 8px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<img src="https://www.rosh-haayin.muni.il/content/images/logo.png" alt="" style="height: 40px; margin-bottom: 15px; filter: brightness(0) invert(1);">
<h1>🏢 טופס פינוי בניין</h1>
<p>אנא מלא את הפרטים הבאים במדויק</p>
</div>
<div class="form-container">
<form id="evacuationForm">
<div class="form-group">
<label for="idNumber">תעודת זהות</label>
<input type="text" id="idNumber" name="idNumber" placeholder="הכנס מספר תעודת זהות (5-9 ספרות)" maxlength="9" required>
</div>
<div class="form-group">
<label for="name">שם</label>
<input type="text" id="name" name="name" placeholder="הכנס שם מלא" required>
</div>
<div class="form-group">
<label for="street">רחוב</label>
<input type="text" id="street" name="street" placeholder="הכנס שם רחוב" required>
</div>
<div class="form-row">
<div class="form-group">
<label for="houseNumber">מספר בית</label>
<input type="text" id="houseNumber" name="houseNumber" placeholder="מספר בית" required>
</div>
<div class="form-group">
<label for="apartmentNumber">מספר דירה</label>
<input type="text" id="apartmentNumber" name="apartmentNumber" placeholder="מספר דירה">
</div>
</div>
<div class="form-group">
<label for="floor">קומה</label>
<input type="text" id="floor" name="floor" placeholder="מספר קומה">
</div>
<div class="phone-section">
<h3>📞 פרטי קשר</h3>
<div class="form-group">
<label for="mobilePhone">טלפון נייד</label>
<input type="tel" id="mobilePhone" name="mobilePhone" placeholder="05X-XXXXXXX" required>
</div>
<div class="form-group">
<label for="homePhone">טלפון בבית</label>
<input type="tel" id="homePhone" name="homePhone" placeholder="0X-XXXXXXX">
</div>
<div class="form-group">
<label for="emergencyPhone">טלפון חירום</label>
<input type="tel" id="emergencyPhone" name="emergencyPhone" placeholder="טלפון ליצירת קשר בחירום">
</div>
<div class="form-group">
<label for="additionalPhone">טלפון נוסף</label>
<input type="tel" id="additionalPhone" name="additionalPhone" placeholder="טלפון נוסף (אופציונלי)">
</div>
</div>
<button type="submit" class="submit-btn">שלח טופס 🚀</button>
</form>
</div>
</div>
<div class="watermark">🤖 MADE WITH CODE-CAL</div>
<script>
document.getElementById('evacuationForm').addEventListener('submit', async function(e) {
e.preventDefault();
// Animation for form submission
const button = document.querySelector('.submit-btn');
const originalText = button.textContent;
button.textContent = 'שולח...';
button.style.background = 'linear-gradient(45deg, #27ae60, #2ecc71)';
// Collect form data
const formData = {
idNumber: document.getElementById('idNumber').value,
name: document.getElementById('name').value,
street: document.getElementById('street').value,
houseNumber: document.getElementById('houseNumber').value,
apartmentNumber: document.getElementById('apartmentNumber').value,
floor: document.getElementById('floor').value,
mobilePhone: document.getElementById('mobilePhone').value,
homePhone: document.getElementById('homePhone').value,
emergencyPhone: document.getElementById('emergencyPhone').value,
additionalPhone: document.getElementById('additionalPhone').value,
submissionDate: new Date().toLocaleString('he-IL')
};
try {
// Send data to SheetBest
const response = await fetch('https://api.sheetbest.com/sheets/2d5dd63d-e73a-450c-bfb0-364a936b11fe', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(formData)
});
if (response.ok) {
button.textContent = 'נשלח בהצלחה! ✅';
setTimeout(() => {
button.textContent = originalText;
button.style.background = 'linear-gradient(45deg, #667eea, #764ba2)';
// Show success message
alert('הטופס נשלח בהצלחה! הנתונים נשמרו במאגר הנתונים.');
// Reset form
document.getElementById('evacuationForm').reset();
}, 2000);
} else {
throw new Error('שגיאה בשליחת הנתונים');
}
} catch (error) {
button.textContent = 'שגיאה בשליחה ❌';
button.style.background = 'linear-gradient(45deg, #e74c3c, #c0392b)';
setTimeout(() => {
button.textContent = originalText;
button.style.background = 'linear-gradient(45deg, #667eea, #764ba2)';
}, 3000);
alert('שגיאה בשליחת הטופס. אנא נסה שוב.');
console.error('Error:', error);
}
});
// ID number validation and auto-fill
document.getElementById('idNumber').addEventListener('input', function(e) {
this.value = this.value.replace(/\D/g, '');
});
document.getElementById('idNumber').addEventListener('blur', async function(e) {
const idNumber = this.value.trim();
if (idNumber.length >= 5 && idNumber.length <= 9) {
// Show loading indicator
const loadingIndicator = document.createElement('div');
loadingIndicator.id = 'loadingIndicator';
loadingIndicator.style.cssText = `
position: absolute;
top: 50%;
right: 15px;
transform: translateY(-50%);
color: #667eea;
font-size: 0.9rem;
`;
loadingIndicator.textContent = 'מחפש בבסיס הנתונים...';
this.parentElement.style.position = 'relative';
this.parentElement.appendChild(loadingIndicator);
try {
// Method 1: Try GET request to fetch all data and filter
console.log('Searching for ID:', idNumber);
const getAllResponse = await fetch('https://api.sheetbest.com/sheets/2d5dd63d-e73a-450c-bfb0-364a936b11fe');
if (getAllResponse.ok) {
const allData = await getAllResponse.json();
console.log('All data received:', allData);
// Find matching record by ID
const matchingRecord = allData.find(record =>
record.idNumber && record.idNumber.toString().trim() === idNumber
);
if (matchingRecord) {
console.log('Found matching record:', matchingRecord);
// Auto-fill form with found data (but don't submit automatically)
if (matchingRecord.name) {
document.getElementById('name').value = matchingRecord.name.trim();
console.log('Filled name:', matchingRecord.name);
}
if (matchingRecord.street) {
document.getElementById('street').value = matchingRecord.street.trim();
console.log('Filled street:', matchingRecord.street);
}
if (matchingRecord.houseNumber) {
document.getElementById('houseNumber').value = matchingRecord.houseNumber.toString().trim();
console.log('Filled house number:', matchingRecord.houseNumber);
}
if (matchingRecord.apartmentNumber && matchingRecord.apartmentNumber !== '0') {
document.getElementById('apartmentNumber').value = matchingRecord.apartmentNumber.toString().trim();
console.log('Filled apartment:', matchingRecord.apartmentNumber);
}
if (matchingRecord.floor) {
document.getElementById('floor').value = matchingRecord.floor.toString().trim();
console.log('Filled floor:', matchingRecord.floor);
}
if (matchingRecord.mobilePhone && matchingRecord.mobilePhone.trim() !== '') {
document.getElementById('mobilePhone').value = matchingRecord.mobilePhone.trim();
console.log('Filled mobile:', matchingRecord.mobilePhone);
}
if (matchingRecord.homePhone && matchingRecord.homePhone.trim() !== '') {
document.getElementById('homePhone').value = matchingRecord.homePhone.trim();
console.log('Filled home phone:', matchingRecord.homePhone);
}
if (matchingRecord.emergencyPhone && matchingRecord.emergencyPhone.trim() !== '') {
document.getElementById('emergencyPhone').value = matchingRecord.emergencyPhone.trim();
console.log('Filled emergency phone:', matchingRecord.emergencyPhone);
}
// Note: additionalPhone column doesn't exist in your database, so we skip it
// Show success message - form is filled but user must click submit button
showNotification(`נמצאו נתונים עבור: ${matchingRecord.name || 'משתמש'} - הטופס מולא אוטומטית! לחץ על "שלח טופס" כדי לשלוח ✅`, 'success');
// Highlight filled fields with animation
const allInputs = document.querySelectorAll('input');
allInputs.forEach(input => {
if (input.id !== 'idNumber' && input.value.trim() !== '') {
input.style.background = '#e8f5e8';
input.style.borderColor = '#27ae60';
input.style.transform = 'scale(1.02)';
setTimeout(() => {
input.style.background = '';
input.style.borderColor = '';
input.style.transform = '';
}, 3000);
}
});
} else {
console.log('No matching record found for ID:', idNumber);
showNotification('לא נמצאו נתונים קיימים עבור תעודת זהות זו - אנא מלא את הפרטים ידנית', 'info');
}
} else {
throw new Error(`HTTP Error: ${getAllResponse.status}`);
}
} catch (error) {
console.error('Error searching for ID:', error);
showNotification('שגיאה בחיפוש נתונים - אנא בדוק את החיבור לאינטרנט ונסה שוב', 'error');
} finally {
// Remove loading indicator
const indicator = document.getElementById('loadingIndicator');
if (indicator) {
indicator.remove();
}
}
} else if (idNumber.length > 0) {
showNotification('מספר תעודת זהות חייב להכיל בין 5-9 ספרות', 'error');
}
});
function showNotification(message, type) {
// Remove existing notifications
const existingNotification = document.getElementById('notification');
if (existingNotification) {
existingNotification.remove();
}
const notification = document.createElement('div');
notification.id = 'notification';
notification.textContent = message;
const colors = {
success: { bg: '#d4edda', text: '#155724', border: '#c3e6cb' },
error: { bg: '#f8d7da', text: '#721c24', border: '#f5c6cb' },
info: { bg: '#d1ecf1', text: '#0c5460', border: '#bee5eb' }
};
const color = colors[type] || colors.info;
notification.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
background: ${color.bg};
color: ${color.text};
border: 1px solid ${color.border};
padding: 15px 20px;
border-radius: 8px;
font-weight: 500;
z-index: 2000;
max-width: 300px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
animation: slideIn 0.3s ease;
`;
// Add animation
const style = document.createElement('style');
style.textContent = `
@keyframes slideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
`;
document.head.appendChild(style);
document.body.appendChild(notification);
// Auto remove after 4 seconds
setTimeout(() => {
if (notification.parentNode) {
notification.style.animation = 'slideIn 0.3s ease reverse';
setTimeout(() => notification.remove(), 300);
}
}, 4000);
}
// Phone number formatting
const phoneInputs = document.querySelectorAll('input[type="tel"]');
phoneInputs.forEach(input => {
input.addEventListener('input', function(e) {
this.value = this.value.replace(/\D/g, '');
});
});
</script>
</body>
</html>