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
|
def index
|
||||||
cookies[:liste] = param_liste
|
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 param_liste
|
||||||
dossiers_list_facade.service.change_sort! param_sort unless params[:dossiers_smart_listing].nil?
|
dossiers_list_facade.service.change_sort! param_sort unless params[:dossiers_smart_listing].nil?
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ class DossierFacades
|
||||||
end
|
end
|
||||||
|
|
||||||
def pieces_justificatives
|
def pieces_justificatives
|
||||||
@dossier.pieces_justificatives
|
@dossier.ordered_pieces_justificatives
|
||||||
end
|
end
|
||||||
|
|
||||||
def commentaires
|
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')
|
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
|
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
|
def ordered_commentaires
|
||||||
commentaires.order(created_at: :desc)
|
commentaires.order(created_at: :desc)
|
||||||
end
|
end
|
||||||
|
@ -282,9 +286,14 @@ class Dossier < ActiveRecord::Base
|
||||||
|
|
||||||
def as_csv(options={})
|
def as_csv(options={})
|
||||||
dossier_attr = DossierSerializer.new(self).attributes
|
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
|
unless entreprise.nil?
|
||||||
dossier_attr.merge(etablissement_attr).merge(entreprise_attr)
|
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
|
end
|
||||||
|
|
||||||
def reset!
|
def reset!
|
||||||
|
|
|
@ -14,6 +14,10 @@ class DossiersListGestionnaireService
|
||||||
'termine' => termine}[@liste]
|
'termine' => termine}[@liste]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.dossiers_list_libelle
|
||||||
|
['nouveaux', 'a_traiter', 'en_attente', 'deposes', 'a_instruire', 'termine']
|
||||||
|
end
|
||||||
|
|
||||||
def nouveaux
|
def nouveaux
|
||||||
@nouveaux ||= filter_dossiers.nouveaux
|
@nouveaux ||= filter_dossiers.nouveaux
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
- else
|
- else
|
||||||
= 'Pièce non fournie'
|
= '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}" }
|
%tr{ id: "piece_justificative_#{type_de_piece_justificative.id}" }
|
||||||
%th.col-lg-6
|
%th.col-lg-6
|
||||||
= type_de_piece_justificative.libelle
|
= type_de_piece_justificative.libelle
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
-else
|
-else
|
||||||
%input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 3.megabytes }
|
%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
|
%tr
|
||||||
%th.col-lg-6
|
%th.col-lg-6
|
||||||
= type_de_piece_justificative.libelle
|
= type_de_piece_justificative.libelle
|
||||||
|
|
|
@ -89,6 +89,19 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
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
|
describe 'POST #search' do
|
||||||
before do
|
before do
|
||||||
sign_in gestionnaire
|
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.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.nom']).to be_nil }
|
||||||
it { expect(subject['entreprise.prenom']).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
|
end
|
||||||
|
|
||||||
describe '#reset!' do
|
describe '#reset!' do
|
||||||
|
|
Loading…
Reference in a new issue