<%= 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', label: 'Name' %>
<%= t('custom_actions.conditions') %> <% @custom_action.all_conditions.each do |condition| %>
<%= styled_label_tag("custom_action_conditions_#{condition.key}", condition.human_name) %> <% 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) %> <%= styled_select_tag input_name, select_options, container_class: '-middle' %>
<% end %>
<%= t('custom_actions.actions') %>
<% @custom_action.all_actions.each do |action| %>
<%= styled_label_tag("custom_action_actions_#{action.key}", action.human_name) %> <% input_name = "custom_action[actions][#{action.key}]" %> <% if %i(associated_property boolean associated_property_multi).include?(action.type) %> <% selected_values = action.values select_options = options_for_select(action.allowed_values.map { |v| [v[:label], v[:value]] }, selected: selected_values) %> <%= styled_select_tag input_name, select_options, multiple: action.type == :associated_property_multi, container_class: '-middle' %> <% elsif %i(date_property).include?(action.type) %> <%= styled_text_field_tag input_name, action.values, id: "on-date-value-#{action.key}", container_class: '-slim', size: '10' %> <% elsif %i(string_property text_property).include?(action.type) %> <%= styled_text_field_tag input_name, action.values, container_class: '-slim', step: 'any' %> <% elsif %i(integer_property float_property).include?(action.type) %> <%= styled_number_field_tag input_name, action.values, container_class: '-slim', step: 'any' %> <% end %>
<% end %>