module Dhatu class PricesController < ResourceController private def permitted_params params.require("dhatu/price").permit(:title, :sub_title, :price, :category_id, :priority) end def get_collections get_category_filters("Dhatu::Price") @relation = Dhatu::Price.where("") parse_filters apply_filters @prices = @r_objects = @relation.page(@current_page).per(@per_page) return true end def apply_filters if @category if @category.id == -1 @relation = @relation.where("category_id is NULL") else @relation = @relation.where("category_id = ?", @category.id) end end @relation = @relation.search(@query) if @query @relation = @relation.status(@status) if @status @order_by = "priority ASC, title ASC" unless @order_by @relation = @relation.order(@order_by) 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: "Select Status", display_hash: Dhatu::Price::STATUS, current_value: @status, values: Dhatu::Price::STATUS_REVERSE, current_filters: @filters, filters_to_remove: [], filters_to_add: {}, url_method_name: 'prices_url', show_all_filter_on_top: true } } end def resource_controller_configuration { page_title: "Prices", js_view_path: "/kuppayam/workflows/parrot", view_path: "dhatu/prices", collection_name: :prices, item_name: :price, class: Dhatu::Price } end def breadcrumbs_configuration { heading: "Manage Prices", icon: "fa-dollar", description: "Listing all Prices", links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'}, {name: "Manage Prices", link: dhatu.prices_path, icon: 'fa-dollar', active: true}] } end def set_navs set_nav("dhatu/price") end end end