<?php
require_once __DIR__ . '/../lib/core.php';
dc_require_login();

$stmt = dc_db()->prepare('SELECT d.*, c.code category_code, c.name category_name, p.project_number, p.client_name, p.site_location
    FROM door_cert_doors d
    JOIN door_cert_categories c ON c.id = d.category_id
    JOIN door_cert_projects p ON p.id = d.project_id
    WHERE d.id = ?');
$stmt->execute(array((int)$_GET['id']));
$door = $stmt->fetch();
if (!$door) {
    exit('Door not found.');
}

dc_admin_header('Door Label');
?>
<div class="dc-card dc-no-print">
  <p>Download the artwork for hard printing.</p>
  <a class="dc-btn" href="label-download.php?id=<?php echo (int)$door['id']; ?>">Download Label Artwork</a>
  <a class="dc-btn secondary" href="label-download.php?id=<?php echo (int)$door['id']; ?>&format=pdf">Download Label PDF</a>
  <!--<a class="dc-btn" href="label-word.php?id=<?php echo (int)$door['id']; ?>">Download Word Label</a>-->
  <a class="dc-btn light" href="doors.php">Back to Doors</a>
</div>
<?php echo dc_label_preview_html($door); ?>
<?php dc_footer(); ?>
