<?php

use App\Models\Point;

$category = 'COVID_FOLLOW-UP';

if(!@$sessionKey) {
        $sessionKey = request()->cookie('sessionKey');
}

$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, $category, $sessionKey, true);

$contentData = [
        "ans_has_received_printed_cdc_covid_matrials" => null, // yes/no
        "ans_has_signed_up_for_gvt_covid_kit" => null, // yes/no/not_sure
        "ans_apply_gvt_covid_kit_for_patient" => null, // yes/no/not_sure
        "ans_has_reviewed_printed_cdc_covid_matrials" => null, // yes/no,
        "cdc_self_protection_emphasis_vaccination" => null,
        "cdc_self_protection_emphasis_mask_wearing" => null,
        "cdc_self_protection_emphasis_mask_wearing" => null,
        "cdc_self_protection_emphasis_social_distancing" => null,
        "cdc_self_protection_emphasis_avoid_crowds" => null,
        "cdc_self_protection_emphasis_test_appropriately" => null,
        "cdc_self_protection_emphasis_wash_hands_often" => null,
        "cdc_self_protection_emphasis_cover_coughs" => null,
        "cdc_self_protection_emphasis_disinfect" => null,
        "cdc_self_protection_emphasis_monitor_health_daily" => null,
        "cdc_self_protection_emphasis_quarantine" => null,
        "cdc_self_protection_emphasis_isolation" => null,
        "cdc_self_protection_emphasis_travel_precaution" => null,
        "ans_has_answered_all_covid_19_questions" => null,
        "ans_has_received_printed_cdc_mental_health_matrials" => null, // yes/no
        "ans_educated_patient_on_mental_health_screening" => null,
        "ans_how_patient_is_doing_regarding_stress" => null,
        "total_phq2" => null,
        "phq_action_taken" => null,
        "cdc_stress_emphasis_covid_19_effects" => null,
        "cdc_stress_emphasis_stressful_challenges" => null,
        "cdc_stress_emphasis_public_health_actions" => null,
        "cdc_stress_emphasis_physical_reactions" => null,
        "cdc_stress_emphasis_coping_with_stress" => null,
        "ans_hypertension_rpm_education" => null,
	"top_wish_1" => null,
	"top_wish_2" => null,
	"top_wish_3" => null,
	"follow_up_for" => null,
    "remarks" => null,
];

if ($point->lastChildReview && $point->lastChildReview->data) {
        $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
        $contentData = $point->lastChildReview->data;
}
$submitFormUrl = '/api/visitPoint/upsertChildReview';

