<?php
$problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
?>
<div class="pt-2">
    <div class="d-flex align-items-center pb-2">
        <h6 class="my-0 font-weight-bold">Current Problems / Focus Areas</h6>
        @if($isOldClient && @$hasDxInCanvas)
            <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
        @endif
        @if($patient->coreNote)
            @if(!@$disallowPointEdits)
            <a native target="_blank"
               class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
               open-in-stag-popup
               update-parent
               mc-initer="problems-center-{{$patient->coreNote->id}}"
               title="Problems Center"
               popup-style="overflow-visible"
               href="/problems-center/{{$patient->uid}}/{{$patient->coreNote->uid}}">
                <i class="fa fa-bolt mr-1"></i>
                <span>Manage</span>
            </a>
            @else
                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
            @endif
        @endif
    </div>
    <div class="bg-light border p-2 mb-3 point-content">
        @foreach($problems as $problem)
            <div class="mb-1">
                <b><?= !!@($problem->data->name) ? @($problem->data->name) : '-' ?></b>
                <?= !!@($problem->data->icd) ? '/&nbsp;' . @($problem->data->icd) : '' ?>
                <div class="ml-3 mt-1">
                    <?php
                    $point = $problem;
                    $note = $point->note;
                    $childHeading = 'Subjective';
                    include resource_path('views/app/patient/segment-templates/_child_review/last-review-optimized-flat.php');
                    ?>
                </div>
                <div class="ml-3 mt-1">
                    <?php
                    $point = $problem;
                    $note = $point->note;
                    $childHeading = 'Plan';
                    include resource_path('views/app/patient/segment-templates/_child_plan/last-plan-optimized-flat.php');
                    ?>
                </div>
            </div>
        @endforeach
        @if(!count($problems))
            <div class="text-secondary">Nothing here yet</div>
        @endif
    </div>
</div>