beta #3
This commit is contained in:
parent
26c7ac9341
commit
07cda1b5ad
9 changed files with 0 additions and 56 deletions
|
@ -12,7 +12,6 @@
|
||||||
--light-card: #ffffff;
|
--light-card: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset i podstawowe style */
|
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -31,7 +30,6 @@ body {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Motyw ciemny - domyślny */
|
|
||||||
body.dark-theme {
|
body.dark-theme {
|
||||||
background-color: var(--dark-primary);
|
background-color: var(--dark-primary);
|
||||||
color: var(--dark-text);
|
color: var(--dark-text);
|
||||||
|
@ -93,7 +91,6 @@ body.dark-theme .order-card .list-group-item strong {
|
||||||
color: #d4af37;
|
color: #d4af37;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Motyw jasny */
|
|
||||||
body.light-theme {
|
body.light-theme {
|
||||||
background-color: var(--light-primary);
|
background-color: var(--light-primary);
|
||||||
color: var(--light-text);
|
color: var(--light-text);
|
||||||
|
@ -133,7 +130,6 @@ body.light-theme footer {
|
||||||
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wspólne style dla obu motywów */
|
|
||||||
.navbar {
|
.navbar {
|
||||||
padding: 1rem 0;
|
padding: 1rem 0;
|
||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
|
@ -319,7 +315,6 @@ footer a:hover {
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Responsywność */
|
|
||||||
@media (max-width: 1200px) {
|
@media (max-width: 1200px) {
|
||||||
.books-grid {
|
.books-grid {
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
@ -350,7 +345,6 @@ footer a:hover {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Koszyk */
|
|
||||||
#cart-items .card {
|
#cart-items .card {
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
@ -374,19 +368,16 @@ footer a:hover {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Animacje dla ilości */
|
|
||||||
.quantity-change {
|
.quantity-change {
|
||||||
transition: opacity 0.15s ease, transform 0.15s ease;
|
transition: opacity 0.15s ease, transform 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Formularze */
|
|
||||||
.form-control, .form-select {
|
.form-control, .form-select {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
padding: 0.75rem;
|
padding: 0.75rem;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Responsywność */
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.navbar-brand {
|
.navbar-brand {
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
|
@ -406,7 +397,6 @@ footer a:hover {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Animacje spinnera */
|
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
to { transform: rotate(360deg); }
|
to { transform: rotate(360deg); }
|
||||||
}
|
}
|
||||||
|
@ -416,7 +406,6 @@ footer a:hover {
|
||||||
color: var(--gold);
|
color: var(--gold);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alerty */
|
|
||||||
.alert {
|
.alert {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
@ -435,12 +424,10 @@ footer a:hover {
|
||||||
color: #0dcaf0;
|
color: #0dcaf0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ikony w koszyku */
|
|
||||||
.bi {
|
.bi {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Strona podziękowania */
|
|
||||||
.py-5 {
|
.py-5 {
|
||||||
padding-top: 6rem !important;
|
padding-top: 6rem !important;
|
||||||
padding-bottom: 6rem !important;
|
padding-bottom: 6rem !important;
|
||||||
|
@ -456,7 +443,6 @@ footer a:hover {
|
||||||
margin-bottom: 3rem;
|
margin-bottom: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Układ dla strony profilu */
|
|
||||||
#order-history .card {
|
#order-history .card {
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
const registerForm = document.getElementById('registerForm');
|
const registerForm = document.getElementById('registerForm');
|
||||||
const logoutLink = document.getElementById('logoutLink');
|
const logoutLink = document.getElementById('logoutLink');
|
||||||
|
|
||||||
// Sprawdź status uwierzytelnienia przy załadowaniu
|
|
||||||
checkAuthStatus();
|
checkAuthStatus();
|
||||||
|
|
||||||
if (loginForm) {
|
if (loginForm) {
|
||||||
|
|
|
@ -7,7 +7,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
if (bookId) {
|
if (bookId) {
|
||||||
loadBookDetails(bookId);
|
loadBookDetails(bookId);
|
||||||
|
|
||||||
// Dodaj obsługę przycisku "Dodaj do koszyka"
|
|
||||||
const addToCartBtn = document.querySelector('.btn-add-to-cart');
|
const addToCartBtn = document.querySelector('.btn-add-to-cart');
|
||||||
if (addToCartBtn) {
|
if (addToCartBtn) {
|
||||||
addToCartBtn.addEventListener('click', () => addToCart(bookId));
|
addToCartBtn.addEventListener('click', () => addToCart(bookId));
|
||||||
|
|
|
@ -5,10 +5,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
const searchInput = document.getElementById('searchInput');
|
const searchInput = document.getElementById('searchInput');
|
||||||
const sortSelect = document.getElementById('sortSelect');
|
const sortSelect = document.getElementById('sortSelect');
|
||||||
|
|
||||||
// Załaduj książki przy starcie
|
|
||||||
loadBooks();
|
loadBooks();
|
||||||
|
|
||||||
// Dodaj event listeners
|
|
||||||
if (searchInput) {
|
if (searchInput) {
|
||||||
searchInput.addEventListener('input', debounce(loadBooks, 300));
|
searchInput.addEventListener('input', debounce(loadBooks, 300));
|
||||||
}
|
}
|
||||||
|
@ -96,7 +94,6 @@ function displayBooks(books) {
|
||||||
booksContainer.innerHTML += bookCard;
|
booksContainer.innerHTML += bookCard;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dodajemy nasłuchiwanie na przyciskach dodania do koszyka
|
|
||||||
document.querySelectorAll('.add-to-cart-btn').forEach(button => {
|
document.querySelectorAll('.add-to-cart-btn').forEach(button => {
|
||||||
button.addEventListener('click', function() {
|
button.addEventListener('click', function() {
|
||||||
const bookId = this.dataset.bookId;
|
const bookId = this.dataset.bookId;
|
||||||
|
|
|
@ -3,13 +3,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
const checkoutBtn = document.getElementById('checkoutBtn');
|
const checkoutBtn = document.getElementById('checkoutBtn');
|
||||||
const localPickupCheckbox = document.getElementById('localPickup');
|
const localPickupCheckbox = document.getElementById('localPickup');
|
||||||
|
|
||||||
// Załaduj zawartość koszyka
|
|
||||||
loadCart();
|
loadCart();
|
||||||
|
|
||||||
// Dodaj event listeners
|
|
||||||
if (localPickupCheckbox) {
|
if (localPickupCheckbox) {
|
||||||
localPickupCheckbox.addEventListener('change', function() {
|
localPickupCheckbox.addEventListener('change', function() {
|
||||||
// Pobierz aktualny stan koszyka i zaktualizuj podsumowanie
|
|
||||||
const cartItems = Array.from(document.querySelectorAll('.card.mb-3')).map(card => {
|
const cartItems = Array.from(document.querySelectorAll('.card.mb-3')).map(card => {
|
||||||
const bookId = card.querySelector('.decrease-btn').dataset.bookId;
|
const bookId = card.querySelector('.decrease-btn').dataset.bookId;
|
||||||
const quantity = parseInt(card.querySelector('.quantity-display').textContent);
|
const quantity = parseInt(card.querySelector('.quantity-display').textContent);
|
||||||
|
@ -60,7 +57,6 @@ async function loadCart() {
|
||||||
const cartItems = await response.json();
|
const cartItems = await response.json();
|
||||||
displayCartItems(cartItems);
|
displayCartItems(cartItems);
|
||||||
|
|
||||||
// Ustaw checkbox jako odznaczony domyślnie (dostawa)
|
|
||||||
const localPickupCheckbox = document.getElementById('localPickup');
|
const localPickupCheckbox = document.getElementById('localPickup');
|
||||||
if (localPickupCheckbox) {
|
if (localPickupCheckbox) {
|
||||||
localPickupCheckbox.checked = false;
|
localPickupCheckbox.checked = false;
|
||||||
|
@ -124,7 +120,6 @@ function displayCartItems(cartItems) {
|
||||||
cartItemsContainer.innerHTML += itemElement;
|
cartItemsContainer.innerHTML += itemElement;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dodaj event listeners dla przycisków
|
|
||||||
document.querySelectorAll('.decrease-btn').forEach(btn => {
|
document.querySelectorAll('.decrease-btn').forEach(btn => {
|
||||||
btn.addEventListener('click', () => updateCartItemQuantity(btn.dataset.bookId, -1));
|
btn.addEventListener('click', () => updateCartItemQuantity(btn.dataset.bookId, -1));
|
||||||
});
|
});
|
||||||
|
@ -157,7 +152,6 @@ async function updateCartItemQuantity(bookId, change) {
|
||||||
const currentQuantity = parseInt(quantityElement.textContent);
|
const currentQuantity = parseInt(quantityElement.textContent);
|
||||||
const newQuantity = currentQuantity + change;
|
const newQuantity = currentQuantity + change;
|
||||||
|
|
||||||
// Jeśli nowa ilość jest mniejsza lub równa 0, usuń produkt
|
|
||||||
if (newQuantity <= 0) {
|
if (newQuantity <= 0) {
|
||||||
const cartItem = quantityElement.closest('.card');
|
const cartItem = quantityElement.closest('.card');
|
||||||
cartItem.style.opacity = '0';
|
cartItem.style.opacity = '0';
|
||||||
|
@ -166,13 +160,11 @@ async function updateCartItemQuantity(bookId, change) {
|
||||||
updateSummaryFromDOM();
|
updateSummaryFromDOM();
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
// Dodatkowo wyślij żądanie usunięcia z serwera
|
|
||||||
await fetch(`/api/remove-from-cart/${bookId}`, {
|
await fetch(`/api/remove-from-cart/${bookId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Animacja zmiany ilości
|
|
||||||
quantityElement.textContent = newQuantity;
|
quantityElement.textContent = newQuantity;
|
||||||
updateSummaryFromDOM();
|
updateSummaryFromDOM();
|
||||||
}
|
}
|
||||||
|
@ -213,7 +205,6 @@ function updateSummary(cartItems) {
|
||||||
|
|
||||||
if (!productsValueEl || !deliveryValueEl || !totalValueEl) return;
|
if (!productsValueEl || !deliveryValueEl || !totalValueEl) return;
|
||||||
|
|
||||||
// Oblicz wartość produktów
|
|
||||||
let productsValue = 0;
|
let productsValue = 0;
|
||||||
if (cartItems && cartItems.length > 0) {
|
if (cartItems && cartItems.length > 0) {
|
||||||
productsValue = cartItems.reduce((total, item) => {
|
productsValue = cartItems.reduce((total, item) => {
|
||||||
|
@ -223,7 +214,6 @@ function updateSummary(cartItems) {
|
||||||
|
|
||||||
productsValueEl.textContent = productsValue.toFixed(2) + ' PLN';
|
productsValueEl.textContent = productsValue.toFixed(2) + ' PLN';
|
||||||
|
|
||||||
// Oblicz koszt dostawy: jeśli checkbox ZAZNACZONY to 0 (odbiór lokalny), w przeciwnym razie 12.99 (dostawa)
|
|
||||||
const deliveryCost = localPickupCheckbox && localPickupCheckbox.checked ? 12.99 : 0;
|
const deliveryCost = localPickupCheckbox && localPickupCheckbox.checked ? 12.99 : 0;
|
||||||
deliveryValueEl.textContent = deliveryCost.toFixed(2) + ' PLN';
|
deliveryValueEl.textContent = deliveryCost.toFixed(2) + ' PLN';
|
||||||
|
|
||||||
|
@ -259,7 +249,6 @@ async function handleCheckout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Pobierz aktualną zawartość koszyka
|
|
||||||
const response = await fetch('/api/cart', {
|
const response = await fetch('/api/cart', {
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
});
|
});
|
||||||
|
@ -270,18 +259,15 @@ async function handleCheckout() {
|
||||||
|
|
||||||
const cartItems = await response.json();
|
const cartItems = await response.json();
|
||||||
|
|
||||||
// Przygotuj dane do zamówienia
|
|
||||||
const checkoutData = {
|
const checkoutData = {
|
||||||
items: cartItems.map(item => ({
|
items: cartItems.map(item => ({
|
||||||
book_id: item.book_id,
|
book_id: item.book_id,
|
||||||
quantity: item.quantity
|
quantity: item.quantity
|
||||||
})),
|
})),
|
||||||
total: parseFloat(document.getElementById('total-value').textContent),
|
total: parseFloat(document.getElementById('total-value').textContent),
|
||||||
// Odwrócona logika: checked = odbiór lokalny, unchecked = dostawa
|
|
||||||
delivery_type: localPickupCheckbox.checked ? "local" : "shipping"
|
delivery_type: localPickupCheckbox.checked ? "local" : "shipping"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wyślij zamówienie
|
|
||||||
const checkoutResponse = await fetch('/api/checkout', {
|
const checkoutResponse = await fetch('/api/checkout', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
(() => {
|
(() => {
|
||||||
// Sprawdź czy jesteśmy na stronie głównej
|
|
||||||
const booksContainer = document.getElementById('books-container');
|
const booksContainer = document.getElementById('books-container');
|
||||||
const searchInput = document.getElementById('searchInput');
|
const searchInput = document.getElementById('searchInput');
|
||||||
const sortSelect = document.getElementById('sortSelect');
|
const sortSelect = document.getElementById('sortSelect');
|
||||||
|
|
||||||
if (!booksContainer || !searchInput || !sortSelect) return;
|
if (!booksContainer || !searchInput || !sortSelect) return;
|
||||||
// Funkcje specyficzne dla strony głównej
|
|
||||||
const createBookCard = (book) => `
|
const createBookCard = (book) => `
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="book-card h-100">
|
<div class="book-card h-100">
|
||||||
|
@ -42,11 +40,9 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Event listeners tylko dla strony głównej
|
|
||||||
searchInput.addEventListener('input', loadBooks);
|
searchInput.addEventListener('input', loadBooks);
|
||||||
sortSelect.addEventListener('change', loadBooks);
|
sortSelect.addEventListener('change', loadBooks);
|
||||||
|
|
||||||
// Inicjalizacja
|
|
||||||
document.addEventListener('DOMContentLoaded', loadBooks);
|
document.addEventListener('DOMContentLoaded', loadBooks);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -82,7 +78,6 @@ async function updateAuthUI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obsługa wylogowania
|
|
||||||
function setupLogout() {
|
function setupLogout() {
|
||||||
document.getElementById('logoutLink')?.addEventListener('click', async (e) => {
|
document.getElementById('logoutLink')?.addEventListener('click', async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -91,7 +86,6 @@ function setupLogout() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inicjalizacja na każdej stronie
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
updateAuthUI();
|
updateAuthUI();
|
||||||
setupLogout();
|
setupLogout();
|
||||||
|
@ -234,7 +228,6 @@ function renderBooks(books) {
|
||||||
</div>
|
</div>
|
||||||
`).join('');
|
`).join('');
|
||||||
|
|
||||||
// Dodaj obsługę przycisków "Dodaj do koszyka"
|
|
||||||
document.querySelectorAll('.add-to-cart').forEach(button => {
|
document.querySelectorAll('.add-to-cart').forEach(button => {
|
||||||
button.addEventListener('click', async (e) => {
|
button.addEventListener('click', async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -290,18 +283,15 @@ function showError(message) {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inicjalizacja przy pierwszym załadowaniu
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (document.getElementById('books-container')) {
|
if (document.getElementById('books-container')) {
|
||||||
loadBooks();
|
loadBooks();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nasłuchiwanie wyszukiwania
|
|
||||||
document.getElementById('searchInput')?.addEventListener('input', (e) => {
|
document.getElementById('searchInput')?.addEventListener('input', (e) => {
|
||||||
loadBooks(e.target.value, document.getElementById('sortSelect')?.value || 'default');
|
loadBooks(e.target.value, document.getElementById('sortSelect')?.value || 'default');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Nasłuchiwanie zmiany sortowania
|
|
||||||
document.getElementById('sortSelect')?.addEventListener('change', (e) => {
|
document.getElementById('sortSelect')?.addEventListener('change', (e) => {
|
||||||
loadBooks(document.getElementById('searchInput')?.value || '', e.target.value);
|
loadBooks(document.getElementById('searchInput')?.value || '', e.target.value);
|
||||||
});
|
});
|
||||||
|
|
|
@ -51,7 +51,6 @@ function displayOrderHistory(orders) {
|
||||||
orders.forEach(order => {
|
orders.forEach(order => {
|
||||||
const orderDate = new Date(order.data_zamowienia).toLocaleDateString();
|
const orderDate = new Date(order.data_zamowienia).toLocaleDateString();
|
||||||
|
|
||||||
// Poprawione mapowanie typów dostawy
|
|
||||||
let deliveryType = order.typ_dostawy || 'shipping';
|
let deliveryType = order.typ_dostawy || 'shipping';
|
||||||
let deliveryText = '';
|
let deliveryText = '';
|
||||||
|
|
||||||
|
@ -60,7 +59,6 @@ function displayOrderHistory(orders) {
|
||||||
} else if (deliveryType === 'shipping') {
|
} else if (deliveryType === 'shipping') {
|
||||||
deliveryText = 'Dostawa';
|
deliveryText = 'Dostawa';
|
||||||
} else {
|
} else {
|
||||||
// Dla starych zamówień bez typu
|
|
||||||
deliveryText = 'Dostawa';
|
deliveryText = 'Dostawa';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// static/js/theme.js
|
|
||||||
// Eksportuj funkcję setTheme
|
|
||||||
export function setTheme(theme) {
|
export function setTheme(theme) {
|
||||||
document.body.classList.remove('dark-theme', 'light-theme');
|
document.body.classList.remove('dark-theme', 'light-theme');
|
||||||
document.body.classList.add(theme + '-theme');
|
document.body.classList.add(theme + '-theme');
|
||||||
|
@ -29,11 +27,9 @@ function updateThemeColors(theme) {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// Przywróć zapisany motyw
|
|
||||||
const savedTheme = localStorage.getItem('theme') || 'dark';
|
const savedTheme = localStorage.getItem('theme') || 'dark';
|
||||||
setTheme(savedTheme);
|
setTheme(savedTheme);
|
||||||
|
|
||||||
// Obsługa przycisku zmiany motywu
|
|
||||||
const themeToggle = document.getElementById('theme-toggle');
|
const themeToggle = document.getElementById('theme-toggle');
|
||||||
if (themeToggle) {
|
if (themeToggle) {
|
||||||
themeToggle.addEventListener('click', function() {
|
themeToggle.addEventListener('click', function() {
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
// Funkcja do wyświetlania komunikatów
|
|
||||||
export function showMessage(type, message) {
|
export function showMessage(type, message) {
|
||||||
// Utwórz kontener komunikatów jeśli nie istnieje
|
|
||||||
let messageContainer = document.getElementById('message-container');
|
let messageContainer = document.getElementById('message-container');
|
||||||
if (!messageContainer) {
|
if (!messageContainer) {
|
||||||
messageContainer = document.createElement('div');
|
messageContainer = document.createElement('div');
|
||||||
|
@ -12,7 +10,6 @@ export function showMessage(type, message) {
|
||||||
document.body.appendChild(messageContainer);
|
document.body.appendChild(messageContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utwórz element komunikatu
|
|
||||||
const messageElement = document.createElement('div');
|
const messageElement = document.createElement('div');
|
||||||
messageElement.className = `alert alert-${type} alert-dismissible fade show`;
|
messageElement.className = `alert alert-${type} alert-dismissible fade show`;
|
||||||
messageElement.role = 'alert';
|
messageElement.role = 'alert';
|
||||||
|
@ -21,22 +18,18 @@ export function showMessage(type, message) {
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// Dodaj do kontenera
|
|
||||||
messageContainer.appendChild(messageElement);
|
messageContainer.appendChild(messageElement);
|
||||||
|
|
||||||
// Automatyczne ukrycie po 5 sekundach
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
messageElement.classList.remove('show');
|
messageElement.classList.remove('show');
|
||||||
setTimeout(() => messageElement.remove(), 150);
|
setTimeout(() => messageElement.remove(), 150);
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funkcja formatująca walutę
|
|
||||||
export function formatCurrency(amount) {
|
export function formatCurrency(amount) {
|
||||||
return parseFloat(amount).toFixed(2) + ' PLN';
|
return parseFloat(amount).toFixed(2) + ' PLN';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funkcja do pobierania parametrów URL
|
|
||||||
export function getUrlParam(name) {
|
export function getUrlParam(name) {
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
return urlParams.get(name);
|
return urlParams.get(name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue