{% extends "layouts/base.html" %} {% load i18n static %} {% block extra_css %} {% endblock %} {% block title %}{% if template %}{% trans "Edit Survey Template" %}{% else %}{% trans "Create Survey Template" %}{% endif %} - PX360{% endblock %} {% block content %}

{% if template %}{% trans "Edit Survey Template" %}{% else %}{% trans "Create Survey Template" %}{% endif %}

{% if template %}{% trans "Modify this survey template and its questions" %}{% else %}{% trans "Create a new survey template with questions" %}{% endif %}

{% trans "Back to Templates" %}
{% csrf_token %} {{ formset.management_form }}

{% trans "General Settings" %}

{{ form.name }} {% if form.name.errors %}
{{ form.name.errors }}
{% endif %}
{{ form.name_ar }} {% if form.name_ar.errors %}
{{ form.name_ar.errors }}
{% endif %}
{% if not form.hospital.is_hidden %} {{ form.hospital }} {% else %} {{ form.hospital }} {% endif %} {% if form.hospital.errors %}
{{ form.hospital.errors }}
{% endif %}

{% trans "Leave blank to apply to all hospitals" %}

{{ form.survey_type }} {% if form.survey_type.errors %}
{{ form.survey_type.errors }}
{% endif %}
{{ form.scoring_method }} {% if form.scoring_method.errors %}
{{ form.scoring_method.errors }}
{% endif %}
{{ form.negative_threshold }} {% if form.negative_threshold.errors %}
{{ form.negative_threshold.errors }}
{% endif %}

{% trans "Score below this is flagged as negative" %}

{% if form.is_active.errors %}
{{ form.is_active.errors }}
{% endif %}

{% trans "Questions" %}

{% for form in formset %}

{% trans "Question" %} {{ forloop.counter }}

{{ form.id }}
{{ form.text }} {% if form.text.errors %}
{{ form.text.errors }}
{% endif %}
{{ form.text_ar }} {% if form.text_ar.errors %}
{{ form.text_ar.errors }}
{% endif %}
{{ form.question_type }} {% if form.question_type.errors %}
{{ form.question_type.errors }}
{% endif %}
{{ form.order }} {% if form.order.errors %}
{{ form.order.errors }}
{% endif %}
{% if form.is_required.errors %}
{{ form.is_required.errors }}
{% endif %}

{% trans "Base questions are always shown regardless of patient events" %}

{{ form.event_type }} {% if form.event_type.errors %}
{{ form.event_type.errors }}
{% endif %}

{% trans "HIS event type that triggers this question (leave blank for base)" %}

{{ form.choices_json }} {% if form.choices_json.errors %}
{{ form.choices_json.errors }}
{% endif %}

{% trans "JSON array of choices. Format: [{"value": "1", "label": "Option 1", "label_ar": "خيار 1"}]" %}

{% if form.non_field_errors %}
{{ form.non_field_errors }}
{% endif %}
{% endfor %}
{% trans "Cancel" %}
{% endblock %} {% block extra_js %} {% endblock %}