2016-08-11 15:27:35 +02:00
|
|
|
class DossiersListGestionnaireService
|
2016-09-06 11:07:26 +02:00
|
|
|
def initialize current_devise_profil, liste, procedure = nil
|
2016-08-11 15:27:35 +02:00
|
|
|
@current_devise_profil = current_devise_profil
|
|
|
|
@liste = liste
|
2016-09-06 11:07:26 +02:00
|
|
|
@procedure = procedure
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def dossiers_to_display
|
|
|
|
{'nouveaux' => nouveaux,
|
|
|
|
'a_traiter' => waiting_for_gestionnaire,
|
|
|
|
'en_attente' => waiting_for_user,
|
|
|
|
'deposes' => deposes,
|
|
|
|
'a_instruire' => a_instruire,
|
2016-09-06 11:07:26 +02:00
|
|
|
'termine' => termine}[@liste]
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def nouveaux
|
2016-09-06 11:07:26 +02:00
|
|
|
@nouveaux ||= filter_dossiers.nouveaux
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def waiting_for_gestionnaire
|
2016-09-06 11:07:26 +02:00
|
|
|
@waiting_for_gestionnaire ||= filter_dossiers.waiting_for_gestionnaire
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def waiting_for_user
|
2016-09-06 11:07:26 +02:00
|
|
|
@waiting_for_user ||= filter_dossiers.waiting_for_user
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def deposes
|
2016-09-06 11:07:26 +02:00
|
|
|
@deposes ||= filter_dossiers.deposes
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def a_instruire
|
2016-09-06 11:07:26 +02:00
|
|
|
@a_instruire ||= filter_dossiers.a_instruire
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def termine
|
2016-09-06 11:07:26 +02:00
|
|
|
@termine ||= filter_dossiers.termine
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
|
2016-09-06 11:07:26 +02:00
|
|
|
def filter_dossiers
|
|
|
|
@procedure.nil? ? @current_devise_profil.dossiers : @procedure.dossiers
|
2016-08-11 15:27:35 +02:00
|
|
|
end
|
|
|
|
end
|