<%= form_with model: integration, url: (integration.persisted? ? admin_integration_path(integration) : admin_integrations_path), scope: :api_token, class: "card card-body max-w-2xl space-y-5", data: { turbo: false } do |f| %> <%= f.errors_summary %> <% if endpoint&.errors&.any? %>
<%= endpoint.errors.full_messages.to_sentence %>
<% end %> <%= f.field :name, hint: t(".name_hint") %>
<%= t(".scopes") %> <% ApiToken::SCOPES.each do |key, label| %> <% end %>
<%= t(".aircraft") %>

<%= t(".aircraft_hint") %>

<% Aircraft.ordered.each do |a| %> <% end %>
<%= t(".webhook") %>

<%= t(".webhook_hint") %>

<%= url_field_tag "webhook[url]", endpoint&.url, class: "input", placeholder: "https://redmine.example.com/sam/webhook", "aria-label": t(".webhook_url") %> <% WebhookEndpoint::EVENTS.each do |key, label| %> <% end %> <% if endpoint&.persisted? %> <%= hidden_field_tag "webhook[enabled]", "0", id: nil %> <% end %>
<%= f.submit integration.persisted? ? t(".save") : t(".create"), class: "btn-primary" %> <% end %>