diff --git a/assets/js/comments.js b/assets/js/comments.js index 07dbc0f..7f802e4 100644 --- a/assets/js/comments.js +++ b/assets/js/comments.js @@ -449,7 +449,7 @@ pop.className = 'comment-popover'; // Budowanie listy komentarzy - let html = '
'; + let html = '
'; commentsList.forEach(data => { // Escape (chociaż API to robi, warto mieć warstwę w JS w razie czego, ale API już robi htmlspecialchars) @@ -496,12 +496,29 @@ }); }); + // Obsługa interakcji (np. scrollbar) + pop.addEventListener('mousedown', () => { + pop._isInteracting = true; + }); + // Obsługa zamykania przy wyjechaniu z popovera pop.addEventListener('mouseleave', () => { - if (activePopover === pop) { - activePopover.remove(); - activePopover = null; - } + pop._leaveTimeout = setTimeout(() => { + if (activePopover === pop) { + // Jeśli user trzyma przycisk myszy (np. na scrollbarze), nie zamykaj + if (pop._isInteracting) return; + + if (!activePopover.matches(':hover') && !marker.matches(':hover')) { + activePopover.remove(); + activePopover = null; + } + } + }, 500); // Zwiększono do 500ms + }); + + pop.addEventListener('mouseenter', () => { + if (pop._leaveTimeout) clearTimeout(pop._leaveTimeout); + if (marker._leaveTimeout) clearTimeout(marker._leaveTimeout); }); // Pozycjonowanie @@ -585,8 +602,11 @@ } else { marker.style.display = 'none'; if (activePopover && activePopover._associatedMarker === marker) { - activePopover.remove(); - activePopover = null; + // Jeśli element zniknął (np. scroll), ale user trzyma myszkę na popoverze - nie usuwaj + if (!activePopover.matches(':hover') && !activePopover._isInteracting) { + activePopover.remove(); + activePopover = null; + } } } } catch (e) { } @@ -604,6 +624,26 @@ } } + // Global mouseup do resetowania flagi interakcji + document.addEventListener('mouseup', () => { + if (activePopover) { + activePopover._isInteracting = false; + // Opcjonalnie: sprawdź czy zamknąć, jeśli myszka jest poza + if (activePopover && !activePopover.matches(':hover') && (!activePopover._associatedMarker || !activePopover._associatedMarker.matches(':hover'))) { + // Możemy wywołać logikę zamykania, ale ona jest w mouseleave. + // Jeśli user puścił myszkę POZA popoverem, mouseleave już dawno poszło (i timeout mógł zostać zablokowany przez flagę). + // Więc tutaj warto sprawdzić. + setTimeout(() => { + // Sprawdź ponownie (bezpiecznik) + if (activePopover && !activePopover._isInteracting && !activePopover.matches(':hover')) { + activePopover.remove(); + activePopover = null; + } + }, 200); + } + } + }); + // START initUI(); loadComments(); diff --git a/prototype/invoice/app-purchase-add.php b/prototype/invoice/app-purchase-add.php index 7097466..cacdf09 100644 --- a/prototype/invoice/app-purchase-add.php +++ b/prototype/invoice/app-purchase-add.php @@ -22,22 +22,24 @@ include '../../header-invoice.php';
-
-
+ +
+ + +
-
Nabywca (My)
+
Nabywca
Magico Software NIP: 8652582386
-
-
-
+ +
Sprzedawca
@@ -59,15 +61,32 @@ include '../../header-invoice.php';
+ + +
-
+ +
Dane Dokumentu
+ +
+ + Przeciągnij fakturę tutaj lub kliknij + (PDF, JPG, PNG) +
+ +
@@ -89,6 +108,8 @@ include '../../header-invoice.php';
+ + `; + } + + // Invoice Data + const invNum = document.querySelector('input[placeholder="np. FV/2026/02/105"]'); + if (invNum) invNum.value = 'FV/KAT/2026/02/552'; + + const dates = document.querySelectorAll('.date-picker'); + if (dates.length >= 3) { + dates[0].value = '2026-02-15'; // Purchase + dates[1].value = '2026-02-15'; // Issue + dates[2].value = '2026-02-29'; // Payment + } + + // Items - Row 1 + const row1 = document.querySelector('table tbody tr:first-child'); + if (row1) { + const inputs = row1.querySelectorAll('input'); + if (inputs.length >= 5) { // Name, Code, Qty, Price, VAT (select is not input) + inputs[0].value = 'Energia elektryczna - taryfa C11'; // Name + inputs[1].value = 'PKW-2026'; // Code + // inputs[2] is select in some tables, here it is unit select (col 4, idx 3) + // wait, let's look at table structure. + // td 2: input name [0] + // td 3: input code [1] + // td 4: select unit + // td 5: input qty [2] + // td 6: input price [3] + + // Let's use specific selector for safety + } + + const nameInput = row1.querySelector('input[placeholder="Np. Usługa księgowa, Paliwo..."]'); + if (nameInput) nameInput.value = 'Energia elektryczna - taryfa C11'; + + const codeInput = row1.querySelector('input[placeholder="-"]'); + if (codeInput) codeInput.value = 'PKW-2026'; + + const qtyInput = row1.querySelector('td:nth-child(5) input'); + if (qtyInput) qtyInput.value = '1.00'; + + const priceInput = row1.querySelector('td:nth-child(6) input'); + if (priceInput) priceInput.value = '450.00'; + + // Update totals in row (td 8 and 9) + const netCell = row1.querySelector('td:nth-child(8)'); + if (netCell) netCell.innerText = '450,00 zł'; + + const grossCell = row1.querySelector('td:nth-child(9)'); + if (grossCell) grossCell.innerText = '553,50 zł'; + } + + // Summary + const summaries = document.querySelectorAll('.card-body .d-flex.justify-content-between span.fw-semibold'); + if (summaries.length >= 2) { + summaries[0].innerText = '450,00 zł'; // Netto + summaries[1].innerText = '103,50 zł'; // VAT + } + + const totalEl = document.getElementById('finalTotal'); + if (totalEl) totalEl.innerText = '553,50 zł'; + + // 4. Restore Button + btn.disabled = false; + btn.innerHTML = ' Dane odczytane poprawnie'; + btn.classList.remove('btn-label-primary'); + btn.classList.add('btn-label-success'); + + // Animation + const allInputs = document.querySelectorAll('input'); + allInputs.forEach(input => { + if (input.value && input.value !== '0.00' && input.type !== 'text' && input.type !== 'hidden') { + // Filter a bit to avoid everything flashing + } + if (input.value && input.value !== '0.00' && input.type !== 'hidden') { + input.classList.add('animate__animated', 'animate__flash'); + setTimeout(() => input.classList.remove('animate__animated', 'animate__flash'), 1000); + } + }); + + + }, 2000); + }); + } + }); diff --git a/prototype/invoice/app-purchase-calendar.php b/prototype/invoice/app-purchase-calendar.php new file mode 100644 index 0000000..06a5f42 --- /dev/null +++ b/prototype/invoice/app-purchase-calendar.php @@ -0,0 +1,162 @@ + + + + +
+ +

+ Faktury i sprzedaż / Kalendarz płatności +

+ +
+
+ + + + + +
+
+
+
Kalendarz płatności
+ +
+
+
+
+
+
+ +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/prototype/invoice/app-purchase-list.php b/prototype/invoice/app-purchase-list.php index 046ab36..3b8808d 100644 --- a/prototype/invoice/app-purchase-list.php +++ b/prototype/invoice/app-purchase-list.php @@ -167,24 +167,185 @@ include '../../header-invoice.php';