ENG v2
This commit is contained in:
parent
11f95cfd4b
commit
55a70dfb41
@ -3,6 +3,7 @@ session_start();
|
|||||||
require_once __DIR__ . '/../includes/auth.php';
|
require_once __DIR__ . '/../includes/auth.php';
|
||||||
require_once __DIR__ . '/../includes/helpers.php';
|
require_once __DIR__ . '/../includes/helpers.php';
|
||||||
require_role('admin');
|
require_role('admin');
|
||||||
|
require_once __DIR__ . '/../includes/i18n.php';
|
||||||
|
|
||||||
$pdo = db();
|
$pdo = db();
|
||||||
|
|
||||||
@ -329,9 +330,9 @@ $page_title = $product['id'] ? 'Edytuj produkt' : 'Dodaj produkt';
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="unit" class="form-label">Jednostka miary</label>
|
<label for="unit" class="form-label">Jednostka miary</label>
|
||||||
<select name="unit" id="unit" class="form-select">
|
<select name="unit" id="unit" class="form-select">
|
||||||
<option value="szt" <?= ($product['unit'] ?? 'szt') === 'szt' ? 'selected' : '' ?>>sztuka</option>
|
<option value="szt" <?= ($product['unit'] ?? 'szt') === 'szt' ? 'selected' : '' ?>><?= t('szt') ?></option>
|
||||||
<option value="mb" <?= ($product['unit'] ?? 'szt') === 'mb' ? 'selected' : '' ?>>mb</option>
|
<option value="mb" <?= ($product['unit'] ?? 'szt') === 'mb' ? 'selected' : '' ?>><?= t('mb') ?></option>
|
||||||
<option value="m2" <?= ($product['unit'] ?? 'szt') === 'm2' ? 'selected' : '' ?>>m2</option>
|
<option value="m2" <?= ($product['unit'] ?? 'szt') === 'm2' ? 'selected' : '' ?>><?= t('m2') ?></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|||||||
170
checkout.php
170
checkout.php
@ -1,10 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
if (session_status() === PHP_SESSION_NONE) {
|
require_once __DIR__ . '/includes/init.php';
|
||||||
session_start();
|
|
||||||
}
|
|
||||||
require_once 'includes/auth.php';
|
|
||||||
require_login();
|
require_login();
|
||||||
require_once 'includes/helpers.php';
|
|
||||||
|
|
||||||
$cart = $_SESSION['cart'] ?? [];
|
$cart = $_SESSION['cart'] ?? [];
|
||||||
$cart_products = [];
|
$cart_products = [];
|
||||||
@ -65,107 +61,89 @@ if (!empty($cart)) {
|
|||||||
$delivery_source = $is_supplier_delivery ? 'supplier' : 'cs';
|
$delivery_source = $is_supplier_delivery ? 'supplier' : 'cs';
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
die('Błąd połączenia z bazą danych: ' . $e->getMessage());
|
die(t('db_error_generic') . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$page_title = 'Podsumowanie zamówienia';
|
$page_title = t('checkout_title');
|
||||||
$user_role = get_user_role();
|
|
||||||
|
|
||||||
|
require_once __DIR__ . '/includes/html_head.php';
|
||||||
|
require_once __DIR__ . '/includes/header.php';
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="pl">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title><?php echo htmlspecialchars($page_title); ?> - ExtraB2B</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php require_once 'includes/header.php'; ?>
|
|
||||||
|
|
||||||
<main class="container my-5">
|
<main class="container my-5">
|
||||||
<h1 class="mb-4">Podsumowanie zamówienia</h1>
|
<h1 class="mb-4"><?= t('checkout_title') ?></h1>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Twoje zamówienie</div>
|
<div class="card-header"><?= t('your_order') ?></div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?= t('product') ?></th>
|
||||||
|
<th><?= t('quantity') ?></th>
|
||||||
|
<th><?= t('price_net') ?></th>
|
||||||
|
<th><?= t('price_gross') ?></th>
|
||||||
|
<th><?= t('total_gross') ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($cart_products as $item): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Produkt</th>
|
<td><?= htmlspecialchars($item['name']) ?></td>
|
||||||
<th>Ilość</th>
|
<td><?= $item['quantity'] ?></td>
|
||||||
<th>Cena netto</th>
|
<td><?= number_format($item['price_net'], 2, ',', ' ') ?> zł</td>
|
||||||
<th>Cena brutto</th>
|
<td><?= number_format($item['price_gross'], 2, ',', ' ') ?> zł</td>
|
||||||
<th>Suma (brutto)</th>
|
<td><?= number_format($item['line_total'], 2, ',', ' ') ?> zł</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
<?php endforeach; ?>
|
||||||
<tbody>
|
</tbody>
|
||||||
<?php foreach ($cart_products as $item): ?>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo htmlspecialchars($item['name']); ?></td>
|
<td colspan="4" class="text-end"><strong><?= t('total_gross') ?>:</strong></td>
|
||||||
<td><?php echo $item['quantity']; ?></td>
|
<td><strong><?= number_format($total_price, 2, ',', ' ') ?> zł</strong></td>
|
||||||
<td><?php echo number_format($item['price_net'], 2, ',', ' '); ?> zł</td>
|
</tr>
|
||||||
<td><?php echo number_format($item['price_gross'], 2, ',', ' '); ?> zł</td>
|
</tfoot>
|
||||||
<td><?php echo number_format($item['line_total'], 2, ',', ' '); ?> zł</td>
|
</table>
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td colspan="4" class="text-end"><strong>Suma (brutto):</strong></td>
|
|
||||||
<td><strong><?php echo number_format($total_price, 2, ',', ' '); ?> zł</strong></td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">Opcje dostawy i płatności</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="alert alert-secondary">
|
|
||||||
Źródło dostawy: <strong><?php echo ($delivery_source === 'cs') ? 'Magazyn Centralny' : 'Dostawca zewnętrzny'; ?></strong>
|
|
||||||
</div>
|
|
||||||
<?php if ($credit_info && $credit_info['credit_enabled']): ?>
|
|
||||||
<div class="alert alert-info">
|
|
||||||
Dostępny kredyt kupiecki: <strong><?php echo number_format($credit_info['credit_balance'], 2, ',', ' '); ?> zł</strong>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<form action="order_process.php" method="POST">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="payment_method" class="form-label">Metoda płatności</label>
|
|
||||||
<select class="form-select" id="payment_method" name="payment_method" required>
|
|
||||||
<option value="bank_transfer">Przelew bankowy</option>
|
|
||||||
<option value="online">Płatność online</option>
|
|
||||||
<?php if ($credit_info && $credit_info['credit_enabled'] && $credit_info['credit_balance'] >= $total_price): ?>
|
|
||||||
<option value="credit">Kredyt kupiecki</option>
|
|
||||||
<?php endif; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="notes" class="form-label">Uwagi do zamówienia</label>
|
|
||||||
<textarea class="form-control" id="notes" name="notes" rows="3"></textarea>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="total_amount" value="<?php echo $total_price; ?>">
|
|
||||||
<button type="submit" class="btn btn-primary w-100">Potwierdź zamówienie</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
<div class="col-md-4">
|
||||||
|
<div class="card">
|
||||||
<footer class="text-center py-4 mt-auto text-muted bg-light">
|
<div class="card-header"><?= t('delivery_payment_options') ?></div>
|
||||||
<div class="container">
|
<div class="card-body">
|
||||||
<p class="mb-0">© <?php echo date("Y"); ?> ExtraB2B. All Rights Reserved.</p>
|
<div class="alert alert-secondary">
|
||||||
|
<?= t('delivery_source') ?>: <strong><?= ($delivery_source === 'cs') ? t('central_warehouse') : t('external_supplier') ?></strong>
|
||||||
|
</div>
|
||||||
|
<?php if ($credit_info && $credit_info['credit_enabled']): ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<?= t('available_trade_credit') ?>: <strong><?= number_format($credit_info['credit_balance'], 2, ',', ' ') ?> zł</strong>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="order_process.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="payment_method" class="form-label"><?= t('payment_method') ?></label>
|
||||||
|
<select class="form-select" id="payment_method" name="payment_method" required>
|
||||||
|
<option value="bank_transfer"><?= t('payment_bank_transfer') ?></option>
|
||||||
|
<option value="online"><?= t('payment_online') ?></option>
|
||||||
|
<?php if ($credit_info && $credit_info['credit_enabled'] && $credit_info['credit_balance'] >= $total_price): ?>
|
||||||
|
<option value="credit"><?= t('payment_trade_credit') ?></option>
|
||||||
|
<?php endif; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="notes" class="form-label"><?= t('order_notes') ?></label>
|
||||||
|
<textarea class="form-control" id="notes" name="notes" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="total_amount" value="<?= $total_price ?>">
|
||||||
|
<button type="submit" class="btn btn-primary w-100"><?= t('confirm_order') ?></button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</div>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
</main>
|
||||||
</body>
|
|
||||||
</html>
|
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||||
|
|||||||
@ -121,6 +121,57 @@ $translations = [
|
|||||||
'total_gross_label' => 'Razem (brutto):',
|
'total_gross_label' => 'Razem (brutto):',
|
||||||
'proceed_to_checkout' => 'Przejdź do zamówienia',
|
'proceed_to_checkout' => 'Przejdź do zamówienia',
|
||||||
'db_connection_error' => 'Błąd połączenia z bazą danych: ',
|
'db_connection_error' => 'Błąd połączenia z bazą danych: ',
|
||||||
|
'price_per' => 'Cena za',
|
||||||
|
'price_per_unit' => 'Cena za j.m.',
|
||||||
|
'db_error_generic' => 'Błąd bazy danych',
|
||||||
|
'your_order' => 'Twoje zamówienie',
|
||||||
|
'delivery_payment_options' => 'Dostawa i płatność',
|
||||||
|
'delivery_source' => 'Źródło dostawy',
|
||||||
|
'central_warehouse' => 'Magazyn centralny',
|
||||||
|
'external_supplier' => 'Dostawca zewnętrzny',
|
||||||
|
'available_trade_credit' => 'Dostępny kredyt kupiecki',
|
||||||
|
'order_notes' => 'Uwagi do zamówienia',
|
||||||
|
'confirm_order' => 'Potwierdź zamówienie',
|
||||||
|
'unauthorized_order_view' => 'Nie masz uprawnień do przeglądania tego zamówienia.',
|
||||||
|
'order_not_found_or_unauthorized' => 'Nie znaleziono zamówienia lub nie masz do niego dostępu.',
|
||||||
|
'order_details_title' => 'Szczegóły zamówienia nr {order_id}',
|
||||||
|
'order_details_fallback_title' => 'Szczegóły zamówienia',
|
||||||
|
'back_to_orders' => 'Powrót do listy zamówień',
|
||||||
|
'summary' => 'Podsumowanie',
|
||||||
|
'notes' => 'Uwagi',
|
||||||
|
'order_details' => 'Szczegóły zamówienia',
|
||||||
|
'image' => 'Zdjęcie',
|
||||||
|
'unit_price_net' => 'Cena jedn. netto',
|
||||||
|
'unit_price_gross' => 'Cena jedn. brutto',
|
||||||
|
'back_to_product_list' => 'Powrót do listy produktów',
|
||||||
|
'product_thumbnail_alt' => 'Miniatura produktu',
|
||||||
|
'quantity_label' => 'Ilość',
|
||||||
|
'btn_add_to_cart' => 'Dodaj do koszyka',
|
||||||
|
'description_tab' => 'Opis',
|
||||||
|
'technical_data_tab' => 'Dane techniczne',
|
||||||
|
'documents_tab' => 'Dokumenty',
|
||||||
|
'related_products_tab' => 'Produkty powiązane',
|
||||||
|
'no_technical_data' => 'Brak danych technicznych.',
|
||||||
|
'no_documents' => 'Brak dokumentów.',
|
||||||
|
'no_related_products' => 'Brak produktów powiązanych.',
|
||||||
|
'error_client_id_not_found' => 'Nie znaleziono ID klienta w sesji.',
|
||||||
|
'error_fetching_orders' => 'Błąd podczas pobierania zamówień.',
|
||||||
|
'title_orders' => 'Zamówienia',
|
||||||
|
'order_history' => 'Historia zamówień',
|
||||||
|
'no_orders_yet' => 'Nie złożyłeś jeszcze żadnych zamówień.',
|
||||||
|
'btn_view_details' => 'Zobacz szczegóły',
|
||||||
|
'my_order_items' => 'Moje pozycje zamówień',
|
||||||
|
'order_id' => 'ID Zamówienia',
|
||||||
|
'last_updated' => 'Ostatnia aktualizacja',
|
||||||
|
'action' => 'Akcja',
|
||||||
|
'no_order_items_found' => 'Nie znaleziono żadnych pozycji zamówień.',
|
||||||
|
'save' => 'Zapisz',
|
||||||
|
'login_error' => 'Nieprawidłowy email lub hasło.',
|
||||||
|
'payment_method' => 'Metoda płatności',
|
||||||
|
'checkout_title' => 'Zamówienie',
|
||||||
|
'szt' => 'sztuka',
|
||||||
|
'mb' => 'metr bieżący',
|
||||||
|
'm2' => 'metr kwadratowy',
|
||||||
],
|
],
|
||||||
'en' => [
|
'en' => [
|
||||||
'login_header' => 'Login',
|
'login_header' => 'Login',
|
||||||
@ -239,6 +290,57 @@ $translations = [
|
|||||||
'total_gross_label' => 'Total (gross):',
|
'total_gross_label' => 'Total (gross):',
|
||||||
'proceed_to_checkout' => 'Proceed to checkout',
|
'proceed_to_checkout' => 'Proceed to checkout',
|
||||||
'db_connection_error' => 'Database connection error: ',
|
'db_connection_error' => 'Database connection error: ',
|
||||||
|
'price_per' => 'Price per',
|
||||||
|
'price_per_unit' => 'Price per unit',
|
||||||
|
'db_error_generic' => 'Database error',
|
||||||
|
'your_order' => 'Your order',
|
||||||
|
'delivery_payment_options' => 'Delivery and payment',
|
||||||
|
'delivery_source' => 'Delivery source',
|
||||||
|
'central_warehouse' => 'Central warehouse',
|
||||||
|
'external_supplier' => 'External supplier',
|
||||||
|
'available_trade_credit' => 'Available trade credit',
|
||||||
|
'order_notes' => 'Order notes',
|
||||||
|
'confirm_order' => 'Confirm order',
|
||||||
|
'unauthorized_order_view' => 'You are not authorized to view this order.',
|
||||||
|
'order_not_found_or_unauthorized' => 'Order not found or you are not authorized to view it.',
|
||||||
|
'order_details_title' => 'Order details {order_id}',
|
||||||
|
'order_details_fallback_title' => 'Order details',
|
||||||
|
'back_to_orders' => 'Back to orders',
|
||||||
|
'summary' => 'Summary',
|
||||||
|
'notes' => 'Notes',
|
||||||
|
'order_details' => 'Order details',
|
||||||
|
'image' => 'Image',
|
||||||
|
'unit_price_net' => 'Unit price net',
|
||||||
|
'unit_price_gross' => 'Unit price gross',
|
||||||
|
'back_to_product_list' => 'Back to product list',
|
||||||
|
'product_thumbnail_alt' => 'Product thumbnail',
|
||||||
|
'quantity_label' => 'Quantity',
|
||||||
|
'btn_add_to_cart' => 'Add to cart',
|
||||||
|
'description_tab' => 'Description',
|
||||||
|
'technical_data_tab' => 'Technical data',
|
||||||
|
'documents_tab' => 'Documents',
|
||||||
|
'related_products_tab' => 'Related products',
|
||||||
|
'no_technical_data' => 'No technical data available.',
|
||||||
|
'no_documents' => 'No documents available.',
|
||||||
|
'no_related_products' => 'No related products available.',
|
||||||
|
'error_client_id_not_found' => 'Client ID not found in session.',
|
||||||
|
'error_fetching_orders' => 'Error fetching orders.',
|
||||||
|
'title_orders' => 'Orders',
|
||||||
|
'order_history' => 'Order history',
|
||||||
|
'no_orders_yet' => 'You have no orders yet.',
|
||||||
|
'btn_view_details' => 'View details',
|
||||||
|
'my_order_items' => 'My order items',
|
||||||
|
'order_id' => 'Order ID',
|
||||||
|
'last_updated' => 'Last updated',
|
||||||
|
'action' => 'Action',
|
||||||
|
'no_order_items_found' => 'No order items found.',
|
||||||
|
'save' => 'Save',
|
||||||
|
'login_error' => 'Invalid email or password.',
|
||||||
|
'payment_method' => 'Payment method',
|
||||||
|
'checkout_title' => 'Checkout',
|
||||||
|
'szt' => 'piece',
|
||||||
|
'mb' => 'linear meter',
|
||||||
|
'm2' => 'square meter',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/init.php';
|
||||||
require_once __DIR__ . '/includes/html_head.php';
|
require_once __DIR__ . '/includes/html_head.php';
|
||||||
|
require_once __DIR__ . '/includes/header.php';
|
||||||
$page_title = t('catalog_title');
|
$page_title = t('catalog_title');
|
||||||
require_once 'includes/helpers.php';
|
require_once 'includes/helpers.php';
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
if (session_status() === PHP_SESSION_NONE) {
|
require_once __DIR__ . '/includes/init.php';
|
||||||
session_start();
|
|
||||||
}
|
|
||||||
require_once 'includes/auth.php';
|
|
||||||
require_login();
|
require_login();
|
||||||
require_once 'includes/helpers.php';
|
|
||||||
require_once 'includes/i18n.php';
|
|
||||||
|
|
||||||
$order_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
$order_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||||
if ($order_id === 0) {
|
if ($order_id === 0) {
|
||||||
@ -20,7 +15,7 @@ $order_items = [];
|
|||||||
$product_images = [];
|
$product_images = [];
|
||||||
|
|
||||||
if ($client_id === 0) {
|
if ($client_id === 0) {
|
||||||
$error_message = 'Brak uprawnień do wyświetlenia tego zamówienia.';
|
$error_message = t('unauthorized_order_view');
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$pdo = db();
|
$pdo = db();
|
||||||
@ -30,7 +25,7 @@ if ($client_id === 0) {
|
|||||||
$order = $stmt->fetch();
|
$order = $stmt->fetch();
|
||||||
|
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
$error_message = 'Nie znaleziono zamówienia lub nie masz do niego dostępu.';
|
$error_message = t('order_not_found_or_unauthorized');
|
||||||
} else {
|
} else {
|
||||||
$stmt = $pdo->prepare(
|
$stmt = $pdo->prepare(
|
||||||
'SELECT oi.*, p.name as product_name FROM order_items oi JOIN products p ON oi.product_id = p.id WHERE oi.order_id = ?'
|
'SELECT oi.*, p.name as product_name FROM order_items oi JOIN products p ON oi.product_id = p.id WHERE oi.order_id = ?'
|
||||||
@ -59,95 +54,77 @@ if ($client_id === 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$error_message = 'Błąd bazy danych. Prosimy spróbować ponownie później.';
|
$error_message = t('db_error_generic');
|
||||||
error_log($e->getMessage());
|
error_log($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$page_title = $order ? 'Szczegóły zamówienia #' . $order['id'] : 'Szczegóły zamówienia';
|
$page_title = $order ? str_replace('{order_id}', $order['id'], t('order_details_title')) : t('order_details_fallback_title');
|
||||||
$user_role = get_user_role();
|
|
||||||
|
|
||||||
|
require_once __DIR__ . '/includes/html_head.php';
|
||||||
|
require_once __DIR__ . '/includes/header.php';
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="<?= get_lang() ?>">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title><?php echo htmlspecialchars($page_title); ?> - B2B Commerce</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php require_once 'includes/header.php'; ?>
|
|
||||||
|
|
||||||
<main class="container my-5">
|
<main class="container my-5">
|
||||||
<?php if ($error_message): ?>
|
<?php if ($error_message): ?>
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
<i class="bi bi-exclamation-triangle-fill"></i> <?php echo htmlspecialchars($error_message); ?>
|
<i class="bi bi-exclamation-triangle-fill"></i> <?= htmlspecialchars($error_message) ?>
|
||||||
|
</div>
|
||||||
|
<a href="orders.php" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> <?= t('back_to_orders') ?></a>
|
||||||
|
<?php elseif ($order): ?>
|
||||||
|
<h1 class="mb-4"><?= htmlspecialchars($page_title) ?></h1>
|
||||||
|
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-header"><?= t('summary') ?></div>
|
||||||
|
<div class="card-body">
|
||||||
|
<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('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('notes') ?>:</strong> <?= nl2br(htmlspecialchars($order['notes'])) ?></p>
|
||||||
</div>
|
</div>
|
||||||
<a href="orders.php" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> Wróć do listy zamówień</a>
|
</div>
|
||||||
<?php elseif ($order): ?>
|
|
||||||
<h1 class="mb-4"><?php echo htmlspecialchars($page_title); ?></h1>
|
|
||||||
|
|
||||||
<div class="card mb-4">
|
<div class="card">
|
||||||
<div class="card-header">Podsumowanie</div>
|
<div class="card-header"><?= t('order_details') ?></div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p><strong>Data zamówienia:</strong> <?php echo date('d.m.Y H:i', strtotime($order['created_at'])); ?></p>
|
<table class="table">
|
||||||
<p><strong>Status:</strong> <span class="badge bg-info"><?php echo htmlspecialchars(t_status($order['status'])); ?></span></p>
|
<thead>
|
||||||
<p><strong>Metoda płatności:</strong> <?php echo htmlspecialchars(t_status($order['payment_method'])); ?></p>
|
<tr>
|
||||||
<p><strong>Suma (brutto):</strong> <?php echo number_format($order['total_amount'], 2, ',', ' '); ?> zł</p>
|
<th><?= t('image') ?></th>
|
||||||
<p><strong>Uwagi:</strong> <?php echo nl2br(htmlspecialchars($order['notes'])); ?></p>
|
<th><?= t('product') ?></th>
|
||||||
</div>
|
<th><?= t('unit_price_net') ?></th>
|
||||||
</div>
|
<th><?= t('unit_price_gross') ?></th>
|
||||||
|
<th><?= t('quantity') ?></th>
|
||||||
<div class="card">
|
<th><?= t('total_gross') ?></th>
|
||||||
<div class="card-header">Szczegóły zamówienia</div>
|
</tr>
|
||||||
<div class="card-body">
|
</thead>
|
||||||
<table class="table">
|
<tbody>
|
||||||
<thead>
|
<?php
|
||||||
|
$vatRate = 1.23;
|
||||||
|
foreach ($order_items as $item):
|
||||||
|
$image_url = $product_images[$item['product_id']] ?? 'https://placehold.co/100x100/EEE/31343C?text=' . urlencode(t('no_image_placeholder'));
|
||||||
|
$unit_price_gross = (float)$item['unit_price'];
|
||||||
|
$unit_price_net = $unit_price_gross / $vatRate;
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Zdjęcie</th>
|
<td><img src="<?= htmlspecialchars($image_url) ?>" alt="<?= htmlspecialchars($item['product_name']) ?>" style="width: 50px; height: 50px; object-fit: cover;"></td>
|
||||||
<th>Produkt</th>
|
<td><?= htmlspecialchars($item['product_name']) ?></td>
|
||||||
<th>Cena jedn. netto</th>
|
<td><?= number_format($unit_price_net, 2, ',', ' ') ?> zł</td>
|
||||||
<th>Cena jedn. brutto</th>
|
<td><?= number_format($unit_price_gross, 2, ',', ' ') ?> zł</td>
|
||||||
<th>Ilość</th>
|
<td><?= $item['quantity'] ?></td>
|
||||||
<th>Suma (brutto)</th>
|
<td><?= number_format($item['line_total'], 2, ',', ' ') ?> zł</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
<?php endforeach; ?>
|
||||||
<tbody>
|
</tbody>
|
||||||
<?php
|
</table>
|
||||||
$vatRate = 1.23;
|
|
||||||
foreach ($order_items as $item):
|
|
||||||
$image_url = $product_images[$item['product_id']] ?? 'https://placehold.co/100x100/EEE/31343C?text=' . urlencode('Brak zdjęcia');
|
|
||||||
$unit_price_gross = (float)$item['unit_price'];
|
|
||||||
$unit_price_net = $unit_price_gross / $vatRate;
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td><img src="<?php echo htmlspecialchars($image_url); ?>" alt="<?php echo htmlspecialchars($item['product_name']); ?>" style="width: 50px; height: 50px; object-fit: cover;"></td>
|
|
||||||
<td><?php echo htmlspecialchars($item['product_name']); ?></td>
|
|
||||||
<td><?php echo number_format($unit_price_net, 2, ',', ' '); ?> zł</td>
|
|
||||||
<td><?php echo number_format($unit_price_gross, 2, ',', ' '); ?> zł</td>
|
|
||||||
<td><?php echo $item['quantity']; ?></td>
|
|
||||||
<td><?php echo number_format($item['line_total'], 2, ',', ' '); ?> zł</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<a href="orders.php" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> Wróć do listy zamówień</a>
|
<a href="orders.php" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> <?= t('back_to_orders') ?></a>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="text-center py-4 mt-auto text-muted bg-light">
|
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||||
<div class="container">
|
|
||||||
<p class="mb-0">© <?php echo date("Y"); ?> powered by LEA24. All Rights Reserved.</p>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|||||||
@ -94,14 +94,14 @@ $page_title = htmlspecialchars($product['name']);
|
|||||||
<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"><?= htmlspecialchars(number_format($prices['gross'], 2, ',', ' ')) ?> zł <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"><?= htmlspecialchars(number_format($prices['net'], 2, ',', ' ')) ?> zł <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') ?>: <?= htmlspecialchars($product['unit']) ?></small>
|
<small class="text-muted"><?= t('price_per') ?>: <?= t(htmlspecialchars($product['unit'])) ?></small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form action="cart_actions.php" method="post" class="d-flex align-items-center">
|
<form action="cart_actions.php" method="post" class="d-flex align-items-center">
|
||||||
<input type="hidden" name="action" value="add">
|
<input type="hidden" name="action" value="add">
|
||||||
<input type="hidden" name="product_id" value="<?= $product['id'] ?>">
|
<input type="hidden" name="product_id" value="<?= $product['id'] ?>">
|
||||||
<div style="max-width: 200px;" class="me-3">
|
<div style="max-width: 200px;" class="me-3">
|
||||||
<label for="quantity" class="form-label"><?= t('quantity_label') ?> (<?= htmlspecialchars($product['unit']) ?>):</label>
|
<label for="quantity" class="form-label"><?= t('quantity_label') ?> (<?= t(htmlspecialchars($product['unit'])) ?>):</label>
|
||||||
<input type="number" id="quantity" name="quantity" class="form-control" value="1" min="1">
|
<input type="number" id="quantity" name="quantity" class="form-control" value="1" min="1">
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary mt-4">
|
<button type="submit" class="btn btn-primary mt-4">
|
||||||
|
|||||||
@ -100,7 +100,7 @@ $user_role = get_user_role();
|
|||||||
</a>
|
</a>
|
||||||
<p class="mb-1">
|
<p class="mb-1">
|
||||||
<?php if (!empty($product['unit'])): ?>
|
<?php if (!empty($product['unit'])): ?>
|
||||||
<small class="text-muted"><?= t('unit'); ?>: <?= htmlspecialchars($product['unit']); ?></small>
|
<small class="text-muted"><?= t('unit'); ?>: <?= t(htmlspecialchars($product['unit'])); ?></small>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user