Ordered piece justificative

This commit is contained in:
Xavier J 2016-10-07 15:16:03 +02:00
parent ac971a805e
commit 8409b660cf
4 changed files with 7 additions and 3 deletions

View file

@ -23,7 +23,7 @@ class DossierFacades
end
def pieces_justificatives
@dossier.pieces_justificatives
@dossier.ordered_pieces_justificatives
end
def commentaires

View file

@ -84,6 +84,10 @@ class Dossier < ActiveRecord::Base
champs_private.joins(', types_de_champ').where("champs.type_de_champ_id = types_de_champ.id AND types_de_champ.procedure_id = #{procedure.id}").order('order_place')
end
def ordered_pieces_justificatives
champs.joins(', types_de_piece_justificative').where("pieces_justificatives.type_de_piece_justificative_id = types_de_piece_justificative.id AND types_de_piece_justificative.procedure_id = #{procedure.id}").order('order_place ASC')
end
def ordered_commentaires
commentaires.order(created_at: :desc)
end

View file

@ -19,7 +19,7 @@
- else
= 'Pièce non fournie'
- @facade.dossier.types_de_piece_justificative.each do |type_de_piece_justificative|
- @facade.dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative|
%tr{ id: "piece_justificative_#{type_de_piece_justificative.id}" }
%th.col-lg-6
= type_de_piece_justificative.libelle

View file

@ -12,7 +12,7 @@
-else
%input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 3.megabytes }
- @dossier.types_de_piece_justificative.each do |type_de_piece_justificative|
- @dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative|
%tr
%th.col-lg-6
= type_de_piece_justificative.libelle