<%= 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, multiple: true, container_class: '-middle' %>
<% end %>
<%= t('custom_actions.actions.name') %>
<% @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).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.multi_value?, container_class: '-middle' %> <% elsif %i(date_property).include?(action.type) %> <%= styled_text_field_tag input_name, action.values, 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 %>