Files
2026-02-17 09:29:34 -06:00

89 lines
4.1 KiB
PHP

<?php // phpcs:ignoreFile
$pageTitle = $pageTitle ?? 'LASUCA Controls';
$pageSubtitle = $pageSubtitle ?? 'Real-time operations dashboard';
$pageDescription = $pageDescription ?? 'Monitoring suite for mill, boilers, and fabrication systems.';
$layoutWithoutSidebar = $layoutWithoutSidebar ?? false;
$layoutReturnUrl = $layoutReturnUrl ?? null;
$layoutReturnLabel = $layoutReturnLabel ?? 'Back to overview';
$layoutCloseWindowLabel = $layoutCloseWindowLabel ?? null;
$shellClasses = 'app-shell' . ($layoutWithoutSidebar ? ' app-shell--no-sidebar' : '');
$assetVersion = $assetVersion ?? '2025.10.06.3';
$assetBasePath = $assetBasePath ?? '';
if ($assetBasePath !== '' && substr($assetBasePath, -1) !== '/') {
$assetBasePath .= '/';
}
// Fetch crop day stats for header display
$headerCropDay = null;
$headerPassedHours = null;
$headerRemainingHours = null;
$cropDayFile = __DIR__ . '/../../includes/cropday.php';
$passedHoursFile = __DIR__ . '/../../includes/passedhours.php';
$remainingHoursFile = __DIR__ . '/../../includes/remaininghours.php';
if (is_file($cropDayFile)) {
ob_start();
include $cropDayFile;
$headerCropDay = trim(ob_get_clean());
}
if (is_file($passedHoursFile)) {
ob_start();
include $passedHoursFile;
$headerPassedHours = trim(ob_get_clean());
}
if (is_file($remainingHoursFile)) {
ob_start();
include $remainingHoursFile;
$headerRemainingHours = trim(ob_get_clean());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<?php echo htmlspecialchars($pageDescription); ?>">
<title><?php echo htmlspecialchars($pageTitle); ?> | LASUCA Controls</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&display=swap" rel="stylesheet">
<link rel="stylesheet" href="<?php echo htmlspecialchars($assetBasePath); ?>style.css?v=<?php echo rawurlencode($assetVersion); ?>">
</head>
<body>
<div class="<?php echo $shellClasses; ?>">
<header class="app-header">
<div class="app-header__inner">
<div class="branding">
<h1><?php echo htmlspecialchars($pageTitle); ?></h1>
<?php if (!empty($pageSubtitle)) : ?>
<p><?php echo htmlspecialchars($pageSubtitle); ?></p>
<?php endif; ?>
<div class="header-stats">
<span class="header-stat"><strong>Crop Day:</strong> <?php echo $headerCropDay ?: '—'; ?></span>
<span class="header-stat"><strong>Hours Passed:</strong> <?php echo $headerPassedHours ? number_format((float)$headerPassedHours, 1) : '—'; ?></span>
<span class="header-stat"><strong>Hours Remaining:</strong> <?php echo $headerRemainingHours ? number_format((float)$headerRemainingHours, 1) : '—'; ?></span>
</div>
</div>
<div class="header-actions">
<?php include __DIR__ . '/../../darkmode.php'; ?>
<?php if ($layoutWithoutSidebar && $layoutCloseWindowLabel) : ?>
<button type="button" class="button button--ghost" onclick="window.close();">
<?php echo htmlspecialchars($layoutCloseWindowLabel); ?>
</button>
<?php elseif ($layoutWithoutSidebar && $layoutReturnUrl) : ?>
<a class="button button--ghost" href="<?php echo htmlspecialchars($layoutReturnUrl); ?>">
← <?php echo htmlspecialchars($layoutReturnLabel); ?>
</a>
<?php elseif (!$layoutWithoutSidebar) : ?>
<button type="button" data-menu-toggle aria-expanded="false" aria-label="Toggle navigation">
<span aria-hidden="true">☰</span>
</button>
<?php endif; ?>
</div>
</div>
</header>
<main class="app-layout">
<div class="app-layout__inner">