<?php

use App\Models\Point;

$category = 'PLAN_FREE_TEXT';
$endPoint = 'upsertNoteSingleton';

$point = Point::where('added_in_note_id', $note->id)->where('category', $category)->orderBy('id', 'DESC')->first();
$parsed = null;
if (!!@$point->data) {
    $parsed = json_decode($point->data);
}
?>
<div visit-moe close-on-save close-on-cancel class="d-block">
    <form show url="/api/visitPoint/<?= $endPoint ?>" class="mcp-theme-1">
        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
        <input type="hidden" name="category" value="<?= $category ?>">
        <input type="hidden" name="data">
        <div note-rte
             class="form-group mb-2 border-left border-right rte-holder"
             data-field-name="free_text"
        ><?= $parsed && @$parsed->free_text ? $parsed->free_text : '' ?></div>
        <div class="mb-2 row mx-0">
            <div class="col-4 pl-0">
                <div class="mb-2">Recommendation:</div>
                <label class="d-flex align-items-center mb-1">
                    <input type="radio" data-name="recommendation" value="Continue current therapeutic focus" {{@$parsed->recommendation === 'Continue current therapeutic focus' ? 'checked' : ''}}>
                    <span class="ml-2">Continue current therapeutic focus</span>
                </label>
                <label class="d-flex align-items-center mb-1">
                    <input type="radio" data-name="recommendation" value="Change treatment goals or objectives" {{@$parsed->recommendation === 'Change treatment goals or objectives' ? 'checked' : ''}}>
                    <span class="ml-2">Change treatment goals or objectives</span>
                </label>
                <label class="d-flex align-items-center mb-1">
                    <input type="radio" data-name="recommendation" value="Terminate treatment" {{@$parsed->recommendation === 'Terminate treatment' ? 'checked' : ''}}>
                    <span class="ml-2">Terminate treatment</span>
                </label>
            </div>
            <div class="col-4">
                <div class="mb-2">Prescribed Frequency of Treatment:</div>
                <label class="d-flex align-items-center mb-1">
                    <input type="text" class="form-control form-control-sm" data-name="frequency" value="{{@$parsed->frequency}}">
                </label>
            </div>
        </div>
        <div class="m-2">
            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
            <div class="d-inline-flex align-self-stretch align-items-center">
                <span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>
                <span class="autosave-indicator saved text-sm text-secondary">
                    <i class="fa fa-check"></i>
                    Saved
                </span>
            </div>
        </div>
    </form>
</div>



