<?php
/**
 * Acuparse - AcuRite Access/smartHUB and IP Camera Data Processing, Display, and Upload.
 * @copyright Copyright (C) 2015-2023 Maxwell Power
 * @author Maxwell Power <max@acuparse.com>
 * @link http://www.acuparse.com
 * @license AGPL-3.0+
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this code. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * File: src/fcn/weather/dashboard/rain.php
 * Get the dashboard rain HTML
 */

/**
 * @var object $config Global Config
 * @var object $wx Weather Values
 */

if ($wx->rainIN !== null) {
    ?>
    <section class="row">
        <div class="col">
            <h1><i class="wi wi-raindrops" aria-hidden="true"></i> Rain</h1>
            <ul class="list-unstyled">
                <li><h3>Fall Rate:</h3> <?php
                    if ($config->site->hide_alternate === 'false' || $config->site->hide_alternate === 'archive') {
                        $rain = ($config->site->imperial === true) ? "$wx->rainIN in/hr ($wx->rainMM mm/hr)" : "$wx->rainMM mm/hr ($wx->rainIN in/hr)";
                    } else {
                        $rain = ($config->site->imperial === true) ? "$wx->rainIN in/hr" : "$wx->rainMM mm/hr";
                    }
                    echo $rain; ?></li>
                <li><h3>Daily Total:</h3> <?php
                    if ($config->site->hide_alternate === 'false' || $config->site->hide_alternate === 'archive') {
                        $rain_today = ($config->site->imperial === true) ? "$wx->rainTotalIN_today in ($wx->rainTotalMM_today mm)" : "$wx->rainTotalMM_today mm ($wx->rainTotalIN_today in)";
                    } else {
                        $rain_today = ($config->site->imperial === true) ? "$wx->rainTotalIN_today in" : "$wx->rainTotalMM_today mm";
                    }
                    echo $rain_today; ?></li>
            </ul>
        </div>
    </section>
    <?php
}
