ENG with EUR
This commit is contained in:
parent
041ee61691
commit
e78733efe8
@ -25,6 +25,9 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="attribute_keys.php">Atrybuty</a>
|
<a class="nav-link" href="attribute_keys.php">Atrybuty</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="settings.php">Ustawienia</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="navbar-nav ms-auto">
|
<ul class="navbar-nav ms-auto">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|||||||
82
admin/settings.php
Normal file
82
admin/settings.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../includes/init.php';
|
||||||
|
require_once __DIR__ . '/../includes/auth.php';
|
||||||
|
require_admin();
|
||||||
|
|
||||||
|
$db = db();
|
||||||
|
|
||||||
|
$rate = 0.23; // Default
|
||||||
|
$message = '';
|
||||||
|
|
||||||
|
// Fetch current rate
|
||||||
|
$stmt = $db->prepare("SELECT value FROM settings WHERE `key` = 'pln_to_eur_rate'");
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
if ($result) {
|
||||||
|
$rate = (float)$result['value'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle form submission
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
if (isset($_POST['pln_to_eur_rate'])) {
|
||||||
|
$new_rate = filter_input(INPUT_POST, 'pln_to_eur_rate', FILTER_VALIDATE_FLOAT);
|
||||||
|
|
||||||
|
if ($new_rate !== false && $new_rate > 0) {
|
||||||
|
$stmt = $db->prepare("UPDATE settings SET value = :value WHERE `key` = 'pln_to_eur_rate'");
|
||||||
|
$stmt->execute([':value' => $new_rate]);
|
||||||
|
|
||||||
|
// Verify update, or insert if it failed (e.g., key didn't exist)
|
||||||
|
if ($stmt->rowCount() === 0) {
|
||||||
|
$insert_stmt = $db->prepare("INSERT INTO settings (`key`, value) VALUES ('pln_to_eur_rate', :value)");
|
||||||
|
$insert_stmt->execute([':value' => $new_rate]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rate = $new_rate;
|
||||||
|
$message = 'Kurs został zaktualizowany.';
|
||||||
|
} else {
|
||||||
|
$message = 'Wprowadź poprawną wartość kursu (liczba większa od 0).';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$page_title = 'Ustawienia Walut';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php require_once __DIR__ . '/../includes/html_head.php'; ?>
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php require_once __DIR__ . '/../includes/footer.php'; ?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
9
cart.php
9
cart.php
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
|
require_once __DIR__ . '/includes/currency.php';
|
||||||
require_once __DIR__ . '/includes/html_head.php';
|
require_once __DIR__ . '/includes/html_head.php';
|
||||||
require_login();
|
require_login();
|
||||||
|
|
||||||
@ -75,8 +76,8 @@ $user_role = get_user_role();
|
|||||||
<?php foreach ($cart_products as $item): ?>
|
<?php foreach ($cart_products as $item): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= htmlspecialchars($item['name']) ?></td>
|
<td><?= htmlspecialchars($item['name']) ?></td>
|
||||||
<td><?= number_format($item['price_net'], 2, ',', ' ') ?> zł</td>
|
<td><?= format_money($item['price_net'], $_SESSION['lang'], $pdo) ?></td>
|
||||||
<td><?= number_format($item['price_gross'], 2, ',', ' ') ?> zł</td>
|
<td><?= format_money($item['price_gross'], $_SESSION['lang'], $pdo) ?></td>
|
||||||
<td>
|
<td>
|
||||||
<form action="cart_actions.php" method="POST" class="d-inline-flex align-items-center">
|
<form action="cart_actions.php" method="POST" class="d-inline-flex align-items-center">
|
||||||
<input type="hidden" name="action" value="update">
|
<input type="hidden" name="action" value="update">
|
||||||
@ -87,7 +88,7 @@ $user_role = get_user_role();
|
|||||||
<button type="submit" class="btn btn-secondary ms-2"><?= t('update_button') ?></button>
|
<button type="submit" class="btn btn-secondary ms-2"><?= t('update_button') ?></button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td><?= number_format($item['line_total'], 2, ',', ' ') ?> zł</td>
|
<td><?= format_money($item['line_total'], $_SESSION['lang'], $pdo) ?></td>
|
||||||
<td>
|
<td>
|
||||||
<form action="cart_actions.php" method="POST" class="d-inline">
|
<form action="cart_actions.php" method="POST" class="d-inline">
|
||||||
<input type="hidden" name="action" value="remove">
|
<input type="hidden" name="action" value="remove">
|
||||||
@ -102,7 +103,7 @@ $user_role = get_user_role();
|
|||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" class="text-end"><strong><?= t('total_gross_label') ?></strong></td>
|
<td colspan="4" class="text-end"><strong><?= t('total_gross_label') ?></strong></td>
|
||||||
<td colspan="2"><strong><?= number_format($total_price, 2, ',', ' ') ?> zł</strong></td>
|
<td colspan="2"><strong><?= format_money($total_price, $_SESSION['lang'], $pdo) ?></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
11
checkout.php
11
checkout.php
@ -69,6 +69,7 @@ $page_title = t('checkout_title');
|
|||||||
|
|
||||||
require_once __DIR__ . '/includes/html_head.php';
|
require_once __DIR__ . '/includes/html_head.php';
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
|
require_once __DIR__ . '/includes/currency.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<main class="container my-5">
|
<main class="container my-5">
|
||||||
@ -94,16 +95,16 @@ require_once __DIR__ . '/includes/header.php';
|
|||||||
<tr>
|
<tr>
|
||||||
<td><?= htmlspecialchars($item['name']) ?></td>
|
<td><?= htmlspecialchars($item['name']) ?></td>
|
||||||
<td><?= $item['quantity'] ?></td>
|
<td><?= $item['quantity'] ?></td>
|
||||||
<td><?= number_format($item['price_net'], 2, ',', ' ') ?> zł</td>
|
<td><?= format_money($item['price_net'], $_SESSION['lang'], $pdo) ?></td>
|
||||||
<td><?= number_format($item['price_gross'], 2, ',', ' ') ?> zł</td>
|
<td><?= format_money($item['price_gross'], $_SESSION['lang'], $pdo) ?></td>
|
||||||
<td><?= number_format($item['line_total'], 2, ',', ' ') ?> zł</td>
|
<td><?= format_money($item['line_total'], $_SESSION['lang'], $pdo) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" class="text-end"><strong><?= t('total_gross') ?>:</strong></td>
|
<td colspan="4" class="text-end"><strong><?= t('total_gross') ?>:</strong></td>
|
||||||
<td><strong><?= number_format($total_price, 2, ',', ' ') ?> zł</strong></td>
|
<td><strong><?= format_money($total_price, $_SESSION['lang'], $pdo) ?></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@ -119,7 +120,7 @@ require_once __DIR__ . '/includes/header.php';
|
|||||||
</div>
|
</div>
|
||||||
<?php if ($credit_info && $credit_info['credit_enabled']): ?>
|
<?php if ($credit_info && $credit_info['credit_enabled']): ?>
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<?= t('available_trade_credit') ?>: <strong><?= number_format($credit_info['credit_balance'], 2, ',', ' ') ?> zł</strong>
|
<?= t('available_trade_credit') ?>: <strong><?= format_money($credit_info['credit_balance'], $_SESSION['lang'], $pdo) ?></strong>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<form action="order_process.php" method="POST">
|
<form action="order_process.php" method="POST">
|
||||||
|
|||||||
8
db/migrations/027_create_settings_table.sql
Normal file
8
db/migrations/027_create_settings_table.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS `settings` (
|
||||||
|
`key` VARCHAR(64) PRIMARY KEY,
|
||||||
|
`value` VARCHAR(255) NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO `settings` (`key`, `value`)
|
||||||
|
SELECT 'pln_to_eur_rate', '0.23'
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'pln_to_eur_rate');
|
||||||
@ -54,3 +54,7 @@ function require_role($role) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function require_admin() {
|
||||||
|
require_role('admin');
|
||||||
|
}
|
||||||
|
|||||||
65
includes/currency.php
Normal file
65
includes/currency.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the PLN to EUR conversion rate from the database.
|
||||||
|
*
|
||||||
|
* @param PDO $db The database connection object.
|
||||||
|
* @return float The conversion rate. Defaults to 0.23 if not set or invalid.
|
||||||
|
*/
|
||||||
|
function get_pln_to_eur_rate(PDO $db): float {
|
||||||
|
static $rate = null;
|
||||||
|
|
||||||
|
if ($rate === null) {
|
||||||
|
try {
|
||||||
|
$stmt = $db->prepare("SELECT value FROM settings WHERE `key` = 'pln_to_eur_rate'");
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($result && is_numeric($result['value']) && $result['value'] > 0) {
|
||||||
|
$rate = (float)$result['value'];
|
||||||
|
} else {
|
||||||
|
$rate = 0.23; // Fallback default
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Log error if possible, for now just use fallback
|
||||||
|
error_log('Could not fetch PLN to EUR rate: ' . $e->getMessage());
|
||||||
|
$rate = 0.23;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a PLN amount to EUR.
|
||||||
|
*
|
||||||
|
* @param float $pln The amount in PLN.
|
||||||
|
* @param float $rate The PLN to EUR conversion rate.
|
||||||
|
* @return float The amount in EUR, rounded to 2 decimal places.
|
||||||
|
*/
|
||||||
|
function to_eur(float $pln, float $rate): float {
|
||||||
|
return round($pln * $rate, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats a money amount based on the language and converts to EUR if necessary.
|
||||||
|
*
|
||||||
|
* @param float|null $amountPLN The amount in PLN. Can be null.
|
||||||
|
* @param string $lang The current language code ('en', 'pl', etc.).
|
||||||
|
* @param PDO $db The database connection object.
|
||||||
|
* @return string The formatted money string. Returns an empty string or placeholder if amount is null.
|
||||||
|
*/
|
||||||
|
function format_money(?float $amountPLN, string $lang, PDO $db): string {
|
||||||
|
if ($amountPLN === null) {
|
||||||
|
return '-'; // Or some other placeholder for null values
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($lang === 'en') {
|
||||||
|
$rate = get_pln_to_eur_rate($db);
|
||||||
|
$eur = to_eur($amountPLN, $rate);
|
||||||
|
return '€' . number_format($eur, 2, '.', ',');
|
||||||
|
} else {
|
||||||
|
// Default to Polish PLN format
|
||||||
|
return number_format($amountPLN, 2, ',', ' ') . ' zł';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -76,6 +76,7 @@ $translations = [
|
|||||||
'payment_bank_transfer' => 'Przelew tradycyjny',
|
'payment_bank_transfer' => 'Przelew tradycyjny',
|
||||||
'payment_online' => 'Płatność online (Przelewy24)',
|
'payment_online' => 'Płatność online (Przelewy24)',
|
||||||
'payment_credit' => 'Kredyt kupiecki',
|
'payment_credit' => 'Kredyt kupiecki',
|
||||||
|
'payment_trade_credit' => 'Kredyt kupiecki (faktura z odroczonym terminem płatności)',
|
||||||
'order_confirmation_thank_you' => 'Dziękujemy za złożenie zamówienia.',
|
'order_confirmation_thank_you' => 'Dziękujemy za złożenie zamówienia.',
|
||||||
'order_confirmation_order_number' => 'Numer Twojego zamówienia to',
|
'order_confirmation_order_number' => 'Numer Twojego zamówienia to',
|
||||||
'order_confirmation_track_status' => 'Możesz śledzić jego status w panelu',
|
'order_confirmation_track_status' => 'Możesz śledzić jego status w panelu',
|
||||||
@ -172,6 +173,8 @@ $translations = [
|
|||||||
'szt' => 'sztuka',
|
'szt' => 'sztuka',
|
||||||
'mb' => 'metr bieżący',
|
'mb' => 'metr bieżący',
|
||||||
'm2' => 'metr kwadratowy',
|
'm2' => 'metr kwadratowy',
|
||||||
|
'login_email' => 'Adres e-mail',
|
||||||
|
'login_password' => 'Hasło',
|
||||||
],
|
],
|
||||||
'en' => [
|
'en' => [
|
||||||
'login_header' => 'Login',
|
'login_header' => 'Login',
|
||||||
@ -245,6 +248,7 @@ $translations = [
|
|||||||
'payment_bank_transfer' => 'Bank transfer',
|
'payment_bank_transfer' => 'Bank transfer',
|
||||||
'payment_online' => 'Online payment (Przelewy24)',
|
'payment_online' => 'Online payment (Przelewy24)',
|
||||||
'payment_credit' => 'Trade credit',
|
'payment_credit' => 'Trade credit',
|
||||||
|
'payment_trade_credit' => 'Trade credit (invoice with deferred payment)',
|
||||||
'order_confirmation_thank_you' => 'Thank you for your order.',
|
'order_confirmation_thank_you' => 'Thank you for your order.',
|
||||||
'order_confirmation_order_number' => 'Your order number is',
|
'order_confirmation_order_number' => 'Your order number is',
|
||||||
'order_confirmation_track_status' => 'You can track its status in the',
|
'order_confirmation_track_status' => 'You can track its status in the',
|
||||||
@ -341,6 +345,8 @@ $translations = [
|
|||||||
'szt' => 'piece',
|
'szt' => 'piece',
|
||||||
'mb' => 'linear meter',
|
'mb' => 'linear meter',
|
||||||
'm2' => 'square meter',
|
'm2' => 'square meter',
|
||||||
|
'login_email' => 'Email',
|
||||||
|
'login_password' => 'Password',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/init.php';
|
require_once __DIR__ . '/includes/init.php';
|
||||||
|
require_once __DIR__ . '/includes/currency.php';
|
||||||
require_once __DIR__ . '/includes/html_head.php';
|
require_once __DIR__ . '/includes/html_head.php';
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
$page_title = t('catalog_title');
|
$page_title = t('catalog_title');
|
||||||
@ -76,8 +77,8 @@ try {
|
|||||||
echo htmlspecialchars(strlen($desc) > 100 ? substr($desc, 0, 100) . '...' : $desc);
|
echo htmlspecialchars(strlen($desc) > 100 ? substr($desc, 0, 100) . '...' : $desc);
|
||||||
?></p>
|
?></p>
|
||||||
<div class="mt-auto">
|
<div class="mt-auto">
|
||||||
<p class="card-text text-muted small mb-0"><?= htmlspecialchars(number_format($prices['net'], 2, ',', ' ')) ?> zł <?= t('net') ?></p>
|
<p class="card-text text-muted small mb-0"><?= format_money($prices['net'], $_SESSION['lang'], $pdo) ?> <?= t('net') ?></p>
|
||||||
<p class="card-text fw-bold fs-5"><?= htmlspecialchars(number_format($prices['gross'], 2, ',', ' ')) ?> zł <?= t('gross') ?></p>
|
<p class="card-text fw-bold fs-5"><?= format_money($prices['gross'], $_SESSION['lang'], $pdo) ?> <?= t('gross') ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer bg-white border-top-0 pb-3">
|
<div class="card-footer bg-white border-top-0 pb-3">
|
||||||
@ -120,8 +121,8 @@ try {
|
|||||||
</a>
|
</a>
|
||||||
</h6>
|
</h6>
|
||||||
<div class="mt-auto">
|
<div class="mt-auto">
|
||||||
<p class="card-text text-muted small mb-0"><?= htmlspecialchars(number_format($prices['net'], 2, ',', ' ')) ?> zł <?= t('net') ?></p>
|
<p class="card-text text-muted small mb-0"><?= format_money($prices['net'], $_SESSION['lang'], $pdo) ?> <?= t('net') ?></p>
|
||||||
<p class="card-text fw-bold"><?= htmlspecialchars(number_format($prices['gross'], 2, ',', ' ')) ?> zł <?= t('gross') ?></p>
|
<p class="card-text fw-bold"><?= format_money($prices['gross'], $_SESSION['lang'], $pdo) ?> <?= t('gross') ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer bg-white border-top-0 pb-3">
|
<div class="card-footer bg-white border-top-0 pb-3">
|
||||||
|
|||||||
@ -63,6 +63,7 @@ $page_title = $order ? str_replace('{order_id}', $order['id'], t('order_details_
|
|||||||
|
|
||||||
require_once __DIR__ . '/includes/html_head.php';
|
require_once __DIR__ . '/includes/html_head.php';
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
|
require_once __DIR__ . '/includes/currency.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<main class="container my-5">
|
<main class="container my-5">
|
||||||
@ -80,7 +81,7 @@ require_once __DIR__ . '/includes/header.php';
|
|||||||
<p><strong><?= t('order_date') ?>:</strong> <?= date('d.m.Y H:i', strtotime($order['created_at'])) ?></p>
|
<p><strong><?= t('order_date') ?>:</strong> <?= date('d.m.Y H:i', strtotime($order['created_at'])) ?></p>
|
||||||
<p><strong><?= t('status') ?>:</strong> <span class="badge bg-info"><?= htmlspecialchars(t_status($order['status'])) ?></span></p>
|
<p><strong><?= t('status') ?>:</strong> <span class="badge bg-info"><?= htmlspecialchars(t_status($order['status'])) ?></span></p>
|
||||||
<p><strong><?= t('payment_method') ?>:</strong> <?= htmlspecialchars(t_status($order['payment_method'])) ?></p>
|
<p><strong><?= t('payment_method') ?>:</strong> <?= htmlspecialchars(t_status($order['payment_method'])) ?></p>
|
||||||
<p><strong><?= t('total_gross') ?>:</strong> <?= number_format($order['total_amount'], 2, ',', ' ') ?> zł</p>
|
<p><strong><?= t('total_gross') ?>:</strong> <?= format_money($order['total_amount'], $_SESSION['lang'], $pdo) ?></p>
|
||||||
<p><strong><?= t('notes') ?>:</strong> <?= nl2br(htmlspecialchars($order['notes'])) ?></p>
|
<p><strong><?= t('notes') ?>:</strong> <?= nl2br(htmlspecialchars($order['notes'])) ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -110,10 +111,10 @@ require_once __DIR__ . '/includes/header.php';
|
|||||||
<tr>
|
<tr>
|
||||||
<td><img src="<?= htmlspecialchars($image_url) ?>" alt="<?= htmlspecialchars($item['product_name']) ?>" style="width: 50px; height: 50px; object-fit: cover;"></td>
|
<td><img src="<?= htmlspecialchars($image_url) ?>" alt="<?= htmlspecialchars($item['product_name']) ?>" style="width: 50px; height: 50px; object-fit: cover;"></td>
|
||||||
<td><?= htmlspecialchars($item['product_name']) ?></td>
|
<td><?= htmlspecialchars($item['product_name']) ?></td>
|
||||||
<td><?= number_format($unit_price_net, 2, ',', ' ') ?> zł</td>
|
<td><?= format_money($unit_price_net, $_SESSION['lang'], $pdo) ?></td>
|
||||||
<td><?= number_format($unit_price_gross, 2, ',', ' ') ?> zł</td>
|
<td><?= format_money($unit_price_gross, $_SESSION['lang'], $pdo) ?></td>
|
||||||
<td><?= $item['quantity'] ?></td>
|
<td><?= $item['quantity'] ?></td>
|
||||||
<td><?= number_format($item['line_total'], 2, ',', ' ') ?> zł</td>
|
<td><?= format_money($item['line_total'], $_SESSION['lang'], $pdo) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@ -23,6 +23,7 @@ if (!isset($_SESSION['client_id'])) {
|
|||||||
$page_title = t('title_orders');
|
$page_title = t('title_orders');
|
||||||
|
|
||||||
require_once 'includes/header.php';
|
require_once 'includes/header.php';
|
||||||
|
require_once 'includes/currency.php';
|
||||||
require_once 'includes/html_head.php';
|
require_once 'includes/html_head.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ require_once 'includes/html_head.php';
|
|||||||
<td>#<?= $order['id']; ?></td>
|
<td>#<?= $order['id']; ?></td>
|
||||||
<td><?= date('d.m.Y H:i', strtotime($order['created_at'])); ?></td>
|
<td><?= date('d.m.Y H:i', strtotime($order['created_at'])); ?></td>
|
||||||
<td><span class="badge bg-info"><?= htmlspecialchars(t_status($order['status'])); ?></span></td>
|
<td><span class="badge bg-info"><?= htmlspecialchars(t_status($order['status'])); ?></span></td>
|
||||||
<td><?= number_format($order['total_amount'], 2, ',', ' '); ?> zł</td>
|
<td><?= format_money($order['total_amount'], $_SESSION['lang'], $pdo) ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="order_details.php?id=<?= $order['id']; ?>" class="btn btn-sm btn-outline-primary">
|
<a href="order_details.php?id=<?= $order['id']; ?>" class="btn btn-sm btn-outline-primary">
|
||||||
<i class="bi bi-eye"></i> <?= t('btn_view_details') ?>
|
<i class="bi bi-eye"></i> <?= t('btn_view_details') ?>
|
||||||
|
|||||||
@ -8,6 +8,7 @@ require_once 'includes/helpers.php';
|
|||||||
|
|
||||||
// This line is now required at the top of pages that use the header.
|
// This line is now required at the top of pages that use the header.
|
||||||
require_once 'includes/i18n.php';
|
require_once 'includes/i18n.php';
|
||||||
|
require_once 'includes/currency.php';
|
||||||
|
|
||||||
$product_id = $_GET['id'] ?? null;
|
$product_id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
@ -91,8 +92,8 @@ $page_title = htmlspecialchars($product['name']);
|
|||||||
<h1 class="mb-3"><?= htmlspecialchars($product['name']) ?></h1>
|
<h1 class="mb-3"><?= htmlspecialchars($product['name']) ?></h1>
|
||||||
|
|
||||||
<div class="bg-light p-4 rounded mb-4">
|
<div class="bg-light p-4 rounded mb-4">
|
||||||
<p class="h4 fw-bold mb-1"><?= htmlspecialchars(number_format($prices['gross'], 2, ',', ' ')) ?> zł <span class="fs-6 fw-normal"><?= t('gross') ?></span></p>
|
<p class="h4 fw-bold mb-1"><?= format_money($prices['gross'], $_SESSION['lang'], $pdo) ?> <span class="fs-6 fw-normal"><?= t('gross') ?></span></p>
|
||||||
<p class="text-muted mb-0"><?= htmlspecialchars(number_format($prices['net'], 2, ',', ' ')) ?> zł <span class="fs-6 fw-normal"><?= t('net') ?></span></p>
|
<p class="text-muted mb-0"><?= format_money($prices['net'], $_SESSION['lang'], $pdo) ?> <span class="fs-6 fw-normal"><?= t('net') ?></span></p>
|
||||||
<hr class="my-2">
|
<hr class="my-2">
|
||||||
<small class="text-muted"><?= t('price_per') ?>: <?= t(htmlspecialchars($product['unit'])) ?></small>
|
<small class="text-muted"><?= t('price_per') ?>: <?= t(htmlspecialchars($product['unit'])) ?></small>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
|
require_once __DIR__ . '/includes/currency.php';
|
||||||
require_once __DIR__ . '/includes/html_head.php';
|
require_once __DIR__ . '/includes/html_head.php';
|
||||||
require_login();
|
require_login();
|
||||||
|
|
||||||
@ -71,8 +72,8 @@ $user_role = get_user_role();
|
|||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<div class="d-flex justify-content-end align-items-center">
|
<div class="d-flex justify-content-end align-items-center">
|
||||||
<div class="text-end">
|
<div class="text-end">
|
||||||
<p class="mb-0 h5"><strong><?= number_format($added_product_price['gross'], 2, ',', ' '); ?> zł</strong> <small><?= t('gross'); ?></small></p>
|
<p class="mb-0 h5"><strong><?= format_money($added_product_price['gross'], $_SESSION['lang'], $db) ?></strong> <small><?= t('gross'); ?></small></p>
|
||||||
<p class="mb-0 text-muted"><?= number_format($added_product_price['net'], 2, ',', ' '); ?> zł <small><?= t('net'); ?></small></p>
|
<p class="mb-0 text-muted"><?= format_money($added_product_price['net'], $_SESSION['lang'], $db) ?> <small><?= t('net'); ?></small></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -106,8 +107,8 @@ $user_role = get_user_role();
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="text-end">
|
<div class="text-end">
|
||||||
<p class="mb-0 h5"><strong><?= number_format($effective_price['gross'], 2, ',', ' '); ?> zł</strong> <small><?= t('gross'); ?></small></p>
|
<p class="mb-0 h5"><strong><?= format_money($effective_price['gross'], $_SESSION['lang'], $db) ?></strong> <small><?= t('gross'); ?></small></p>
|
||||||
<p class="mb-0 text-muted"><?= number_format($effective_price['net'], 2, ',', ' '); ?> zł <small><?= t('net'); ?></small></p>
|
<p class="mb-0 text-muted"><?= format_money($effective_price['net'], $_SESSION['lang'], $db) ?> <small><?= t('net'); ?></small></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user