<div class="px-3 pb-3">
    <?php $numPlans = 0; ?>
    @foreach($point->childPlans as $record)
        @if(@$record->data)
            <?php $numPlans++; ?>
            <div class="border mt-3">
                <div class="border-bottom p-2 bg-light">
                    <span class="text-secondary text-sm">Created on </span>
                    @if($record->client->core_note_id !== $record->note->id)
                        <a native target="_blank" class="text-sm"
                           href="<?= route('patients.view.notes.view.dashboard', ['patient' => $record->client, 'note' => $record->note]) ?>">
                            <?= friendlier_date_time($record->created_at) ?>
                        </a>
                        @if($record->creatorPro)
                            <span class="text-secondary text-sm">by {{$record->creatorPro->displayName()}}</span>
                        @endif
                    @elseif($record->parentPoint && $record->parentPoint->core_child_plan_point_id === $record->id)
                        <span class="text-sm"><?= friendlier_date_time($record->created_at) ?> as pre-existing plan</span>
                    @else
                        <span class="text-sm"><?= friendlier_date_time($record->created_at) ?> from the patient's chart</span>
                    @endif
                </div>
                <div class="p-2 inline-html-container">
                    <?php
                    if (file_exists(resource_path('views/app/patient/segment-templates/_plan/' . strtolower($record->parent_category) . '/view.php'))) {
                        $plan = json_decode($record->data);
                        include resource_path('views/app/patient/segment-templates/_plan/problem/view.php');
                    } else {
                        $plan = json_decode($record->data);
                        echo $plan->value;
                    }
                    ?>
                </div>
            </div>
        @endif
    @endforeach
    @if(!$numPlans)
        <div class="border mb-3">
            <div class="p-2">
                No plans
            </div>
        </div>
    @endif
</div>