{% extends "utilities/_base.html" %} {% from "components/distance_input.html" import distance_input %} {% from "components/page_header.html" import page_header %} {% from "components/modal.html" import render_modal %} {% macro render_edit_automation_form() %}
{% endmacro %} {% macro render_configure_form() %} {% for field in config_fields %}
{% if field.type in ('float', 'int') %} {% endif %} {% if field.type == 'string' %} {% endif %} {% if field.type == 'distance' %} {{ distance_input( 'config-' ~ field.key, field.key, field.value, field.unit_key, field.unit, field.units, min=field.min, max=field.max, step=field.step, required=field.required ) }} {% endif %} {% if field.type == 'bool' %} {% endif %} {% if field.help %}

{{ field.help }}

{% endif %}
{% endfor %} {% endmacro %} {% block title %}{{ _("Automations - Yaffo") }}{% endblock %} {% block utility_styles %} {% endblock %} {% block utility_content %} {% if not selected %}

{{ _("No automation selected") }}

{{ _("Pick one from the sidebar, or create one with “New automation”.") }}

{% else %} {% set header_actions %}
{% if scoped_run %} {% else %} {% endif %} {% if not selected.is_system %} {{ _("Edit") }} {% endif %} {{ _("Edit triggers") }} {% if config_fields %} {% endif %} {% if not selected.is_system %} {% endif %}
{% endset %} {% call page_header(selected.display_name, actions=header_actions) %} {% if selected.is_system %} {{ selected.display_description or _("A built-in automation that ships with Yaffo. System automations cannot be edited or deleted.") }} {% else %} {{ selected.display_description or _("No description yet — use “Edit details” to add one.") }} {% endif %} {% endcall %}
{% include "utilities/automations_runs.html" %}
{% if not selected.is_system %} {{ render_modal('editAutomationModal', _('Edit automation'), url_for('automations_update_details', slug=selected.slug), render_edit_automation_form, _('Save')) }} {% endif %} {% if config_fields %} {{ render_modal('configureAutomationModal', _('Configure automation'), url_for('automations_update_config', slug=selected.slug), render_configure_form, _('Save')) }} {% endif %} {% endif %} {% endblock %} {% block scripts %} {% if selected %} {% endif %} {% endblock %}