{# Trigger list + add controls for one automation. Included by automations.html on first render and re-rendered in place by the automations_triggers HTMX endpoint (single endpoint, action via hx-vals). Expects: triggers, slug, events, error. The schedule add UI is the cron editor component (components/cron_builder.js): the
mount renders itself and keeps a hidden `cron` input the server validates. Existing schedule rows carry data-cron and the component fills the friendly text (the raw cron shown here is the no-JS fallback). Editing a schedule = delete + re-add. #}
{% if error %}

{{ error }}

{% endif %} {% if triggers %}
    {% for trigger in triggers %}
  • {% if trigger.trigger_type == 'schedule' %} {{ _("Schedule") }} {{ trigger.cron }} {% set scope = trigger.config or {} %} {% if scope.get('scope_type') == 'media_dirs' or (not scope.get('scope_type') and scope.get('media_dir_ids')) %} {% trans count=scope.get('media_dir_ids', [])|length %}{{ count }} media directory{% pluralize %}{{ count }} media directories{% endtrans %} {% elif scope.get('scope_type') == 'paths' or (not scope.get('scope_type') and scope.get('folder_paths')) %} {% trans count=scope.get('folder_paths', [])|length %}{{ count }} path{% pluralize %}{{ count }} paths{% endtrans %} {% else %}{{ _("Everything") }}{% endif %} {% else %} {{ _("Event") }} {{ events.get(trigger.event_type, trigger.event_type) }} {% endif %} {% if trigger.trigger_type == 'schedule' %} {% endif %}
  • {% endfor %}
{% else %}

{{ _("No triggers — this automation won't run until one is added.") }}

{% endif %} {# Two entry points; each reveals its own panel (one at a time). automations.js (initTriggerEditor) toggles .adding-schedule / .adding-event on this container and drives the cron builder; a row's Edit reuses the schedule panel pre-populated. #}

{{ _("Add a schedule") }}

{{ _("Schedule") }}
{{ _("Scope") }}

{{ _("All indexed media in every configured media directory.") }}

{{ _("Add an event trigger") }}