Merge branch 'develop_v2' into develop
This commit is contained in:
commit
04a8632bda
11 changed files with 125 additions and 14 deletions
|
@ -32,7 +32,7 @@ class Users::CarteController < UsersController
|
|||
end
|
||||
|
||||
def get_position
|
||||
point = Carto::Geocodeur.convert_adresse_to_point(current_user_dossier.etablissement.geo_adresse)
|
||||
point = Carto::Geocodeur.convert_adresse_to_point(current_user_dossier.etablissement.geo_adresse) rescue nil
|
||||
|
||||
lon = '2.428462'
|
||||
lat = '46.538192'
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
%textarea.form-control{id: 'texte_commentaire', class: 'wysihtml5', name: 'texte_commentaire', style: 'width: 100%; margin-bottom:2%', rows: '5', placeholder:"Commentaire"}
|
||||
%h4.text-primary{style: 'margin-top: 0px'} Ajouter un fichier
|
||||
= file_field_tag "piece_justificative[content]", accept: PieceJustificative.accept_format, style: 'float: left; margin-left: 20px'
|
||||
%input.form-control.btn.btn-send{ type: 'submit', value: 'ENVOYER' }
|
||||
%input#save-message.form-control.btn.btn-send{ type: 'submit', value: 'ENVOYER' }
|
||||
- if last_comment = @facade.commentaires.first
|
||||
%div.last-commentaire
|
||||
.row
|
||||
|
@ -40,13 +40,13 @@
|
|||
= file.original_filename
|
||||
.row
|
||||
.col-lg-12.col-md-12
|
||||
%div.new-action
|
||||
%div#open-message.new-action
|
||||
ENVOYER UN MESSAGE
|
||||
- else
|
||||
.last-commentaire
|
||||
.row
|
||||
.col-lg-12.col-md-12
|
||||
%div.new-action
|
||||
%div#open-message.new-action
|
||||
ENVOYER UN MESSAGE
|
||||
|
||||
- if @facade.procedure.individual_with_siret
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- unless @facade.dossier.read_only?
|
||||
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
||||
%a#maj_infos.action{href: "/users/dossiers/#{@facade.dossier.id}/description"}
|
||||
%div.col-lg-2.col-md-2.action
|
||||
%div#edit-dossier.col-lg-2.col-md-2.action
|
||||
= "éditer".upcase
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
- else
|
||||
%div.col-md-1.col-lg-1.comments-off
|
||||
= "-"
|
||||
%div.col-md-5.col-lg-5.depositaire-info
|
||||
%div.col-md-5.col-lg-5.depositaire-info{ id: "champ-#{champ.id}-value" }
|
||||
- unless champ.decorate.value.blank?
|
||||
= champ.decorate.value.html_safe
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
.form-group.form-group-lg
|
||||
= f.text_field :siret, class: "form-control", placeholder: "Entrez votre Siret", value: @siret
|
||||
= f.hidden_field :dossier_id, value: @facade.dossier.id
|
||||
= f.submit 'Valider', class: %w(btn btn-lg btn-success), data: { disable_with: "Recherche en cours ..." }
|
||||
= f.submit 'Valider', class: %w(btn btn-lg btn-success), id: 'submit-siret', data: { disable_with: "Recherche en cours ..." }
|
||||
- else
|
||||
%br
|
||||
#recap_info_entreprise
|
||||
|
|
|
@ -11,37 +11,37 @@
|
|||
%div.split-hr-left
|
||||
#procedure_list
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'brouillon')}", 'data-toggle' => :tooltip, title: 'Les dossiers jamais proposés à la relecture.'}
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.brouillon_class }
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.brouillon_class, id: 'brouillon' }
|
||||
= "Brouillons"
|
||||
.badge.progress-bar-default
|
||||
= @dossiers_list_facade.brouillon_total
|
||||
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'a_traiter')}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.'}
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.en_construction_class }
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.en_construction_class, id: 'a_traiter' }
|
||||
= "En construction"
|
||||
.badge.progress-bar-danger
|
||||
= @dossiers_list_facade.en_construction_total
|
||||
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'valides')}", 'data-toggle' => :tooltip, title: 'Les dossiers relus par votre accompagnateur pouvant être déposés pour examen.'}
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.valides_class }
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.valides_class, id: 'valides' }
|
||||
="À déposer"
|
||||
.badge.progress-bar-purple
|
||||
= @dossiers_list_facade.valides_total
|
||||
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'en_instruction')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours d\'examen par l\'administration compétante.'}
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.en_instruction_class }
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.en_instruction_class, id: 'en_instruction' }
|
||||
="En examen"
|
||||
.badge.progress-bar-default
|
||||
= @dossiers_list_facade.en_instruction_total
|
||||
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'termine')}", 'data-toggle' => :tooltip, title: 'Les dossiers cloturés qui peuvent être "Accepté", "Refusé" ou "Sans suite".'}
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.termine_class }
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.termine_class, id: 'termine' }
|
||||
= "Cloturé"
|
||||
.badge.progress-bar-success
|
||||
= @dossiers_list_facade.termine_total
|
||||
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'invite')}"}
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.invite_class }
|
||||
%div.procedure_list_element{ class: @dossiers_list_facade.invite_class, id: 'invite' }
|
||||
= "Invitation"
|
||||
.badge.progress-bar-warning
|
||||
= @dossiers_list_facade.invite_total
|
||||
|
|
|
@ -22,6 +22,12 @@ FactoryGirl.define do
|
|||
end
|
||||
end
|
||||
|
||||
trait :for_individual do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
procedure.for_individual = true
|
||||
end
|
||||
end
|
||||
|
||||
trait :with_type_de_champ do
|
||||
after(:build) do |procedure, _evaluator|
|
||||
type_de_champ = create(:type_de_champ_public)
|
||||
|
|
53
spec/features/users/dossier_creation_spec.rb
Normal file
53
spec/features/users/dossier_creation_spec.rb
Normal file
|
@ -0,0 +1,53 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As a User I wanna create a dossier', js: true do
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:siret) { '40307130100044' }
|
||||
let(:siren) { siret[0...9] }
|
||||
|
||||
context 'Right after sign_in I shall see inscription by credentials/siret, I can create a new Dossier' do
|
||||
let(:procedure_with_siret) { create(:procedure, :published, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative) }
|
||||
let(:procedure_for_individual) { create(:procedure, :published, :for_individual, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative) }
|
||||
|
||||
scenario 'Identification for individual' do
|
||||
login_as user, scope: :user
|
||||
visit commencer_path(procedure_path: procedure_for_individual.path)
|
||||
fill_in 'dossier_individual_attributes_nom', with: 'Nom'
|
||||
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
|
||||
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
|
||||
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
||||
page.find_by_id('etape_suivante').click
|
||||
expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
|
||||
page.find_by_id('etape_suivante').click
|
||||
fill_in 'champs_1', with: 'contenu du champ 1'
|
||||
page.find_by_id('suivant').click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
|
||||
end
|
||||
|
||||
scenario 'Identification through siret' do
|
||||
login_as user, scope: :user
|
||||
visit commencer_path(procedure_path: procedure_with_siret.path)
|
||||
expect(page).to have_current_path(users_dossier_path(Dossier.first.id.to_s), only_path: true)
|
||||
fill_in 'dossier_siret', with: siret
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/v1/etablissements/exercices/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/v1/associations/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 404, body: '')
|
||||
page.find_by_id('dossier_siret').set siret
|
||||
page.find_by_id('submit-siret').click
|
||||
expect(page).to have_css('#recap_info_entreprise')
|
||||
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
||||
page.find_by_id('etape_suivante').click
|
||||
expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
|
||||
page.find_by_id('etape_suivante').click
|
||||
fill_in 'champs_1', with: 'contenu du champ 1'
|
||||
page.find_by_id('suivant').click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
|
||||
end
|
||||
end
|
||||
end
|
52
spec/features/users/dossier_edition_spec.rb
Normal file
52
spec/features/users/dossier_edition_spec.rb
Normal file
|
@ -0,0 +1,52 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As a User I want to edit a dossier I own', js: true do
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:procedure_for_individual) { create(:procedure, :published, :for_individual, :with_api_carto, :with_type_de_champ, :with_two_type_de_piece_justificative) }
|
||||
|
||||
before "Create dossier" do
|
||||
login_as user, scope: :user
|
||||
visit commencer_path(procedure_path: procedure_for_individual.path)
|
||||
fill_in 'dossier_individual_attributes_nom', with: 'Nom'
|
||||
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
|
||||
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
|
||||
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
|
||||
page.find_by_id('etape_suivante').click
|
||||
page.find_by_id('etape_suivante').click
|
||||
page.find_by_id('suivant').click
|
||||
visit root_path
|
||||
end
|
||||
|
||||
context 'After sign_in, I can navigate through dossiers indexes and edit a dossier' do
|
||||
|
||||
scenario 'After sign_in, I can see dossiers "à traiter" (default), and other indexes' do
|
||||
expect(page.find('#a_traiter')['class'] ).to eq('active procedure_list_element')
|
||||
page.find_by_id('brouillon').click
|
||||
page.find_by_id('a_traiter').click
|
||||
page.find_by_id('valides').click
|
||||
page.find_by_id('en_instruction').click
|
||||
page.find_by_id('termine').click
|
||||
page.find_by_id('invite').click
|
||||
end
|
||||
|
||||
scenario 'Getting a dossier, I want to create a new message on' do
|
||||
page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
|
||||
page.find_by_id('open-message').click
|
||||
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
|
||||
page.find_by_id('save-message').click
|
||||
expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message')
|
||||
end
|
||||
|
||||
scenario 'On the same dossier, I want to edit informations' do
|
||||
page.find_by_id('tr_dossier_' + Dossier.last.id.to_s).click
|
||||
page.find_by_id('edit-dossier').click
|
||||
expect(page).to have_current_path(users_dossier_description_path(Dossier.first.id.to_s), only_path: true)
|
||||
fill_in 'champs_1', with: 'Contenu du champ 1'
|
||||
page.find_by_id('modification_terminee').click
|
||||
expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
|
||||
expect(page.find('#champ-1-value').text).to eq('Contenu du champ 1')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -44,4 +44,4 @@ feature 'user arrive on siret page' do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
0
spec/fixtures/file.pdf
vendored
Normal file
0
spec/fixtures/file.pdf
vendored
Normal file
Loading…
Reference in a new issue