<%= form_with model: ad, url: ad.new_record? ? aircraft_airworthiness_directives_path(aircraft) : aircraft_airworthiness_directive_path(aircraft, ad), class: "card card-body space-y-4 max-w-3xl" do |f| %> <%= f.errors_summary %>
<%= f.field :name, label: t(".number"), required: true, placeholder: "2011-10-09" %> <%= f.field :bulletin_type, as: :select, label: t(".type"), collection: AirworthinessDirective::BULLETIN_TYPES.invert %> <%= f.field :compliance_type, as: :select, label: t(".compliance"), collection: AirworthinessDirective::COMPLIANCE_TYPES.invert, hint: t(".conditional_ads_only_apply_when") %>
<%= f.field :short_description, required: true %> <%= f.field :required_action, as: :textarea, rows: 3 %> <%= f.field :trigger_condition, as: :textarea, rows: 2, hint: t(".for_conditional_ads_e_g") %>
<%= f.field :mandatory, as: :checkbox, label: t(".mandatory") %> <%= f.field :recurring, as: :checkbox, label: t(".recurring") %>
<%= f.field :recurring_hours, as: :number, step: 0.1, label: t(".every_hours") %> <%= f.interval :recurring, label: t(".every"), hint: t(".months_and_years_are_due") %> <%= f.field :document_id, as: :select, label: t(".reference_document"), collection: document_options(aircraft) %>
<%= f.field :document_url, label: t(".link_to_ad_document"), placeholder: t(".https"), hint: t(".filled_in_automatically_from_a") %> <%= render "shared/applicability_fields", aircraft: aircraft, record: ad, applies_to_airframe: @applies_to_airframe %> <% if ad.persisted? && (ad.aircraft.count + ad.components.where.not(aircraft_id: aircraft.id).count) > 1 %>

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

<% end %>
<%= f.submit t(".save") %><%= link_to t(".cancel"), aircraft_airworthiness_directives_path(aircraft), class: "btn-secondary" %>
<% end %> <% if ad.persisted? %>
<%= delete_button t(".remove_from", tail_number: aircraft.tail_number), aircraft_airworthiness_directive_path(aircraft, ad) %>
<% end %>