module Dhatu class ManufacturersController < ResourceController private def permitted_params params.require("dhatu/manufacturer").permit(:name, :description, :remarks, :website, :priority) end def get_collections @relation = Dhatu::Manufacturer.includes(:logo).where("") parse_filters apply_filters @manufacturers = @r_objects = @relation.page(@current_page).per(@per_page) return true end def apply_filters @relation = @relation.search(@query) if @query @relation = @relation.status(@status) if @status @relation = @relation.order("priority ASC, name ASC") end def configure_filter_settings @filter_settings = { string_filters: [ { filter_name: :query }, { filter_name: :status } ], boolean_filters: [], reference_filters: [], variable_filters: [], } end def configure_filter_ui_settings @filter_ui_settings = { status: { object_filter: false, select_label: "Filter by Status", display_hash: Dhatu::Manufacturer::STATUS_REVERSE, current_value: @status, values: Dhatu::Manufacturer::STATUS, current_filters: @filters, filters_to_remove: [], filters_to_add: {}, url_method_name: 'manufacturers_url', show_all_filter_on_top: true } } end def resource_controller_configuration { page_title: "Manage Manufacturers", current_nav: "dhatu/manufacturers", feature_name: "KM - Users", # Resource Names class: Dhatu::Manufacturer, collection_name: :manufacturers, item_name: :manufacturer, # Conditions get_collections_after_save_resource: false, show_modal_after_create: true, show_modal_after_update: false, # Model Size can be large or generic form_model_size: :large, show_model_size: :large, # Layout can be table or feed # table uses html tables and feed uses div based boxes layout: :table, # "/kuppayam/workflows/default" # # Default partial opens show and form partial according to the model_size configuration # It also respect the configuration layout and refresh the page element on both cases - i.e layout is table or feed # "/kuppayam/workflows/peacock" # "/kuppayam/workflows/parrot" # # Peacock & Parrot are old ways of doing things and it respects certail configurations # Peacock opens show and form partials in large popup where as Parrot opens it in small # Both Peacock and Parrot expect table based layout and will reload a single row after create / update # Rendering Paths view_path: "dhatu/manufacturers", js_view_path: "/kuppayam/workflows/default", # Additional Configurations load_rich_text_editor: true, tagsinput: false } end def breadcrumbs_configuration { heading: "Manage Manufacturers", icon: "fa-institution", description: "Listing all Manufacturers", links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'}, {name: "Manage Manufacturers", link: dhatu.manufacturers_path, icon: 'fa-institution', active: true}] } end end end