2015-12-24 15:10:20 +01:00
|
|
|
class DossierFacades
|
|
|
|
|
|
|
|
#TODO rechercher en fonction de la personne/email
|
|
|
|
def initialize dossier_id, email
|
|
|
|
@dossier = Dossier.where(archived: false).find(dossier_id)
|
|
|
|
@email = email
|
|
|
|
end
|
|
|
|
|
|
|
|
def dossier
|
|
|
|
@dossier.decorate
|
|
|
|
end
|
|
|
|
|
|
|
|
def champs
|
|
|
|
@dossier.ordered_champs
|
|
|
|
end
|
|
|
|
|
|
|
|
def entreprise
|
2016-06-20 13:57:57 +02:00
|
|
|
@dossier.entreprise.decorate unless @dossier.entreprise.nil?
|
2015-12-24 15:10:20 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def etablissement
|
|
|
|
@dossier.etablissement
|
|
|
|
end
|
|
|
|
|
|
|
|
def pieces_justificatives
|
|
|
|
@dossier.pieces_justificatives
|
|
|
|
end
|
|
|
|
|
|
|
|
def commentaires
|
|
|
|
@dossier.ordered_commentaires.all.decorate
|
|
|
|
end
|
|
|
|
|
|
|
|
def commentaire_email
|
|
|
|
@email
|
|
|
|
end
|
|
|
|
|
|
|
|
def procedure
|
|
|
|
@dossier.procedure
|
|
|
|
end
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2016-03-16 15:34:35 +01:00
|
|
|
def cerfas_ordered
|
|
|
|
@dossier.cerfa.order('created_at DESC')
|
|
|
|
end
|
|
|
|
|
2016-02-08 18:16:18 +01:00
|
|
|
def invites
|
|
|
|
@dossier.invites
|
|
|
|
end
|
2016-07-18 18:48:59 +02:00
|
|
|
|
2016-08-08 12:52:30 +02:00
|
|
|
def champs_private
|
|
|
|
@dossier.ordered_champs_private
|
|
|
|
end
|
|
|
|
|
2016-08-30 11:18:43 +02:00
|
|
|
def individual
|
|
|
|
@dossier.individual
|
|
|
|
end
|
|
|
|
|
2016-07-18 18:48:59 +02:00
|
|
|
def commentaires_files
|
|
|
|
PieceJustificative.where(dossier_id: @dossier.id, type_de_piece_justificative_id: nil)
|
|
|
|
end
|
2016-07-19 16:44:26 +02:00
|
|
|
|
|
|
|
def followers
|
|
|
|
Gestionnaire.joins(:follows).where("follows.dossier_id=#{@dossier.id}")
|
|
|
|
end
|
2015-12-24 15:10:20 +01:00
|
|
|
end
|