{# AI Generated Note: Enhanced observation_edit.html.twig template with QuestionnaireResponse linking functionality #} {% extends "core/base.html.twig" %} {% block pagetitle %}{{ "Observation"|xlt }}{% endblock %} {% block head %} {{ parent() }} {{ setupHeader(['i18next', 'i18formatting', 'datetime-picker', 'datetime-picker-translated', 'reason-code-widget']) }} {% endblock %} {% block content %}
{# AI Generated: Hidden field for QuestionnaireResponse FHIR ID #} {# Return to List Button #} {% if isEdit %} {% endif %}
{# Basic Information Card #}
{{ "Basic Information"|xlt }}
{{ selectList('ob_status', 'observation-status', observation.ob_status, '') }}
{{ selectList('ob_type', 'Observation_Types', observation.ob_type, 'Select Type'|xla, {empty_name: 'Select Type'|xlt}) }}
{# AI Generated: QuestionnaireResponse Linking Card #}
{{ "Linked Questionnaire"|xlt }}
{% if linkedQuestionnaireResponse %} {# Linked State #}
{{ "Linked"|xlt }}: {{ linkedQuestionnaireResponse.name|text }}

{{ "Response ID"|xlt }}: {{ linkedQuestionnaireResponse.response_id|text }}

{{ "Date"|xlt }}: {{ linkedQuestionnaireResponse.date|oeFormatDateTime|attr }} {{ "Status"|xlt }}: {{ linkedQuestionnaireResponse.status|text }}

{% else %} {# Unlinked State #}
{{ "No Questionnaire Linked"|xlt }}

{{ "Link a questionnaire response to provide additional context for this observation"|xlt }}

{% endif %}
{# Sub-observations Card - existing content remains the same #}
{{ "Sub-observations"|xlt }}
{# Sub-observation Template - existing content #} {% if observation.sub_observations is not empty %} {% for index,subObservation in observation.sub_observations %} {% include "forms/observation/templates/partials/_sub-observation.html.twig" with { nodeId: "sub-observation-" ~ (index + 1), observation: subObservation } %} {% endfor %} {% endif %}
{# Comments Card - existing content remains the same #}
{{ "Comments"|xlt }}
{# Reason Code Card - Hidden by default #}
{{ "Reason for Observation"|xlt }}

{{ "When recording a reason for the value (or abscence of a value) of an observation both the reason code and status of the reason are required"|xlt }}

{{ observation.ob_reason_text|default('')|text }}
{# Action Bar #}
{# if we do any more ajax stuff we can do some auto saving here #} {# {{ "Form Ready"|xlt }}#}
{% if isEdit %} {{ "Cancel"|xlt }} {% else %} {% endif %}
{# AI Generated: Hidden Templates for Dialog Content #}
{# Sub-observation Template #} {% include "forms/observation/templates/partials/_sub-observation.html.twig" with { nodeId: 'sub-observation-template' , observation: {id: '', code: '', value: '', units: '', description: '', status: defaultStatusType} } %} {# QuestionnaireResponse Dialog Template #} {# QuestionnaireResponse Result Item Template #} {# Linked State Template #} {# Unlinked State Template #} {# Empty Sub-observations State Template #}
{% endblock %} {% block scripts %} {% endblock %}