<%= form_for(@category, :html => {:id=>"form_category", :class=>"mb-0 form-horizontal", :role => "form", :method => (@category.new_record? ? :post : :put), :remote=>true}) do |f| %>
<%= @category.errors[:base].to_sentence %>
<% @category.category_type = params[:category_type] if @category.category_type.blank? && params[:category_type] != "All" %> <%= theme_form_field(@category, :name) %> <% options_list = Array[*@features.collect {|f| [f.display_name, f.name] }].sort %> <%= theme_form_select_group(@category, :category_type, options_list, param_name: "dhatu/category[category_type]", label: "Choose Type", prompt: "Select Category Type") %> <%= theme_form_field(@category, :one_liner, required: false) %> <%= theme_form_field(@category, :description, required: false, html_options: {type: :textarea}) %> <%= theme_form_field(@category, :priority, required: false, html_options: {type: :number, style: "width:70px;"}) %> <% @category.parent_id = params[:parent_id] if params[:parent_id] relation = Dhatu::Category.select("id, name").order("name ASC") relation = relation.where("category_type = '#{@category.category_type}'") if @category.category_type relation = relation.where("id != '#{@category.id}'") if @category.id categories = relation.all %> <% options = {assoc_collection: categories, required: false, editable: true, assoc_display_method: :name, label: "Parent Category", include_blank: true} %> <%= theme_form_assoc_group(@category, :parent_id, **options) %>
<%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %> <%= link_to raw("Cancel"), "#", onclick: "closeGenericModal();", class: "pull-right ml-10 btn btn-white" %>
<%= clear_tag(10) %> <% end %>