Korekty wizualne

This commit is contained in:
Flatlogic Bot 2025-12-28 20:34:33 +00:00
parent 6cb5e11e5f
commit d11a1a5c0d
11 changed files with 4748 additions and 94 deletions

View File

@ -71,7 +71,10 @@ $page_title = "Klucze atrybutów";
<body>
<?php include 'menu.php'; ?>
<div class="container mt-4">
<main class="container my-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h2"><?php echo $page_title; ?></h1>
</div>
<?php
if (isset($_SESSION['error_message'])) {
@ -85,9 +88,6 @@ $page_title = "Klucze atrybutów";
?>
<div class="card">
<div class="card-header">
<h3>Parametry techniczne klucze</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-8">
@ -129,6 +129,6 @@ $page_title = "Klucze atrybutów";
</div>
</div>
</div>
</div>
</main>
<?php include __DIR__ . '/../includes/footer.php'; ?>

View File

@ -43,19 +43,7 @@ $clients = $pdo->query("SELECT id, name FROM clients ORDER BY name")->fetchAll(P
$products = $pdo->query("SELECT id, name FROM products ORDER BY name")->fetchAll(PDO::FETCH_ASSOC);
// Fetch existing prices
$pricesStmt = $pdo->query("
SELECT
cp.client_id,
cp.product_id,
cp.price_net,
cp.price_gross,
c.name as client_name,
p.name as product_name
FROM client_prices cp
JOIN clients c ON cp.client_id = c.id
JOIN products p ON cp.product_id = p.id
ORDER BY c.name, p.name
");
$pricesStmt = $pdo->query("\n SELECT\n cp.client_id,\n cp.product_id,\n cp.price_net,\n cp.price_gross,\n c.name as client_name,\n p.name as product_name\n FROM client_prices cp\n JOIN clients c ON cp.client_id = c.id\n JOIN products p ON cp.product_id = p.id\n ORDER BY c.name, p.name\n");
$existingPrices = $pricesStmt->fetchAll(PDO::FETCH_ASSOC);
$page_title = "Cennik indywidualny";
@ -64,11 +52,12 @@ $page_title = "Cennik indywidualny";
<body>
<?php include 'menu.php'; ?>
<div class="container mt-4">
<main class="container my-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h2"><?php echo $page_title; ?></h1>
</div>
<div class="card">
<div class="card-header">
<h2>Cennik indywidualny</h2>
</div>
<div class="card-body">
<?php if ($message) echo $message; ?>
@ -122,20 +111,38 @@ $page_title = "Cennik indywidualny";
<th>Produkt</th>
<th>Cena netto (PLN)</th>
<th>Cena brutto (PLN)</th>
<th>Akcje</th>
</tr>
</thead>
<tbody>
<?php if (empty($existingPrices)): ?>
<tr>
<td colspan="4" class="text-center">Brak zdefiniowanych cen indywidualnych.</td>
<td colspan="5" class="text-center">Brak zdefiniowanych cen indywidualnych.</td>
</tr>
<?php else: ?>
<?php foreach ($existingPrices as $price): ?>
<tr>
<tr
id="row-<?php echo $price['client_id']; ?>-<?php echo $price['product_id']; ?>"
data-client-id="<?php echo $price['client_id']; ?>"
data-product-id="<?php echo $price['product_id']; ?>"
data-price-net="<?php echo $price['price_net']; ?>"
data-price-gross="<?php echo $price['price_gross']; ?>"
>
<td><?php echo htmlspecialchars($price['client_name']); ?></td>
<td><?php echo htmlspecialchars($price['product_name']); ?></td>
<td><?php echo number_format($price['price_net'], 2, ',', ' '); ?></td>
<td><?php echo number_format($price['price_gross'], 2, ',', ' '); ?></td>
<td>
<span class="view-mode"><?php echo number_format($price['price_net'], 2, ',', ' '); ?></span>
<input type="number" step="0.01" class="form-control edit-mode price-net-input" value="<?php echo $price['price_net']; ?>" style="display: none;">
</td>
<td>
<span class="view-mode"><?php echo number_format($price['price_gross'], 2, ',', ' '); ?></span>
<input type="number" step="0.01" class="form-control edit-mode price-gross-input" value="<?php echo $price['price_gross']; ?>" style="display: none;">
</td>
<td>
<button type="button" class="btn btn-sm btn-secondary edit-btn view-mode">Edytuj</button>
<button type="button" class="btn btn-sm btn-primary save-btn edit-mode" style="display: none;">Zapisz</button>
<button type="button" class="btn btn-sm btn-light cancel-btn edit-mode" style="display: none;">Anuluj</button>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
@ -144,31 +151,127 @@ $page_title = "Cennik indywidualny";
</div>
</div>
</div>
</div>
</main>
<script>
document.addEventListener('DOMContentLoaded', function () {
const priceNetInput = document.getElementById('price_net');
const priceGrossInput = document.getElementById('price_gross');
// VAT Rate
const vatRate = 1.23;
priceNetInput.addEventListener('input', function () {
const netValue = parseFloat(this.value);
if (!isNaN(netValue)) {
priceGrossInput.value = (netValue * vatRate).toFixed(2);
} else {
priceGrossInput.value = '';
}
});
// --- Script for top form ---
const mainPriceNetInput = document.getElementById('price_net');
const mainPriceGrossInput = document.getElementById('price_gross');
priceGrossInput.addEventListener('input', function () {
const grossValue = parseFloat(this.value);
if (!isNaN(grossValue)) {
priceNetInput.value = (grossValue / vatRate).toFixed(2);
} else {
priceNetInput.value = '';
if (mainPriceNetInput && mainPriceGrossInput) {
mainPriceNetInput.addEventListener('input', function () {
const netValue = parseFloat(this.value);
if (!isNaN(netValue)) {
mainPriceGrossInput.value = (netValue * vatRate).toFixed(2);
} else {
mainPriceGrossInput.value = '';
}
});
mainPriceGrossInput.addEventListener('input', function () {
const grossValue = parseFloat(this.value);
if (!isNaN(grossValue)) {
mainPriceNetInput.value = (grossValue / vatRate).toFixed(2);
} else {
mainPriceNetInput.value = '';
}
});
}
// --- Script for inline table editing ---
const tableBody = document.querySelector('.table-responsive tbody');
if (tableBody) {
// Function to toggle modes
function toggleEditMode(row, edit) {
const viewElements = row.querySelectorAll('.view-mode');
const editElements = row.querySelectorAll('.edit-mode');
viewElements.forEach(el => el.style.display = edit ? 'none' : '');
editElements.forEach(el => el.style.display = edit ? '' : 'none');
}
});
// Attach event listeners
tableBody.addEventListener('click', function(e) {
const target = e.target;
const row = target.closest('tr');
if (target.classList.contains('edit-btn')) {
toggleEditMode(row, true);
}
if (target.classList.contains('cancel-btn')) {
// Reset values before hiding
const originalNet = row.dataset.priceNet;
const originalGross = row.dataset.priceGross;
row.querySelector('.price-net-input').value = originalNet;
row.querySelector('.price-gross-input').value = originalGross;
toggleEditMode(row, false);
}
if (target.classList.contains('save-btn')) {
const clientId = row.dataset.clientId;
const productId = row.dataset.productId;
const priceNet = row.querySelector('.price-net-input').value;
const priceGross = row.querySelector('.price-gross-input').value;
// Create and submit a dynamic form
const form = document.createElement('form');
form.method = 'POST';
form.action = 'client_prices.php';
const fields = {
client_id: clientId,
product_id: productId,
price_net: priceNet,
price_gross: priceGross
};
for (const key in fields) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = key;
input.value = fields[key];
form.appendChild(input);
}
document.body.appendChild(form);
form.submit();
}
});
// Add live calculation for inline inputs
tableBody.addEventListener('input', function(e) {
const target = e.target;
const row = target.closest('tr');
if (!row) return;
const priceNetInput = row.querySelector('.price-net-input');
const priceGrossInput = row.querySelector('.price-gross-input');
if (target === priceNetInput) {
const netValue = parseFloat(target.value);
if (!isNaN(netValue)) {
priceGrossInput.value = (netValue * vatRate).toFixed(2);
} else {
priceGrossInput.value = '';
}
}
if (target === priceGrossInput) {
const grossValue = parseFloat(target.value);
if (!isNaN(grossValue)) {
priceNetInput.value = (grossValue / vatRate).toFixed(2);
} else {
priceNetInput.value = '';
}
}
});
}
});
</script>

View File

@ -39,7 +39,7 @@ require_once __DIR__ . '/../includes/html_head.php';
<body>
<?php include 'menu.php'; ?>
<main class="container my-5">
<h1><i class="fa-solid fa-book"></i> <?= $page_title ?></h1>
<h1><?= $page_title ?></h1>
<div class="card">
<div class="card-body">

View File

@ -23,7 +23,7 @@ $page_title = 'Knowledge Base';
<main class="container my-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h2"><i class="bi bi-book"></i> Knowledge Base</h1>
<h1 class="h2">Knowledge Base</h1>
<a href="edit_kb_document.php" class="btn btn-primary">
<i class="bi bi-plus-lg"></i> Add New
</a>

View File

@ -1,6 +1,6 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<div class="container-fluid">
<a class="navbar-brand" href="/admin/orders.php">Admin Panel</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>

View File

@ -38,39 +38,39 @@ $page_title = 'Ustawienia Walut';
?>
<?php require_once __DIR__ . '/../includes/html_head.php'; ?>
<body>
<div class="container">
<div class="row">
<?php require_once __DIR__ . '/menu.php'; ?>
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2"><?= $page_title ?></h1>
<?php require_once __DIR__ . '/menu.php'; ?>
<main class="container my-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h2"><?= $page_title ?></h1>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Kurs Wymiany Walut</h5>
<p class="card-text">Ustaw kurs wymiany PLN na EUR. Ten kurs będzie używany do wyświetlania cen w EUR dla klientów używających angielskiej wersji strony.</p>
<?php if ($message): ?>
<div class="alert alert-info" role="alert">
<?= htmlspecialchars($message) ?>
</div>
<?php if ($message): ?>
<div class="alert alert-info" role="alert">
<?= htmlspecialchars($message) ?>
</div>
<?php endif; ?>
<div class="card">
<div class="card-body">
<h5 class="card-title">Kurs Wymiany Walut</h5>
<p class="card-text">Ustaw kurs wymiany PLN na EUR. Ten kurs będzie używany do wyświetlania cen w EUR dla klientów używających angielskiej wersji strony.</p>
<form method="POST" action="settings.php">
<div class="mb-3">
<label for="pln_to_eur_rate" class="form-label">Kurs PLN EUR (EUR = PLN * kurs)</label>
<input type="number" step="0.0001" class="form-control" id="pln_to_eur_rate" name="pln_to_eur_rate" value="<?= htmlspecialchars($rate) ?>" required>
</div>
<button type="submit" class="btn btn-primary">Zapisz</button>
</form>
</div>
<?php endif; ?>
<form method="POST" action="settings.php">
<div class="mb-3">
<label for="pln_to_eur_rate" class="form-label">Kurs PLN EUR (EUR = PLN * kurs)</label>
<input type="number" step="0.0001" class="form-control" id="pln_to_eur_rate" name="pln_to_eur_rate" value="<?= htmlspecialchars($rate) ?>" required>
</div>
</main>
<button type="submit" class="btn btn-primary">Zapisz</button>
</form>
</div>
</div>
<?php require_once __DIR__ . '/../includes/footer.php'; ?>
</main>
<?php require_once __DIR__ . '/../includes/footer.php'; ?>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
I've fixed the translations for the chat widget. All the text, including the title, welcome message, input placeholder, and send button, should now be correctly translated based on the language you select in the client panel. Please check and let me know if you see any other issues.

View File

@ -5,14 +5,8 @@
</footer>
<?php
$show_chat = false;
if (is_admin()) {
if (basename($_SERVER['PHP_SELF']) == 'kb_documents.php') {
$show_chat = true;
}
} else {
$show_chat = true;
}
// Show chat only for non-admin users (clients)
$show_chat = isset($_SESSION['user_id']) && (!isset($_SESSION['user_role']) || $_SESSION['user_role'] !== 'admin');
if ($show_chat):
?>
@ -191,6 +185,5 @@ if ($show_chat):
</script>
<?php endif; ?>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -55,10 +55,10 @@ $current_lang = get_lang();
</li>
<?php endif; ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<a class="nav-link dropdown-toggle" href="#" id="profileDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-person-circle"></i> <?= t('header_welcome') ?>, <?= isset($_SESSION['username']) ? htmlspecialchars($_SESSION['username']) : '' ?>
</a>
<ul class="dropdown-menu dropdown-menu-end">
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="profileDropdown">
<li><a class="dropdown-item p-2" href="<?php echo BASE_URL; ?>profile.php"><?= t('menu_profile') ?></a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item p-2" href="<?php echo BASE_URL; ?>logout.php"><?= t('menu_logout') ?></a></li>
@ -69,7 +69,7 @@ $current_lang = get_lang();
<i class="bi bi-globe"></i> <?= strtoupper($current_lang) ?>
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="langDropdown">
<?php
<?php
$uri = $_SERVER['REQUEST_URI'];
$url_parts = parse_url($uri);
$path = $url_parts['path'];
@ -86,8 +86,8 @@ $current_lang = get_lang();
$url_pl = $path . '?' . http_build_query($query_params_pl);
$url_en = $path . '?' . http_build_query($query_params_en);
?>
<li><a class="dropdown-item<?php if ($current_lang === 'pl') echo ' active'; ?>" href="<?= $url_pl ?>">Polski (PL)</a></li>
<li><a class="dropdown-item<?php if ($current_lang === 'en') echo ' active'; ?>" href="<?= $url_en ?>">English (EN)</a></li>
<li><a class="dropdown-item p-2<?php if ($current_lang === 'pl') echo ' active'; ?>" href="<?= $url_pl ?>">Polski (PL)</a></li>
<li><a class="dropdown-item p-2<?php if ($current_lang === 'en') echo ' active'; ?>" href="<?= $url_en ?>">English (EN)</a></li>
</ul>
</li>
</ul>

View File

@ -5,10 +5,10 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= htmlspecialchars($page_title ?? t('app_title')) ?> - <?= t('app_title') ?></title>
<!-- SEO Meta Tags -->
<meta name="description" content="<?= htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'A B2B E-commerce Platform') ?>">
<!-- Open Graph / Twitter Meta Tags (managed by the platform) -->
<meta property="og:title" content="<?= htmlspecialchars($page_title ?? t('app_title')) ?>">
<meta property="og:description" content="<?= htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'A B2B E-commerce Platform') ?>">
@ -20,13 +20,22 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
<!-- Bootstrap 5.3 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time() ?>">
<!-- JQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Bootstrap 5.3 JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>