<?php
$parsed = null;
if(@$json) {
    try {
        $parsed = json_decode($json);
    }
    catch (Exception $e) {}
}
elseif($patient->rtm_msk_protocol_detail_json) {
    try {
        $parsed = json_decode($patient->rtm_msk_protocol_detail_json);
    }
    catch (Exception $e) {}
}
?>
@if($parsed)
    <div>
        @if($parsed->program_notes)
            <div class="mb-1"><b class="">Program Notes: </b>{{$parsed->program_notes}}</div>
        @endif
        @if(count($parsed->activities))
            @foreach($parsed->activities as $activity)
                <div class="">
                    <div class="font-weight-bold">{{$activity->name}}</div>
                    <div class="pl-3">
                        @foreach($activity->props as $prop)
                            @if($prop->include && $prop->value)
                                <span class="ml-2">{{$prop->name}}: {{$prop->value}}</span>
                            @endif
                        @endforeach
                    </div>
                </div>
            @endforeach
        @else
            <div class="text-secondary">No exercises defined.</div>
        @endif
    </div>
@endif
