2016-09-27 17:26:49 +02:00
|
|
|
class Backoffice::DossiersListController < ApplicationController
|
|
|
|
include SmartListing::Helper::ControllerExtensions
|
|
|
|
helper SmartListing::Helper
|
|
|
|
|
|
|
|
before_action :authenticate_gestionnaire!
|
|
|
|
|
|
|
|
def index
|
2016-10-04 19:19:03 +02:00
|
|
|
cookies[:liste] = param_liste
|
2016-09-27 17:26:49 +02:00
|
|
|
|
2016-10-04 19:19:03 +02:00
|
|
|
dossiers_list_facade param_liste
|
2016-09-27 17:26:49 +02:00
|
|
|
dossiers_list_facade.service.change_sort! param_sort unless params[:dossiers_smart_listing].nil?
|
|
|
|
|
|
|
|
smartlisting_dossier
|
|
|
|
end
|
|
|
|
|
2016-10-04 19:19:03 +02:00
|
|
|
def filter
|
|
|
|
dossiers_list_facade param_liste
|
|
|
|
dossiers_list_facade.service.add_filter param_filter
|
|
|
|
end
|
|
|
|
|
2016-09-27 17:26:49 +02:00
|
|
|
def dossiers_list_facade liste='a_traiter'
|
|
|
|
@dossiers_list_facade ||= DossiersListFacades.new current_gestionnaire, liste, retrieve_procedure
|
|
|
|
end
|
|
|
|
|
2016-10-07 14:58:45 +02:00
|
|
|
def smartlisting_dossier dossiers_list=nil, liste='a_traiter'
|
|
|
|
dossiers_list_facade liste
|
|
|
|
dossiers_list = dossiers_list_facade.dossiers_to_display if dossiers_list.nil?
|
|
|
|
|
2016-09-27 17:26:49 +02:00
|
|
|
@dossiers = smart_listing_create :dossiers,
|
2016-10-07 14:58:45 +02:00
|
|
|
dossiers_list,
|
2016-09-27 17:26:49 +02:00
|
|
|
partial: "backoffice/dossiers/list",
|
|
|
|
array: true,
|
|
|
|
default_sort: dossiers_list_facade.service.default_sort
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def param_sort
|
|
|
|
params[:dossiers_smart_listing][:sort]
|
|
|
|
end
|
2016-10-04 19:19:03 +02:00
|
|
|
|
|
|
|
def param_filter
|
|
|
|
params[:filter_input]
|
|
|
|
end
|
|
|
|
|
|
|
|
def param_liste
|
|
|
|
@liste ||= params[:liste] || cookies[:liste] || 'a_traiter'
|
|
|
|
end
|
2016-09-27 17:26:49 +02:00
|
|
|
end
|