<?php
$iName = $segment->segmentTemplate->internal_name;
$wizardPowered = [
    'omega_medications',
    'omega_problems',
    'omega_allergies',
    'omega_ros'
];
?>

<div class="border-bottom note-section visit-segment outline-0 {{$note->is_signed_by_hcp ? 'events-none' : (in_array($iName, $wizardPowered) !== FALSE ? 'edit-trigger' : 'edit')}}"
     data-segment-uid="{{ $segment->uid }}"
     data-segment-template-uid="{{ $segment->segmentTemplate->uid }}"
     data-segment-template-name="{{ $segment->segmentTemplate->internal_name }}">

    <div class="bg-white text-dark px-2 py-1">
        <div class="d-flex align-items-baseline">

            @if(!!$segment->display_title)
                <div class="text-dark font-weight-bold font-size-13 mr-2 mt-2">
                    {{$segment->display_title}}:
                </div>
            @endif

            @if(!$note->is_signed_by_hcp)
                @if(!$note->visitTemplate->segments_always_open)
                    <a class="edit-trigger d-none if-edit c-pointer ml-3">
                        <i class="fas fa-caret-up font-size-16"></i>
                    </a>
                @endif

            <!-- refresh -->
                <a class="ml-3 font-weight-normal refresh-segment c-pointer {{$iName === 'medrisk_vigilence' ? 'on-hover-only' : ''}} screen-only"
                   data-segment-uid="{{$segment->uid}}"
                   title="Update with latest patient data">
                    <i class="fa fa-sync on-hover-opaque"></i>
                </a>

            @endif

            {{-- if segment has log feature, link --}}
            @if($pro->pro_type === 'ADMIN' && file_exists(resource_path("views/app/patient/segment-templates/{$segment->segmentTemplate->internal_name}/log.blade.php")))
                <a native="" target="_blank"
                   class="c-pointer ml-2 text-decoration-none"
                   open-in-stag-popup=""
                   title="{{$segment->display_title}} - Change Log"
                   popup-style="medium"
                   href="/note-segment-view/{{$patient->uid}}/{{$note->uid}}/{{$segment->uid}}/<?= $segment->segmentTemplate->internal_name ?>/log">
                    <i class="fas fa-history on-hover-opaque"></i>
                </a>
            @endif

        </div>

        <div class="py-1">
            @if(in_array($iName, $wizardPowered) !== FALSE)
                <div class="d-none if-not-edit inset-comment summary-container">
                    @if($note->is_signed_by_hcp && $segment->accepted_suggestion_summary_html)
                        {!! $segment->accepted_suggestion_summary_html !!}
                    @else
                        {!! $segment->summary_html !!}
                    @endif
                </div>
            @else
                <div class="{{!$note->visitTemplate->segments_always_open ? 'd-none if-edit' : ''}} edit-container">
                    {!! $segment->edit_html !!}
                </div>
            @endif

        </div>

    </div>

</div>
