Merge branch 'develop' into staging

This commit is contained in:
Xavier J 2016-08-22 17:29:11 +02:00
commit 016077046d
45 changed files with 1089 additions and 600 deletions

View file

@ -2,7 +2,7 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.2'
gem 'rails', '4.2.7.1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
@ -132,7 +132,7 @@ group :development, :test do
gem "nyan-cat-formatter"
gem 'parallel_tests'
gem 'parallel_tests', '~> 1.9.0'
gem 'brakeman', require: false
# Deploy

View file

@ -10,38 +10,38 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.2)
actionmailer (4.2.5.2)
actionpack (= 4.2.5.2)
actionview (= 4.2.5.2)
activejob (= 4.2.5.2)
actionmailer (4.2.7.1)
actionpack (= 4.2.7.1)
actionview (= 4.2.7.1)
activejob (= 4.2.7.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.5.2)
actionview (= 4.2.5.2)
activesupport (= 4.2.5.2)
actionpack (4.2.7.1)
actionview (= 4.2.7.1)
activesupport (= 4.2.7.1)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.5.2)
activesupport (= 4.2.5.2)
actionview (4.2.7.1)
activesupport (= 4.2.7.1)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
active_model_serializers (0.8.3)
activemodel (>= 3.0)
activejob (4.2.5.2)
activesupport (= 4.2.5.2)
activejob (4.2.7.1)
activesupport (= 4.2.7.1)
globalid (>= 0.3.0)
activemodel (4.2.5.2)
activesupport (= 4.2.5.2)
activemodel (4.2.7.1)
activesupport (= 4.2.7.1)
builder (~> 3.1)
activerecord (4.2.5.2)
activemodel (= 4.2.5.2)
activesupport (= 4.2.5.2)
activerecord (4.2.7.1)
activemodel (= 4.2.7.1)
activesupport (= 4.2.7.1)
arel (~> 6.0)
activesupport (4.2.5.2)
activesupport (4.2.7.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
@ -112,10 +112,10 @@ GEM
execjs
coffee-script-source (1.9.1.1)
columnize (0.9.0)
concurrent-ruby (1.0.1)
concurrent-ruby (1.0.2)
crack (0.4.2)
safe_yaml (~> 1.0.0)
css_splitter (0.4.4)
css_splitter (0.4.5)
sprockets (>= 2.0.0)
database_cleaner (1.4.1)
debug_inspector (0.0.2)
@ -282,7 +282,7 @@ GEM
font-awesome-rails (4.4.0.0)
railties (>= 3.2, < 5.0)
formatador (0.2.5)
globalid (0.3.6)
globalid (0.3.7)
activesupport (>= 4.1.0)
guard (2.13.0)
formatador (>= 0.2.4)
@ -357,23 +357,24 @@ GEM
loofah (2.0.3)
nokogiri (>= 1.5.9)
lumberjack (1.0.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mail (2.6.4)
mime-types (>= 1.16, < 4)
mailjet (1.1.0)
activesupport (>= 3.1.0)
rack (>= 1.4.0)
rest-client
maruku (0.7.2)
method_source (0.8.2)
mime-types (2.99.1)
mini_portile2 (2.0.0)
minitest (5.8.4)
mime-types (2.99.2)
mini_portile2 (2.1.0)
minitest (5.9.0)
multi_json (1.11.2)
multipart-post (2.0.0)
nenv (0.2.0)
netrc (0.10.3)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
notiffany (0.0.8)
nenv (~> 0.1)
shellany (~> 0.0)
@ -394,12 +395,13 @@ GEM
openstack (2.0.2)
json
orm_adapter (0.5.0)
parallel (1.6.1)
parallel (1.9.0)
parallel_tests (1.9.0)
parallel
parser (2.2.2.2)
ast (>= 1.1, < 3.0)
pg (0.18.2)
pkg-config (1.1.7)
poltergeist (1.6.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
@ -423,16 +425,16 @@ GEM
rack-test (0.6.3)
rack (>= 1.0)
railroady (1.3.0)
rails (4.2.5.2)
actionmailer (= 4.2.5.2)
actionpack (= 4.2.5.2)
actionview (= 4.2.5.2)
activejob (= 4.2.5.2)
activemodel (= 4.2.5.2)
activerecord (= 4.2.5.2)
activesupport (= 4.2.5.2)
rails (4.2.7.1)
actionmailer (= 4.2.7.1)
actionpack (= 4.2.7.1)
actionview (= 4.2.7.1)
activejob (= 4.2.7.1)
activemodel (= 4.2.7.1)
activerecord (= 4.2.7.1)
activesupport (= 4.2.7.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.2)
railties (= 4.2.7.1)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
@ -442,14 +444,14 @@ GEM
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.5.2)
actionpack (= 4.2.5.2)
activesupport (= 4.2.5.2)
railties (4.2.7.1)
actionpack (= 4.2.7.1)
activesupport (= 4.2.7.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
raindrops (0.13.0)
rake (10.5.0)
rake (11.2.2)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
@ -508,13 +510,13 @@ GEM
sexp_processor (~> 4.1)
rubyzip (1.1.7)
safe_yaml (1.0.4)
sass (3.4.16)
sass-rails (5.0.3)
railties (>= 4.0.0, < 5.0)
sass (3.4.22)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1)
tilt (>= 1.1, < 3)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
@ -547,10 +549,10 @@ GEM
spring (1.3.6)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.5.2)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.0.3)
sprockets-rails (3.1.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
@ -567,7 +569,7 @@ GEM
ref
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
tilt (2.0.5)
timecop (0.7.3)
trollop (2.1.2)
turbolinks (2.5.3)
@ -660,12 +662,12 @@ DEPENDENCIES
nyan-cat-formatter
openid_connect
openstack
parallel_tests
parallel_tests (~> 1.9.0)
pg
poltergeist
pry-byebug
railroady
rails (= 4.2.5.2)
rails (= 4.2.7.1)
rest-client
rgeo-geojson
rspec-rails (~> 3.0)

View file

@ -32,8 +32,18 @@
//= require handlebars
//= require typeahead.bundle
$(document).on('page:load', scroll_to);
$(document).ready(scroll_to);
$(document).on('page:load', application_init);
$(document).ready(application_init);
function application_init(){
tooltip_init();
scroll_to();
}
function tooltip_init() {
$('[data-toggle="tooltip"]').tooltip({delay: { "show": 800, "hide": 100 }});
}
function scroll_to() {
$('.js-scrollTo').on('click', function () { // Au clic sur un élément

View file

@ -93,6 +93,17 @@ body {
z-index: 10;
}
.beta_staging {
background-color: #B00100 !important;
}
.staging_warning {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#sign_out {
decorate: none;
box-shadow: none;
@ -101,7 +112,6 @@ body {
margin-right: 105px;
}
#header {
top: 0;
left: -3px;
@ -111,7 +121,6 @@ body {
}
.navbar {
height: 35px;
background-color: rgba(235, 235, 235, 0.95);
@ -123,6 +132,18 @@ body {
}
.text-purple {
color: #8B008B
}
.text-default {
color: grey;
}
.progress-bar-purple {
background-color: #800080;
}
.btn {
box-shadow: none !important;
}

View file

@ -5,11 +5,7 @@ class Backoffice::DossiersController < ApplicationController
before_action :authenticate_gestionnaire!
def index
@liste = params[:liste] || 'a_traiter'
smartlisting_dossier
total_dossiers_per_state
smartlisting_dossier (params[:liste] || 'a_traiter')
end
def show
@ -21,13 +17,14 @@ class Backoffice::DossiersController < ApplicationController
@search_terms = params[:q]
@dossiers_search, @dossier = Dossier.search(current_gestionnaire, @search_terms)
create_dossiers_list_facade
unless @dossiers_search.empty?
@dossiers_search = @dossiers_search.paginate(:page => params[:page]).decorate
end
@dossier = @dossier.decorate unless @dossier.nil?
total_dossiers_per_state
rescue RuntimeError
@dossiers_search = []
end
@ -65,52 +62,25 @@ class Backoffice::DossiersController < ApplicationController
rescue NoMethodError
@liste = 'a_traiter'
end
smartlisting_dossier
smartlisting_dossier @liste
render 'backoffice/dossiers/index', formats: :js
end
private
def smartlisting_dossier
def smartlisting_dossier liste
create_dossiers_list_facade liste
@dossiers = smart_listing_create :dossiers,
dossiers_to_display,
@dossiers_list_facade.dossiers_to_display,
partial: "backoffice/dossiers/list",
array: true
end
def dossiers_to_display
{'a_traiter' => waiting_for_gestionnaire,
'en_attente' => waiting_for_user,
'termine' => termine,
'suivi' => suivi}[@liste]
end
def waiting_for_gestionnaire
@a_traiter_class = (@liste == 'a_traiter' ? 'active' : '')
@waiting_for_gestionnaire ||= current_gestionnaire.dossiers_filter.waiting_for_gestionnaire
end
def waiting_for_user
@en_attente_class = (@liste == 'en_attente' ? 'active' : '')
@waiting_for_user ||= current_gestionnaire.dossiers_filter.waiting_for_user
end
def termine
@termine_class = (@liste == 'termine' ? 'active' : '')
@termine ||= current_gestionnaire.dossiers_filter.termine
end
def suivi
@suivi_class = (@liste == 'suivi' ? 'active' : '')
@suivi ||= current_gestionnaire.dossiers_follow
end
def total_dossiers_per_state
@dossiers_a_traiter_total = waiting_for_gestionnaire.count
@dossiers_en_attente_total = waiting_for_user.count
@dossiers_termine_total = termine.count
@dossiers_suivi_total = suivi.count
def create_dossiers_list_facade liste='a_traiter'
@dossiers_list_facade = DossiersListFacades.new current_gestionnaire, liste
end
def create_dossier_facade dossier_id

View file

@ -1,16 +0,0 @@
class Backoffice::ProcedureFilterController < ApplicationController
before_action :authenticate_gestionnaire!
def index
@gestionnaire = current_gestionnaire
@procedures = current_gestionnaire.procedures
end
def update
current_gestionnaire.update_attribute(:procedure_filter, (params[:procedure_filter].nil? ? [] : params[:procedure_filter]))
flash.notice = 'Filtre mis à jour'
redirect_to backoffice_filtres_path
end
end

View file

@ -10,16 +10,12 @@ class Users::DossiersController < UsersController
end
def index
order = 'DESC'
@liste = params[:liste] || 'a_traiter'
@dossiers_list_facade = DossiersListFacades.new current_user, (params[:liste] || 'a_traiter')
@dossiers = smart_listing_create :dossiers,
dossiers_to_display,
@dossiers_list_facade.dossiers_to_display,
partial: "users/dossiers/list",
array: true
total_dossiers_per_state
end
def commencer
@ -109,40 +105,6 @@ class Users::DossiersController < UsersController
private
def dossiers_to_display
{'a_traiter' => waiting_for_user,
'en_attente' => waiting_for_gestionnaire,
'termine' => termine,
'invite' => invite}[@liste]
end
def waiting_for_user
@a_traiter_class = (@liste == 'a_traiter' ? 'active' : '')
@waiting_for_user ||= current_user.dossiers.waiting_for_user 'DESC'
end
def waiting_for_gestionnaire
@en_attente_class = (@liste == 'en_attente' ? 'active' : '')
@waiting_for_gestionnaire ||= current_user.dossiers.waiting_for_gestionnaire 'DESC'
end
def termine
@termine_class = (@liste == 'termine' ? 'active' : '')
@termine ||= current_user.dossiers.termine 'DESC'
end
def invite
@invite_class = (@liste == 'invite' ? 'active' : '')
@invite ||= current_user.invites
end
def total_dossiers_per_state
@dossiers_a_traiter_total = waiting_for_user.count
@dossiers_en_attente_total = waiting_for_gestionnaire.count
@dossiers_termine_total = termine.count
@dossiers_invite_total = invite.count
end
def check_siret
errors_valid_siret unless Siret.new(siret: siret).valid?
end
@ -183,5 +145,4 @@ class Users::DossiersController < UsersController
def facade id = params[:id]
DossierFacades.new id, current_user.email
end
end

View file

@ -0,0 +1,114 @@
class DossiersListFacades
def initialize current_devise_profil, liste
@current_devise_profil = current_devise_profil
@liste = liste
end
def service
if gestionnaire?
@service ||= DossiersListGestionnaireService.new @current_devise_profil, @liste
elsif user?
@service ||= DossiersListUserService.new @current_devise_profil, @liste
end
end
def liste
@liste
end
def dossiers_to_display
service.dossiers_to_display
end
def nouveaux_class
(@liste == 'nouveaux' ? 'active' : '')
end
def a_traiter_class
(@liste == 'a_traiter' ? 'active' : '')
end
def en_attente_class
(@liste == 'en_attente' ? 'active' : '')
end
def deposes_class
(@liste == 'deposes' ? 'active' : '')
end
def valides_class
(@liste == 'valides' ? 'active' : '')
end
def en_instruction_class
(@liste == 'en_instruction' ? 'active' : '')
end
def a_instruire_class
(@liste == 'a_instruire' ? 'active' : '')
end
def termine_class
(@liste == 'termine' ? 'active' : '')
end
def suivi_class
(@liste == 'suivi' ? 'active' : '')
end
def invite_class
(@liste == 'invite' ? 'active' : '')
end
def nouveaux_total
service.nouveaux.count
end
def a_traiter_total
return service.waiting_for_gestionnaire.count if gestionnaire?
service.waiting_for_user.count if user?
end
def en_attente_total
return service.waiting_for_user.count if gestionnaire?
service.waiting_for_gestionnaire.count if user?
end
def valides_total
service.valides.count
end
def deposes_total
service.deposes.count
end
def en_instruction_total
service.en_instruction.count
end
def a_instruire_total
service.a_instruire.count
end
def termine_total
service.termine.count
end
def suivi_total
service.suivi.count
end
def invite_total
service.invite.count
end
private
def gestionnaire?
@current_devise_profil.class == Gestionnaire
end
def user?
@current_devise_profil.class == User
end
end

View file

@ -2,11 +2,15 @@ class Dossier < ActiveRecord::Base
enum state: {draft: 'draft',
initiated: 'initiated',
replied: 'replied',
updated: 'updated',
replied: 'replied', #action utilisateur demandé
updated: 'updated',#etude par l'administration en cours
validated: 'validated',
submitted: 'submitted',
closed: 'closed'}
received: 'received',
closed: 'closed',
refused: 'refused',
without_continuation: 'without_continuation'
}
has_one :etablissement, dependent: :destroy
has_one :entreprise, dependent: :destroy
@ -34,9 +38,15 @@ class Dossier < ActiveRecord::Base
validates :user, presence: true
WAITING_FOR_GESTIONNAIRE = %w(initiated updated submitted)
NOUVEAUX = %w(initiated)
WAITING_FOR_GESTIONNAIRE = %w(updated)
WAITING_FOR_USER = %w(replied validated)
TERMINE = %w(closed)
WAITING_FOR_USER_WITHOUT_VALIDATED = %w(replied)
VALIDES = %w(validated)
DEPOSES = %w(submitted)
EN_INSTRUCTION = %w(submitted received)
A_INSTRUIRE = %w(received)
TERMINE = %w(closed refused without_continuation)
def retrieve_last_piece_justificative_by_type(type)
pieces_justificatives.where(type_de_piece_justificative_id: type).last
@ -129,6 +139,10 @@ class Dossier < ActiveRecord::Base
state
end
def nouveaux?
NOUVEAUX.include?(state)
end
def waiting_for_gestionnaire?
WAITING_FOR_GESTIONNAIRE.include?(state)
end
@ -137,10 +151,34 @@ class Dossier < ActiveRecord::Base
WAITING_FOR_USER.include?(state)
end
def waiting_for_user_without_validated?
WAITING_FOR_USER_WITHOUT_VALIDATED.include?(state)
end
def deposes?
DEPOSES.include?(state)
end
def valides?
VALIDES.include?(state)
end
def a_instruire?
A_INSTRUIRE.include?(state)
end
def en_instruction?
EN_INSTRUCTION.include?(state)
end
def termine?
TERMINE.include?(state)
end
def self.nouveaux order = 'ASC'
where(state: NOUVEAUX, archived: false).order("updated_at #{order}")
end
def self.waiting_for_gestionnaire order = 'ASC'
where(state: WAITING_FOR_GESTIONNAIRE, archived: false).order("updated_at #{order}")
end
@ -149,6 +187,26 @@ class Dossier < ActiveRecord::Base
where(state: WAITING_FOR_USER, archived: false).order("updated_at #{order}")
end
def self.waiting_for_user_without_validated order = 'ASC'
where(state: WAITING_FOR_USER_WITHOUT_VALIDATED, archived: false).order("updated_at #{order}")
end
def self.valides order = 'ASC'
where(state: VALIDES, archived: false).order("updated_at #{order}")
end
def self.deposes order = 'ASC'
where(state: DEPOSES, archived: false).order("updated_at #{order}")
end
def self.a_instruire order = 'ASC'
where(state: A_INSTRUIRE, archived: false).order("updated_at #{order}")
end
def self.en_instruction order = 'ASC'
where(state: EN_INSTRUCTION, archived: false).order("updated_at #{order}")
end
def self.termine order = 'ASC'
where(state: TERMINE, archived: false).order("updated_at #{order}")
end
@ -177,12 +235,12 @@ class Dossier < ActiveRecord::Base
#TODO refactor
composed_scope = composed_scope.where(
dossiers[:id].eq_any(current_gestionnaire.dossiers_filter.ids).and\
dossiers[:id].eq_any(current_gestionnaire.dossiers.ids).and\
dossiers[:state].does_not_match('draft').and\
dossiers[:archived].eq(false))
begin
if Float(terms) && terms.to_i <= 2147483647 && current_gestionnaire.dossiers_filter.ids.include?(terms.to_i)
if Float(terms) && terms.to_i <= 2147483647 && current_gestionnaire.dossiers.ids.include?(terms.to_i)
dossier = Dossier.where("state != 'draft'").find(terms.to_i)
end
rescue ArgumentError, ActiveRecord::RecordNotFound

View file

@ -12,18 +12,10 @@ class Gestionnaire < ActiveRecord::Base
after_create :build_default_preferences_list_dossier
def dossiers_filter
dossiers.where(procedure_id: procedure_filter_list)
end
def dossiers_follow
dossiers.joins(:follows).where("follows.gestionnaire_id = #{id}")
end
def procedure_filter_list
procedure_filter.empty? ? procedures.pluck(:id) : procedure_filter
end
def toggle_follow_dossier dossier_id
dossier = dossier_id
dossier = Dossier.find(dossier_id) unless dossier_id.class == Dossier

View file

@ -0,0 +1,44 @@
class DossiersListGestionnaireService
def initialize current_devise_profil, liste
@current_devise_profil = current_devise_profil
@liste = liste
end
def dossiers_to_display
{'nouveaux' => nouveaux,
'a_traiter' => waiting_for_gestionnaire,
'en_attente' => waiting_for_user,
'deposes' => deposes,
'a_instruire' => a_instruire,
'termine' => termine,
'suivi' => suivi}[@liste]
end
def nouveaux
@nouveaux ||= @current_devise_profil.dossiers.nouveaux
end
def waiting_for_gestionnaire
@waiting_for_gestionnaire ||= @current_devise_profil.dossiers.waiting_for_gestionnaire
end
def waiting_for_user
@waiting_for_user ||= @current_devise_profil.dossiers.waiting_for_user
end
def deposes
@deposes ||= @current_devise_profil.dossiers.deposes
end
def a_instruire
@a_instruire ||= @current_devise_profil.dossiers.a_instruire
end
def termine
@termine ||= @current_devise_profil.dossiers.termine
end
def suivi
@suivi ||= @current_devise_profil.dossiers_follow
end
end

View file

@ -0,0 +1,44 @@
class DossiersListUserService
def initialize current_devise_profil, liste
@current_devise_profil = current_devise_profil
@liste = liste
end
def dossiers_to_display
{'nouveaux' => nouveaux,
'a_traiter' => waiting_for_user,
'en_attente' => waiting_for_gestionnaire,
'valides' => valides,
'en_instruction' => en_instruction,
'termine' => termine,
'invite' => invite}[@liste]
end
def nouveaux
@nouveaux ||= @current_devise_profil.dossiers.nouveaux
end
def waiting_for_gestionnaire
@waiting_for_gestionnaire ||= @current_devise_profil.dossiers.waiting_for_gestionnaire
end
def waiting_for_user
@waiting_for_user ||= @current_devise_profil.dossiers.waiting_for_user_without_validated
end
def invite
@invite ||= @current_devise_profil.invites
end
def valides
@valides ||= @current_devise_profil.dossiers.valides
end
def en_instruction
@en_instruction ||= @current_devise_profil.dossiers.en_instruction
end
def termine
@termine ||= @current_devise_profil.dossiers.termine
end
end

View file

@ -3,33 +3,47 @@
#onglets
%ul.nav.nav-tabs
%li{ class: (@a_traiter_class) }
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'a_traiter')}"}
%h5.text-danger
= "À traiter "
.badge.progress-bar-danger
=@dossiers_a_traiter_total
%li{ class: (@en_attente_class) }
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'en_attente')}"}
%li{ class: (@dossiers_list_facade.nouveaux_class)}
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'nouveaux')}", 'data-toggle' => :tooltip, title: 'Les nouveaux dossiers non ouverts.'}
%h5.text-info
="En attente "
= "Nouveaux "
.badge.progress-bar-info
=@dossiers_en_attente_total
=@dossiers_list_facade.nouveaux_total
%li{ class: (@suivi_class) }
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'suivi')}"}
%li{ class: (@dossiers_list_facade.a_traiter_class) }
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'a_traiter')}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.'}
%h5.text-danger
= "Action requise"
.badge.progress-bar-danger
=@dossiers_list_facade.a_traiter_total
%li{ class: (@dossiers_list_facade.en_attente_class) }
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'en_attente')}", 'data-toggle' => :tooltip, title: 'Les dossiers en attentes d\'une action de la part de l\'usager.'}
%h5.text-default
="Attente usager "
.badge.progress-bar-default
=@dossiers_list_facade.en_attente_total
%li{ class: (@dossiers_list_facade.deposes_class) }
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'deposes')}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ont été validés et déposés par les usager qui attendent une réponse de bonne réception avant instruction.'}
%h5.text-purple
="À réceptionner"
.badge.progress-bar-purple
=@dossiers_list_facade.deposes_total
%li{ class: (@dossiers_list_facade.a_instruire_class) }
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'a_instruire')}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ont été notifiés comme bien réceptionnés et qui attendent un verdict final.'}
%h5.text-warning
="Suivi"
= "À instruire"
.badge.progress-bar-warning
=@dossiers_suivi_total
=@dossiers_list_facade.a_instruire_total
%li{ class: (@termine_class) }
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'termine')}"}
%li{ class: (@dossiers_list_facade.termine_class) }
%a{:href => "#{url_for backoffice_dossiers_path(liste: 'termine')}",'data-toggle' => :tooltip, title: 'Tous les dossiers qui ont été traité avec un statut "Validé", "Refusé" ou "Sans suite "'}
%h5.text-success
= "Terminé"
.badge.progress-bar-success
=@dossiers_termine_total
=@dossiers_list_facade.termine_total
%ul.nav.nav-tabs.navbar-right{style:'border-bottom: none;'}
%li#search{class: "#{'active' unless @dossiers_search.nil?}"}
@ -46,5 +60,4 @@
%a.btn#pref_list_dossier_open_action{href: '#'}
%i.fa.fa-columns
%br

