Widok Kalendarza płatności
This commit is contained in:
@@ -449,7 +449,7 @@
|
||||
pop.className = 'comment-popover';
|
||||
|
||||
// Budowanie listy komentarzy
|
||||
let html = '<div style="max-height: 200px; overflow-y: auto;">';
|
||||
let html = '<div style="max-height: 600px; overflow-y: auto;">';
|
||||
|
||||
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();
|
||||
|
||||
@@ -22,22 +22,24 @@ include '../../header-invoice.php';
|
||||
|
||||
<div class="row mb-4">
|
||||
|
||||
<div class="col-lg-2 col-md-12 mb-3 mb-lg-0">
|
||||
<div class="card h-100 bg-label-secondary border-0">
|
||||
<!-- Left Column: Seller & Buyer -->
|
||||
<div class="col-lg-5 col-md-12 mb-3 mb-lg-0">
|
||||
|
||||
<!-- Buyer Card -->
|
||||
<div class="card bg-label-secondary border-0 mb-3">
|
||||
<div class="card-body p-3 d-flex flex-column justify-content-center text-center">
|
||||
<div class="avatar mx-auto mb-2">
|
||||
<span class="avatar-initial rounded bg-white text-secondary"><i
|
||||
class="bx bx-building-house fs-4"></i></span>
|
||||
</div>
|
||||
<h6 class="card-title mb-1 text-nowrap">Nabywca (My)</h6>
|
||||
<h6 class="card-title mb-1 text-nowrap">Nabywca</h6>
|
||||
<small class="d-block fw-bold text-truncate">Magico Software</small>
|
||||
<small class="text-muted text-truncate">NIP: 8652582386</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5 col-md-6 mb-3 mb-lg-0">
|
||||
<div class="card h-100">
|
||||
<!-- Seller Card -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-header border-bottom py-3">
|
||||
<h6 class="card-title m-0"><i class="bx bx-store-alt me-2"></i>Sprzedawca</h6>
|
||||
</div>
|
||||
@@ -59,15 +61,32 @@ include '../../header-invoice.php';
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5 col-12">
|
||||
<!-- Right Column: Document Data -->
|
||||
<div class="col-lg-7 col-12">
|
||||
<div class="card h-100">
|
||||
<div class="card-header border-bottom py-3">
|
||||
<h6 class="card-title m-0"><i class="bx bx-file me-2"></i>Dane Dokumentu</h6>
|
||||
</div>
|
||||
<div class="card-body pt-3">
|
||||
|
||||
<!-- OCR Dropzone -->
|
||||
<div class="dropzone p-4 border-dashed border-2 rounded text-center mb-3 d-flex flex-column justify-content-center align-items-center"
|
||||
style="border-color: #d9dee3; background-color: #f8f9fa; cursor: pointer; transition: 0.2s;"
|
||||
onmouseover="this.style.borderColor='#696cff'; this.style.backgroundColor='#f0f2ff';"
|
||||
onmouseout="this.style.borderColor='#d9dee3'; this.style.backgroundColor='#f8f9fa';">
|
||||
<i class="bx bx-cloud-upload fs-2 text-muted mb-2"></i>
|
||||
<span class="text-muted fw-bold">Przeciągnij fakturę tutaj lub kliknij</span>
|
||||
<span class="small text-muted">(PDF, JPG, PNG)</span>
|
||||
</div>
|
||||
<button type="button" class="btn btn-label-primary w-100 mb-4" id="btn-ocr-read-page">
|
||||
<i class="bx bx-scan me-1"></i> Odczytaj dane z pliku (OCR)
|
||||
</button>
|
||||
|
||||
<!-- KSeF Info Block -->
|
||||
<div class="mb-4 p-3 bg-label-secondary rounded border-dashed border-2">
|
||||
<div class="d-flex align-items-center mb-2 justify-content-between">
|
||||
@@ -89,6 +108,8 @@ include '../../header-invoice.php';
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="d-flex gap-2 mb-2">
|
||||
<button class="btn btn-sm btn-outline-primary w-100"><i
|
||||
class="bx bx-download me-1"></i>PDF</button>
|
||||
<button class="btn btn-sm btn-outline-primary w-100"><i
|
||||
class="bx bx-download me-1"></i>UPO</button>
|
||||
<button class="btn btn-sm btn-outline-secondary w-100"><i
|
||||
@@ -394,6 +415,117 @@ include '../../header-invoice.php';
|
||||
paidInput.focus();
|
||||
});
|
||||
}
|
||||
|
||||
// --- OCR Simulation Logic for Page ---
|
||||
const ocrBtnPage = document.getElementById('btn-ocr-read-page');
|
||||
if (ocrBtnPage) {
|
||||
ocrBtnPage.addEventListener('click', function () {
|
||||
const btn = this;
|
||||
|
||||
// 1. Loader
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<span class="spinner-border spinner-border-sm me-1" role="status" aria-hidden="true"></span> Przetwarzanie obrazu...';
|
||||
|
||||
// 2. Delay
|
||||
setTimeout(() => {
|
||||
// 3. Fill Data
|
||||
|
||||
// Vendor (Find the card body with select placeholder)
|
||||
const vendorCardBody = document.querySelector('.card.shadow-none .card-body');
|
||||
if (vendorCardBody) {
|
||||
vendorCardBody.innerHTML = `
|
||||
<div>
|
||||
<h6 class="mb-0">Tauron Polska Energia S.A.</h6>
|
||||
<small class="text-muted d-block">ul. Ks. Piotra Ściegiennego 3</small>
|
||||
<small class="text-muted d-block">40-114 Katowice</small>
|
||||
<small class="text-muted d-block">NIP: 551-102-12-34</small>
|
||||
</div>
|
||||
<button class="btn btn-outline-secondary btn-sm position-absolute end-0 top-0 m-2"><i class="bx bx-x"></i></button>
|
||||
`;
|
||||
}
|
||||
|
||||
// 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 = '<i class="bx bx-check me-1"></i> 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);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
162
prototype/invoice/app-purchase-calendar.php
Normal file
162
prototype/invoice/app-purchase-calendar.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
$enablePrototypeComments = true;
|
||||
include '../../header-invoice.php';
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" href="../../assets/vendor/libs/fullcalendar/fullcalendar.css" />
|
||||
|
||||
<div class="container-fluid flex-grow-1 container-p-y">
|
||||
|
||||
<h4 class="py-3 mb-4">
|
||||
<span class="text-muted fw-light">Faktury i sprzedaż /</span> Kalendarz płatności
|
||||
</h4>
|
||||
|
||||
<div class="card app-calendar-wrapper">
|
||||
<div class="row g-0">
|
||||
<!-- Calendar Sidebar -->
|
||||
<div class="col app-calendar-sidebar" id="app-calendar-sidebar" style="display:none;">
|
||||
<!-- Hide sidebar/filter for now, we use tabs -->
|
||||
</div>
|
||||
<!-- /Calendar Sidebar -->
|
||||
|
||||
<!-- Calendar & Tabs -->
|
||||
<div class="col app-calendar-content">
|
||||
<div class="card shadow-none border-0">
|
||||
<div class="card-header border-bottom d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0">Kalendarz płatności</h5>
|
||||
<ul class="nav nav-pills" role="tablist">
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link active" role="tab" data-bs-toggle="tab"
|
||||
data-filter="all">Wszystkie</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link" role="tab" data-bs-toggle="tab"
|
||||
data-filter="paid">Zapłacone</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button type="button" class="nav-link" role="tab" data-bs-toggle="tab"
|
||||
data-filter="unpaid">Do zapłaty</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body pb-0">
|
||||
<div id="calendar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Calendar & Tabs -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include '../../footer.php'; ?>
|
||||
|
||||
<script src="../../assets/vendor/libs/fullcalendar/fullcalendar.js"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const calendarEl = document.getElementById('calendar');
|
||||
const today = new Date();
|
||||
const y = today.getFullYear();
|
||||
const m = today.getMonth(); // 0-indexed
|
||||
|
||||
// Mock Data
|
||||
// Paid: Green, use payment date
|
||||
// Unpaid: Red/Orange, use due date
|
||||
const allEvents = [
|
||||
// PAID (Past)
|
||||
{
|
||||
id: 1,
|
||||
title: 'FV/2026/01/001 - Comarch',
|
||||
start: new Date(y, m, 5),
|
||||
allDay: true,
|
||||
extendedProps: { status: 'paid', amount: '1230.00 PLN' },
|
||||
className: 'bg-label-success'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: 'FV/2026/01/015 - Google Cloud',
|
||||
start: new Date(y, m, 10),
|
||||
allDay: true,
|
||||
extendedProps: { status: 'paid', amount: '50.00 USD' },
|
||||
className: 'bg-label-success'
|
||||
},
|
||||
|
||||
// UNPAID (Future / Current)
|
||||
{
|
||||
id: 3,
|
||||
title: 'FV/2026/02/105 - Tauron',
|
||||
start: new Date(y, m, 24), // Due date
|
||||
allDay: true,
|
||||
extendedProps: { status: 'unpaid', amount: '553.50 PLN' },
|
||||
className: 'bg-label-danger'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: 'FV/2026/02/110 - Orange',
|
||||
start: new Date(y, m, 28), // Due date
|
||||
allDay: true,
|
||||
extendedProps: { status: 'unpaid', amount: '120.00 PLN' },
|
||||
className: 'bg-label-warning'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: 'FV/2026/02/115 - Biurorach',
|
||||
start: new Date(y, m + 1, 5), // Next month
|
||||
allDay: true,
|
||||
extendedProps: { status: 'unpaid', amount: '1500.00 PLN' },
|
||||
className: 'bg-label-warning'
|
||||
}
|
||||
];
|
||||
|
||||
let calendar = new Calendar(calendarEl, {
|
||||
plugins: [dayGridPlugin, interactionPlugin, listPlugin, timegridPlugin],
|
||||
initialView: 'dayGridMonth',
|
||||
headerToolbar: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,listMonth'
|
||||
},
|
||||
events: allEvents,
|
||||
locale: 'pl',
|
||||
firstDay: 1, // Start week on Monday
|
||||
eventDidMount: function (info) {
|
||||
// Add tooltip using Bootstrap
|
||||
if (info.event.extendedProps.amount) {
|
||||
new bootstrap.Tooltip(info.el, {
|
||||
title: info.event.title + ' (' + info.event.extendedProps.amount + ')',
|
||||
placement: 'top',
|
||||
trigger: 'hover',
|
||||
container: 'body'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
|
||||
// Tabs Filtering
|
||||
const tabBtns = document.querySelectorAll('[data-bs-toggle="tab"]');
|
||||
tabBtns.forEach(btn => {
|
||||
btn.addEventListener('shown.bs.tab', function (e) {
|
||||
const filter = e.target.getAttribute('data-filter');
|
||||
console.log("Filtering by:", filter);
|
||||
|
||||
// Remove all events first
|
||||
calendar.removeAllEvents();
|
||||
|
||||
// Filter and add back
|
||||
let filteredEvents = [];
|
||||
if (filter === 'all') {
|
||||
filteredEvents = allEvents;
|
||||
} else {
|
||||
filteredEvents = allEvents.filter(ev => ev.extendedProps.status === filter);
|
||||
}
|
||||
|
||||
filteredEvents.forEach(ev => calendar.addEvent(ev));
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -167,24 +167,185 @@ include '../../header-invoice.php';
|
||||
|
||||
<!-- Modal Szybkie dodawanie (Placeholder) -->
|
||||
<div class="modal fade" id="quickAddModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Szybkie dodawanie kosztu</h5>
|
||||
<div class="modal-header border-bottom">
|
||||
<h5 class="modal-title fs-5">Szybkie dodawanie kosztu</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"
|
||||
aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-label-info">
|
||||
<i class="bx bx-info-circle me-1"></i> Tutaj pojawi się formularz szybkiego
|
||||
dodawania.
|
||||
|
||||
<form id="quickAddForm" onsubmit="return false">
|
||||
<div class="modal-body pb-3">
|
||||
<!-- Dropzone & OCR -->
|
||||
<div class="dropzone p-4 border-dashed border-2 rounded text-center mb-3 d-flex flex-column justify-content-center align-items-center"
|
||||
style="border-color: #d9dee3; background-color: #f8f9fa; cursor: pointer; transition: 0.2s;"
|
||||
onmouseover="this.style.borderColor='#696cff'; this.style.backgroundColor='#f0f2ff';"
|
||||
onmouseout="this.style.borderColor='#d9dee3'; this.style.backgroundColor='#f8f9fa';">
|
||||
<i class="bx bx-cloud-upload fs-2 text-muted mb-2"></i>
|
||||
<span class="text-muted fw-bold">Przeciągnij fakturę tutaj lub kliknij</span>
|
||||
<span class="small text-muted">(PDF, JPG, PNG)</span>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-label-primary w-100 mb-4" id="btn-ocr-read">
|
||||
<i class="bx bx-scan me-1"></i> Odczytaj dane z pliku (OCR)
|
||||
</button>
|
||||
|
||||
<h6 class="mb-3 text-muted small text-uppercase fw-bold border-bottom pb-2">Dane z faktury</h6>
|
||||
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-md-7">
|
||||
<label class="form-label">Dostawca</label>
|
||||
<div class="input-group">
|
||||
<select class="form-select select2-modal"
|
||||
data-placeholder="Wybierz lub wpisz nazwę...">
|
||||
<option></option>
|
||||
<option value="1">Tauron Polska</option>
|
||||
<option value="2">Orange Polska</option>
|
||||
<option value="3">Orlen S.A.</option>
|
||||
<option value="4">Google Ireland</option>
|
||||
</select>
|
||||
<button class="btn btn-outline-primary" type="button"
|
||||
title="Dodaj nowego"><i class="bx bx-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<label class="form-label">Numer dokumentu</label>
|
||||
<input type="text" class="form-control" placeholder="np. FV/2026/02/10">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Data wystawienia</label>
|
||||
<input type="text" class="form-control date-picker-modal"
|
||||
value="<?php echo date('Y-m-d'); ?>">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Data zakupu / dostawy</label>
|
||||
<input type="text" class="form-control date-picker-modal"
|
||||
value="<?php echo date('Y-m-d'); ?>">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Termin płatności</label>
|
||||
<input type="text" class="form-control date-picker-modal"
|
||||
value="<?php echo date('Y-m-d', strtotime('+7 days')); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-label-secondary p-3 rounded mb-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h6 class="mb-0 small text-uppercase text-muted fw-bold">Wartości faktury
|
||||
</h6>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="calcFromGross">
|
||||
<label class="form-check-label small" for="calcFromGross">Licz od
|
||||
brutto</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 align-items-end">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Netto</label>
|
||||
<div class="input-group input-group-merge bg-white">
|
||||
<input type="number" class="form-control" id="qa_netto" step="0.01"
|
||||
placeholder="0.00">
|
||||
<span class="input-group-text">zł</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Stawka VAT</label>
|
||||
<select class="form-select" id="qa_vat_rate">
|
||||
<option value="0.23" selected>23%</option>
|
||||
<option value="0.08">8%</option>
|
||||
<option value="0.05">5%</option>
|
||||
<option value="0">0%</option>
|
||||
<option value="zw">ZW</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label text-muted">Kwota VAT</label>
|
||||
<input type="number" class="form-control bg-white" id="qa_vat_amount"
|
||||
disabled placeholder="0.00">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label fw-bold">Brutto</label>
|
||||
<div class="input-group input-group-merge bg-white">
|
||||
<input type="number" class="form-control fw-bold text-heading"
|
||||
id="qa_brutto" step="0.01" placeholder="0.00">
|
||||
<span class="input-group-text fw-bold">zł</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label d-flex justify-content-between">
|
||||
Kategoria kosztu
|
||||
</label>
|
||||
<select class="form-select">
|
||||
<option value="towary">Towary handlowe</option>
|
||||
<option value="materialy">Materiały podstawowe</option>
|
||||
<option value="paliwo" selected>Paliwo i eksploatacja</option>
|
||||
<option value="biuro">Koszty biurowe</option>
|
||||
<option value="uslugi">Usługi obce</option>
|
||||
<option value="media">Media i energia</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Opis zdarzenia (opcjonalne)</label>
|
||||
<input type="text" class="form-control"
|
||||
placeholder="np. Paliwo Ford Mondeo">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-top pt-3">
|
||||
<div class="d-flex align-items-center mb-3">
|
||||
<div class="form-check form-switch me-4">
|
||||
<input class="form-check-input" type="checkbox" id="qa_is_paid">
|
||||
<label class="form-check-label fw-bold" for="qa_is_paid">Faktura
|
||||
opłacona</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="qa_payment_details"
|
||||
class="row g-3 d-none animate__animated animate__fadeIn">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Data zapłaty</label>
|
||||
<input type="text" class="form-control date-picker-modal"
|
||||
value="<?php echo date('Y-m-d'); ?>">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Metoda płatności</label>
|
||||
<select class="form-select">
|
||||
<option value="karta">Karta płatnicza</option>
|
||||
<option value="przelew">Przelew</option>
|
||||
<option value="gotowka">Gotówka</option>
|
||||
<option value="blik">BLIK</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Z rachunku</label>
|
||||
<select class="form-select">
|
||||
<option value="1">Konto Główne (mBank)</option>
|
||||
<option value="2">Konto VAT</option>
|
||||
<option value="3">Kasa gotówkowa</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary"
|
||||
data-bs-dismiss="modal">Anuluj</button>
|
||||
<button type="button" class="btn btn-primary">Zapisz</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-light">
|
||||
<button type="button" class="btn btn-outline-secondary"
|
||||
data-bs-dismiss="modal">Anuluj</button>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="bx bx-save me-1"></i> Zapisz koszt
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -649,6 +810,71 @@ include '../../header-invoice.php';
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- OCR Simulation Script -->
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const ocrBtn = document.getElementById('btn-ocr-read');
|
||||
if (ocrBtn) {
|
||||
ocrBtn.addEventListener('click', function() {
|
||||
const btn = this;
|
||||
const originalContent = btn.innerHTML;
|
||||
|
||||
// 1. Loader state
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<span class="spinner-border spinner-border-sm me-1" role="status" aria-hidden="true"></span> Przetwarzanie obrazu...';
|
||||
|
||||
// 2. Simulate delay
|
||||
setTimeout(() => {
|
||||
// 3. Fill form data
|
||||
// Dostawca: Tauron (value=1)
|
||||
const supplierSelect = document.querySelector('#quickAddModal select.select2-modal');
|
||||
if (supplierSelect) {
|
||||
$(supplierSelect).val('1').trigger('change');
|
||||
}
|
||||
|
||||
// Numer dokumentu
|
||||
document.querySelector('#quickAddModal input[placeholder="np. FV/2026/02/10"]').value = 'FV/AUT/2026/02/194';
|
||||
|
||||
// Daty
|
||||
const dates = document.querySelectorAll('#quickAddModal .date-picker-modal');
|
||||
if (dates.length >= 3) {
|
||||
dates[0].value = '2026-02-15'; // Wystawienia
|
||||
dates[1].value = '2026-02-15'; // Zakupu
|
||||
dates[2].value = '2026-02-22'; // Płatności
|
||||
}
|
||||
|
||||
// Netto
|
||||
document.getElementById('qa_netto').value = '1250.00';
|
||||
// VAT Rate
|
||||
document.getElementById('qa_vat_rate').value = '0.23';
|
||||
// VAT Amount (manual calc for demo or trigger calculation if logic exists)
|
||||
document.getElementById('qa_vat_amount').value = '287.50';
|
||||
// Brutto
|
||||
document.getElementById('qa_brutto').value = '1537.50';
|
||||
|
||||
// Opis
|
||||
document.querySelector('#quickAddModal input[placeholder="np. Paliwo Ford Mondeo"]').value = 'Energia elektryczna - Luty 2026';
|
||||
|
||||
// 4. Restore button
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="bx bx-check me-1"></i> Dane odczytane poprawnie';
|
||||
btn.classList.remove('btn-label-primary');
|
||||
btn.classList.add('btn-label-success');
|
||||
|
||||
// Opcjonalnie: animacja pól
|
||||
const inputs = document.querySelectorAll('#quickAddModal input');
|
||||
inputs.forEach(input => {
|
||||
if(input.value) {
|
||||
input.classList.add('animate__animated', 'animate__flash');
|
||||
setTimeout(() => input.classList.remove('animate__animated', 'animate__flash'), 1000);
|
||||
}
|
||||
});
|
||||
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -30,7 +30,7 @@ $currentPage = basename($_SERVER['PHP_SELF']);
|
||||
</li>
|
||||
|
||||
<li
|
||||
class="menu-item <?php echo ($currentPage == 'app-invoice-list.php' || $currentPage == 'app-purchase-list.php' || $currentPage == 'app-products.php') ? 'active open' : ''; ?>">
|
||||
class="menu-item <?php echo ($currentPage == 'app-invoice-list.php' || $currentPage == 'app-purchase-list.php' || $currentPage == 'app-purchase-calendar.php' || $currentPage == 'app-products.php') ? 'active open' : ''; ?>">
|
||||
<a href="javascript:void(0);" class="menu-link menu-toggle">
|
||||
<i class="menu-icon tf-icons bx bx-cart-alt"></i>
|
||||
<div class="text-truncate" data-i18n="Faktury i sprzedaż">Faktury i sprzedaż</div>
|
||||
@@ -46,6 +46,11 @@ $currentPage = basename($_SERVER['PHP_SELF']);
|
||||
<div class="text-truncate" data-i18n="Faktury zakupy">Faktury zakupy</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item <?php echo ($currentPage == 'app-purchase-calendar.php') ? 'active' : ''; ?>">
|
||||
<a href="app-purchase-calendar.php" class="menu-link">
|
||||
<div class="text-truncate" data-i18n="Kalendarz płatności">Kalendarz płatności</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="menu-item <?php echo ($currentPage == 'app-products.php') ? 'active' : ''; ?>">
|
||||
<a href="app-products.php" class="menu-link">
|
||||
<div class="text-truncate" data-i18n="Towary">Towary i usługi</div>
|
||||
|
||||
Reference in New Issue
Block a user