<%= activate_angular_js do %> <%= initialize_hide_sections_with @custom_action.all_actions.map { |a| { key: a.key, label: a.human_name } }, @custom_action.actions.map { |a| { key: a.key, label: a.human_name } } %>
<%= f.text_field :name, required: true, container_class: '-middle' %>
<%= f.text_area :description, container_class: '-middle' %>
<%= t('custom_actions.conditions') %> <% @custom_action.all_conditions.each do |condition| %>
<%= styled_label_tag("custom_action_conditions_#{condition.key}", condition.human_name, class: '-top') %> <% input_name = "custom_action[conditions][#{condition.key}]" %> <% selected_values = condition.values select_options = options_for_select(condition.allowed_values.map { |v| [v[:label], v[:value]] }, selected: selected_values) %>
<%= select_tag input_name, select_options, multiple: true %>
<% end %>
<%= t('custom_actions.actions.name') %>
<% @custom_action.all_actions.each do |action| %>
<%= styled_label_tag("custom_action_actions_#{action.key}", action.human_name, class: '-top') %> <% input_name = "custom_action[actions][#{action.key}]" %> <% if %i(associated_property boolean).include?(action.type) %> <% selected_values = action.values select_options = options_for_select(action.allowed_values.map { |v| [v[:label], v[:value]] }, selected: selected_values) %>
<%= select_tag input_name, select_options, multiple: action.multi_value? %>
<% elsif %i(date_property).include?(action.type) %>
<% elsif %i(string_property text_property).include?(action.type) %>
<%= styled_text_field_tag input_name, action.values, container_class: '-slim', step: 'any' %>
<% elsif action.type == :float_property %>
<%= styled_number_field_tag input_name, action.values, container_class: '-slim', min: action.minimum, max: action.maximum, step: 'any' %>
<% elsif action.type == :integer_property %>
<%= styled_number_field_tag input_name, action.values, container_class: '-slim', min: action.minimum, max: action.maximum, step: 1 %>
<% end %>
<% end %>
<% end %>