<?php

use App\Models\Point;

$category = 'VITALS';
$endPoint = 'upsertNoteSingleton';

$vitalLabels = [
    "heightInInches" => "Ht. (in.)",
    "weightPounds" => "Wt. (lbs.)",
    "lastVitaminDCheck" => "Last Vit. D Check",
    "ethnicity" => "Eth.",
    "has_htn" => "HTN?",
    "has_diabetes" => "DM?",
    "has_copd" => "COPD?",
    "has_arthritis" => "Arthritis?",
    "temperatureF" => "Temp. (F)",
    "systolicBP" => "SBP",
    "diastolicBP" => "DBP",
    "pulseRatePerMinute" => "Pulse",
    "respirationRatePerMinute" => "Resp.",
    "pulseOx" => "Pulse Ox.",
    "smokingStatus" => "Smoking Status",
    "bmi" => "BMI (kg/m²)",
];

$contentData = null;
if (!!@$point->data) {
    $contentData = json_decode($point->data, true);
}
?>

<div class="row">
@foreach ($vitalLabels as $k => $v)
<div class="col-5 vital-item align-items-center mr-3">
    @if($contentData && @$contentData['date'])
        <span class="content-html text-nowrap">
            <?php $vital = @$contentData[$k]; ?>
            @if($k === 'sbp')
                <span>Blood Pressure:</span>
                <b>{{ @$contentData['sbp'] ?: '-' }} / {{ @$contentData['dbp'] ?: '-' }}</b>
            @elseif($k === 'dbp') <!--ignore-->

            @else
                <span>{{$v}}:</span>
                <b>{{ !empty($vital) ? $vital : '-' }}</b>
            @endif
            @if($k === 'bmi' && !empty($vital))
                <?php $bmi = floatval($vital); ?>
                <span class="ml-2 py-1 m-0 font-weight-bold">
                     @if($bmi < 18.5)
                        <span class="text-sm text-warning-mellow">(Underweight)</span>
                    @endif
                    @if($bmi >= 18.5 && $bmi < 25)
                         <!--<span class="text-sm text-success">(Healthy Weight)</span>-->
                    @endif
                    @if($bmi >= 25 && $bmi < 30)
                        <span class="text-sm text-warning-mellow">(Overweight)</span>
                    @endif
                    @if($bmi >= 30)
                        <span class="text-sm text-warning-mellow">(Obese)</span>
                    @endif
                </span>
            @endif
        </span>
    @endif
</div>
@endforeach
</div>

