<div id="sleep-apnea-background">

    <div class="d-flex px-3 py-2 bg-light align-items-baseline border-bottom">
        <h4 class="font-weight-bold text-nowrap m-0">Sleep Apnea Background</h4>
        <div moe center huge-1100 class="ml-3">
            <a start show href="#"><i class="fa fa-edit"></i> Edit</a>
            <form url="/api/client/updateSleepApneaBackground" hook="refreshSleepStudyStep">
                <input type="hidden" name="uid" value="{{$patient->uid}}">
                <div class="font-weight-bold font-size-14 text-secondary border-bottom px-2 pb-2 mb-2">Sleep Apnea Background</div>
                <div class="row mx-0">
                    <div class="col-5 px-0 pb-4">
                        <div class="px-3 pt-2 pb-1">
                            <span class="d-inline-block width-200px">Diagnosed with Sleep Apnea:</span>
                            <select name="hasSleepApneaDiagnosis" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                <option value="">-- select --</option>
                                <option value="CURRENTLY" {{$patient->has_sleep_apnea_diagnosis === 'CURRENTLY' ? 'selected' : ''}}>Currently</option>
                                <option value="PREVIOUSLY" {{$patient->has_sleep_apnea_diagnosis === 'PREVIOUSLY' ? 'selected' : ''}}>Previously</option>
                                <option value="NEVER" {{$patient->has_sleep_apnea_diagnosis === 'NEVER' ? 'selected' : ''}}>Never</option>
                                <option value="UNKNOWN" {{$patient->has_sleep_apnea_diagnosis === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                            </select>
                        </div>

                        <div class="px-3 py-1">
                            <span class="d-inline-block width-200px">Has CPAP Machine:</span>
                            <select name="hasCpapMachine" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                <option value="">-- select --</option>
                                <option value="CURRENTLY" {{$patient->has_cpap_machine === 'CURRENTLY' ? 'selected' : ''}}>Currently</option>
                                <option value="PREVIOUSLY" {{$patient->has_cpap_machine === 'PREVIOUSLY' ? 'selected' : ''}}>Previously</option>
                                <option value="NEVER" {{$patient->has_cpap_machine === 'NEVER' ? 'selected' : ''}}>Never</option>
                                <option value="UNKNOWN" {{$patient->has_cpap_machine === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                            </select>
                        </div>

                        <div class="px-3 py-1">
                            <span class="d-inline-block width-200px">Has Sleep Apnea Oral Appliance:</span>
                            <select name="hasSleepApneaOralAppliance" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                <option value="">-- select --</option>
                                <option value="CURRENTLY" {{$patient->has_sleep_apnea_oral_appliance === 'CURRENTLY' ? 'selected' : ''}}>Currently</option>
                                <option value="PREVIOUSLY" {{$patient->has_sleep_apnea_oral_appliance === 'PREVIOUSLY' ? 'selected' : ''}}>Previously</option>
                                <option value="NEVER" {{$patient->has_sleep_apnea_oral_appliance === 'NEVER' ? 'selected' : ''}}>Never</option>
                                <option value="UNKNOWN" {{$patient->has_sleep_apnea_oral_appliance === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                            </select>
                        </div>

                        <div class="px-3 py-1">
                            <span class="d-inline-block width-200px">Has Sleep Physician:</span>
                            <select name="hasSleepPhysician" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                <option value="">-- select --</option>
                                <option value="CURRENTLY" {{$patient->has_sleep_physician === 'CURRENTLY' ? 'selected' : ''}}>Currently</option>
                                <option value="PREVIOUSLY" {{$patient->has_sleep_physician === 'PREVIOUSLY' ? 'selected' : ''}}>Previously</option>
                                <option value="NEVER" {{$patient->has_sleep_physician === 'NEVER' ? 'selected' : ''}}>Never</option>
                                <option value="UNKNOWN" {{$patient->has_sleep_physician === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                            </select>
                        </div>

                        <div class="px-3 py-1">
                            <span class="d-inline-block width-200px">Has Sleep Dentist:</span>
                            <select name="hasSleepDentist" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                <option value="">-- select --</option>
                                <option value="CURRENTLY" {{$patient->has_sleep_dentist === 'CURRENTLY' ? 'selected' : ''}}>Currently</option>
                                <option value="PREVIOUSLY" {{$patient->has_sleep_dentist === 'PREVIOUSLY' ? 'selected' : ''}}>Previously</option>
                                <option value="NEVER" {{$patient->has_sleep_dentist === 'NEVER' ? 'selected' : ''}}>Never</option>
                                <option value="UNKNOWN" {{$patient->has_sleep_dentist === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                            </select>
                        </div>

                        <hr class="my-2">

                        <div class="px-3 py-1">
                            Has Had Home Sleep Study:
                            <select name="hasHadHomeSleepStudy" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                <option value="">-- select --</option>
                                <option value="YES" {{$patient->has_had_home_sleep_study === 'YES' ? 'selected' : ''}}>Yes</option>
                                <option value="NO" {{$patient->has_had_home_sleep_study === 'NO' ? 'selected' : ''}}>No</option>
                                <option value="UNKNOWN" {{$patient->has_had_home_sleep_study === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                            </select>
                        </div>
                        @if(1 || $patient->has_had_home_sleep_study === 'YES')
                            <div class="ml-3 border-left">
                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="width-150px mr-2">Memo</span>
                                    <input type="text" value="{{$patient->has_had_home_sleep_study_memo}}" name="hasHadHomeSleepStudyMemo" class="form-control form-control-sm d-inline-block flex-grow-1">
                                </div>
                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="width-150px mr-2">Findings</span>
                                    <input type="text" value="{{$patient->has_had_home_sleep_study_findings}}" name="hasHadHomeSleepStudyFindings" class="form-control form-control-sm d-inline-block flex-grow-1">
                                </div>
                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="width-150px mr-2">Approx. Date</span>
                                    <input type="date" value="{{$patient->has_had_home_sleep_study_approximate_date}}" name="hasHadHomeSleepStudyApproximateDate" class="form-control form-control-sm d-inline-block flex-grow-1">
                                </div>
                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="width-150px mr-2">Value As Of</span>
                                    <input type="date" value="{{$patient->has_had_home_sleep_study_value_as_of}}" name="hasHadHomeSleepStudyValueAsOf" class="form-control form-control-sm d-inline-block flex-grow-1">
                                </div>
                            </div>
                        @endif

                        <hr class="my-2">

                        <div class="px-3 py-1">
                            Has Had Lab Sleep Study:
                            <select name="hasHadLabSleepStudy" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                <option value="">-- select --</option>
                                <option value="YES" {{$patient->has_had_lab_sleep_study === 'YES' ? 'selected' : ''}}>Yes</option>
                                <option value="NO" {{$patient->has_had_lab_sleep_study === 'NO' ? 'selected' : ''}}>No</option>
                                <option value="UNKNOWN" {{$patient->has_had_lab_sleep_study === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                            </select>
                        </div>
                        @if(1 || $patient->has_had_lab_sleep_study === 'YES')
                            <div class="ml-3 border-left">
                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="width-150px mr-2">Memo</span>
                                    <input type="text" value="{{$patient->has_had_lab_sleep_study_memo}}" name="hasHadLabSleepStudyMemo" class="form-control form-control-sm d-inline-block flex-grow-1">
                                </div>
                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="width-150px mr-2">Findings</span>
                                    <input type="text" value="{{$patient->has_had_lab_sleep_study_findings}}" name="hasHadLabSleepStudyFindings" class="form-control form-control-sm d-inline-block flex-grow-1">
                                </div>
                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="width-150px mr-2">Approx. Date</span>
                                    <input type="date" value="{{$patient->has_had_lab_sleep_study_approximate_date}}" name="hasHadLabSleepStudyApproximateDate" class="form-control form-control-sm d-inline-block flex-grow-1">
                                </div>
                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="width-150px mr-2">Value As Of</span>
                                    <input type="date" value="{{$patient->has_had_lab_sleep_study_value_as_of}}" name="hasHadLabSleepStudyValueAsOf" class="form-control form-control-sm d-inline-block flex-grow-1">
                                </div>
                            </div>
                        @endif
                    </div>
                    <div class="col-7 border-left px-0 pb-4">
                        <div class="px-3 pt-2 pb-1 font-weight-bold text-secondary">STOPBANG Questionnaire</div>

                        <hr class="my-2">

                        <div class="px-3 py-1 d-flex align-items-baseline">
                            <span class="mr-3">Value As Of</span>
                            <input type="date" value="{{$patient->stop_bang_value_as_of}}" name="stopBangValueAsOf" class="form-control form-control-sm d-inline-block w-auto min-width-unset">
                        </div>

                        <hr class="my-2">

                        <div class="row mx-0">
                            <div class="col-6 px-0">
                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="mr-2 font-weight-bold">Snore:</span>
                                    <select name="stopBangSnore" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                        <option value="">-- select --</option>
                                        <option value="YES" {{$patient->stop_bang_snore === 'YES' ? 'selected' : ''}}>Yes</option>
                                        <option value="NO" {{$patient->stop_bang_snore === 'NO' ? 'selected' : ''}}>No</option>
                                        <option value="UNKNOWN" {{$patient->stop_bang_snore === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                                    </select>
                                </div>
                                <div class="">
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2">Memo</span>
                                        <input type="text" value="{{$patient->stop_bang_snore_memo}}" name="stopBangSnoreMemo" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                </div>

                                <hr class="my-2">

                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="mr-2 font-weight-bold">Tired:</span>
                                    <select name="stopBangTired" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                        <option value="">-- select --</option>
                                        <option value="YES" {{$patient->stop_bang_tired === 'YES' ? 'selected' : ''}}>Yes</option>
                                        <option value="NO" {{$patient->stop_bang_tired === 'NO' ? 'selected' : ''}}>No</option>
                                        <option value="UNKNOWN" {{$patient->stop_bang_tired === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                                    </select>
                                </div>
                                <div class="">
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2">Memo</span>
                                        <input type="text" value="{{$patient->stop_bang_tired_memo}}" name="stopBangTiredMemo" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                </div>

                                <hr class="my-2">

                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="mr-2 font-weight-bold">Observed Apnea:</span>
                                    <select name="stopBangObservedApnea" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                        <option value="">-- select --</option>
                                        <option value="YES" {{$patient->stop_bang_observed_apnea === 'YES' ? 'selected' : ''}}>Yes</option>
                                        <option value="NO" {{$patient->stop_bang_observed_apnea === 'NO' ? 'selected' : ''}}>No</option>
                                        <option value="UNKNOWN" {{$patient->stop_bang_observed_apnea === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                                    </select>
                                </div>
                                <div class="">
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2">Memo</span>
                                        <input type="text" value="{{$patient->stop_bang_observed_apnea_memo}}" name="stopBangObservedApneaMemo" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                </div>

                                <hr class="my-2">

                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="mr-2 font-weight-bold">High BP:</span>
                                    <select name="stopBangHighBloodPressure" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                        <option value="">-- select --</option>
                                        <option value="YES" {{$patient->stop_bang_high_blood_pressure === 'YES' ? 'selected' : ''}}>Yes</option>
                                        <option value="NO" {{$patient->stop_bang_high_blood_pressure === 'NO' ? 'selected' : ''}}>No</option>
                                        <option value="UNKNOWN" {{$patient->stop_bang_high_blood_pressure === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                                    </select>
                                </div>
                                <div class="">
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2">Memo</span>
                                        <input type="text" value="{{$patient->stop_bang_high_blood_pressure_memo}}" name="stopBangHighBloodPressureMemo" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                </div>
                            </div>
                            <div class="col-6 px-0 border-left">

                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="mr-2 font-weight-bold">BMI &gt; 35:</span>
                                    <select name="stopBangBmiOver35" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                        <option value="">-- select --</option>
                                        <option value="YES" {{$patient->stop_bang_bmi_over35 === 'YES' ? 'selected' : ''}}>Yes</option>
                                        <option value="NO" {{$patient->stop_bang_bmi_over35 === 'NO' ? 'selected' : ''}}>No</option>
                                        <option value="UNKNOWN" {{$patient->stop_bang_bmi_over35 === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                                    </select>
                                </div>

                                <div class="">
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2 width-50px">Memo</span>
                                        <input type="text" value="{{$patient->stop_bang_bmi_over35memo}}" name="stopBangBmiOver35Memo" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2 width-50px">Weight</span>
                                        <input type="text" value="{{$patient->stop_bang_weight_in_pounds}}" refresh-bmi name="stopBangWeightInPounds" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2 width-50px">Height</span>
                                        <input type="text" value="{{$patient->stop_bang_height_in_inches}}" refresh-bmi name="stopBangHeightInInches" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2 width-50px">BMI</span>
                                        <input type="text" readonly value="{{$patient->stop_bang_bmi}}" name="stopBangBmi" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                </div>

                                <hr class="my-2">

                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="mr-2 font-weight-bold">Age &gt; 50:</span>
                                    <select name="stopBangAgeOver50" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                        <option value="">-- select --</option>
                                        <option value="YES" {{$patient->stop_bang_age_over50 === 'YES' ? 'selected' : ''}}>Yes</option>
                                        <option value="NO" {{$patient->stop_bang_age_over50 === 'NO' ? 'selected' : ''}}>No</option>
                                        <option value="UNKNOWN" {{$patient->stop_bang_age_over50 === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                                    </select>
                                </div>
                                <div class="">
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2">Memo</span>
                                        <input type="text" value="{{$patient->stop_bang_age_over50memo}}" name="stopBangAgeOver50Memo" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                </div>

                                <hr class="my-2">

                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="mr-2 font-weight-bold">Neck Circumf. &gt; 16 in.:</span>
                                    <select name="stopBangNeckCircumferenceOver16Inches" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                        <option value="">-- select --</option>
                                        <option value="YES" {{$patient->stop_bang_neck_circumference_over16inches === 'YES' ? 'selected' : ''}}>Yes</option>
                                        <option value="NO" {{$patient->stop_bang_neck_circumference_over16inches === 'NO' ? 'selected' : ''}}>No</option>
                                        <option value="UNKNOWN" {{$patient->stop_bang_neck_circumference_over16inches === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                                    </select>
                                </div>
                                <div class="">
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2">Memo</span>
                                        <input type="text" value="{{$patient->stop_bang_neck_circumference_over16inches_memo}}" name="stopBangNeckCircumferenceOver16InchesMemo" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                </div>
                                <div class="">
                                    <div class="px-3 py-1 d-flex align-items-baseline">
                                        <span class="mr-2">Neck Circumference</span>
                                        <input type="text" value="{{$patient->neck_circumference_in_inches}}" name="neckCircumferenceInInches" class="form-control form-control-sm d-inline-block flex-grow-1 min-width-unset">
                                    </div>
                                </div>

                                <hr class="my-2">

                                <div class="px-3 py-1 d-flex align-items-baseline">
                                    <span class="mr-2 font-weight-bold">Gender is Male:</span>
                                    <select name="stopBangGenderMale" class="form-control form-control-sm min-width-unset d-inline w-auto">
                                        <option value="">-- select --</option>
                                        <option value="YES" {{$patient->stop_bang_gender_male === 'YES' ? 'selected' : ''}}>Yes</option>
                                        <option value="NO" {{$patient->stop_bang_gender_male === 'NO' ? 'selected' : ''}}>No</option>
                                        <option value="UNKNOWN" {{$patient->stop_bang_gender_male === 'UNKNOWN' ? 'selected' : ''}}>Unknown</option>
                                    </select>
                                </div>

                            </div>
                        </div>

                        <hr class="my-2">

                        @if($patient->stop_bang_calculated_risk_category)
                            <div class="px-3 py-1 bg-aliceblue font-weight-bold">
                                Risk Category: {{$patient->stop_bang_calculated_risk_category ?: '-'}}
                            </div>
                        @endif

                    </div>
                </div>

                <div class="mt-2 border-top pt-2 text-center">
                    <button class="btn btn-primary btn-sm" submit>Submit</button>
                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
                </div>

            </form>
        </div>
    </div>

    <div class="row mx-0">
        <div class="col-5 px-0 pb-4">
            <div class="px-3 pt-2 pb-1">
                Diagnosed with Sleep Apnea: <b>{{$patient->has_sleep_apnea_diagnosis ?: '-'}}</b>
            </div>

            <div class="px-3 py-1">
                Has CPAP Machine: <b>{{$patient->has_cpap_machine ?: '-'}}</b>
            </div>

            <div class="px-3 py-1">
                Has Sleep Apnea Oral Appliance: <b>{{$patient->has_sleep_apnea_oral_appliance ?: '-'}}</b>
            </div>

            <div class="px-3 py-1">
                Has Sleep Physician: <b>{{$patient->has_sleep_physician ?: '-'}}</b>
            </div>

            <div class="px-3 py-1">
                Has Sleep Dentist: <b>{{$patient->has_sleep_dentist ?: '-'}}</b>
            </div>

            <hr class="my-2">

            <div class="px-3 py-1">
                Has Had Home Sleep Study: <b>{{$patient->has_had_home_sleep_study ?: '-'}}</b>
            </div>
            @if(1 || $patient->has_had_home_sleep_study === 'YES')
                <div class="ml-3 border-left">
                    <div class="px-3 py-1">
                        Memo: <b>{{$patient->has_had_home_sleep_study_memo ?: '-'}}</b>
                    </div>
                    <div class="px-3 py-1">
                        Findings: <b>{{$patient->has_had_home_sleep_study_findings ?: '-'}}</b>
                    </div>
                    <div class="px-3 py-1">
                        Approximate Date: <b>{{$patient->has_had_home_sleep_study_approximate_date ?: '-'}}</b>
                    </div>
                    <div class="px-3 py-1">
                        Value As Of: <b>{{$patient->has_had_home_sleep_study_value_as_of ?: '-'}}</b>
                    </div>
                </div>
            @endif

            <hr class="my-2">

            <div class="px-3 py-1">
                Has Had Lab Sleep Study: <b>{{$patient->has_had_lab_sleep_study ?: '-'}}</b>
            </div>
            @if(1 || $patient->has_had_lab_sleep_study === 'YES')
                <div class="ml-3 border-left">
                    <div class="px-3 py-1">
                        Memo: <b>{{$patient->has_had_lab_sleep_study_memo ?: '-'}}</b>
                    </div>
                    <div class="px-3 py-1">
                        Findings: <b>{{$patient->has_had_lab_sleep_study_findings ?: '-'}}</b>
                    </div>
                    <div class="px-3 py-1">
                        Approximate Date: <b>{{$patient->has_had_lab_sleep_study_approximate_date ?: '-'}}</b>
                    </div>
                    <div class="px-3 py-1">
                        Value As Of: <b>{{$patient->has_had_lab_sleep_study_value_as_of ?: '-'}}</b>
                    </div>
                </div>
            @endif
        </div>
        <div class="col-7 border-left px-0 pb-4">
            <div class="px-3 pt-2 pb-1 font-weight-bold text-secondary">STOPBANG Questionnaire</div>

            <hr class="my-2">

            <div class="px-3 py-1">
                Value As Of: <b>{{$patient->stop_bang_value_as_of ?: '-'}}</b>
            </div>

            <hr class="my-2">

            <div class="row mx-0">
                <div class="col-6 px-0">
                    <div class="px-3 py-1">
                        Snore: <b>{{$patient->stop_bang_snore ?: '-'}}</b>
                    </div>
                    <div class="ml-3 border-left">
                        <div class="px-3 py-1">
                            Memo: <b>{{$patient->stop_bang_snore_memo ?: '-'}}</b>
                        </div>
                    </div>

                    <div class="px-3 py-1">
                        Tired: <b>{{$patient->stop_bang_tired ?: '-'}}</b>
                    </div>
                    <div class="ml-3 border-left">
                        <div class="px-3 py-1">
                            Memo: <b>{{$patient->stop_bang_tired_memo ?: '-'}}</b>
                        </div>
                    </div>

                    <div class="px-3 py-1">
                        Observed Apnea: <b>{{$patient->stop_bang_observed_apnea ?: '-'}}</b>
                    </div>
                    <div class="ml-3 border-left">
                        <div class="px-3 py-1">
                            Memo: <b>{{$patient->stop_bang_observed_apnea_memo ?: '-'}}</b>
                        </div>
                    </div>

                    <div class="px-3 py-1">
                        High BP: <b>{{$patient->stop_bang_high_blood_pressure ?: '-'}}</b>
                    </div>
                    <div class="ml-3 border-left">
                        <div class="px-3 py-1">
                            Memo: <b>{{$patient->stop_bang_high_blood_pressure_memo ?: '-'}}</b>
                        </div>
                    </div>
                </div>
                <div class="col-6 px-0 border-left">
                    <div class="px-3 py-1">
                        BMI &gt; 35: <b>{{$patient->stop_bang_bmi_over35 ?: '-'}}</b>
                    </div>
                    <div class="ml-3 border-left">
                        <div class="px-3 py-1">
                            Memo: <b>{{$patient->stop_bang_bmi_over35memo ?: '-'}}</b>
                        </div>
                        <div class="px-3 py-1">
                            Weight: <b>{{$patient->stop_bang_weight_in_pounds ?: '-'}}</b>
                        </div>
                        <div class="px-3 py-1">
                            Height: <b>{{$patient->stop_bang_height_in_inches ?: '-'}}</b>
                        </div>
                        <div class="px-3 py-1">
                            BMI: <b>{{$patient->stop_bang_bmi ?: '-'}}</b>
                        </div>
                    </div>

                    <div class="px-3 py-1">
                        Age &gt; 50: <b>{{$patient->stop_bang_age_over50 ?: '-'}}</b>
                    </div>
                    <div class="ml-3 border-left">
                        <div class="px-3 py-1">
                            Memo: <b>{{$patient->stop_bang_age_over50memo ?: '-'}}</b>
                        </div>
                    </div>

                    <div class="px-3 py-1">
                        Neck Circumference &gt; 16 in.: <b>{{$patient->stop_bang_neck_circumference_over16inches ?: '-'}}</b>
                    </div>
                    <div class="ml-3 border-left">
                        <div class="px-3 py-1">
                            Memo: <b>{{$patient->stop_bang_neck_circumference_over16inches_memo ?: '-'}}</b>
                        </div>
                        <div class="px-3 py-1">
                            Neck Circumference: <b>{{$patient->neck_circumference_in_inches ?: '-'}}</b>
                        </div>
                    </div>

                    <div class="px-3 py-1">
                        Gender is Male: <b>{{$patient->stop_bang_gender_male ?: '-'}}</b>
                    </div>
                </div>
            </div>

            <hr class="my-2">

            @if($patient->stop_bang_calculated_risk_category)
                <div class="px-3 py-1 bg-aliceblue font-weight-bold">
                    Risk Category: {{$patient->stop_bang_calculated_risk_category ?: '-'}}
                </div>
            @endif

        </div>
    </div>

</div>

<script>
    (function() {
        function init() {
            let parentSegment = $('#sleep-apnea-background');
            parentSegment.find('[refresh-bmi]').off('change input');
            parentSegment.find('[refresh-bmi]').on('change input', function () {
                refreshBMI();
            });
            refreshBMI();
        }
        function refreshBMI() {
            let parentSegment = $('#sleep-apnea-background');
            let w = parentSegment.find('[name="stopBangWeightInPounds"]').val(),
                h = parentSegment.find('[name="stopBangHeightInInches"]').val();
            let bmi = '';
            try {
                w = parseInt(w);
                h = parseInt(h);
                bmi = Math.round((w / (h * h)) * 703.06957964);
                parentSegment.find('[name="stopBangBmi"]').val(!isNaN(bmi) ? bmi : '');
            }
            catch (e) {}
        }
        addMCInitializer('sleep-apnea-background', init, '#sleep-apnea-background');
    }).call(window);
</script>