View file

@ -0,0 +1,30 @@
#state_description.row{style:'width: 50%; margin-left: auto; margin-right: auto'}
.panel.panel-info
.panel-body.center
.row
.col-md-1.col-lg-1
.fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
.col-md-11.col-lg-11
-if dossiers_list_facade.liste == 'nouveaux'
Tous les dossiers présents dans cette liste sont ceux qui
%b
n'ont jamais été ouvert par votre service.
Il attende une première lecture et intervention de votre part.
-elsif dossiers_list_facade.liste == 'a_traiter'
Tous les dossiers présents dans cette liste sont ceux qui
%b
attendent une action de votre part.
Cela peut être par exemple une demande client ou une relecture pour validation de complétude.
-elsif dossiers_list_facade.liste == 'en_attente'
Tous les dossiers présents dans cette liste sont ceux qui requière une action de la part de l'usager. À priori, vous n'avez donc pas d'intervention particulière à réaliser.
-elsif dossiers_list_facade.liste == 'deposes'
Tous les dossiers présents dans cette liste ont été
%b
officiellement déposé par l'usager pour instruction.
Il faut donc que vous confirmiez par "accusé de réception" la bonne réception de toutes les informations et documents demandés avant instruction finale.
-elsif dossiers_list_facade.liste == 'a_instruire'
Tous les dossiers présents dans cette liste sont à instruire. Ceux sont tous les dossiers
%b
qui ont reçu bonne réception.
-elsif dossiers_list_facade.liste == 'termine'
Tous les dossiers présents dans cette liste sont considérés comme cloturé car ils ont tous reçu un verdict final qui peut être "Validé", "Refusé" ou "Sans suite".

