@if($points && count($points))
    <div class="d-flex border-bottom">
        <a class="mr-2 min-width-110px hide-if-note-signed"
           open-in-stag-popup
           href="/nutrition-center/{{$note->client->uid}}/{{$note->uid}}"
           mc-initer="nutrition-center-{{$note->id}}"
           title="<img src='/img/nutrition-rx.png'/> Nutrition Rx"
           popup-style="overflow-visible">
            Nutrition Rx
        </a>
        <span class="mr-2 min-width-110px font-weight-bold show-if-note-signed">
            Nutrition Rx
        </span>
        <div class="flex-grow-1">
            <table class="table table-bordered table-xs table-cage mb-0">
                <?php $j = 0; foreach ($points as $point): $j++; ?>
                <?php $rel = $point->relevanceToNote($note); ?>
                <tr>
                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                        @if($rel)
                            {{ $j }}.
                        @else
                            {{ $j }}.
                        @endif
                    </td>
                    <td class="px-2">
                        <div class=" <?= $point->is_removed ? 'strike-through' : '' ?> grow-till-300px">
                            @if($point->category === 'HIGH_SUGAR_BEVERAGES')
                                Beverages
                            @else
                                {{ucwords(str_replace('_', ' ', strtolower($point->category)))}}
                            @endif
                        </div>
                    </td>
                    <td class="width-300px">
                        <div class="pl-2">
                            <?php $plan = $point->lastChildPlan ?: null; ?>
                            <?php if(!!$plan): ?>
                                <?php
                                $flat = true;
                                include resource_path('views/app/patient/segment-templates/_child_plan/nutrition/' . $point['category'] . '/last-plan.php');
                                ?>
                            <?php endif; ?>
                        </div>
                        <div class="pl-3">
                            <?php if ($point->is_removed): ?>
                            @if($point->removal_reason_category === 'DURING_VISIT')
                                <span class="text-sm text-secondary">Removed during visit</span>
                            @elseif($point->removal_reason_category === 'ON_INTAKE')
                                <span class="text-sm text-secondary">Historic</span>
                            @endif
                            <?php elseif ($point->added_in_note_id === $note->id): ?>
                            <?php if ($point->addition_reason_category === 'DURING_VISIT'): ?>
                            <span class="text-sm text-success">* Added during visit</span>
                            <?php else: ?>
                            <span class="text-sm text-info">* Added on intake</span>
                            <?php endif;?>
                            <?php endif; ?>
                        </div>

                    </td>
                    <td></td>
                </tr>
                <?php endforeach; ?>
            </table>

        </div>
    </div>
@endif