Store UI cleanup and rework
This commit is contained in:
Binary file not shown.
@@ -432,7 +432,7 @@ def log_payment():
|
||||
total = float(data.get('total', 0))
|
||||
balance_before = float(data.get('balance_before', 0))
|
||||
balance_after = float(data.get('balance_after', 0))
|
||||
buyer = (data.get('buyer') or '').strip()
|
||||
seller = (data.get('seller') or '').strip()
|
||||
cart_items = data.get('cart_items', []) # [{id, name, price, qty, image}]
|
||||
|
||||
# Deduct stock for each sold item
|
||||
@@ -448,7 +448,7 @@ def log_payment():
|
||||
# Update balance atomically with payment log
|
||||
data_manager.set_balance(balance_after)
|
||||
|
||||
if data_manager.log_payment(items, total, balance_before, balance_after, buyer):
|
||||
if data_manager.log_payment(items, total, balance_before, balance_after, seller):
|
||||
return jsonify({'success': True})
|
||||
return jsonify({'success': False, 'message': 'Error logging payment'}), 400
|
||||
except Exception as e:
|
||||
|
||||
+181
-6
File diff suppressed because one or more lines are too long
+2
-2
@@ -309,7 +309,7 @@ class DataManager:
|
||||
print(f"Error deleting item: {e}")
|
||||
return False
|
||||
|
||||
def log_payment(self, items: list, total: float, balance_before: float, balance_after: float, buyer: str = '') -> bool:
|
||||
def log_payment(self, items: list, total: float, balance_before: float, balance_after: float, seller: str = '') -> bool:
|
||||
try:
|
||||
store = self.load_store()
|
||||
payments = store.get('payments', [])
|
||||
@@ -317,7 +317,7 @@ class DataManager:
|
||||
payments.append({
|
||||
'id': new_id,
|
||||
'timestamp': datetime.now().isoformat(),
|
||||
'buyer': buyer,
|
||||
'seller': seller,
|
||||
'items': items,
|
||||
'total': round(total, 2),
|
||||
'balance_before': round(balance_before, 2),
|
||||
|
||||
+113
-56
@@ -56,6 +56,8 @@ body {
|
||||
overflow-y: auto;
|
||||
box-shadow: var(--shadow-sm);
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.logo-section {
|
||||
@@ -280,7 +282,8 @@ body {
|
||||
|
||||
/* Admin Section */
|
||||
.admin-section {
|
||||
margin-bottom: 0;
|
||||
margin-top: auto;
|
||||
padding-top: 24px;
|
||||
}
|
||||
|
||||
.admin-btn {
|
||||
@@ -394,6 +397,36 @@ body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.toolbar-stacked {
|
||||
height: auto;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
padding: 8px 14px;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.toolbar-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
.toolbar-row + .toolbar-row {
|
||||
border-top: 1px solid var(--border-color);
|
||||
padding-top: 6px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.toolbar-stacked .toolbar-actions {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.toolbar-stacked .tf-quick {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.toolbar-title {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
@@ -1284,8 +1317,8 @@ table tbody tr.duplicate-warning:hover {
|
||||
|
||||
.inventory-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
|
||||
gap: 10px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
|
||||
gap: 12px;
|
||||
align-content: start;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
@@ -1293,29 +1326,28 @@ table tbody tr.duplicate-warning:hover {
|
||||
.inventory-card {
|
||||
background: #fff;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 10px;
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transition: box-shadow 0.15s, border-color 0.15s;
|
||||
transition: border-color 0.15s;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.inventory-card:hover {
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.10);
|
||||
border-color: #ccc;
|
||||
border-color: var(--accent-blue);
|
||||
}
|
||||
|
||||
.inventory-card.out-of-stock {
|
||||
opacity: 0.5;
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
/* Image area — fills full width, fixed height */
|
||||
/* Image area */
|
||||
.inventory-card-img-wrap {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
background: var(--bg-tertiary);
|
||||
height: 120px;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@@ -1337,11 +1369,12 @@ table tbody tr.duplicate-warning:hover {
|
||||
}
|
||||
|
||||
.inventory-card-body {
|
||||
padding: 10px 12px 8px;
|
||||
padding: 10px 12px 6px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
gap: 6px;
|
||||
flex: 1;
|
||||
background: var(--bg-tertiary);
|
||||
border-top: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
@@ -1353,8 +1386,15 @@ table tbody tr.duplicate-warning:hover {
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.inventory-card-meta {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.inventory-card-price {
|
||||
font-size: 16px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
@@ -1362,27 +1402,32 @@ table tbody tr.duplicate-warning:hover {
|
||||
.inventory-card-stock {
|
||||
font-size: 11px;
|
||||
color: var(--text-secondary);
|
||||
letter-spacing: 0.2px;
|
||||
background: var(--bg-tertiary);
|
||||
border-radius: 4px;
|
||||
padding: 1px 6px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.inventory-card-stock.stock-empty {
|
||||
color: var(--accent-red);
|
||||
background: rgba(239,68,68,0.08);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.inventory-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
padding: 6px 12px 10px;
|
||||
padding: 6px 12px 12px;
|
||||
background: var(--bg-tertiary);
|
||||
}
|
||||
|
||||
.inventory-add-btn {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 7px;
|
||||
padding: 8px;
|
||||
font-size: 12px;
|
||||
border-radius: 6px;
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
.inventory-add-btn:disabled {
|
||||
@@ -1390,10 +1435,15 @@ table tbody tr.duplicate-warning:hover {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.inventory-card-actions .action-btn {
|
||||
.inventory-card-admin-actions {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.inventory-card-admin-actions .action-btn {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
padding: 6px 8px;
|
||||
padding: 5px 6px;
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -1693,6 +1743,11 @@ table tbody tr.duplicate-warning:hover {
|
||||
|
||||
/* Print Styles */
|
||||
@media print {
|
||||
@page {
|
||||
size: A4 portrait;
|
||||
margin: 18mm 22mm;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
@@ -1759,10 +1814,9 @@ table tbody tr.duplicate-warning:hover {
|
||||
}
|
||||
|
||||
body.printing-receipt #receiptPrintArea {
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
top: 0; left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
z-index: 9999;
|
||||
padding: 0;
|
||||
@@ -1771,59 +1825,62 @@ table tbody tr.duplicate-warning:hover {
|
||||
|
||||
/* ---- Shared print page wrapper ---- */
|
||||
.rp-page {
|
||||
max-width: 580px;
|
||||
max-width: 155mm;
|
||||
margin: 0 auto;
|
||||
padding: 32px 40px;
|
||||
padding: 6mm 0 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
font-size: 13px;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.rp-monthly { max-width: 720px; }
|
||||
.rp-monthly {
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.rp-logo-block { text-align: center; margin-bottom: 16px; }
|
||||
.rp-logo { height: 72px; object-fit: contain; }
|
||||
.rp-logo-block { text-align: center; margin-bottom: 20px; }
|
||||
.rp-logo { height: 80px; object-fit: contain; }
|
||||
|
||||
.rp-divider { border: none; border-top: 2px solid #111; margin: 10px 0; }
|
||||
.rp-divider-dashed { border: none; border-top: 2px dashed #999; margin: 10px 0; }
|
||||
.rp-divider { border: none; border-top: 2px solid #111; margin: 12px 0; }
|
||||
.rp-divider-dashed { border: none; border-top: 2px dashed #999; margin: 12px 0; }
|
||||
|
||||
.rp-title {
|
||||
text-align: center;
|
||||
font-size: 17px;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1.5px;
|
||||
letter-spacing: 2px;
|
||||
text-transform: uppercase;
|
||||
margin: 10px 0 6px;
|
||||
margin: 12px 0 8px;
|
||||
}
|
||||
|
||||
.rp-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 11px;
|
||||
font-size: 12px;
|
||||
color: #555;
|
||||
margin-bottom: 6px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.rp-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 10px 0;
|
||||
font-size: 12px;
|
||||
margin: 12px 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.rp-table th {
|
||||
font-size: 10px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.4px;
|
||||
border-bottom: 1px solid #333;
|
||||
padding: 5px 4px;
|
||||
border-bottom: 1.5px solid #333;
|
||||
padding: 7px 5px;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.rp-table td {
|
||||
padding: 5px 4px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding: 7px 5px;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
@@ -1835,56 +1892,56 @@ table tbody tr.duplicate-warning:hover {
|
||||
.rp-total {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 16px;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
padding: 8px 0;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.rp-footer {
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.5px;
|
||||
color: #555;
|
||||
padding-top: 8px;
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
/* Monthly-specific */
|
||||
.rp-monthly-kpi {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
margin: 12px 0;
|
||||
gap: 20px;
|
||||
margin: 14px 0;
|
||||
}
|
||||
|
||||
.rp-kpi-box {
|
||||
flex: 1;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
padding: 10px 14px;
|
||||
padding: 12px 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.rp-kpi-label {
|
||||
font-size: 10px;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.4px;
|
||||
color: #666;
|
||||
margin-bottom: 4px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.rp-kpi-value {
|
||||
font-size: 20px;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.rp-section-title {
|
||||
font-size: 10px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
color: #555;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding-bottom: 4px;
|
||||
margin: 14px 0 6px;
|
||||
padding-bottom: 5px;
|
||||
margin: 16px 0 8px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+44
-37
@@ -36,6 +36,7 @@ async function checkAdminStatus() {
|
||||
function updateAdminUI() {
|
||||
const adminBtn = document.getElementById('adminToggleBtn');
|
||||
const addBtn = document.querySelector('[onclick="openAddParticipantModal()"]');
|
||||
const participantsToolbar = document.getElementById('participantsToolbar');
|
||||
const addUnregisteredBtn = document.getElementById('addUnregisteredBtn');
|
||||
const addItemBtn = document.getElementById('addItemBtn');
|
||||
const editBalanceBtn = document.getElementById('editBalanceBtn');
|
||||
@@ -47,6 +48,7 @@ function updateAdminUI() {
|
||||
adminBtn.onclick = adminLogout;
|
||||
adminBtn.classList.add('active');
|
||||
if (addBtn) addBtn.style.display = 'block';
|
||||
if (participantsToolbar) participantsToolbar.style.display = '';
|
||||
if (addItemBtn) addItemBtn.style.display = 'inline-flex';
|
||||
if (editBalanceBtn) editBalanceBtn.style.display = 'inline-flex';
|
||||
} else {
|
||||
@@ -54,6 +56,7 @@ function updateAdminUI() {
|
||||
adminBtn.onclick = openLoginModal;
|
||||
adminBtn.classList.remove('active');
|
||||
if (addBtn) addBtn.style.display = 'none';
|
||||
if (participantsToolbar) participantsToolbar.style.display = 'none';
|
||||
if (addItemBtn) addItemBtn.style.display = 'none';
|
||||
if (editBalanceBtn) editBalanceBtn.style.display = 'none';
|
||||
}
|
||||
@@ -532,7 +535,10 @@ function resetFilters() {
|
||||
}
|
||||
|
||||
function getDateString(date) {
|
||||
return date.toISOString().split('T')[0];
|
||||
const y = date.getFullYear();
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const d = String(date.getDate()).padStart(2, '0');
|
||||
return `${y}-${m}-${d}`;
|
||||
}
|
||||
|
||||
function filterByToday() {
|
||||
@@ -732,6 +738,7 @@ function switchTab(tabName, event) {
|
||||
event.target.classList.add('active');
|
||||
|
||||
// Load tab-specific data
|
||||
if (tabName === 'logs') filterByToday();
|
||||
if (tabName === 'documents') loadDocuments();
|
||||
if (tabName === 'store') {
|
||||
// Always return to shop view when switching to store tab
|
||||
@@ -903,7 +910,7 @@ async function loadBalance() {
|
||||
const response = await fetch('/api/store/balance');
|
||||
const data = await response.json();
|
||||
currentBalance = data.balance;
|
||||
document.getElementById('storeBalanceDisplay').textContent = '€' + currentBalance.toFixed(2);
|
||||
document.getElementById('storeBalanceDisplay').textContent = '€ ' + currentBalance.toFixed(2);
|
||||
updateCartTotals();
|
||||
} catch (error) {
|
||||
console.error('Error loading balance:', error);
|
||||
@@ -933,13 +940,17 @@ function renderInventory() {
|
||||
${imgHtml}
|
||||
<div class="inventory-card-body">
|
||||
<div class="inventory-card-name">${item.name}</div>
|
||||
<div class="inventory-card-price">€${item.price.toFixed(2)}</div>
|
||||
<div class="inventory-card-stock ${item.stock === 0 ? 'stock-empty' : ''}">Zaloga: ${item.stock}</div>
|
||||
<div class="inventory-card-meta">
|
||||
<div class="inventory-card-price">€ ${item.price.toFixed(2)}</div>
|
||||
<div class="inventory-card-stock ${item.stock === 0 ? 'stock-empty' : ''}">${item.stock === 0 ? 'Ni zaloge' : item.stock + ' kos'}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inventory-card-actions">
|
||||
<button class="btn btn-primary inventory-add-btn" onclick="addToCart(${item.id})" ${item.stock === 0 ? 'disabled' : ''}>+ Dodaj</button>
|
||||
${isAdmin ? `<button class="action-btn edit-btn" onclick="openEditItemModal(${item.id})">Uredi</button>
|
||||
<button class="action-btn delete-btn" onclick="deleteStoreItem(${item.id})">Izbriši</button>` : ''}
|
||||
${isAdmin ? `<div class="inventory-card-admin-actions">
|
||||
<button class="action-btn edit-btn" onclick="openEditItemModal(${item.id})">Uredi</button>
|
||||
<button class="action-btn delete-btn" onclick="deleteStoreItem(${item.id})">Izbriši</button>
|
||||
</div>` : ''}
|
||||
</div>
|
||||
`;
|
||||
grid.appendChild(card);
|
||||
@@ -1003,7 +1014,7 @@ function renderCart() {
|
||||
<span class="cart-qty">${item.qty}</span>
|
||||
<button class="cart-qty-btn" onclick="addToCart(${item.id})">+</button>
|
||||
</div>
|
||||
<div class="cart-item-subtotal">€${(item.price * item.qty).toFixed(2)}</div>
|
||||
<div class="cart-item-subtotal">€ ${(item.price * item.qty).toFixed(2)}</div>
|
||||
`;
|
||||
container.appendChild(row);
|
||||
});
|
||||
@@ -1018,9 +1029,9 @@ function updateCartTotals() {
|
||||
const totalEl = document.getElementById('cartTotal');
|
||||
const balanceAfterEl = document.getElementById('cartBalanceAfter');
|
||||
|
||||
if (totalEl) totalEl.textContent = '€' + total.toFixed(2);
|
||||
if (totalEl) totalEl.textContent = '€ ' + total.toFixed(2);
|
||||
if (balanceAfterEl) {
|
||||
balanceAfterEl.textContent = '€' + balanceAfter.toFixed(2);
|
||||
balanceAfterEl.textContent = '€ ' + balanceAfter.toFixed(2);
|
||||
balanceAfterEl.className = 'cart-balance-after';
|
||||
}
|
||||
}
|
||||
@@ -1033,12 +1044,11 @@ function processPayment() {
|
||||
const total = cart.reduce((sum, i) => sum + i.price * i.qty, 0);
|
||||
const balanceAfter = currentBalance + total;
|
||||
|
||||
document.getElementById('checkoutFirstName').value = '';
|
||||
document.getElementById('checkoutLastName').value = '';
|
||||
document.getElementById('checkoutTotal').textContent = '€' + total.toFixed(2);
|
||||
document.getElementById('checkoutBalanceAfter').textContent = '€' + balanceAfter.toFixed(2);
|
||||
document.getElementById('checkoutBuyer').value = '';
|
||||
document.getElementById('checkoutTotal').textContent = '€ ' + total.toFixed(2);
|
||||
document.getElementById('checkoutBalanceAfter').textContent = '€ ' + balanceAfter.toFixed(2);
|
||||
document.getElementById('checkoutModal').classList.add('show');
|
||||
document.getElementById('checkoutFirstName').focus();
|
||||
document.getElementById('checkoutBuyer').focus();
|
||||
}
|
||||
|
||||
function closeCheckoutModal() {
|
||||
@@ -1046,15 +1056,12 @@ function closeCheckoutModal() {
|
||||
}
|
||||
|
||||
async function confirmCheckout() {
|
||||
const firstName = document.getElementById('checkoutFirstName').value.trim();
|
||||
const lastName = document.getElementById('checkoutLastName').value.trim();
|
||||
const seller = document.getElementById('checkoutBuyer').value.trim();
|
||||
|
||||
if (!firstName || !lastName) {
|
||||
alert('Prosimo, vnesite ime in priimek kupca');
|
||||
if (!seller) {
|
||||
alert('Prosimo, vnesite ime in priimek prodajalca');
|
||||
return;
|
||||
}
|
||||
|
||||
const buyer = firstName + ' ' + lastName;
|
||||
const total = cart.reduce((sum, i) => sum + i.price * i.qty, 0);
|
||||
const balanceAfter = currentBalance + total;
|
||||
|
||||
@@ -1077,7 +1084,7 @@ async function confirmCheckout() {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
buyer,
|
||||
seller,
|
||||
items: cart.map(i => ({ name: i.name, qty: i.qty, price: i.price })),
|
||||
cart_items: cartItems,
|
||||
total,
|
||||
@@ -1090,7 +1097,7 @@ async function confirmCheckout() {
|
||||
if (!data.success) { alert('Napaka: ' + data.message); return; }
|
||||
|
||||
const payment = {
|
||||
buyer,
|
||||
seller,
|
||||
items: cart.map(i => ({ name: i.name, qty: i.qty, price: i.price })),
|
||||
total,
|
||||
balance_before: currentBalance,
|
||||
@@ -1299,13 +1306,13 @@ async function loadPaymentHistory() {
|
||||
const row = document.createElement('tr');
|
||||
row.innerHTML = `
|
||||
<td>${p.id}</td>
|
||||
<td style="font-weight:600;">${p.buyer || '-'}</td>
|
||||
<td style="font-weight:600;">${p.seller || '-'}</td>
|
||||
<td>${date}</td>
|
||||
<td>${time}</td>
|
||||
<td style="max-width:200px;word-break:break-word;">${itemsSummary}</td>
|
||||
<td style="font-weight:700;color:var(--accent-blue);">€${p.total.toFixed(2)}</td>
|
||||
<td>€${p.balance_before.toFixed(2)}</td>
|
||||
<td>€${p.balance_after.toFixed(2)}</td>
|
||||
<td style="font-weight:700;color:var(--accent-blue);">€ ${p.total.toFixed(2)}</td>
|
||||
<td>€ ${p.balance_before.toFixed(2)}</td>
|
||||
<td>€ ${p.balance_after.toFixed(2)}</td>
|
||||
<td><button class="action-btn edit-btn" onclick="printReceipt(${JSON.stringify(p).replace(/"/g, '"')})">🖨 Natisni</button></td>
|
||||
`;
|
||||
tbody.appendChild(row);
|
||||
@@ -1323,7 +1330,7 @@ function printReceipt(payment) {
|
||||
const date = fmtDate(ts.split('T')[0]);
|
||||
const time = ts.split('T')[1] ? ts.split('T')[1].substring(0, 5) : '';
|
||||
const rows = payment.items.map(i =>
|
||||
`<tr><td class="rp-td-name">${i.name}</td><td class="rp-td-qty">${i.qty}×</td><td class="rp-td-price">€${i.price.toFixed(2)}</td><td class="rp-td-sub">€${(i.price * i.qty).toFixed(2)}</td></tr>`
|
||||
`<tr><td class="rp-td-name">${i.name}</td><td class="rp-td-qty">${i.qty}×</td><td class="rp-td-price">€ ${i.price.toFixed(2)}</td><td class="rp-td-sub">€ ${(i.price * i.qty).toFixed(2)}</td></tr>`
|
||||
).join('');
|
||||
|
||||
const html = `
|
||||
@@ -1335,17 +1342,17 @@ function printReceipt(payment) {
|
||||
<div class="rp-title">POTRDILO O PLAČILU</div>
|
||||
<div class="rp-meta">
|
||||
<span>${date} ${time}</span>
|
||||
<span>Prodajalec: <strong>${payment.buyer || '-'}</strong></span>
|
||||
<span>Prodajalec: <strong>${payment.seller || '-'}</strong></span>
|
||||
</div>
|
||||
<div class="rp-divider-dashed"></div>
|
||||
<table class="rp-table">
|
||||
<thead><tr><th>Artikel</th><th>Kol.</th><th>Cena</th><th style="text-align:right;">Znesek</th></tr></thead>
|
||||
<thead><tr><th>Artikel</th><th style="text-align:center;">Količina</th><th style="text-align:right;">Cena</th><th style="text-align:right;">Znesek</th></tr></thead>
|
||||
<tbody>${rows}</tbody>
|
||||
</table>
|
||||
<div class="rp-divider"></div>
|
||||
<div class="rp-total">
|
||||
<span>SKUPAJ</span>
|
||||
<span>€${payment.total.toFixed(2)}</span>
|
||||
<span>€ ${payment.total.toFixed(2)}</span>
|
||||
</div>
|
||||
<div class="rp-divider-dashed"></div>
|
||||
<div class="rp-footer">Hvala za nakup!</div>
|
||||
@@ -1404,17 +1411,17 @@ async function renderMonthlyOverview() {
|
||||
}));
|
||||
|
||||
const itemRows = Object.entries(itemTotals).map(([name, v]) =>
|
||||
`<tr><td>${name}</td><td style="text-align:center;">${v.qty}</td><td style="text-align:right;font-weight:600;">€${v.revenue.toFixed(2)}</td></tr>`
|
||||
`<tr><td>${name}</td><td style="text-align:center;">${v.qty}</td><td style="text-align:right;font-weight:600;">€ ${v.revenue.toFixed(2)}</td></tr>`
|
||||
).join('');
|
||||
|
||||
const txRows = [...filtered].reverse().map(p => {
|
||||
const date = fmtDate(p.timestamp.split('T')[0]);
|
||||
const time = p.timestamp.split('T')[1].substring(0, 5);
|
||||
return `<tr><td>${date}</td><td>${time}</td><td style="font-weight:600;">${p.buyer || '-'}</td><td>${p.items.map(i => `${i.name} ×${i.qty}`).join(', ')}</td><td style="text-align:right;font-weight:700;color:var(--accent-blue);">€${p.total.toFixed(2)}</td></tr>`;
|
||||
return `<tr><td>${date}</td><td>${time}</td><td style="font-weight:600;">${p.seller || '-'}</td><td>${p.items.map(i => `${i.name} ×${i.qty}`).join(', ')}</td><td style="text-align:right;font-weight:700;color:var(--accent-blue);">€ ${p.total.toFixed(2)}</td></tr>`;
|
||||
}).join('');
|
||||
|
||||
content.innerHTML = `
|
||||
<div class="monthly-summary-total">Skupaj prihodek: <strong>€${grandTotal.toFixed(2)}</strong> (${filtered.length} transakcij)</div>
|
||||
<div class="monthly-summary-total">Skupaj prihodek: <strong>€ ${grandTotal.toFixed(2)}</strong> (${filtered.length} transakcij)</div>
|
||||
<h4 class="monthly-section-title">Po artiklih</h4>
|
||||
<div class="table-container" style="margin-bottom:16px;">
|
||||
<table><thead><tr><th>Artikel</th><th style="text-align:center;">Količina</th><th style="text-align:right;">Prihodek</th></tr></thead>
|
||||
@@ -1445,14 +1452,14 @@ function printMonthlyOverview() {
|
||||
}));
|
||||
|
||||
const itemRows = Object.entries(itemTotals).map(([name, v]) =>
|
||||
`<tr><td>${name}</td><td style="text-align:center;">${v.qty}</td><td style="text-align:right;font-weight:600;">€${v.revenue.toFixed(2)}</td></tr>`
|
||||
`<tr><td>${name}</td><td style="text-align:center;">${v.qty}</td><td style="text-align:right;font-weight:600;">€ ${v.revenue.toFixed(2)}</td></tr>`
|
||||
).join('');
|
||||
|
||||
const txRows = [...filtered].reverse().map(p => {
|
||||
const date = fmtDate(p.timestamp.split('T')[0]);
|
||||
const time = p.timestamp.split('T')[1].substring(0, 5);
|
||||
const items = p.items.map(i => `${i.name} ×${i.qty} (€${(i.price*i.qty).toFixed(2)})`).join(', ');
|
||||
return `<tr><td>${date}</td><td>${time}</td><td style="font-weight:600;">${p.buyer || '-'}</td><td>${items}</td><td style="text-align:right;font-weight:700;">€${p.total.toFixed(2)}</td></tr>`;
|
||||
const items = p.items.map(i => `${i.name} ×${i.qty} (€ ${(i.price*i.qty).toFixed(2)})`).join(', ');
|
||||
return `<tr><td>${date}</td><td>${time}</td><td style="font-weight:600;">${p.seller || '-'}</td><td>${items}</td><td style="text-align:right;font-weight:700;">€ ${p.total.toFixed(2)}</td></tr>`;
|
||||
}).join('');
|
||||
|
||||
const [year, month] = picker.split('-');
|
||||
@@ -1469,7 +1476,7 @@ function printMonthlyOverview() {
|
||||
<div class="rp-meta"><span>${monthName}</span><span>Natisnjeno: ${printDate}</span></div>
|
||||
<div class="rp-divider-dashed"></div>
|
||||
<div class="rp-monthly-kpi">
|
||||
<div class="rp-kpi-box"><div class="rp-kpi-label">Skupaj prihodek</div><div class="rp-kpi-value">€${grandTotal.toFixed(2)}</div></div>
|
||||
<div class="rp-kpi-box"><div class="rp-kpi-label">Skupaj prihodek</div><div class="rp-kpi-value">€ ${grandTotal.toFixed(2)}</div></div>
|
||||
<div class="rp-kpi-box"><div class="rp-kpi-label">Št. transakcij</div><div class="rp-kpi-value">${filtered.length}</div></div>
|
||||
</div>
|
||||
<div class="rp-section-title">Po artiklih</div>
|
||||
|
||||
+11
-18
@@ -60,8 +60,7 @@
|
||||
|
||||
<!-- Participants Tab -->
|
||||
<div id="participants-tab" class="tab-panel">
|
||||
<div class="toolbar">
|
||||
<span class="toolbar-title">Člani</span>
|
||||
<div id="participantsToolbar" class="toolbar">
|
||||
<div class="toolbar-actions">
|
||||
<button class="tb-btn tb-btn-primary" onclick="openAddParticipantModal()">+ Dodaj udeleženca</button>
|
||||
</div>
|
||||
@@ -88,8 +87,8 @@
|
||||
|
||||
<!-- Scan Logs Tab -->
|
||||
<div id="logs-tab" class="tab-panel active">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-filters">
|
||||
<div class="toolbar toolbar-stacked">
|
||||
<div class="toolbar-row">
|
||||
<div class="tf-group">
|
||||
<label>Rezultat</label>
|
||||
<select id="filterSelect" onchange="refreshLogs()">
|
||||
@@ -112,6 +111,8 @@
|
||||
<label>Do</label>
|
||||
<input type="date" id="endDateFilter" onchange="refreshLogs()">
|
||||
</div>
|
||||
</div>
|
||||
<div class="toolbar-row">
|
||||
<div class="tf-quick">
|
||||
<button class="btn-quick-filter" onclick="filterByToday()">Danes</button>
|
||||
<button class="btn-quick-filter" onclick="filterByLastWeek()">Teden</button>
|
||||
@@ -119,12 +120,12 @@
|
||||
<button class="btn-quick-filter" onclick="filterByLastYear()">Leto</button>
|
||||
<button class="btn-filter" onclick="resetFilters()">×</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<button class="tb-btn" onclick="printLogs()">Natisni</button>
|
||||
<button id="addUnregisteredBtn" class="tb-btn tb-btn-primary" onclick="openAddUnregisteredModal()">+ Neregistriran</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<div class="table-container">
|
||||
<table>
|
||||
@@ -148,9 +149,6 @@
|
||||
|
||||
<!-- Documents Tab -->
|
||||
<div id="documents-tab" class="tab-panel">
|
||||
<div class="toolbar">
|
||||
<span class="toolbar-title">Dokumenti</span>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<div id="documentsGrid" class="documents-grid">
|
||||
<p style="color: var(--text-secondary);">Nalaganje dokumentov...</p>
|
||||
@@ -162,11 +160,10 @@
|
||||
<div id="store-tab" class="tab-panel">
|
||||
<!-- Single shared toolbar -->
|
||||
<div class="toolbar">
|
||||
<span class="toolbar-title">Trgovina</span>
|
||||
<div class="toolbar-actions">
|
||||
<div class="store-balance-chip">
|
||||
<span class="store-balance-label">Stanje</span>
|
||||
<span id="storeBalanceDisplay" class="store-balance-value">€0.00</span>
|
||||
<span id="storeBalanceDisplay" class="store-balance-value">€ 0.00</span>
|
||||
</div>
|
||||
<button id="editBalanceBtn" class="tb-btn" onclick="openEditBalanceModal()" style="display:none;">Uredi stanje</button>
|
||||
<button id="addItemBtn" class="tb-btn tb-btn-primary" onclick="openAddItemModal()" style="display:none;">+ Artikel</button>
|
||||
@@ -193,11 +190,11 @@
|
||||
<div class="cart-total">
|
||||
<div class="cart-total-row">
|
||||
<span>Skupaj:</span>
|
||||
<span id="cartTotal" class="cart-total-amount">€0.00</span>
|
||||
<span id="cartTotal" class="cart-total-amount">€ 0.00</span>
|
||||
</div>
|
||||
<div class="cart-total-row cart-balance-row">
|
||||
<span>Stanje po plačilu:</span>
|
||||
<span id="cartBalanceAfter" class="cart-balance-after">€0.00</span>
|
||||
<span id="cartBalanceAfter" class="cart-balance-after">€ 0.00</span>
|
||||
</div>
|
||||
<button class="btn btn-primary cart-pay-btn" onclick="processPayment()">Plačaj</button>
|
||||
</div>
|
||||
@@ -362,12 +359,8 @@
|
||||
<span class="close" onclick="closeCheckoutModal()">×</span>
|
||||
<h2>Podatki prodajalca</h2>
|
||||
<div class="form-group">
|
||||
<label>Ime:</label>
|
||||
<input type="text" id="checkoutFirstName" placeholder="Ime">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Priimek:</label>
|
||||
<input type="text" id="checkoutLastName" placeholder="Priimek" onkeydown="if(event.key==='Enter')confirmCheckout()">
|
||||
<label>Ime in priimek:</label>
|
||||
<input type="text" id="checkoutBuyer" placeholder="Ime in priimek" onkeydown="if(event.key==='Enter')confirmCheckout()">
|
||||
</div>
|
||||
<div class="checkout-summary">
|
||||
<div class="checkout-summary-row">
|
||||
|
||||
Reference in New Issue
Block a user