?>
<div id="covid-follow-up-{{$note->id}}" visit-moe close-on-save close-on-cancel class="d-block p-3 popup-content-container">
        <form id="visitNoteForm" show url="{{ $submitFormUrl }}" class="mcp-theme-1">
                <input type="hidden" name="uid" value="<?= $point->uid ?>">
                <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
                <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
                <input type="hidden" name="category" value="<?= $category ?>">
                <input id="mainData" type="hidden" name="data" value="{{json_encode($contentData)}}">

		<h2><strong>Note to provider:</strong> please begin visit asking vital signs using supplied equipment, and resolve any technical questions.</h2>
		<h2><strong>CHECKBOXES ON THIS TEMPLATE ARE SIMPLY SUGGESTIONS.</strong></h2>

                <div class="mb-2">
                        <label class="mb-1">Have you received printed materials from CDC, “<b>How to Protect Yourself & Others</b>”?</label>
                        <div class="d-inline-flex ml-2 align-items-baseline pt-1">
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_has_received_printed_cdc_covid_matrials" name="ans_has_received_printed_cdc_covid_matrials" {{@$contentData['ans_has_received_printed_cdc_covid_matrials'] && @$contentData['ans_has_received_printed_cdc_covid_matrials'] === 'yes' ? 'checked' : ''}} value="yes">
                                        <span class="ml-1">Yes</span>
                                </label>
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_has_received_printed_cdc_covid_matrials" name="ans_has_received_printed_cdc_covid_matrials" {{@$contentData['ans_has_received_printed_cdc_covid_matrials'] && @$contentData['ans_has_received_printed_cdc_covid_matrials'] === 'no' ? 'checked' : ''}} value="no">
                                        <span class="ml-1">No</span>
                                </label>
                        </div>
                </div>

                <hr class="my-3">

                <div class="mb-2">
                        <label class="mb-1">Have you already signed up for government supplied COVID-19 home diagnostic kits?</label>
                        <div class="d-inline-flex ml-2 align-items-baseline pt-1">
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_has_signed_up_for_gvt_covid_kit" name="ans_has_signed_up_for_gvt_covid_kit" {{@$contentData['ans_has_signed_up_for_gvt_covid_kit'] && @$contentData['ans_has_signed_up_for_gvt_covid_kit'] === 'yes' ? 'checked' : ''}} value="yes">
                                        <span class="ml-1">Yes</span>
                                </label>
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_has_signed_up_for_gvt_covid_kit" name="ans_has_signed_up_for_gvt_covid_kit" {{@$contentData['ans_has_signed_up_for_gvt_covid_kit'] && @$contentData['ans_has_signed_up_for_gvt_covid_kit'] === 'no' ? 'checked' : ''}} value="no">
                                        <span class="ml-1">No</span>
                                </label>
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_has_signed_up_for_gvt_covid_kit" name="ans_has_signed_up_for_gvt_covid_kit" {{@$contentData['ans_has_signed_up_for_gvt_covid_kit'] && @$contentData['ans_has_signed_up_for_gvt_covid_kit'] === 'no' ? 'checked' : ''}} value="not_sure">
                                        <span class="ml-1">Not Sure</span>
                                </label>
                        </div>
                </div>

                <hr class="my-3">

                <div class="mb-2">
                        <label class="mb-1">Can we apply on CovidTests.gov for you?</label>
                        <div class="d-inline-flex ml-2 align-items-baseline pt-1">
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_apply_gvt_covid_kit_for_patient" name="ans_apply_gvt_covid_kit_for_patient" {{@$contentData['ans_apply_gvt_covid_kit_for_patient'] && @$contentData['ans_apply_gvt_covid_kit_for_patient'] === 'yes' ? 'checked' : ''}} value="yes">
                                        <span class="ml-1">Yes</span>
                                </label>
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_apply_gvt_covid_kit_for_patient" name="ans_apply_gvt_covid_kit_for_patient" {{@$contentData['ans_apply_gvt_covid_kit_for_patient'] && @$contentData['ans_apply_gvt_covid_kit_for_patient'] === 'no' ? 'checked' : ''}} value="no">
                                        <span class="ml-1">No</span>
                                </label>
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_apply_gvt_covid_kit_for_patient" name="ans_apply_gvt_covid_kit_for_patient" {{@$contentData['ans_apply_gvt_covid_kit_for_patient'] && @$contentData['ans_apply_gvt_covid_kit_for_patient'] === 'no' ? 'checked' : ''}} value="not_sure">
                                        <span class="ml-1">Not Sure</span>
                                </label>
                        </div>
                </div>

                <hr class="my-3">

                <div class="mb-2">
                        <div class="d-flex align-items-start">
                                <label class="d-flex align-items-baseline mb-2">
                                        <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                                <input type="checkbox" data-name="ans_has_reviewed_printed_cdc_covid_matrials" {{@($contentData['ans_has_reviewed_printed_cdc_covid_matrials'] ? 'checked' : '')}} cdc-stress-emphasis>
                                        </div>
                                        <span></span>
                                </label>
                                <label class="mr-3">Reviewed CDC "<b>How to Protect Yourself & Others</b>" with the patient
                                        <br />
                                        <a native href="https://www.cdc.gov/coronavirus/2019-ncov/prevent-getting-sick/prevention.html" target="_blank">https://www.cdc.gov/coronavirus/2019-ncov/prevent-getting-sick/prevention.html</a>
                                </label>
                        </div>
                </div>

                <hr class="my-3">
                <div class="mb-2">
                        <div>
                                <label> Emphasis placed on:</label>
                        </div>

                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_vaccination" {{@($contentData["cdc_self_protection_emphasis_vaccination"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Vaccination.</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_mask_wearing" {{@($contentData["cdc_self_protection_emphasis_mask_wearing"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Mask wearing.</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_social_distancing" {{@($contentData["cdc_self_protection_emphasis_social_distancing"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Social distancing.</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_avoid_crowds" {{@($contentData["cdc_self_protection_emphasis_avoid_crowds"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Avoid poorly ventilated spaces and crowds.</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_test_appropriately" {{@($contentData["cdc_self_protection_emphasis_test_appropriately"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Test appropriately</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_wash_hands_often" {{@($contentData["cdc_self_protection_emphasis_wash_hands_often"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Wash your hands often</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_cover_coughs" {{@($contentData["cdc_self_protection_emphasis_cover_coughs"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Cover coughs</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_disinfect" {{@($contentData["cdc_self_protection_emphasis_disinfect"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Clean and disinfect surfaces</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_monitor_health_daily" {{@($contentData["cdc_self_protection_emphasis_monitor_health_daily"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Monitor your health daily; Monitoring symptoms is especially important if you are running errands, going into the office or workplace, and in settings where it may be difficult to keep a physical distance of 6 feet.</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_quarantine" {{@($contentData["cdc_self_protection_emphasis_quarantine"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Follow recommendations for quarantine; If you come into close contact with someone with COVID-19: follow CDC’s recommendations for quarantine.</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_isolation" {{@($contentData["cdc_self_protection_emphasis_isolation"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Follow recommendations for isolation; If you test positive for COVID-19 or have symptoms: follow CDC’s recommendations for isolation.</span>
                        </label>
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="cdc_self_protection_emphasis_travel_precaution" {{@($contentData["cdc_self_protection_emphasis_travel_precaution"] ? 'checked' : '')}} cdc-covid-emphasis>
                                </div>
                                <span>Take precautions when you travel; Follow CDC’s recommendations for domestic and international travel.</span>
                        </label>
                </div>

                <hr class="my-3">
                <div class="mb-2">
                        <label class="mb-1">Answered all questions relating to COVID-19; patient verbalizes understanding.</label>
                        <div class="d-inline-flex ml-2 align-items-baseline pt-1">
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_has_answered_all_covid_19_questions" name="ans_has_answered_all_covid_19_questions" {{@$contentData['ans_has_answered_all_covid_19_questions'] && @$contentData['ans_has_answered_all_covid_19_questions'] === 'yes' ? 'checked' : ''}} value="yes">
                                        <span class="ml-1">Yes</span>
                                </label>
                                <label class="my-0 mr-3 d-flex align-items-center">
                                        <input type="radio" data-name="ans_has_answered_all_covid_19_questions" name="ans_has_answered_all_covid_19_questions" {{@$contentData['ans_has_answered_all_covid_19_questions'] && @$contentData['ans_has_answered_all_covid_19_questions'] === 'no' ? 'checked' : ''}} value="no">
                                        <span class="ml-1">No</span>
                                </label>
                        </div>
                </div>

                <hr class="my-3">
                <div class="mb-2">
                        <h6><b>CDC: Coping with Stress - Mental Health Screening</b></h6>
                        <div class="mb-3">
                                <label>Have you received printed materials from the CDC “<b>Coping with Stress</b>”.</label>
                                <div class="d-inline-flex ml-2 align-items-baseline pt-1">
                                        <label class="my-0 mr-3 d-flex align-items-center">
                                                <input type="radio" data-name="ans_has_received_printed_cdc_mental_health_matrials" name="ans_has_received_printed_cdc_mental_health_matrials" {{@$contentData['ans_has_received_printed_cdc_mental_health_matrials'] && @$contentData['ans_has_received_printed_cdc_mental_health_matrials'] === 'yes' ? 'checked' : ''}} value="yes">
                                                <span class="ml-1">Yes</span>
                                        </label>
                                        <label class="my-0 mr-3 d-flex align-items-center">
                                                <input type="radio" data-name="ans_has_received_printed_cdc_mental_health_matrials" name="ans_has_received_printed_cdc_mental_health_matrials" {{@$contentData['ans_has_received_printed_cdc_mental_health_matrials'] && @$contentData['ans_has_received_printed_cdc_mental_health_matrials'] === 'no' ? 'checked' : ''}} value="no">
                                                <span class="ml-1">No</span>
                                        </label>
                                </div>
                                <div>
                                        <a native href="https://www.cdc.gov/mentalhealth/stress-coping/cope-with-stress/index.html" target="_blank">https://www.cdc.gov/mentalhealth/stress-coping/cope-with-stress/index.html</a>
                                </div>
                        </div>
                        <div class="mb-2">
                                <label class="d-flex align-items-baseline mb-2">
                                        <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                                <input type="checkbox" data-name="ans_educated_patient_on_mental_health_screening" {{@($contentData["ans_educated_patient_on_mental_health_screening"] ? 'checked' : '')}} cdc-stress-emphasis>
                                        </div>
                                        <span>Educated patient that stress and mental health screening is important because 7 in 10 adults are reporting feelings of anxiety, sadness, and depression due to COVID-19</span>
                                </label>
                        </div>

                        <div class="mb-2">
                                <label class="mb-1">How are you doing regarding stress?</label>
                                <input id="stressChangeInput" type="text" data-name="ans_how_patient_is_doing_regarding_stress" value="{{@$contentData['ans_how_patient_is_doing_regarding_stress']}}" class="form-control form-control-sm d-inline-block w-auto ml-2">
                        </div>
                        <hr class="my-3">
                        <div class="mb-2 phq">
                                <div class="table-responsive">
                                        <h6><b>Patient Health Questionnaire-2 (PHQ-2)</b></h6>
                                        <table class="table">
                                                <thead>
                                                        <tr>
                                                                <th>Over the last 2 weeks, how often have you been bothered by any of the following problems?</th>
                                                                <th class="text-center">Not at all</th>
                                                                <th class="text-center">Several days</th>
                                                                <th class="text-center">More than half the days</th>
                                                                <th class="text-center">Nearly every day</th>
                                                        </tr>
                                                </thead>
                                                <tbody>
                                                        <tr>
                                                                <td>1. Little interest or pleasure in doing things</td>
                                                                <td class="text-center"><button type="button" onclick="onValueChange(this, 'no_interest', 'phq2')" class="no_interest_phq2 btn btn-select zero_phq2 {{ @$contentData['no_interest_phq2'] === 0 ? 'active':'' }}" data-id="0">0</button></td>
                                                                <td class="text-center"><button type="button" onclick="onValueChange(this, 'no_interest', 'phq2')" class="no_interest_phq2 btn btn-select one_phq2 {{ @$contentData['no_interest_phq2'] == 1 ? 'active':'' }}" data-id="1">1</button></td>
                                                                <td class="text-center"><button type="button" onclick="onValueChange(this, 'no_interest', 'phq2')" class="no_interest_phq2 btn btn-select two_phq2 {{ @$contentData['no_interest_phq2'] == 2 ? 'active':'' }}" data-id="2">2</button></td>
                                                                <td class="text-center"><button type="button" onclick="onValueChange(this, 'no_interest', 'phq2')" class="no_interest_phq2 btn btn-select three_phq2 {{ @$contentData['no_interest_phq2'] == 3 ? 'active':'' }}" data-id="3">3</button></td>
                                                        </tr>
                                                        <tr>
                                                                <td>2. Feeling down, depressed, or hopeless</td>
                                                                <td class="text-center"><button type="button" onclick="onValueChange(this, 'depressed', 'phq2')" class="depressed_phq2 btn btn-select zero_phq2 {{ @$contentData['depressed_phq2'] === 0 ? 'active':'' }}" data-id="0">0</button></td>
                                                                <td class="text-center"><button type="button" onclick="onValueChange(this, 'depressed', 'phq2')" class="depressed_phq2 btn btn-select one_phq2 {{ @$contentData['depressed_phq2'] == 1 ? 'active':'' }}" data-id="1">1</button></td>
                                                                <td class="text-center"><button type="button" onclick="onValueChange(this, 'depressed', 'phq2')" class="depressed_phq2 btn btn-select two_phq2 {{ @$contentData['depressed_phq2'] == 2 ? 'active':'' }}" data-id="2">2</button></td>
                                                                <td class="text-center"><button type="button" onclick="onValueChange(this, 'depressed', 'phq2')" class="depressed_phq2 btn btn-select three_phq2 {{ @$contentData['depressed_phq2'] == 3 ? 'active':'' }}" data-id="3">3</button></td>
                                                        </tr>
                                                        <tr>
                                                                <td class="text-right"><em>For office coding:</em></td>
                                                                <td class="text-center">0</td>
                                                                <td class="text-center plus"><span id="first_phq2"><b><u><?= @$contentData['first_phq2'] ?? '____' ?></u></b></span></td>
                                                                <td class="text-center plus"><span id="second_phq2"><b><u><?= @$contentData['second_phq2'] ?? '____' ?></u></b></span></td>
                                                                <td class="text-center plus"><span id="third_phq2"><b><u><?= @$contentData['third_phq2'] ?? '____' ?></u></b></span></td>
                                                        </tr>
                                                        <tr>
                                                                <td class="text-right" colspan="5">
                                                                        <input type="hidden" name="total_phq2" data-name="total_phq2" value="{{ @$contentData['total_phq2'] }}">
                                                                        <em>= Total Score</em> <span id="total_phq2"><b><u><?= @$contentData['total_phq2'] ?? '___' ?></u></b></span>
                                                                </td>
                                                        </tr>
                                                </tbody>
                                        </table>
                                </div>
                        </div>

                        <div class="mb-2">
                                <label class="mb-1">If(PHQ-2 > 3?) then optionally:</label>
                                <div class="d-flex flex-column ml-2 align-items-baseline pt-1">
                                        <label class="my-0 mr-3 d-flex align-items-center">
                                                <input type="radio" data-name="phq_action_taken" name="phq_action_taken" {{@$contentData['phq_action_taken'] && @$contentData['phq_action_taken'] === 'phq_administer_phq_9_now' ? 'checked' : ''}} value="phq_administer_phq_9_now">
                                                <span class="ml-1">Administer PHQ-9 now.</span>
                                        </label>
                                        <label class="my-0 mr-3 d-flex align-items-center">
                                                <input type="radio" data-name="phq_action_taken" name="phq_action_taken" {{@$contentData['phq_action_taken'] && @$contentData['phq_action_taken'] === 'phq_schedule_phq_9_now' ? 'checked' : ''}} value="phq_schedule_phq_9_now">
                                                <span class="ml-1">Schedule PHQ-9 now.</span>
                                        </label>
                                        <label class="my-0 mr-3 d-flex align-items-center">
                                                <input type="radio" data-name="phq_action_taken" name="phq_action_taken" {{@$contentData['phq_action_taken'] && @$contentData['phq_action_taken'] === 'phq_schedule_phq_9_later' ? 'checked' : ''}} value="phq_schedule_phq_9_later">
                                                <span class="ml-1">Schedule PHQ-9 later.</span>
                                        </label>
                                        <label class="my-0 mr-3 d-flex align-items-center">
                                                <input type="radio" data-name="phq_action_taken" name="phq_action_taken" {{@$contentData['phq_action_taken'] && @$contentData['phq_action_taken'] === 'phq_refer_to_psych_np' ? 'checked' : ''}} value="phq_refer_to_psych_np">
                                                <span class="ml-1">Referral to Psych NP - “Stress Specialist”.</span>
                                        </label>
                                </div>
                        </div>
                        <div class="mb-2">
                                <label class="mb-1">Reviewed “<b>CDC: Coping with Stress</b>” with patient. Went over the following points.</label>

                                <label class="d-flex align-items-baseline mb-2">
                                        <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                                <input type="checkbox" data-name="cdc_stress_emphasis_covid_19_effects" {{@($contentData["cdc_stress_emphasis_covid_19_effects"] ? 'checked' : '')}} cdc-stress-emphasis>
                                        </div>
                                        <span>The COVID-19 pandemic has had a major effect on our lives.</span>
                                </label>
                                <label class="d-flex align-items-baseline mb-2">
                                        <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                                <input type="checkbox" data-name="cdc_stress_emphasis_stressful_challenges" {{@($contentData["cdc_stress_emphasis_stressful_challenges"] ? 'checked' : '')}} cdc-stress-emphasis>
                                        </div>
                                        <span>Many of us are facing challenges that can be stressful.</span>
                                </label>
                                <label class="d-flex align-items-baseline mb-2">
                                        <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                                <input type="checkbox" data-name="cdc_stress_emphasis_public_health_actions" {{@($contentData["cdc_stress_emphasis_public_health_actions"] ? 'checked' : '')}} cdc-stress-emphasis>
                                        </div>
                                        <span>Public health actions like social distancing can increase stress and anxiety / isolation.</span>
                                </label>
                                <label class="d-flex align-items-baseline mb-2">
                                        <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                                <input type="checkbox" data-name="cdc_stress_emphasis_physical_reactions" {{@($contentData["cdc_stress_emphasis_physical_reactions"] ? 'checked' : '')}} cdc-stress-emphasis>
                                        </div>
                                        <span>Stress can cause adverse feelings and physical reactions, especially relating to HTN and DM.</span>
                                </label>
                                <label class="d-flex align-items-baseline mb-2">
                                        <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                                <input type="checkbox" data-name="cdc_stress_emphasis_coping_with_stress" {{@($contentData["cdc_stress_emphasis_coping_with_stress"] ? 'checked' : '')}} cdc-stress-emphasis>
                                        </div>
                                        <span>Educated patient on healthy ways to cope with stress (as per CDC: Coping with Stress):</span>
                                </label>
                                <div class="pl-4">
                                        <?php
                                        $healthyWaysOptions = [
                                                'take_break_from_social_media' => 'Take breaks from news and social media.',
                                                'take_care_of_your_body' => 'Take care of your body',
                                                'take_deep_breaths' => 'Take deep breaths, stretch, or meditate',
                                                'try_to_eat_healthy' => 'Try to eat healthy, well-balanced meals',
                                                'exercise_regularly' => 'Exercise regularly',
                                                'get_plenty_of_sleep' => 'Get plenty of sleep',
                                                'avoid_excessive_alcohol' => 'Avoid excessive alcohol, tobacco, and substance use',
                                                'continue_with_routine_preventive_measures' => 'Continue with routine preventive measures (such as vaccinations, cancer screenings, etc.) as recommended by your healthcare provider',
                                                'get_vaccinated_with_covid' => 'Get vaccinated with a COVID-19 vaccine',
                                                'make_time_unwind' => 'Make time to unwind — Try to do some other activities you enjoy',
                                                'connect_with_others' => 'Connect with others — Talk with people you trust about your concerns and how you are feeling',
                                                'connect_with_your_community' => 'Connect with your community- or faith-based organizations — While social distancing measures are in place, try connecting online, through social media, or by phone or mail'
                                        ];
                                        ?>
                                        <div class="">
                                                @foreach($healthyWaysOptions as $hOptionKey => $hOptionLabel)
                                                <label class="d-flex align-items-baseline mb-2">
                                                        <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                                                <input type="checkbox" data-name="{{ $hOptionKey }}" {{@($contentData[$hOptionKey] ? 'checked' : '')}} cdc-stress-emphasis>
                                                        </div>
                                                        <span>{{ $hOptionLabel }}</span>
                                                </label>
                                                @endforeach
                                        </div>
                                </div>

                        </div>
                </div>

                <div class="mb-2">
                        <label class="d-flex align-items-baseline mb-2">
                                <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                                        <input type="checkbox" data-name="ans_hypertension_rpm_education" {{@($contentData["ans_hypertension_rpm_education"] ? 'checked' : '')}} cdc-stress-emphasis>
                                </div>
                                <span>Educated patient about hypertension RPM and election to enroll into it.</span>
                        </label>
                </div>

                <hr class="my-3">

		<div class="mb-2">
                   <label class="mb-1">What are your top three wishes for your health? <i class="fa fa-info-circle"></i> (Note to provider: sometimes patients need help to identify goals; <strong>"if you could wave a magic wand and have any three health wishes granted, what would they be?"</strong> common issues are fatigue, weight, joint pain, blood sugar, BP, etc.)</label>
                                     <div class="mt-1">1. <input type="text" data-name="top_wish_1" value="{{@$contentData        ['top_wish_1']}}" class="form-control form-control-sm d-inline-block w-auto ml-2"></div>
                                     <div class="mt-1">2. <input type="text" data-name="top_wish_2" value="{{@$contentData        ['top_wish_2']}}" class="form-control form-control-sm d-inline-block w-auto ml-2"></div>
                                     <div class="mt-1">3. <input type="text" data-name="top_wish_3" value="{{@$contentData        ['top_wish_3']}}" class="form-control form-control-sm d-inline-block w-auto ml-2"></div>
                         </div>
	<hr class="my-3">

		<div class="mb-2">
            <label class="mb-1">Next follow-up for:</label>
                <input type="text" data-name="follow_up_for" value="{{@$contentData        ['follow_up_for']}}" class="form-control form-control-sm d-inline-block w-auto ml-2">
        </div>
    <hr class="my-3">
    <div class="mb-3">
            <label class="mb-1">Remarks</label>
            <textarea data-name="remarks" class="form-control form-control-sm" rows="2">{{ @$contentData['remarks'] }}</textarea>
        </div>
        

	<hr class="my-3">

                <div class="pt-2">
                        <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
                        <div class="d-inline-flex align-self-stretch align-items-center">
                                <span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>
                                <span class="autosave-indicator saved text-sm text-secondary">
                                        <i class="fa fa-check"></i>
                                        Saved
                                </span>
                        </div>
                </div>
        </form>
</div>

<script>
        // PHQ
        function phqSubmitChanges() {
                var form = $('#visitNoteForm');
                $.post('{{ $submitFormUrl }}', form.serializeArray(), function(response) {}, 'json');
        }

        function phqUpdateData(object) {
                var mainDataInput = $('#mainData');
                var mainData = mainDataInput.val();
                try {
                        mainData = JSON.parse(mainData);
                } catch (e) {
                        mainData = {};
                }
                var data = $.extend(mainData, object);
                mainDataInput.val(JSON.stringify(data));
                phqSubmitChanges(data);
        }

        function onValueChange(elem, category, phq_type) {
                var btn = elem;
                var name = category + '_' + phq_type;
                var value = $(btn).data('id');
                $('[name=' + name + ']').remove();
                if ($(btn).hasClass('active')) {
                        $(btn).removeClass('active');
                        calculateChange(phq_type);
                        return;
                }
                $('.' + name).removeClass('active');
                $(btn).addClass('active');
                $('.phq').append('<input type="hidden" data-name=' + name + ' name=' + name + ' value=' + value + ' />');
                calculateChange(phq_type);
                phqUpdateData({
                        [name]: value
                });
        };

        function calculateChange(phq_type) {
                var first = $('.one_' + phq_type + '.active').length * 1;
                var second = $('.two_' + phq_type + '.active').length * 2;
                var third = $('.three_' + phq_type + '.active').length * 3;
                var total = first + second + third;

                var values = [first, second, third, total];
                var labels = ['first', 'second', 'third', 'total'];
                var object = {};
                for (var i = 0; i < labels.length; i++) {
                        var name = labels[i] + '_' + phq_type;
                        var value = values[i];
                        $('#' + name).html(value);
                        $('[name=' + name + ']').remove();
                        $('.phq').append('<input type="hidden" data-name=' + name + ' name=' + name + ' value=' + value + ' />');
                        object[name] = value;
                        phqUpdateData({
                                [name]: value
                        });
                }
        };
        // PHQ

        (function() {
                @if(@$segment->segmentTemplate && @$segment->segmentTemplate->internal_name)
                window.segmentInitializers.covidFollowUp = function() {
                        var covidFollowUp = {
                                parentSegment: $('[data-segment-template-name="<?= $segment->segmentTemplate->internal_name ?>"] '),
                                initAutoCheckAll: function() {
                                        var self = this;
                                        var checkSegments = $('[check-all]');
                                        $.each(checkSegments, function(i, segment) {
                                                var target = $(segment).data('target');
                                                var allChildrenCheckboxes = self.parentSegment.find('input[type=checkbox][' + target + ']');
                                                $(segment).click(function() {
                                                        var checkAllInput = this;
                                                        var isChecked = checkAllInput.checked ? true : false;
                                                        allChildrenCheckboxes.attr('checked', isChecked);
                                                });
                                                var allCheckedChildrenCheckboxes = self.parentSegment.find('input[type=checkbox][' + target + ']:checked');
                                                if (allChildrenCheckboxes.length === allCheckedChildrenCheckboxes.length) {
                                                        $(segment).attr('checked', true);
                                                }
                                        });

                                },
                                init: function() {
                                        this.initAutoCheckAll();
                                }
                        };
                        covidFollowUp.init();
                };
                @endif

                addMCInitializer('covid-follow-up-{{$note->id}}', function() {
                        var covidFollowUp = {
                                parentSegment: $('#covid-follow-up-{{$note->id}}'),
                                initAutoCheckAll: function() {
                                        var self = this;
                                        var checkSegments = $('[check-all]');
                                        $.each(checkSegments, function(i, segment) {
                                                var target = $(segment).data('target');
                                                var allChildrenCheckboxes = self.parentSegment.find('input[type=checkbox][' + target + ']');
                                                $(segment).click(function() {
                                                        var checkAllInput = this;
                                                        var isChecked = checkAllInput.checked ? true : false;
                                                        allChildrenCheckboxes.attr('checked', isChecked);
                                                });
                                                var allCheckedChildrenCheckboxes = self.parentSegment.find('input[type=checkbox][' + target + ']:checked');
                                                if (allChildrenCheckboxes.length === allCheckedChildrenCheckboxes.length) {
                                                        $(segment).attr('checked', true);
                                                }
                                        });

                                },
                                init: function() {
                                        $('div[moe] form').hide();
                                        this.initAutoCheckAll();
                                }
                        };
                        covidFollowUp.init();
                        // if in popup (omega template), add provision to toggle relevance
                        @include('app.patient.segment-templates._common_actions.toggle-relevance', ['container' => '#covid-follow-up-' . $note->id])
                }, '#covid-follow-up-{{$note->id}}');
        }).call(window);
</script>
