Merge branch 'develop' into staging
This commit is contained in:
commit
3c98601f10
8 changed files with 44 additions and 6 deletions
|
@ -7,6 +7,11 @@ class Backoffice::DossiersListController < ApplicationController
|
|||
def index
|
||||
cookies[:liste] = param_liste
|
||||
|
||||
unless DossiersListGestionnaireService.dossiers_list_libelle.include?(param_liste)
|
||||
cookies[:liste] = 'a_traiter'
|
||||
return redirect_to backoffice_dossiers_path
|
||||
end
|
||||
|
||||
dossiers_list_facade param_liste
|
||||
dossiers_list_facade.service.change_sort! param_sort unless params[:dossiers_smart_listing].nil?
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class DossierFacades
|
|||
end
|
||||
|
||||
def pieces_justificatives
|
||||
@dossier.pieces_justificatives
|
||||
@dossier.ordered_pieces_justificatives
|
||||
end
|
||||
|
||||
def commentaires
|
||||
|
|
|
@ -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
|
||||
|
@ -282,9 +286,14 @@ class Dossier < ActiveRecord::Base
|
|||
|
||||
def as_csv(options={})
|
||||
dossier_attr = DossierSerializer.new(self).attributes
|
||||
etablissement_attr = EtablissementCsvSerializer.new(self.etablissement).attributes.map { |k, v| ["etablissement.#{k}", v] }.to_h
|
||||
entreprise_attr = EntrepriseSerializer.new(self.entreprise).attributes.map { |k, v| ["entreprise.#{k}", v] }.to_h
|
||||
dossier_attr.merge(etablissement_attr).merge(entreprise_attr)
|
||||
|
||||
unless entreprise.nil?
|
||||
etablissement_attr = EtablissementCsvSerializer.new(self.etablissement).attributes.map { |k, v| ["etablissement.#{k}", v] }.to_h
|
||||
entreprise_attr = EntrepriseSerializer.new(self.entreprise).attributes.map { |k, v| ["entreprise.#{k}", v] }.to_h
|
||||
dossier_attr = dossier_attr.merge(etablissement_attr).merge(entreprise_attr)
|
||||
end
|
||||
|
||||
dossier_attr
|
||||
end
|
||||
|
||||
def reset!
|
||||
|
|
|
@ -14,6 +14,10 @@ class DossiersListGestionnaireService
|
|||
'termine' => termine}[@liste]
|
||||
end
|
||||
|
||||
def self.dossiers_list_libelle
|
||||
['nouveaux', 'a_traiter', 'en_attente', 'deposes', 'a_instruire', 'termine']
|
||||
end
|
||||
|
||||
def nouveaux
|
||||
@nouveaux ||= filter_dossiers.nouveaux
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -89,6 +89,19 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'GET #list_fake' do
|
||||
context 'when gestionnaire is connected' do
|
||||
before do
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :index, liste: :list_fake
|
||||
expect(response).to redirect_to(backoffice_dossiers_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #search' do
|
||||
before do
|
||||
sign_in gestionnaire
|
||||
|
|
|
@ -689,6 +689,13 @@ describe Dossier do
|
|||
it { expect(subject['entreprise.date_creation']).to eq('Thu, 28 Jan 2016 10:16:29 UTC +00:0') }
|
||||
it { expect(subject['entreprise.nom']).to be_nil }
|
||||
it { expect(subject['entreprise.prenom']).to be_nil }
|
||||
|
||||
context 'when dossier does not have enterprise' do
|
||||
let(:dossier) { create(:dossier, user: user, procedure: procedure) }
|
||||
subject { dossier.as_csv }
|
||||
|
||||
it { expect(subject[:archived]).to be_falsey }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#reset!' do
|
||||
|
|
Loading…
Add table
Reference in a new issue