View file

@ -4,3 +4,7 @@
= render partial: 'onglets'
= smart_listing_render :dossiers
%br
%br
= render partial: 'state_description', locals: {dossiers_list_facade: @dossiers_list_facade}

View file

@ -1,16 +0,0 @@
%h2.text-primary Filtre des procédures
%h4 Sélectionnez les procédures que vous souhaitez suivre.
= form_for @gestionnaire, url:{controller: 'backoffice/procedure_filter', action: :update } do |f|
.input-group
- @procedures.each do |procedure|
.checkbox
%label
= check_box_tag 'procedure_filter[]', procedure.id, (true if @gestionnaire.procedure_filter.include?(procedure.id))
= procedure.libelle
%br
= submit_tag 'Valider', class: 'btn btn-primary'
%br
%b
Aucune sélection = voir tout

View file

@ -41,7 +41,7 @@
%br
.row{style: 'text-align:right'}
- if !@facade.dossier.validated? && !@facade.dossier.submitted? && !@facade.dossier.closed?
- if !@facade.dossier.validated? && !@facade.dossier.received? && !@facade.dossier.submitted? && !@facade.dossier.closed? && !@facade.dossier.refused? && !@facade.dossier.without_continuation?
- if user_signed_in? && (current_user.email == @facade.dossier.user.email)
- if @facade.procedure.cerfa_flag? || @facade.dossier.types_de_piece_justificative.size > 0
%a.btn.btn-success{"data-target" => "#UploadPJmodal",
@ -60,7 +60,7 @@
= 'Modifier mon dossier'
-if gestionnaire_signed_in?
-if !@facade.dossier.validated? && !@facade.dossier.submitted? && !@facade.dossier.closed?
-if !@facade.dossier.validated? && !@facade.dossier.received? && !@facade.dossier.submitted? && !@facade.dossier.closed? && !@facade.dossier.refused? && !@facade.dossier.without_continuation?
= form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
%button#action_button.btn.btn-success
= 'Valider le dossier'

View file

@ -1,17 +1,6 @@
%div{ style: "decorate:none; display: flex;box-shadow:none; float:right; display: flex" }
%div{ style: "vertical-align: middle; margin-right: 10px; margin-top: auto; margin-bottom: auto;" }
%div.user
%i.fa.fa-user
= current_gestionnaire.email
.dropdown#admin_menu
%button.btn.btn-default.dropdown-toggle#dropdownMenuAdmin{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false}
%i.fa.fa-cog
%span.caret
%ul.dropdown-menu.dropdown-menu-right
%li
= link_to(backoffice_filtres_path, id: :filter) do
%i.fa.fa-list
&nbsp;Filtre procédure
%li.divider{ role: :separator}
%li
= link_to('/gestionnaires/sign_out',id: :admin_sign_out, method: :delete) do
%i.fa.fa-power-off
&nbsp;Se déconnecter
= link_to "Déconnexion", '/gestionnaires/sign_out', method: :delete, :class => 'btn btn-md'

View file

@ -1,5 +1,8 @@
#beta
#beta{class:(Rails.env == 'production' ? '' : 'beta_staging')}
- if Rails.env == 'production'
Beta
- else
Env Test
= image_tag('marianne_small.png', class: 'logo')
%a{href: '/'}
= image_tag('logo-tps.png', class: 'logo')
@ -8,26 +11,22 @@
Mes Dossiers
-elsif administrateur_signed_in?
Mes Procédures
#sign_out
-if gestionnaire_signed_in?
= render partial: 'gestionnaires/login_banner'
-elsif administrateur_signed_in?
= render partial: 'administrateurs/login_banner'
- elsif user_signed_in?
%div.user
-if current_user.loged_in_with_france_connect?
%div{ id: "fconnect-profile", "data-fc-logout-url" => '/users/sign_out" data-method="delete' }
%a.text-info{ href: "#" }
= "#{current_user.given_name} #{current_user.family_name}"
= link_to "", '/users/sign_out', method: :delete, :class => 'btn fa fa-power-off off-fc-link'
-else
%i.fa.fa-user
= current_user.email
= link_to "Déconnexion", '/users/sign_out', method: :delete, :class => 'btn btn-md'
= render partial: 'users/login_banner'
- else
= link_to "Utilisateur", '/users/sign_in', method: :get, :class => 'btn btn-md'
= link_to "Accompagnateur", '/gestionnaires/sign_in', method: :get, :class => 'btn btn-md'
= link_to "Administrateur", '/administrateurs/sign_in', method: :get, :class => 'btn btn-md'
- if Rails.env != 'production'
%div.staging_warning
%b{style:'color: #B00100', 'data-placement' => 'bottom', 'data-original-title' => "Aucune donnée présente sur cette plateforme ne pourra être transférée sur l'environnement final de production.", 'data-toggle' => 'tooltip'}
Vous vous trouvez actuellement sur la plateforme de test.
%div.badge.progress-bar-danger
?

View file

@ -0,0 +1,13 @@
%div.user
-if current_user.loged_in_with_france_connect?
%div{ id: "fconnect-profile", "data-fc-logout-url" => '/users/sign_out" data-method="delete' }
%a.text-info{ href: "#" }
= "#{current_user.given_name} #{current_user.family_name}"
= link_to "", '/users/sign_out', method: :delete, :class => 'btn fa fa-power-off off-fc-link'
-else
%i.fa.fa-user
= current_user.email
= link_to "Déconnexion", '/users/sign_out', method: :delete, :class => 'btn btn-md'

View file

@ -1,33 +1,55 @@
%h1 Mes dossiers
%br
%br
#onglets
%ul.nav.nav-tabs
%li{ class: @a_traiter_class }
%a{:href => "#{url_for users_dossiers_path(liste: 'a_traiter')}"}
%h5.text-danger
= "À traiter "
.badge.progress-bar-danger
= @dossiers_a_traiter_total
%li{ class: @en_attente_class }
%a{:href => "#{url_for users_dossiers_path(liste: 'en_attente')}"}
%li{ class: @dossiers_list_facade.nouveaux_class }
%a{:href => "#{url_for users_dossiers_path(liste: 'nouveaux')}", 'data-toggle' => :tooltip, title: 'Les nouveaux dossiers qui n\'ont pas encore été vus par votre accompagnateur.'}
%h5.text-info
="En attente "
= "Nouveaux"
.badge.progress-bar-info
= @dossiers_en_attente_total
= @dossiers_list_facade.nouveaux_total
%li{ class: @termine_class }
%a{:href => "#{url_for users_dossiers_path(liste: 'termine')}"}
%li{ class: @dossiers_list_facade.a_traiter_class }
%a{:href => "#{url_for users_dossiers_path(liste: 'a_traiter')}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.'}
%h5.text-danger
= "Action requise"
.badge.progress-bar-danger
= @dossiers_list_facade.a_traiter_total
%li{ class: @dossiers_list_facade.en_attente_class }
%a{:href => "#{url_for users_dossiers_path(liste: 'en_attente')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours de relecture par votre accompagnateur.'}
%h5.text-default
="Etude en cours"
.badge.progress-bar-default
= @dossiers_list_facade.en_attente_total
%li{ class: @dossiers_list_facade.valides_class }
%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 instruction.'}
%h5.text-purple
="À déposer"
.badge.progress-bar-purple
= @dossiers_list_facade.valides_total
%li{ class: @dossiers_list_facade.en_instruction_class }
%a{:href => "#{url_for users_dossiers_path(liste: 'en_instruction')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours d\'instruction par l\'administration compétante.'}
%h5.text-default
="En instruction"
.badge.progress-bar-default
= @dossiers_list_facade.en_instruction_total
%li{ class: @dossiers_list_facade.termine_class }
%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".'}
%h5.text-success
= "Terminé"
= "Cloturé"
.badge.progress-bar-success
= @dossiers_termine_total
= @dossiers_list_facade.termine_total
%li{ class: @invite_class }
%ul.nav.nav-tabs.navbar-right{style:'border-bottom: none;'}
%li{ class: @dossiers_list_facade.invite_class }
%a{:href => "#{url_for users_dossiers_path(liste: 'invite')}"}
%h5{style: 'color: #696969'}
%h5.text-warning
= "Invitation"
.badge{style: 'background-color: #696969'}
= @dossiers_invite_total
.badge.progress-bar-warning
= @dossiers_list_facade.invite_total
%br

View file

@ -0,0 +1,45 @@
#state_description.row{style:'width: 55%; margin-left: auto; margin-right: auto'}
.panel.panel-info
.panel-body.center
.row
.col-md-1.col-lg-1
.fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
.col-md-11.col-lg-11
-if dossiers_list_facade.liste == 'nouveaux'
Les dossiers présents dans cette liste
%b
n'ont pas encore été ouverts
par votre accompagnteur. Une notification vous sera envoyée quand votre demande aura été étudiée.
-elsif dossiers_list_facade.liste == 'a_traiter'
Les dossiers présents dans cette liste
%b
attendent une action de votre part.
Plus d'informations vous sont généralement données par votre accompagnateur dans le flux de commentaires du dossier.
-elsif dossiers_list_facade.liste == 'en_attente'
Les dossiers présents dans cette liste sont
%b
en cours de relecture par votre accompagnateur.
Il reviendra vers vous si des informations ou documents sont manquants pour la future instruction de votre dossier.
-elsif dossiers_list_facade.liste == 'valides'
Les dossiers présents dans cette liste ont été
%b
relus et considérés comme complet
pour instruction par votre accompagnateur. Ceux-ci ne peuvent maintenant plus être modifié. Il faut que vous procédiez à leurs dépôts afin qu'une décision finale soit rendue.
-elsif dossiers_list_facade.liste == 'en_instruction'
Les dossiers présents dans cette liste sont
%b
en cours de réception
ou
%b
en cours d'instruction
par l'administration compétente. Une notification vous sera envoyée une fois qu'une décision aura été rendue.
-elsif dossiers_list_facade.liste == 'termine'
Les dossiers présents dans cette liste sont ceux qui ont été instruits par l'admnistration et
%b
une décision finale a été rendue.
Ils peuvent posséder trois états différents : Accepté, Refusé ou Sans Suite.
-elsif dossiers_list_facade.liste == 'invite'
Les dossiers présents dans cete liste sont ceux
%b
auxquels vous avez été invités
à participer afin d'émettre un avis et/ou à founir des documents complétmentaires.

View file

@ -2,3 +2,7 @@
= render partial: 'onglets'
= smart_listing_render :dossiers
%br
%br
= render partial: 'state_description', locals: {dossiers_list_facade: @dossiers_list_facade}

View file

@ -9,12 +9,15 @@ fr:
date_previsionnelle: "La date de début prévisionnelle"
state:
draft: "Brouillon"
initiated: "Soumis"
initiated: "Nouveau"
replied: "Répondu"
updated: "Mis à jour"
validated: "Validé"
validated: "Figé"
submitted: "Déposé"
closed: "Traité"
received: "Reçu"
closed: "Accepté"
refused: "Refusé"
without_continuation: "Sans suite"
errors:
models:

View file

@ -142,9 +142,6 @@ Rails.application.routes.draw do
get 'dossiers/search' => 'dossiers#search'
get 'filtres' => 'procedure_filter#index'
patch 'filtres/update' => 'procedure_filter#update'
resource :private_formulaire
namespace :preference_list_dossier do

View file

@ -0,0 +1,9 @@
class DeleteValueOfFilterProcedure < ActiveRecord::Migration
class Gestionnaire < ActiveRecord::Base
end
def change
Gestionnaire.all.update_all(procedure_filter: '{}')
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160809083606) do
ActiveRecord::Schema.define(version: 20160822142045) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

View file

@ -1 +1,7 @@
Administration.create(email: SUPERADMIN.email, password: SUPERADMIN.password)
begin
Administration.create!(email: SUPERADMIN.email, password: SUPERADMIN.password)
rescue ActiveRecord::RecordInvalid
admin = Administration.find_by_email(SUPERADMIN.email)
admin.password = SUPERADMIN.password
admin.save
end

View file

@ -1,62 +0,0 @@
require 'spec_helper'
describe Backoffice::ProcedureFilterController, type: :controller do
let(:gestionnaire) { create :gestionnaire }
before do
sign_in gestionnaire
end
describe '#GET index' do
subject { get :index }
before do
subject
end
it { expect(response.status).to eq 200 }
end
describe '#PATCH update' do
context 'when procedure_filter params is not present' do
subject { patch :update }
before do
subject
end
it { is_expected.to redirect_to backoffice_filtres_path }
it { expect(gestionnaire.procedure_filter).to eq [] }
end
context 'when procedure_filter attribut is not empty and procedure_filter params is not present' do
let(:gestionnaire) { create :gestionnaire, procedure_filter: [3,2] }
subject { patch :update }
before do
subject
gestionnaire.reload
end
it { is_expected.to redirect_to backoffice_filtres_path }
it { expect(gestionnaire.procedure_filter).to eq [] }
end
context 'when procedure_filter params is present' do
let (:procedure_filter) { ["3", "1"] }
subject { patch :update, procedure_filter: procedure_filter }
before do
subject
gestionnaire.reload
end
it { is_expected.to redirect_to backoffice_filtres_path }
it { expect(gestionnaire.procedure_filter.size).to eq 2 }
it { expect(gestionnaire.procedure_filter).to include 1 }
it { expect(gestionnaire.procedure_filter).to include 3 }
end
end
end

View file

@ -19,7 +19,7 @@ describe DossierDecorator do
it 'initiated is initiate' do
dossier.initiated!
expect(subject).to eq('Soumis')
expect(subject).to eq('Nouveau')
end
it 'replied is repondu' do
@ -34,7 +34,7 @@ describe DossierDecorator do
it 'validated is valide' do
dossier.validated!
expect(subject).to eq('Validé')
expect(subject).to eq('Figé')
end
it 'submitted is dépose' do
@ -44,7 +44,22 @@ describe DossierDecorator do
it 'closed is traité' do
dossier.closed!
expect(subject).to eq('Traité')
expect(subject).to eq('Accepté')
end
it 'received is reçu' do
dossier.received!
expect(subject).to eq('Reçu')
end
it 'without_continuation is traité' do
dossier.without_continuation!
expect(subject).to eq('Sans suite')
end
it 'refused is traité' do
dossier.refused!
expect(subject).to eq('Refusé')
end
end
end

View file

@ -10,6 +10,7 @@ describe AdminProceduresShowFacades do
let!(:dossier_4) { create(:dossier, procedure: procedure, archived: true, state: 'validated') }
let!(:dossier_5) { create(:dossier, procedure: procedure, archived: true, state: 'validated') }
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'initiated') }
let!(:dossier_7) { create(:dossier, procedure: procedure, state: 'updated') }
subject { AdminProceduresShowFacades.new procedure }
@ -22,13 +23,13 @@ describe AdminProceduresShowFacades do
describe '.dossiers' do
subject { super().dossiers }
it { expect(subject.size).to eq(6) }
it { expect(subject.size).to eq(7) }
end
describe '.dossiers_for_pie_highchart' do
subject { super().dossiers_for_pie_highchart }
it { expect(subject).to eq({'Soumis' => 1, 'Validé' => 2}) }
it { expect(subject).to eq({'Nouveau' => 1, 'Figé' => 2, "Mis à jour"=>1}) }
end
describe '.dossiers_archived_by_state_total' do
@ -52,7 +53,7 @@ describe AdminProceduresShowFacades do
describe 'dossiers_total' do
subject { super().dossiers_total }
it { is_expected.to eq(6) }
it { is_expected.to eq(7) }
end
describe 'dossiers_waiting_gestionnaire_total' do

View file

@ -7,7 +7,7 @@ feature 'usage of pref list dossier lateral panel', js: true do
let(:procedure) { create(:procedure, administrateur: administrateur) }
before do
create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated')
create(:dossier, :with_entreprise, procedure: procedure, state: 'updated')
create :assign_to, procedure: procedure, gestionnaire: gestionnaire
visit backoffice_path
end

View file

@ -5,7 +5,7 @@ feature 'on backoffice page' do
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
let(:procedure) { create(:procedure, administrateur: administrateur) }
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated') }
let!(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
@ -17,12 +17,14 @@ feature 'on backoffice page' do
before do
page.find_by_id(:gestionnaire_email).set gestionnaire.email
page.find_by_id(:gestionnaire_password).set gestionnaire.password
page.click_on 'Se connecter'
end
context 'when he click on first dossier' do
before do
page.click_on dossier.id
end
scenario 'it redirect to dossier page' do
expect(page).to have_css('#backoffice_dossier_show')
end

View file

@ -4,15 +4,40 @@ feature 'on click on tabs button' do
let(:administrateur) { create(:administrateur) }
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
let(:procedure) { create :procedure, administrateur: administrateur }
before do
create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated')
create(:dossier, :with_entreprise, procedure: procedure, state: 'replied')
create(:dossier, :with_entreprise, procedure: procedure, state: 'updated')
create(:dossier, :with_entreprise, procedure: procedure, state: 'validated')
create(:dossier, :with_entreprise, procedure: procedure, state: 'submitted')
create(:dossier, :with_entreprise, procedure: procedure, state: 'received')
create(:dossier, :with_entreprise, procedure: procedure, state: 'closed')
create(:dossier, :with_entreprise, procedure: procedure, state: 'refused')
create(:dossier, :with_entreprise, procedure: procedure, state: 'without_continuation')
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
login_as gestionnaire, scope: :gestionnaire
end
context 'when gestionnaire is logged in' do
context 'when he click on tabs a traitee' do
context 'when he click on tabs nouveaux' do
before do
visit backoffice_dossiers_url(liste: :nouveaux)
page.click_on 'Nouveaux 1'
end
scenario 'it redirect to backoffice dossier termine' do
expect(page).to have_css('#backoffice_index')
end
end
context 'when he click on tabs a traite' do
before do
visit backoffice_dossiers_url(liste: :a_traiter)
page.click_on 'À traiter 0'
page.click_on 'Action requise 1'
end
scenario 'it redirect to backoffice dossier termine' do
@ -23,7 +48,7 @@ feature 'on click on tabs button' do
context 'when he click on tabs en attente' do
before do
visit backoffice_dossiers_url(liste: :en_attente)
page.click_on 'En attente 0'
page.click_on 'Attente usager 2'
end
scenario 'it redirect to backoffice dossier en attente' do
@ -31,10 +56,32 @@ feature 'on click on tabs button' do
end
end
context 'when he click on tabs a receptionner' do
before do
visit backoffice_dossiers_url(liste: :deposes)
page.click_on 'À réceptionner 1'
end
scenario 'it redirect to backoffice dossier a_receptionner' do
expect(page).to have_css('#backoffice_index')
end
end
context 'when he click on tabs a instruire' do
before do
visit backoffice_dossiers_url(liste: :a_instruire)
page.click_on 'À instruire 1'
end
scenario 'it redirect to backoffice dossier termine' do
expect(page).to have_css('#backoffice_index')
end
end
context 'when he click on tabs termine' do
before do
visit backoffice_dossiers_url(liste: :termine)
page.click_on 'Terminé 0'
page.click_on 'Terminé 3'
end
scenario 'it redirect to backoffice dossier termine' do

View file

@ -8,7 +8,7 @@ feature 'user access to the list of his dossier' do
let!(:dossier2) { create(:dossier, :with_entreprise) }
before do
dossier1.update_column(:updated_at, "19/07/2016 15:35".to_time)
dossier1.update_column(:updated_at, "19/07/2052 15:35".to_time)
dossier1.entreprise.update_column(:raison_sociale, 'PLOP')
last_updated_dossier.entreprise.update_column(:raison_sociale, 'PLIP')

View file

@ -0,0 +1,102 @@
require 'spec_helper'
feature 'on click on tabs button' do
let(:user) { create :user }
let(:dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'initiated') }
before do
create(:dossier, :with_entreprise, user: user, state: 'initiated')
create(:dossier, :with_entreprise, user: user, state: 'replied')
create(:dossier, :with_entreprise, user: user, state: 'updated')
create(:dossier, :with_entreprise, user: user, state: 'validated')
create(:dossier, :with_entreprise, user: user, state: 'submitted')
create(:dossier, :with_entreprise, user: user, state: 'received')
create(:dossier, :with_entreprise, user: user, state: 'closed')
create(:dossier, :with_entreprise, user: user, state: 'refused')
create(:dossier, :with_entreprise, user: user, state: 'without_continuation')
create :invite, dossier: dossier_invite, user: user
login_as user, scope: :user
end
context 'when user is logged in' do
context 'when he click on tabs nouveaux' do
before do
visit users_dossiers_url(liste: :nouveaux)
page.click_on 'Nouveaux 1'
end
scenario 'it redirect to users dossier termine' do
expect(page).to have_css('#users_index')
end
end
context 'when he click on tabs a traite' do
before do
visit users_dossiers_url(liste: :a_traiter)
page.click_on 'Action requise 1'
end
scenario 'it redirect to users dossier termine' do
expect(page).to have_css('#users_index')
end
end
context 'when he click on tabs en attente' do
before do
visit users_dossiers_url(liste: :en_attente)
page.click_on 'Etude en cours 1'
end
scenario 'it redirect to users dossier en attente' do
expect(page).to have_css('#users_index')
end
end
context 'when he click on tabs a deposes' do
before do
visit users_dossiers_url(liste: :valides)
page.click_on 'À déposer 1'
end
scenario 'it redirect to users dossier deposes' do
expect(page).to have_css('#users_index')
end
end
context 'when he click on tabs en instruction' do
before do
visit users_dossiers_url(liste: :en_instruction)
page.click_on 'En instruction 2'
end
scenario 'it redirect to users dossier termine' do
expect(page).to have_css('#users_index')
end
end
context 'when he click on tabs termine' do
before do
visit users_dossiers_url(liste: :termine)
page.click_on 'Cloturé 3'
end
scenario 'it redirect to users dossier termine' do
expect(page).to have_css('#users_index')
end
end
context 'when he click on tabs invitation' do
before do
visit users_dossiers_url(liste: :invite)
page.click_on 'Invitation 1'
end
scenario 'it redirect to users dossier invites' do
expect(page).to have_css('#users_index')
end
end
end
end

View file

@ -387,25 +387,36 @@ describe Dossier do
before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_admin
create(:dossier, procedure: procedure_admin, state: 'draft')
create(:dossier, procedure: procedure_admin, state: 'initiated') #nouveaux
create(:dossier, procedure: procedure_admin, state: 'initiated') #nouveaux
create(:dossier, procedure: procedure_admin, state: 'replied') #en_attente
create(:dossier, procedure: procedure_admin, state: 'updated') #a_traiter
create(:dossier, procedure: procedure_admin, state: 'submitted') #deposes
create(:dossier, procedure: procedure_admin, state: 'received') #a_instruire
create(:dossier, procedure: procedure_admin, state: 'received') #a_instruire
create(:dossier, procedure: procedure_admin, state: 'closed') #termine
create(:dossier, procedure: procedure_admin, state: 'refused') #termine
create(:dossier, procedure: procedure_admin, state: 'without_continuation') #termine
create(:dossier, procedure: procedure_admin_2, state: 'validated') #en_attente
create(:dossier, procedure: procedure_admin_2, state: 'submitted') #deposes
create(:dossier, procedure: procedure_admin_2, state: 'closed') #termine
create(:dossier, procedure: procedure_admin, state: 'initiated', archived: true) #a_traiter #archived
create(:dossier, procedure: procedure_admin, state: 'replied', archived: true) #en_attente #archived
create(:dossier, procedure: procedure_admin, state: 'closed', archived: true) #termine #archived
end
let!(:dossier1) { create(:dossier, procedure: procedure_admin, state: 'draft') }
let!(:dossier2) { create(:dossier, procedure: procedure_admin, state: 'initiated') } #a_traiter
let!(:dossier3) { create(:dossier, procedure: procedure_admin, state: 'initiated') } #a_traiter
let!(:dossier4) { create(:dossier, procedure: procedure_admin, state: 'replied') } #en_attente
let!(:dossier5) { create(:dossier, procedure: procedure_admin, state: 'updated') } #a_traiter
let!(:dossier6) { create(:dossier, procedure: procedure_admin_2, state: 'validated') } #en_attente
let!(:dossier7) { create(:dossier, procedure: procedure_admin_2, state: 'submitted') } #a_traiter
let!(:dossier8) { create(:dossier, procedure: procedure_admin_2, state: 'closed') } #termine
let!(:dossier9) { create(:dossier, procedure: procedure_admin, state: 'closed') } #termine
let!(:dossier10) { create(:dossier, procedure: procedure_admin, state: 'initiated', archived: true) } #a_traiter #archived
let!(:dossier11) { create(:dossier, procedure: procedure_admin, state: 'replied', archived: true) } #en_attente #archived
let!(:dossier12) { create(:dossier, procedure: procedure_admin, state: 'closed', archived: true) } #termine #archived
describe '#nouveaux' do
subject { gestionnaire.dossiers.nouveaux }
it { expect(subject.size).to eq(2) }
end
describe '#waiting_for_gestionnaire' do
subject { gestionnaire.dossiers.waiting_for_gestionnaire }
it { expect(subject.size).to eq(3) }
it { expect(subject.size).to eq(1) }
end
describe '#waiting_for_user' do
@ -414,10 +425,22 @@ describe Dossier do
it { expect(subject.size).to eq(1) }
end
describe '#a_instruire' do
subject { gestionnaire.dossiers.a_instruire }
it { expect(subject.size).to eq(2) }
end
describe '#deposes' do
subject { gestionnaire.dossiers.deposes }
it { expect(subject.size).to eq(1) }
end
describe '#termine' do
subject { gestionnaire.dossiers.termine }
it { expect(subject.size).to eq(1) }
it { expect(subject.size).to eq(3) }
end
end

View file

@ -35,36 +35,6 @@ describe Gestionnaire, type: :model do
it { is_expected.to have_many(:preference_list_dossiers) }
end
describe '#dossiers_filter' do
let!(:dossier) { create :dossier, procedure: procedure }
subject { gestionnaire.dossiers_filter }
context 'before filter' do
it { expect(subject.size).to eq 1 }
end
context 'after filter' do
let(:procedure_filter) { [procedure_2.id] }
it { expect(subject.size).to eq 0 }
end
end
describe '#procedure_filter_list' do
subject { gestionnaire.procedure_filter_list }
context 'when gestionnaire procedure_filter is empty' do
it { expect(subject).to eq [procedure.id, procedure_2.id] }
end
context 'when gestionnaire procedure_filter is no empty' do
let(:procedure_filter) { [procedure.id] }
it { expect(subject).to eq [procedure.id] }
end
end
describe '#toggle_follow_dossier' do
let!(:dossier) { create :dossier, procedure: procedure }

View file

@ -175,7 +175,7 @@ describe Procedure do
end
it 'is correctly set in ProcedurePath table' do
expect(ProcedurePath.count(path: procedure.path)).to eq(1)
expect(ProcedurePath.where(path: procedure.path).count).to eq(1)
expect(procedure_path.procedure_id).to eq(procedure.id)
expect(procedure_path.administrateur_id).to eq(procedure.administrateur_id)
end
@ -196,7 +196,7 @@ describe Procedure do
end
it 'is not in ProcedurePath table anymore' do
expect(ProcedurePath.count(path: procedure.path)).to eq(0)
expect(ProcedurePath.where(path: procedure.path).count).to eq(0)
expect(ProcedurePath.find_by_procedure_id(procedure.id)).to be_nil
end
end
@ -214,6 +214,5 @@ describe Procedure do
subject { procedure.total_dossier }
it { is_expected.to eq 2 }
end
end

View file

@ -8,12 +8,23 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'initiated').decorate }
let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, procedure: procedure, state: 'replied').decorate }
let!(:decorate_dossier_updated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated').decorate }
let!(:decorate_dossier_validated) { create(:dossier, :with_entreprise, procedure: procedure, state: 'validated').decorate }
let!(:decorate_dossier_submitted) { create(:dossier, :with_entreprise, procedure: procedure, state: 'submitted').decorate }
let!(:decorate_dossier_received) { create(:dossier, :with_entreprise, procedure: procedure, state: 'received').decorate }
let!(:decorate_dossier_closed) { create(:dossier, :with_entreprise, procedure: procedure, state: 'closed').decorate }
let!(:decorate_dossier_refused) { create(:dossier, :with_entreprise, procedure: procedure, state: 'refused').decorate }
let!(:decorate_dossier_without_continuation) { create(:dossier, :with_entreprise, procedure: procedure, state: 'without_continuation').decorate }
before do
decorate_dossier_closed.entreprise.update_column(:raison_sociale, 'plip')
decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plop')
decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plap')
decorate_dossier_updated.entreprise.update_column(:raison_sociale, 'plep')
decorate_dossier_validated.entreprise.update_column(:raison_sociale, 'plip')
decorate_dossier_submitted.entreprise.update_column(:raison_sociale, 'plop')
decorate_dossier_received.entreprise.update_column(:raison_sociale, 'plup')
decorate_dossier_closed.entreprise.update_column(:raison_sociale, 'plyp')
decorate_dossier_refused.entreprise.update_column(:raison_sociale, 'plzp')
decorate_dossier_without_continuation.entreprise.update_column(:raison_sociale, 'plnp')
create :preference_list_dossier,
gestionnaire: gestionnaire,
@ -43,119 +54,120 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
sign_in gestionnaire
end
describe 'on tab a_traiter' do
shared_examples 'check_tab_content' do
before do
assign :dossiers_list_facade, (DossiersListFacades.new gestionnaire, liste)
assign(:dossiers, (smart_listing_create :dossiers,
gestionnaire.dossiers.waiting_for_gestionnaire,
dossiers_to_display,
partial: "backoffice/dossiers/list",
array: true))
assign(:liste, 'a_traiter')
assign(:a_traiter_class, 'active')
render
end
subject { rendered }
describe 'pref list column' do
it { is_expected.to have_css('#backoffice_index') }
it { is_expected.to have_content(procedure.libelle) }
it { is_expected.to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
it { is_expected.to have_content(decorate_dossier_initiated.display_state) }
it { is_expected.to have_content(decorate_dossier_initiated.last_update) }
it { is_expected.to have_content(decorate_dossier_at_check.entreprise.raison_sociale) }
it { is_expected.to have_content(decorate_dossier_at_check.display_state) }
it { is_expected.to have_content(decorate_dossier_at_check.last_update) }
end
it { is_expected.not_to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
it { is_expected.not_to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
it { is_expected.to have_css("#suivre_dossier_#{dossiers_to_display.first.id}") }
it { is_expected.to have_css("#suivre_dossier_#{gestionnaire.dossiers.waiting_for_gestionnaire.first.id}") }
it { expect(dossiers_to_display.count).to eq total_dossiers }
describe 'active tab' do
it { is_expected.to have_selector('.active .text-danger') }
it { is_expected.to have_selector(active_class) }
end
end
describe 'on tab nouveaux' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-info' }
let(:dossiers_to_display) { gestionnaire.dossiers.nouveaux }
let(:liste) { 'nouveaux' }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_initiated }
end
end
describe 'on tab a_traiter' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-danger' }
let(:dossiers_to_display) { gestionnaire.dossiers.waiting_for_gestionnaire }
let(:liste) { 'a_traiter' }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_updated }
end
end
describe 'on tab en_attente' do
before do
assign(:dossiers, (smart_listing_create :dossiers,
gestionnaire.dossiers.waiting_for_user,
partial: "backoffice/dossiers/list",
array: true))
assign(:liste, 'en_attente')
assign(:en_attente_class, 'active')
let(:total_dossiers) { 2 }
let(:active_class) { '.active .text-default' }
let(:dossiers_to_display) { gestionnaire.dossiers.waiting_for_user }
let(:liste) { 'en_attente' }
render
end
subject { rendered }
it { is_expected.to have_css('#backoffice_index') }
it { is_expected.to have_content(procedure.libelle) }
it { is_expected.to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
it { is_expected.to have_content(decorate_dossier_replied.display_state) }
it { is_expected.to have_content(decorate_dossier_replied.last_update) }
it { is_expected.not_to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
it { is_expected.not_to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
describe 'active tab' do
it { is_expected.to have_selector('.active .text-info') }
describe 'for state replied' do
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_replied }
end
end
describe 'on tab suivi' do
before do
create :follow, dossier_id: decorate_dossier_replied.id, gestionnaire_id: gestionnaire.id
assign(:dossiers, (smart_listing_create :dossiers,
gestionnaire.dossiers_follow,
partial: "backoffice/dossiers/list",
array: true))
assign(:suivi_class, 'active')
assign(:liste, 'suivi')
render
describe 'for state validated' do
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_validated }
end
end
end
subject { rendered }
describe 'on tab deposes' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-purple' }
let(:dossiers_to_display) { gestionnaire.dossiers.deposes }
let(:liste) { 'deposes' }
it { is_expected.to have_css('#backoffice_index') }
it { is_expected.to have_content(procedure.libelle) }
it { is_expected.to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
it { is_expected.to have_content(decorate_dossier_replied.display_state) }
it { is_expected.to have_content(decorate_dossier_replied.last_update) }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_submitted }
end
end
it { is_expected.not_to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
it { is_expected.not_to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
describe 'on tab a_instruire' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-warning' }
let(:dossiers_to_display) { gestionnaire.dossiers.a_instruire }
let(:liste) { 'a_instruire' }
it { is_expected.to have_css("#suivre_dossier_#{gestionnaire.dossiers_follow.first.id}") }
describe 'active tab' do
it { is_expected.to have_selector('.active .text-warning') }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_received }
end
end
describe 'on tab termine' do
before do
assign(:dossiers, (smart_listing_create :dossiers,
gestionnaire.dossiers.termine,
partial: "backoffice/dossiers/list",
array: true))
assign(:termine_class, 'active')
assign(:liste, 'termine')
render
let(:total_dossiers) { 3 }
let(:active_class) { '.active .text-success' }
let(:dossiers_to_display) { gestionnaire.dossiers.termine }
let(:liste) { 'termine' }
describe 'for state closed' do
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_closed }
end
end
subject { rendered }
describe 'for state refused' do
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_refused }
end
end
it { is_expected.to have_css('#backoffice_index') }
it { is_expected.to have_content(procedure.libelle) }
it { is_expected.to have_content(decorate_dossier_closed.entreprise.raison_sociale) }
it { is_expected.to have_content(decorate_dossier_closed.display_state) }
it { is_expected.to have_content(decorate_dossier_closed.last_update) }
it { is_expected.not_to have_content(decorate_dossier_initiated.entreprise.raison_sociale) }
it { is_expected.not_to have_content(decorate_dossier_replied.entreprise.raison_sociale) }
it { is_expected.to have_css("#suivre_dossier_#{gestionnaire.dossiers.termine.first.id}") }
describe 'active tab' do
it { is_expected.to have_selector('.active .text-success') }
describe 'for state without_continuation' do
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_without_continuation }
end
end
end
end

View file

@ -57,7 +57,7 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
render
end
it { expect(rendered).to have_content('Soumis') }
it { expect(rendered).to have_content('Nouveau') }
it 'button Valider le dossier is present' do
expect(rendered).to have_css('#action_button')
@ -102,7 +102,7 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
render
end
it { expect(rendered).to have_content('Validé') }
it { expect(rendered).to have_content('Figé') }
it 'button Valider le dossier is not present' do
expect(rendered).not_to have_css('#action_button')
@ -136,7 +136,52 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
render
end
it { expect(rendered).to have_content('Traité') }
it { expect(rendered).to have_content('Accepté') }
it 'button Valider le dossier is not present' do
expect(rendered).not_to have_css('#action_button')
expect(rendered).not_to have_content('Valider le dossier')
end
end
context 'when dossier have state received' do
let(:state) { 'received' }
before do
render
end
it { expect(rendered).to have_content('Reçu') }
it 'button Valider le dossier is not present' do
expect(rendered).not_to have_css('#action_button')
expect(rendered).not_to have_content('Valider le dossier')
end
end
context 'when dossier have state without_continuation' do
let(:state) { 'without_continuation' }
before do
render
end
it { expect(rendered).to have_content('Sans suite') }
it 'button Valider le dossier is not present' do
expect(rendered).not_to have_css('#action_button')
expect(rendered).not_to have_content('Valider le dossier')
end
end
context 'when dossier have state refused' do
let(:state) { 'refused' }
before do
render
end
it { expect(rendered).to have_content('Refusé') }
it 'button Valider le dossier is not present' do
expect(rendered).not_to have_css('#action_button')

View file

@ -1,37 +0,0 @@
require 'spec_helper'
describe 'backoffice/procedure_filter/index.html.haml', type: :view do
let(:administrateur) { create :administrateur }
before do
create :procedure, libelle: 'plip', administrateur: administrateur
create :procedure, libelle: 'plop', administrateur: administrateur
create :procedure, libelle: 'plap', administrateur: administrateur
end
context 'when gestionnaire have already check procedure' do
let(:gestionnaire) { create(:gestionnaire,
administrateurs: [administrateur],
procedure_filter: [administrateur.procedures.first.id,
administrateur.procedures.last.id]) }
before do
create :assign_to, gestionnaire: gestionnaire, procedure: administrateur.procedures.first
create :assign_to, gestionnaire: gestionnaire, procedure: administrateur.procedures.second
create :assign_to, gestionnaire: gestionnaire, procedure: administrateur.procedures.last
sign_in gestionnaire
assign(:gestionnaire, gestionnaire)
assign(:procedures, gestionnaire.procedures)
render
end
subject { rendered }
it { is_expected.to have_content('Filtre des procédures') }
it { is_expected.to have_css("input[type=checkbox][value='#{gestionnaire.procedures.first.id}'][checked=checked]") }
it { is_expected.to have_css("input[type=checkbox][value='#{gestionnaire.procedures.last.id}'][checked=checked]") }
end
end

View file

@ -52,7 +52,7 @@ describe 'layouts/_navbar.html.haml', type: :view do
it { is_expected.not_to match(/href="\/administrateurs\/sign_in">Administrateur/) }
it { is_expected.not_to match(/Mes Procédures/) }
it { is_expected.to match(/Mes Dossiers/) }
it { is_expected.to match(/Se déconnecter/) }
it { is_expected.to match(/Déconnexion/) }
end
end

View file

@ -3,118 +3,144 @@ require 'spec_helper'
describe 'users/dossiers/index.html.haml', type: :view do
let(:user) { create(:user) }
let!(:dossier) { create(:dossier, :with_entreprise, user: user, state: 'initiated').decorate }
let!(:dossier_2) { create(:dossier, :with_entreprise, user: user, state: 'replied').decorate }
let!(:dossier_3) { create(:dossier, :with_entreprise, user: user, state: 'replied').decorate }
let!(:dossier_termine) { create(:dossier, :with_entreprise, user: user, state: 'closed').decorate }
let!(:decorate_dossier_initiated) { create(:dossier, :with_entreprise, user: user, state: 'initiated').decorate }
let!(:decorate_dossier_replied) { create(:dossier, :with_entreprise, user: user, state: 'replied').decorate }
let!(:decorate_dossier_updated) { create(:dossier, :with_entreprise, user: user, state: 'updated').decorate }
let!(:decorate_dossier_validated) { create(:dossier, :with_entreprise, user: user, state: 'validated').decorate }
let!(:decorate_dossier_submitted) { create(:dossier, :with_entreprise, user: user, state: 'submitted').decorate }
let!(:decorate_dossier_received) { create(:dossier, :with_entreprise, user: user, state: 'received').decorate }
let!(:decorate_dossier_closed) { create(:dossier, :with_entreprise, user: user, state: 'closed').decorate }
let!(:decorate_dossier_refused) { create(:dossier, :with_entreprise, user: user, state: 'refused').decorate }
let!(:decorate_dossier_without_continuation) { create(:dossier, :with_entreprise, user: user, state: 'without_continuation').decorate }
let!(:decorate_dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'initiated').decorate }
before do
dossier_2.entreprise.update_column(:raison_sociale, 'plip')
dossier_2.entreprise.update_column(:raison_sociale, 'plop')
dossier_3.entreprise.update_column(:raison_sociale, 'plup')
dossier_termine.entreprise.update_column(:raison_sociale, 'plap')
decorate_dossier_replied.entreprise.update_column(:raison_sociale, 'plap')
decorate_dossier_updated.entreprise.update_column(:raison_sociale, 'plep')
decorate_dossier_validated.entreprise.update_column(:raison_sociale, 'plip')
decorate_dossier_submitted.entreprise.update_column(:raison_sociale, 'plop')
decorate_dossier_received.entreprise.update_column(:raison_sociale, 'plup')
decorate_dossier_closed.entreprise.update_column(:raison_sociale, 'plyp')
decorate_dossier_refused.entreprise.update_column(:raison_sociale, 'plzp')
decorate_dossier_without_continuation.entreprise.update_column(:raison_sociale, 'plnp')
create :invite, dossier: decorate_dossier_invite, user: user
end
describe 'params liste is a_traiter' do
let(:dossiers_list) { user.dossiers.waiting_for_user('DESC') }
shared_examples 'check_tab_content' do
before do
sign_in user
assign :dossiers_list_facade, (DossiersListFacades.new user, liste)
assign(:dossiers, (smart_listing_create :dossiers,
user.dossiers.waiting_for_user('DESC'),
dossiers_to_display,
partial: "users/dossiers/list",
array: true))
assign(:liste, 'a_traiter')
assign(:dossiers_a_traiter_total, '1')
assign(:dossiers_en_attente_total, '2')
assign(:dossiers_termine_total, '1')
render
end
subject { rendered }
it { is_expected.to have_css('#users_index') }
describe 'dossier replied is present' do
it { is_expected.to have_content(dossier_2.procedure.libelle) }
it { is_expected.to have_content(dossier_2.entreprise.raison_sociale) }
it { is_expected.to have_content(dossier_2.display_state) }
it { is_expected.to have_content(dossier_2.last_update) }
describe 'columns' do
it { is_expected.to have_content(decorate_dossier_at_check.procedure.libelle) }
it { is_expected.to have_content(decorate_dossier_at_check.entreprise.raison_sociale) }
it { is_expected.to have_content(decorate_dossier_at_check.display_state) }
it { is_expected.to have_content(decorate_dossier_at_check.last_update) }
end
describe 'dossier initiated and closed are not present' do
it { is_expected.not_to have_content(dossier.entreprise.raison_sociale) }
it { is_expected.not_to have_content(dossier_termine.entreprise.raison_sociale) }
end
it { expect(dossiers_to_display.count).to eq total_dossiers }
describe 'badges on tabs' do
it { is_expected.to have_content('À traiter 1') }
it { is_expected.to have_content('En attente 2') }
it { is_expected.to have_content('Terminé 1') }
describe 'active tab' do
it { is_expected.to have_selector(active_class) }
end
end
describe 'params liste is en_attente' do
let(:dossiers_list) { user.dossiers.waiting_for_gestionnaire('DESC') }
describe 'on tab nouveaux' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-info' }
let(:dossiers_to_display) { user.dossiers.nouveaux }
let(:liste) { 'nouveaux' }
before do
sign_in user
assign(:dossiers, (smart_listing_create :dossiers,
user.dossiers.waiting_for_gestionnaire('DESC'),
partial: "users/dossiers/list",
array: true))
assign(:liste, 'en_attente')
render
end
subject { rendered }
it { is_expected.to have_css('#users_index') }
describe 'dossier initiated is present' do
it { is_expected.to have_content(dossier.procedure.libelle) }
it { is_expected.to have_content(dossier.entreprise.raison_sociale) }
it { is_expected.to have_content(dossier.display_state) }
it { is_expected.to have_content(dossier.last_update) }
end
describe 'dossier replied and closed are not present' do
it { is_expected.not_to have_content(dossier_2.entreprise.raison_sociale) }
it { is_expected.not_to have_content(dossier_termine.entreprise.raison_sociale) }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_initiated }
end
end
describe 'params liste is termine' do
let(:dossiers_list) { user.dossiers.termine('DESC') }
describe 'on tab action requise' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-danger' }
let(:dossiers_to_display) { user.dossiers.waiting_for_user_without_validated }
let(:liste) { 'a_traiter' }
before do
sign_in user
assign(:dossiers, (smart_listing_create :dossiers,
user.dossiers.termine('DESC'),
partial: "users/dossiers/list",
array: true))
assign(:liste, 'termine')
render
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_replied }
end
end
subject { rendered }
describe 'on tab etude en cours' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-default' }
let(:dossiers_to_display) { user.dossiers.waiting_for_gestionnaire }
let(:liste) { 'en_attente' }
it { is_expected.to have_css('#users_index') }
describe 'dossier termine is present' do
it { is_expected.to have_content(dossier_termine.procedure.libelle) }
it { is_expected.to have_content(dossier_termine.entreprise.raison_sociale) }
it { is_expected.to have_content(dossier_termine.display_state) }
it { is_expected.to have_content(dossier_termine.last_update) }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_updated }
end
end
describe 'dossier initiated and replied are not present' do
it { is_expected.not_to have_content(dossier.entreprise.raison_sociale) }
it { is_expected.not_to have_content(dossier_2.entreprise.raison_sociale) }
describe 'on tab etude a deposer' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-purple' }
let(:dossiers_to_display) { user.dossiers.valides }
let(:liste) { 'valides' }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_validated }
end
end
describe 'on tab etude en instruction' do
let(:total_dossiers) { 2 }
let(:active_class) { '.active .text-default' }
let(:dossiers_to_display) { user.dossiers.en_instruction }
let(:liste) { 'en_instruction' }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_submitted }
end
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_received }
end
end
describe 'on tab etude termine' do
let(:total_dossiers) { 3 }
let(:active_class) { '.active .text-success' }
let(:dossiers_to_display) { user.dossiers.termine }
let(:liste) { 'termine' }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_closed }
end
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_refused }
end
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_without_continuation }
end
end
describe 'on tab etude invite' do
let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-warning' }
let(:dossiers_to_display) { user.invites }
let(:liste) { 'invite' }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_invite }
end
end
end

View file

@ -59,7 +59,7 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
render
end
it { expect(rendered).to have_content('Soumis') }
it { expect(rendered).to have_content('Nouveau') }
it 'button Modifier les document est present' do
expect(rendered).to have_content('Modifier les documents')
@ -125,13 +125,41 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
end
end
context 'when dossier state is traité' do
context 'when dossier state is closed' do
let(:state) { 'closed' }
before do
render
end
it { expect(rendered).to have_content('Traité') }
it { expect(rendered).to have_content('Accepté') }
it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos')
expect(rendered).not_to have_content('Modifier mon dossier')
end
end
context 'when dossier state is refused' do
let(:state) { 'refused' }
before do
render
end
it { expect(rendered).to have_content('Refusé') }
it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos')
expect(rendered).not_to have_content('Modifier mon dossier')
end
end
context 'when dossier state is without_continuation' do
let(:state) { 'without_continuation' }
before do
render
end
it { expect(rendered).to have_content('Sans suite') }
it 'button Editer mon dossier n\'est plus present' do
expect(rendered).not_to have_css('#maj_infos')