<?php

// info from patient chart
$drugsMRV = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");

// filter out drugs without fdb info on them
$drugsMRV = $drugsMRV->filter(function($_drug) {
    return @$_drug->data &&
        $_drug->data->name &&
        $_drug->data->medId &&
        $_drug->data->routedMedId &&
        $_drug->data->routedDosageFormMedId &&
        $_drug->data->gcnSeqno;
});

// dpt
$dptInfo = duplicate_therapy_info($drugsMRV);

// ddi
$ddi = drug_drug_interaction_info($drugsMRV);

?>
@if(!!$dptInfo || !!$ddi)

    <div native target="_blank"
         class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}} mrv-sidebar"
         open-in-stag-popup
         title="Medrisk Vigilence"
         popup-style="overflow-visible mrv-content"
         href="/mrv-summary/{{$note->uid}}">

        @if(!!$dptInfo)
            <p class="font-weight-bold mb-2">Duplicate Therapy</p>
            <div class="my-2 text-sm text-nowrap mw-100 text-ellipsis no-bold-children">
                {!! $dptInfo !!}
            </div>
        @endif

        @if(!!$ddi)
            <p class="font-weight-bold mb-2">Drug-Drug Interaction</p>
            <div class="mt-2 text-sm text-nowrap mw-100 text-ellipsis no-bold-children">
                {!! $ddi !!}
            </div>
        @endif

    </div>

@endif
