90 lines
4.5 KiB
PHP
90 lines
4.5 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
// Mock data for products. In a real app, this would come from a database.
|
|
$products = [
|
|
['id' => 1, 'name' => 'Avocado', 'calories' => 160, 'protein' => 2, 'carbs' => 9, 'fat' => 15],
|
|
['id' => 2, 'name' => 'Chicken Breast', 'calories' => 165, 'protein' => 31, 'carbs' => 0, 'fat' => 3.6],
|
|
['id' => 3, 'name' => 'Salmon Fillet', 'calories' => 208, 'protein' => 20, 'carbs' => 0, 'fat' => 13],
|
|
['id' => 4, 'name' => 'Brown Rice', 'calories' => 111, 'protein' => 2.6, 'carbs' => 23, 'fat' => 0.9],
|
|
['id' => 5, 'name' => 'Broccoli', 'calories' => 55, 'protein' => 3.7, 'carbs' => 11, 'fat' => 0.6],
|
|
['id' => 6, 'name' => 'Apple', 'calories' => 52, 'protein' => 0.3, 'carbs' => 14, 'fat' => 0.2],
|
|
['id' => 7, 'name' => 'Banana', 'calories' => 89, 'protein' => 1.1, 'carbs' => 23, 'fat' => 0.3],
|
|
['id' => 8, 'name' => 'Almonds', 'calories' => 579, 'protein' => 21, 'carbs' => 22, 'fat' => 49],
|
|
];
|
|
|
|
$projectName = $_SERVER['PROJECT_NAME'] ?? 'Sales & Nutrition';
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= htmlspecialchars($projectName) ?></title>
|
|
|
|
<?php
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Track your sales and product nutrition information easily.';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
?>
|
|
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="og:title" content="<?= htmlspecialchars($projectName) ?>" />
|
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="twitter:card" content="summary" />
|
|
<meta property="twitter:title" content="<?= htmlspecialchars($projectName) ?>" />
|
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<?php endif; ?>
|
|
|
|
<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="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="mobile-container">
|
|
<div class="background-gradient"></div>
|
|
<header class="app-header p-3 text-center">
|
|
<h1 class="h4 mb-0"><?= htmlspecialchars($projectName) ?></h1>
|
|
</header>
|
|
|
|
<main class="p-3">
|
|
<h2 class="h5 mb-3 text-white">Products</h2>
|
|
<div class="list-group">
|
|
<?php foreach ($products as $product): ?>
|
|
<?php
|
|
$imageUrl = 'https://picsum.photos/seed/' . $product['id'] . '/400/200';
|
|
// Note: The Pexels API integration can be used here for higher quality images.
|
|
// Example: $imageUrl = 'api/pexels.php?query=' . urlencode($product['name']);
|
|
?>
|
|
<div class="product-card mb-4" style="background-image: url('<?= $imageUrl ?>');">
|
|
<div class="card-overlay"></div>
|
|
<div class="card-content">
|
|
<h5 class="card-title"><?= htmlspecialchars($product['name']) ?></h5>
|
|
<p class="card-text"><?= (int)$product['calories'] ?> kcal</p>
|
|
<div class="d-flex gap-2 mt-2">
|
|
<span class="badge nutrient-badge">
|
|
Protein: <?= (float)$product['protein'] ?>g
|
|
</span>
|
|
<span class="badge nutrient-badge">
|
|
Carbs: <?= (float)$product['carbs'] ?>g
|
|
</span>
|
|
<span class="badge nutrient-badge">
|
|
Fat: <?= (float)$product['fat'] ?>g
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</main>
|
|
|
|
<a href="add_sale.php" class="fab">+</a>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|