Files
controls-web/controls-rework/overviews/data/tanklevelswrap.php
2026-02-17 09:29:34 -06:00

60 lines
3.1 KiB
PHP

<?php
// phpcs:ignoreFile
declare(strict_types=1);
include __DIR__ . '/../../items.php';
require_once __DIR__ . '/module-helpers.php';
$syrupOverflow = module_numeric($value['Syrup Overflow Lvl'] ?? null) ?? 0.0;
$syrupRcvr = module_numeric($value['Syrup RCVR'] ?? null) ?? 0.0;
$totalSyrup = ($syrupOverflow * 0.82569) + ($syrupRcvr * 0.17431);
$tanks = [
['label' => 'Juice Tank 1', 'value' => module_numeric($value['Juice Tank1'] ?? null)],
['label' => 'Juice Tank 2', 'value' => module_numeric($value['Juice Tank2'] ?? null)],
['label' => 'Syrup Receiver', 'value' => module_numeric($value['Syrup RCVR'] ?? null)],
['label' => 'Syrup Overflow', 'value' => module_numeric($value['Syrup Overflow Lvl'] ?? null)],
['label' => 'Total Syrup', 'value' => module_numeric($totalSyrup)],
['label' => 'Condensate Water', 'value' => module_numeric($value['CondensateWater'] ?? null)],
['label' => 'Sweet Water', 'value' => module_numeric($value['SweetwaterTank'] ?? null)],
['label' => 'Cold Water Injection', 'value' => module_numeric($value['Cold Water Injection LVL'] ?? null)],
['label' => 'A1 Receiver', 'value' => module_numeric($value['A1 RCVR'] ?? null)],
['label' => 'A1 Overflow', 'value' => module_numeric($value['A1 Molasses Overflow Lvl'] ?? null)],
['label' => 'A2 Receiver', 'value' => module_numeric($value['A2 RCVR'] ?? null)],
['label' => 'A2 Overflow', 'value' => module_numeric($value['A2 Molasses Overflow Lvl'] ?? null)],
['label' => 'B Receiver', 'value' => module_numeric($value['B RCVR'] ?? null)],
['label' => 'B Overflow', 'value' => module_numeric($value['B Molasses Overflow Lvl'] ?? null)],
['label' => 'Flash Tank', 'value' => module_numeric($value['FlashTankLVL'] ?? null)],
];
$tankGroups = array_chunk($tanks, (int) ceil(count($tanks) / 2));
?>
<section class="module-card module-card--tight">
<div class="module-heading">
<h2 class="module-heading__title">Tank Levels (Stacked)</h2>
<span class="module-heading__meta">Combined juice, syrup, water, and molasses storage</span>
</div>
<div class="module-grid module-grid--two">
<?php foreach ($tankGroups as $group) : ?>
<div class="module-stack">
<?php foreach ($group as $tank) : ?>
<?php $percent = module_clamp_percent($tank['value']); ?>
<div class="module-subcard module-subcard--compact">
<div class="module-row">
<span class="module-row__label"><?php echo module_html($tank['label']); ?></span>
<span class="module-row__value"><?php echo module_number($tank['value'], 0); ?>%</span>
</div>
<div class="module-progress">
<div class="module-bar">
<div class="module-bar__fill" style="width: <?php echo number_format($percent, 2); ?>%;"></div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
</section>