- Split single-page into 3 pages: - index.php: product catalog with VM size cards - create.php: order form (name, domain, description) - requests.php: request history with pagination - Rewrite NetBox integration to create Virtual Machines (/virtualization/virtual-machines/) instead of DCIM devices - Add netbox_integration/netbox_api.php: NetBoxClient with createVirtualMachine(), findCluster(), findTag(), getList() - Generate new sleek product-card images (420x280) with aligned spec boxes (vcpus/ram/disk) - Add webshop CSS: product cards, nav links, hero section, order layout, responsive grid - Update redirects: send.php -> requests.php, cancel.php -> requests.php - Update E2E test for new page structure - Add .gitignore, deploy-local.sh, setup_database.sql to repo
59 lines
2.1 KiB
PHP
Executable File
59 lines
2.1 KiB
PHP
Executable File
<?php
|
|
require __DIR__ . '/config.php';
|
|
require_login();
|
|
|
|
$config = require __DIR__ . '/sizes.php';
|
|
$sizes = $config['sizes'];
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>VM Shop</title>
|
|
<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=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="/style.css">
|
|
</head>
|
|
<body>
|
|
<main class="shop-page">
|
|
<nav class="topbar">
|
|
<div>
|
|
<p class="eyebrow">Infrastructure Portal</p>
|
|
<h1>VM Shop</h1>
|
|
</div>
|
|
<div class="nav-links">
|
|
<a href="/index.php" class="nav-link active">Shop</a>
|
|
<a href="/requests.php" class="nav-link">My Requests</a>
|
|
<a class="link-button" href="/logout.php">← Logout</a>
|
|
</div>
|
|
</nav>
|
|
|
|
<section class="hero">
|
|
<h2>Choose your VM configuration</h2>
|
|
<p class="hero-sub">Pick a plan below to customize and submit your request.</p>
|
|
</section>
|
|
|
|
<section class="product-grid">
|
|
<?php foreach ($sizes as $key => $size): ?>
|
|
<article class="product-card">
|
|
<div class="product-media">
|
|
<img src="/vm_images/<?= h($key) ?>_vm.png" alt="<?= h($size['label']) ?>" loading="lazy">
|
|
</div>
|
|
<div class="product-body">
|
|
<h3><?= h($size['label']) ?></h3>
|
|
<ul class="product-specs">
|
|
<li><strong><?= h((string)$size['vcpus']) ?></strong> vCPU<?= $size['vcpus'] > 1 ? 's' : '' ?></li>
|
|
<li><strong><?= h((string)$size['ram_gb']) ?></strong> GB RAM</li>
|
|
<li><strong><?= h((string)$size['disk_gb']) ?></strong> GB Disk</li>
|
|
</ul>
|
|
<a class="btn btn-primary" href="/create.php?size=<?= h($key) ?>">Order <?= h($size['label']) ?></a>
|
|
</div>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</section>
|
|
</main>
|
|
</body>
|
|
</html>
|