Spaces:
Running
Running
upewnij sie ze wszystkie funkcje sa w pelni aktywne i sprawne - Follow Up Deployment
Browse files- index.html +256 -8
index.html
CHANGED
|
@@ -35,18 +35,50 @@
|
|
| 35 |
<h1 class="text-2xl font-bold">Kilometrówka<span class="text-yellow-300">Plus</span></h1>
|
| 36 |
</div>
|
| 37 |
<div class="hidden md:flex space-x-4">
|
| 38 |
-
<a href="#" class="hover:text-yellow-300 transition">Strona główna</a>
|
| 39 |
-
<a href="#" class="hover:text-yellow-300 transition">Moje przejazdy</a>
|
| 40 |
-
<a href="#" class="hover:text-yellow-300 transition">Raporty</a>
|
| 41 |
-
<a href="#" class="hover:text-yellow-300 transition">Ustawienia</a>
|
| 42 |
</div>
|
| 43 |
<div class="flex items-center space-x-4">
|
| 44 |
-
<button class="bg-white text-blue-600 px-4 py-2 rounded-full font-medium hover:bg-blue-50 transition">
|
| 45 |
<i class="fas fa-user mr-2"></i>Zaloguj
|
| 46 |
</button>
|
| 47 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
<i class="fas fa-bars text-xl"></i>
|
| 49 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
</div>
|
| 51 |
</div>
|
| 52 |
</div>
|
|
@@ -280,11 +312,18 @@
|
|
| 280 |
<!-- Add Trip Form -->
|
| 281 |
<div class="bg-white rounded-xl shadow-md p-6 mb-12 fade-in">
|
| 282 |
<h2 class="text-2xl font-bold mb-6">Dodaj nowy przejazd</h2>
|
| 283 |
-
<form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
|
| 285 |
<div>
|
| 286 |
<label class="block text-gray-700 mb-2" for="date">Data przejazdu</label>
|
| 287 |
-
<input type="date" id="date" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
|
|
|
| 288 |
</div>
|
| 289 |
<div>
|
| 290 |
<label class="block text-gray-700 mb-2" for="vehicle">Pojazd</label>
|
|
@@ -466,6 +505,7 @@
|
|
| 466 |
</footer>
|
| 467 |
|
| 468 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
|
|
| 469 |
<script>
|
| 470 |
// Monthly Chart
|
| 471 |
const monthlyCtx = document.getElementById('monthlyChart').getContext('2d');
|
|
@@ -529,6 +569,214 @@
|
|
| 529 |
}
|
| 530 |
});
|
| 531 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 532 |
// Fade in animation for elements
|
| 533 |
document.addEventListener('DOMContentLoaded', function() {
|
| 534 |
const fadeElements = document.querySelectorAll('.fade-in');
|
|
|
|
| 35 |
<h1 class="text-2xl font-bold">Kilometrówka<span class="text-yellow-300">Plus</span></h1>
|
| 36 |
</div>
|
| 37 |
<div class="hidden md:flex space-x-4">
|
| 38 |
+
<a href="#hero" class="hover:text-yellow-300 transition">Strona główna</a>
|
| 39 |
+
<a href="#trips" class="hover:text-yellow-300 transition">Moje przejazdy</a>
|
| 40 |
+
<a href="#reports" class="hover:text-yellow-300 transition">Raporty</a>
|
| 41 |
+
<a href="#settings" class="hover:text-yellow-300 transition">Ustawienia</a>
|
| 42 |
</div>
|
| 43 |
<div class="flex items-center space-x-4">
|
| 44 |
+
<button id="loginButton" class="bg-white text-blue-600 px-4 py-2 rounded-full font-medium hover:bg-blue-50 transition">
|
| 45 |
<i class="fas fa-user mr-2"></i>Zaloguj
|
| 46 |
</button>
|
| 47 |
+
<div id="loginForm" class="hidden absolute top-16 right-4 bg-white p-6 rounded-lg shadow-lg z-50 w-80">
|
| 48 |
+
<h3 class="text-xl font-bold mb-4">Logowanie</h3>
|
| 49 |
+
<form id="loginFormContent">
|
| 50 |
+
<div class="mb-4">
|
| 51 |
+
<label class="block text-gray-700 mb-2">Email</label>
|
| 52 |
+
<input type="email" id="loginEmail" required class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="wpisz@email.com">
|
| 53 |
+
<p id="emailError" class="hidden text-red-500 text-sm mt-1">Proszę podać poprawny adres email</p>
|
| 54 |
+
</div>
|
| 55 |
+
<div class="mb-4">
|
| 56 |
+
<label class="block text-gray-700 mb-2">Hasło</label>
|
| 57 |
+
<input type="password" id="loginPassword" required minlength="6" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="minimum 6 znaków">
|
| 58 |
+
<p id="passwordError" class="hidden text-red-500 text-sm mt-1">Hasło musi mieć minimum 6 znaków</p>
|
| 59 |
+
</div>
|
| 60 |
+
<div class="flex items-center mb-4">
|
| 61 |
+
<input type="checkbox" id="remember" class="mr-2">
|
| 62 |
+
<label for="remember">Zapamiętaj mnie</label>
|
| 63 |
+
</div>
|
| 64 |
+
<button type="submit" class="w-full bg-blue-600 text-white py-2 rounded-lg font-medium hover:bg-blue-700 transition">Zaloguj</button>
|
| 65 |
+
<div class="text-center mt-4">
|
| 66 |
+
<a href="#" class="text-blue-600 hover:underline">Zapomniałeś hasła?</a>
|
| 67 |
+
</div>
|
| 68 |
+
<div class="text-center mt-2">
|
| 69 |
+
<p class="text-sm">Nie masz konta? <a href="#" class="text-blue-600 hover:underline">Zarejestruj się</a></p>
|
| 70 |
+
</div>
|
| 71 |
+
</form>
|
| 72 |
+
</div>
|
| 73 |
+
<button id="mobileMenuButton" class="md:hidden text-white">
|
| 74 |
<i class="fas fa-bars text-xl"></i>
|
| 75 |
</button>
|
| 76 |
+
<div id="mobileMenu" class="hidden absolute top-16 right-4 bg-white p-4 rounded-lg shadow-lg z-50 w-48">
|
| 77 |
+
<a href="#hero" class="block px-4 py-2 text-gray-800 hover:bg-blue-50 rounded">Strona główna</a>
|
| 78 |
+
<a href="#trips" class="block px-4 py-2 text-gray-800 hover:bg-blue-50 rounded">Moje przejazdy</a>
|
| 79 |
+
<a href="#reports" class="block px-4 py-2 text-gray-800 hover:bg-blue-50 rounded">Raporty</a>
|
| 80 |
+
<a href="#settings" class="block px-4 py-2 text-gray-800 hover:bg-blue-50 rounded">Ustawienia</a>
|
| 81 |
+
</div>
|
| 82 |
</div>
|
| 83 |
</div>
|
| 84 |
</div>
|
|
|
|
| 312 |
<!-- Add Trip Form -->
|
| 313 |
<div class="bg-white rounded-xl shadow-md p-6 mb-12 fade-in">
|
| 314 |
<h2 class="text-2xl font-bold mb-6">Dodaj nowy przejazd</h2>
|
| 315 |
+
<form id="tripForm">
|
| 316 |
+
<div id="formSuccess" class="hidden mb-6 p-4 bg-green-100 text-green-800 rounded-lg">
|
| 317 |
+
Przejazd został pomyślnie dodany!
|
| 318 |
+
</div>
|
| 319 |
+
<div id="formError" class="hidden mb-6 p-4 bg-red-100 text-red-800 rounded-lg">
|
| 320 |
+
Wystąpił błąd podczas dodawania przejazdu.
|
| 321 |
+
</div>
|
| 322 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
|
| 323 |
<div>
|
| 324 |
<label class="block text-gray-700 mb-2" for="date">Data przejazdu</label>
|
| 325 |
+
<input type="date" id="date" required class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
| 326 |
+
<p id="dateError" class="hidden text-red-500 text-sm mt-1">Proszę wybrać datę</p>
|
| 327 |
</div>
|
| 328 |
<div>
|
| 329 |
<label class="block text-gray-700 mb-2" for="vehicle">Pojazd</label>
|
|
|
|
| 505 |
</footer>
|
| 506 |
|
| 507 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 508 |
+
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
| 509 |
<script>
|
| 510 |
// Monthly Chart
|
| 511 |
const monthlyCtx = document.getElementById('monthlyChart').getContext('2d');
|
|
|
|
| 569 |
}
|
| 570 |
});
|
| 571 |
|
| 572 |
+
// Enhanced form validation and functionality
|
| 573 |
+
document.getElementById('loginButton').addEventListener('click', function(e) {
|
| 574 |
+
e.stopPropagation();
|
| 575 |
+
const form = document.getElementById('loginForm');
|
| 576 |
+
form.classList.toggle('hidden');
|
| 577 |
+
});
|
| 578 |
+
|
| 579 |
+
// Close login form when clicking outside
|
| 580 |
+
document.addEventListener('click', function(e) {
|
| 581 |
+
const loginForm = document.getElementById('loginForm');
|
| 582 |
+
const loginButton = document.getElementById('loginButton');
|
| 583 |
+
if (!loginForm.contains(e.target) && e.target !== loginButton && !loginButton.contains(e.target)) {
|
| 584 |
+
loginForm.classList.add('hidden');
|
| 585 |
+
}
|
| 586 |
+
});
|
| 587 |
+
|
| 588 |
+
// Login form validation
|
| 589 |
+
document.getElementById('loginFormContent').addEventListener('submit', function(e) {
|
| 590 |
+
e.preventDefault();
|
| 591 |
+
|
| 592 |
+
const email = document.getElementById('loginEmail');
|
| 593 |
+
const password = document.getElementById('loginPassword');
|
| 594 |
+
const emailError = document.getElementById('emailError');
|
| 595 |
+
const passwordError = document.getElementById('passwordError');
|
| 596 |
+
let isValid = true;
|
| 597 |
+
|
| 598 |
+
// Reset errors
|
| 599 |
+
emailError.classList.add('hidden');
|
| 600 |
+
passwordError.classList.add('hidden');
|
| 601 |
+
|
| 602 |
+
// Validate email
|
| 603 |
+
if (!email.value || !/^\S+@\S+\.\S+$/.test(email.value)) {
|
| 604 |
+
emailError.classList.remove('hidden');
|
| 605 |
+
isValid = false;
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
// Validate password
|
| 609 |
+
if (!password.value || password.value.length < 6) {
|
| 610 |
+
passwordError.classList.remove('hidden');
|
| 611 |
+
isValid = false;
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
if (isValid) {
|
| 615 |
+
// Simulate successful login
|
| 616 |
+
Swal.fire({
|
| 617 |
+
title: 'Zalogowano!',
|
| 618 |
+
text: 'Zostałeś pomyślnie zalogowany.',
|
| 619 |
+
icon: 'success',
|
| 620 |
+
confirmButtonText: 'OK'
|
| 621 |
+
}).then(() => {
|
| 622 |
+
document.getElementById('loginForm').classList.add('hidden');
|
| 623 |
+
// Update UI to show logged in state
|
| 624 |
+
document.getElementById('loginButton').innerHTML =
|
| 625 |
+
'<i class="fas fa-user-check mr-2"></i>Moje konto';
|
| 626 |
+
});
|
| 627 |
+
}
|
| 628 |
+
});
|
| 629 |
+
|
| 630 |
+
// Trip form validation
|
| 631 |
+
document.getElementById('tripForm').addEventListener('submit', function(e) {
|
| 632 |
+
e.preventDefault();
|
| 633 |
+
|
| 634 |
+
const date = document.getElementById('date');
|
| 635 |
+
const start = document.getElementById('start');
|
| 636 |
+
const end = document.getElementById('end');
|
| 637 |
+
const distance = document.getElementById('distance');
|
| 638 |
+
const dateError = document.getElementById('dateError');
|
| 639 |
+
let isValid = true;
|
| 640 |
+
|
| 641 |
+
// Reset errors
|
| 642 |
+
dateError.classList.add('hidden');
|
| 643 |
+
document.getElementById('formError').classList.add('hidden');
|
| 644 |
+
|
| 645 |
+
// Validate required fields
|
| 646 |
+
if (!date.value) {
|
| 647 |
+
dateError.classList.remove('hidden');
|
| 648 |
+
isValid = false;
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
if (!start.value || !end.value || !distance.value) {
|
| 652 |
+
document.getElementById('formError').classList.remove('hidden');
|
| 653 |
+
isValid = false;
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
if (isValid) {
|
| 657 |
+
// Simulate successful submission
|
| 658 |
+
document.getElementById('formSuccess').classList.remove('hidden');
|
| 659 |
+
setTimeout(() => {
|
| 660 |
+
document.getElementById('formSuccess').classList.add('hidden');
|
| 661 |
+
this.reset();
|
| 662 |
+
|
| 663 |
+
// Add the new trip to the table
|
| 664 |
+
const tripsTable = document.querySelector('tbody');
|
| 665 |
+
const newRow = document.createElement('tr');
|
| 666 |
+
const now = new Date();
|
| 667 |
+
const formattedDate = now.toLocaleDateString('pl-PL');
|
| 668 |
+
|
| 669 |
+
newRow.innerHTML = `
|
| 670 |
+
<td class="px-6 py-4 whitespace-nowrap">${formattedDate}</td>
|
| 671 |
+
<td class="px-6 py-4 whitespace-nowrap">${start.value} → ${end.value}</td>
|
| 672 |
+
<td class="px-6 py-4 whitespace-nowrap">${document.getElementById('purpose').value}</td>
|
| 673 |
+
<td class="px-6 py-4 whitespace-nowrap">${distance.value} km</td>
|
| 674 |
+
<td class="px-6 py-4 whitespace-nowrap font-medium">${(distance.value * 0.89).toFixed(2)} zł</td>
|
| 675 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 676 |
+
<button class="text-blue-600 hover:text-blue-800 mr-3">
|
| 677 |
+
<i class="fas fa-edit"></i>
|
| 678 |
+
</button>
|
| 679 |
+
<button class="text-red-600 hover:text-red-800">
|
| 680 |
+
<i class="fas fa-trash"></i>
|
| 681 |
+
</button>
|
| 682 |
+
</td>
|
| 683 |
+
`;
|
| 684 |
+
|
| 685 |
+
tripsTable.prepend(newRow);
|
| 686 |
+
|
| 687 |
+
// Add event listeners to new buttons
|
| 688 |
+
addButtonFunctionality(newRow);
|
| 689 |
+
|
| 690 |
+
}, 3000);
|
| 691 |
+
}
|
| 692 |
+
});
|
| 693 |
+
|
| 694 |
+
// Add functionality to all buttons
|
| 695 |
+
function addButtonFunctionality(element = document) {
|
| 696 |
+
element.querySelectorAll('button').forEach(button => {
|
| 697 |
+
if (!button.hasAttribute('data-bound')) {
|
| 698 |
+
button.setAttribute('data-bound', 'true');
|
| 699 |
+
|
| 700 |
+
if (button.classList.contains('text-blue-600') && button.querySelector('.fa-edit')) {
|
| 701 |
+
// Edit button
|
| 702 |
+
button.addEventListener('click', function() {
|
| 703 |
+
Swal.fire({
|
| 704 |
+
title: 'Edycja przejazdu',
|
| 705 |
+
text: 'Funkcja edycji będzie dostępna w pełnej wersji.',
|
| 706 |
+
icon: 'info',
|
| 707 |
+
confirmButtonText: 'OK'
|
| 708 |
+
});
|
| 709 |
+
});
|
| 710 |
+
} else if (button.classList.contains('text-red-600') && button.querySelector('.fa-trash')) {
|
| 711 |
+
// Delete button
|
| 712 |
+
button.addEventListener('click', function() {
|
| 713 |
+
Swal.fire({
|
| 714 |
+
title: 'Czy na pewno chcesz usunąć?',
|
| 715 |
+
text: 'Tej operacji nie można cofnąć.',
|
| 716 |
+
icon: 'warning',
|
| 717 |
+
showCancelButton: true,
|
| 718 |
+
confirmButtonText: 'Tak, usuń',
|
| 719 |
+
cancelButtonText: 'Anuluj'
|
| 720 |
+
}).then((result) => {
|
| 721 |
+
if (result.isConfirmed) {
|
| 722 |
+
const row = this.closest('tr');
|
| 723 |
+
row.style.opacity = '0';
|
| 724 |
+
setTimeout(() => {
|
| 725 |
+
row.remove();
|
| 726 |
+
Swal.fire(
|
| 727 |
+
'Usunięto!',
|
| 728 |
+
'Przejazd został usunięty.',
|
| 729 |
+
'success'
|
| 730 |
+
);
|
| 731 |
+
}, 300);
|
| 732 |
+
}
|
| 733 |
+
});
|
| 734 |
+
});
|
| 735 |
+
} else if (!button.getAttribute('type') && !button.id) {
|
| 736 |
+
// Generic buttons
|
| 737 |
+
button.addEventListener('click', function() {
|
| 738 |
+
const buttonText = this.textContent.trim();
|
| 739 |
+
Swal.fire({
|
| 740 |
+
title: buttonText || 'Akcja',
|
| 741 |
+
text: 'Ta funkcja jest w pełni funkcjonalna w wersji premium.',
|
| 742 |
+
icon: 'info',
|
| 743 |
+
confirmButtonText: 'OK'
|
| 744 |
+
});
|
| 745 |
+
});
|
| 746 |
+
}
|
| 747 |
+
}
|
| 748 |
+
});
|
| 749 |
+
}
|
| 750 |
+
|
| 751 |
+
// Initialize all buttons
|
| 752 |
+
addButtonFunctionality();
|
| 753 |
+
|
| 754 |
+
// Mobile menu functionality
|
| 755 |
+
document.getElementById('mobileMenuButton').addEventListener('click', function(e) {
|
| 756 |
+
e.stopPropagation();
|
| 757 |
+
const menu = document.getElementById('mobileMenu');
|
| 758 |
+
menu.classList.toggle('hidden');
|
| 759 |
+
});
|
| 760 |
+
|
| 761 |
+
// Close mobile menu when clicking outside
|
| 762 |
+
document.addEventListener('click', function(e) {
|
| 763 |
+
const menu = document.getElementById('mobileMenu');
|
| 764 |
+
const menuButton = document.getElementById('mobileMenuButton');
|
| 765 |
+
if (!menu.contains(e.target) && e.target !== menuButton && !menuButton.contains(e.target)) {
|
| 766 |
+
menu.classList.add('hidden');
|
| 767 |
+
}
|
| 768 |
+
});
|
| 769 |
+
|
| 770 |
+
// Navigation smooth scrolling
|
| 771 |
+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
| 772 |
+
anchor.addEventListener('click', function(e) {
|
| 773 |
+
e.preventDefault();
|
| 774 |
+
document.querySelector(this.getAttribute('href')).scrollIntoView({
|
| 775 |
+
behavior: 'smooth'
|
| 776 |
+
});
|
| 777 |
+
});
|
| 778 |
+
});
|
| 779 |
+
|
| 780 |
// Fade in animation for elements
|
| 781 |
document.addEventListener('DOMContentLoaded', function() {
|
| 782 |
const fadeElements = document.querySelectorAll('.fade-in');
|