Merge branch 'staging'
This commit is contained in:
commit
8ded471f61
94 changed files with 724 additions and 994 deletions
4
Gemfile
4
Gemfile
|
@ -64,7 +64,6 @@ gem 'fog'
|
|||
gem 'fog-openstack'
|
||||
|
||||
gem 'pg'
|
||||
gem 'scenic'
|
||||
|
||||
gem 'rgeo-geojson'
|
||||
gem 'leaflet-rails'
|
||||
|
@ -115,6 +114,7 @@ group :test do
|
|||
gem 'guard-livereload', '~> 2.4', require: false
|
||||
gem 'vcr'
|
||||
gem 'rails-controller-testing'
|
||||
gem 'sqlite3'
|
||||
end
|
||||
|
||||
group :development do
|
||||
|
@ -122,6 +122,7 @@ group :development do
|
|||
gem 'web-console'
|
||||
gem 'rack-handlers'
|
||||
gem 'xray-rails'
|
||||
gem 'scenic'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
|
@ -152,5 +153,6 @@ group :development, :test do
|
|||
end
|
||||
|
||||
group :production, :staging do
|
||||
gem 'scenic'
|
||||
gem 'sentry-raven'
|
||||
end
|
||||
|
|
|
@ -564,6 +564,7 @@ GEM
|
|||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.13)
|
||||
swd (1.0.1)
|
||||
activesupport (>= 3)
|
||||
attr_required (>= 0.0.5)
|
||||
|
@ -695,6 +696,7 @@ DEPENDENCIES
|
|||
simplecov
|
||||
smart_listing
|
||||
spreadsheet_architect
|
||||
sqlite3
|
||||
therubyracer
|
||||
timecop
|
||||
turbolinks (~> 2.5)
|
||||
|
@ -708,4 +710,4 @@ DEPENDENCIES
|
|||
xray-rails
|
||||
|
||||
BUNDLED WITH
|
||||
1.13.7
|
||||
1.14.4
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
font-family: Arial;
|
||||
|
||||
.show-block {
|
||||
width: 840px;
|
||||
min-width: 840px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.5);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
}
|
||||
}
|
||||
#navbar-body {
|
||||
height: 60px;
|
||||
min-height: 60px;
|
||||
background-color: #FFFFFF;
|
||||
box-shadow: 0 1px 2px 0 rgba(50,50,50,0.5);
|
||||
padding-left: 50px;
|
||||
|
@ -43,9 +43,10 @@
|
|||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
line-height: 58px;
|
||||
height: 58px;
|
||||
min-height: 58px;
|
||||
color: #000000;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.options {
|
||||
|
@ -56,7 +57,7 @@
|
|||
color: #666666;
|
||||
padding: 8px;
|
||||
border-right: 1px solid #C8C6C8;
|
||||
height: 60px;
|
||||
min-height: 60px;
|
||||
.dropdown-toggle {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -84,12 +85,8 @@
|
|||
#sign_in{
|
||||
margin-top: 7px;
|
||||
.btn {
|
||||
color: #003C92;
|
||||
float: right;
|
||||
margin-right: 1.3em;
|
||||
}
|
||||
.btn:hover {
|
||||
color: #668ABD;
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,8 @@ class Admin::ProceduresController < AdminController
|
|||
def path_list
|
||||
render json: ProcedurePath
|
||||
.joins(', procedures')
|
||||
.where("procedures.id = procedure_paths.procedure_id AND procedures.archived != true")
|
||||
.where("procedures.id = procedure_paths.procedure_id")
|
||||
.where("procedures.archived" => false)
|
||||
.where("path LIKE '%#{params[:request]}%'")
|
||||
.pluck(:path, :administrateur_id)
|
||||
.inject([]) {
|
||||
|
|
|
@ -85,21 +85,10 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
default_sort: dossiers_list_facade.service.default_sort
|
||||
end
|
||||
|
||||
def valid
|
||||
create_dossier_facade params[:dossier_id]
|
||||
|
||||
@facade.dossier.next_step! 'gestionnaire', 'valid'
|
||||
flash.notice = 'Dossier confirmé avec succès.'
|
||||
|
||||
NotificationMailer.dossier_validated(@facade.dossier).deliver_now!
|
||||
|
||||
redirect_to backoffice_dossier_path(id: @facade.dossier.id)
|
||||
end
|
||||
|
||||
def receive
|
||||
create_dossier_facade params[:dossier_id]
|
||||
|
||||
@facade.dossier.next_step! 'gestionnaire', 'receive'
|
||||
@facade.dossier.received!
|
||||
flash.notice = 'Dossier considéré comme reçu.'
|
||||
|
||||
NotificationMailer.dossier_received(@facade.dossier).deliver_now!
|
||||
|
@ -162,7 +151,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
end
|
||||
|
||||
def archive
|
||||
facade = create_dossier_facade params[:dossier_id]
|
||||
facade = create_dossier_facade params[:id]
|
||||
unless facade.dossier.archived
|
||||
facade.dossier.update(archived: true)
|
||||
flash.notice = 'Dossier archivé'
|
||||
|
@ -170,6 +159,25 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
redirect_to backoffice_dossiers_path
|
||||
end
|
||||
|
||||
|
||||
def unarchive
|
||||
@dossier = Dossier.find(params[:id])
|
||||
if @dossier.archived
|
||||
@dossier.update(archived: false)
|
||||
flash.notice = 'Dossier désarchivé'
|
||||
end
|
||||
redirect_to backoffice_dossier_path(@dossier)
|
||||
end
|
||||
|
||||
def reopen
|
||||
create_dossier_facade params[:dossier_id]
|
||||
|
||||
@facade.dossier.replied!
|
||||
flash.notice = 'Dossier réouvert.'
|
||||
|
||||
redirect_to backoffice_dossiers_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_dossier_facade dossier_id
|
||||
|
|
|
@ -29,36 +29,31 @@ class Backoffice::DossiersListController < ApplicationController
|
|||
|
||||
def smartlisting_dossier dossiers_list=nil, liste='all_state'
|
||||
dossiers_list_facade liste
|
||||
service = dossiers_list_facade.service
|
||||
|
||||
new_dossiers_list = dossiers_list_facade.service.nouveaux
|
||||
follow_dossiers_list = dossiers_list_facade.service.suivi
|
||||
all_state_dossiers_list = dossiers_list_facade.service.all_state
|
||||
|
||||
if param_page.nil?
|
||||
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
|
||||
end
|
||||
|
||||
smart_listing_create :new_dossiers,
|
||||
new_dossiers_list,
|
||||
partial: "backoffice/dossiers/list",
|
||||
array: true,
|
||||
default_sort: dossiers_list_facade.service.default_sort
|
||||
default_smart_listing_create :new_dossiers, service.nouveaux
|
||||
default_smart_listing_create :follow_dossiers, service.suivi
|
||||
default_smart_listing_create :all_state_dossiers, service.all_state
|
||||
default_smart_listing_create :archived_dossiers, service.archive
|
||||
|
||||
smart_listing_create :follow_dossiers,
|
||||
follow_dossiers_list,
|
||||
partial: "backoffice/dossiers/list",
|
||||
array: true,
|
||||
default_sort: dossiers_list_facade.service.default_sort
|
||||
|
||||
smart_listing_create :all_state_dossiers,
|
||||
all_state_dossiers_list,
|
||||
partial: "backoffice/dossiers/list",
|
||||
array: true,
|
||||
default_sort: dossiers_list_facade.service.default_sort
|
||||
@archived_dossiers = service.archive
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def default_smart_listing_create name, collection
|
||||
smart_listing_create name,
|
||||
collection,
|
||||
partial: 'backoffice/dossiers/list',
|
||||
array: true,
|
||||
default_sort: dossiers_list_facade.service.default_sort
|
||||
end
|
||||
|
||||
def param_smart_listing
|
||||
params[:dossiers_smart_listing]
|
||||
end
|
||||
|
|
|
@ -17,20 +17,21 @@ class Users::DescriptionController < UsersController
|
|||
acc
|
||||
end
|
||||
|
||||
unless @dossier.can_be_initiated?
|
||||
flash[:alert] = t('errors.messages.procedure_archived')
|
||||
end
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for(root_path)
|
||||
end
|
||||
|
||||
# def error
|
||||
# show
|
||||
# flash.now.alert = 'Un ou plusieurs attributs obligatoires sont manquants ou incorrects.'
|
||||
# render 'show'
|
||||
# end
|
||||
|
||||
def create
|
||||
def update
|
||||
@dossier = current_user_dossier
|
||||
@procedure = @dossier.procedure
|
||||
|
||||
return head :forbidden unless @dossier.can_be_initiated?
|
||||
|
||||
@champs = @dossier.ordered_champs
|
||||
|
||||
mandatory = true
|
||||
|
|
|
@ -17,18 +17,9 @@ class Users::RecapitulatifController < UsersController
|
|||
redirect_to users_dossier_recapitulatif_path
|
||||
end
|
||||
|
||||
def submit
|
||||
create_dossier_facade
|
||||
|
||||
@facade.dossier.submit!
|
||||
flash.notice = 'Dossier déposé avec succès.'
|
||||
|
||||
redirect_to users_dossier_recapitulatif_path
|
||||
end
|
||||
|
||||
def self.route_authorization
|
||||
{
|
||||
states: [:initiated, :replied, :updated, :validated, :received, :submitted, :without_continuation, :closed, :refused]
|
||||
states: [:initiated, :replied, :updated, :received, :without_continuation, :closed, :refused]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@ class MailTemplateDecorator < Draper::Decorator
|
|||
case object.type
|
||||
when "MailReceived"
|
||||
"E-mail d'accusé de réception"
|
||||
when "MailValidated"
|
||||
"E-mail de validation"
|
||||
else
|
||||
object.type
|
||||
end
|
||||
|
|
|
@ -13,8 +13,11 @@ class AdminProceduresShowFacades
|
|||
|
||||
def dossiers_for_pie_highchart
|
||||
dossiers.where.not(state: :draft, archived: true).group(:state).count
|
||||
.map{|key, value| { (DossierDecorator.case_state_fr key) => value } }
|
||||
.reduce({}, :merge)
|
||||
.reduce({}) do |acc, (key, val)|
|
||||
translated_key = DossierDecorator.case_state_fr(key)
|
||||
acc[translated_key].nil? ? acc[translated_key] = val : acc[translated_key] += val
|
||||
acc
|
||||
end
|
||||
end
|
||||
|
||||
def dossiers_archived_by_state_total
|
||||
|
|
|
@ -2,7 +2,7 @@ class DossierFacades
|
|||
|
||||
#TODO rechercher en fonction de la personne/email
|
||||
def initialize(dossier_id, email, champ_id = nil)
|
||||
@dossier = Dossier.where(archived: false).find(dossier_id)
|
||||
@dossier = Dossier.find(dossier_id)
|
||||
@champ_id = champ_id
|
||||
end
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@ class NotificationMailer < ApplicationMailer
|
|||
send_mail dossier, dossier.procedure.mail_received.object_for_dossier(dossier)
|
||||
end
|
||||
|
||||
def dossier_validated dossier
|
||||
send_mail dossier, dossier.procedure.mail_validated.object_for_dossier(dossier)
|
||||
end
|
||||
|
||||
def dossier_submitted dossier
|
||||
send_mail dossier, "Votre dossier TPS N°#{dossier.id} a été déposé"
|
||||
end
|
||||
|
|
|
@ -5,8 +5,6 @@ class Dossier < ActiveRecord::Base
|
|||
initiated: 'initiated',
|
||||
replied: 'replied', #action utilisateur demandé
|
||||
updated: 'updated', #etude par l'administration en cours
|
||||
validated: 'validated',
|
||||
submitted: 'submitted',
|
||||
received: 'received',
|
||||
closed: 'closed',
|
||||
refused: 'refused',
|
||||
|
@ -40,9 +38,10 @@ class Dossier < ActiveRecord::Base
|
|||
delegate :types_de_champ, to: :procedure
|
||||
delegate :france_connect_information, to: :user
|
||||
|
||||
before_validation :update_state_dates, if: -> { state_changed? }
|
||||
|
||||
after_save :build_default_champs, if: Proc.new { procedure_id_changed? }
|
||||
after_save :build_default_individual, if: Proc.new { procedure.for_individual? }
|
||||
after_save :internal_notification
|
||||
|
||||
validates :user, presence: true
|
||||
|
||||
|
@ -50,14 +49,12 @@ class Dossier < ActiveRecord::Base
|
|||
NOUVEAUX = %w(initiated)
|
||||
OUVERT = %w(updated replied)
|
||||
WAITING_FOR_GESTIONNAIRE = %w(updated)
|
||||
WAITING_FOR_USER = %w(replied validated)
|
||||
WAITING_FOR_USER = %w(replied)
|
||||
EN_CONSTRUCTION = %w(initiated updated replied)
|
||||
VALIDES = %w(validated)
|
||||
DEPOSES = %w(submitted)
|
||||
EN_INSTRUCTION = %w(submitted received)
|
||||
EN_INSTRUCTION = %w(received)
|
||||
A_INSTRUIRE = %w(received)
|
||||
TERMINE = %w(closed refused without_continuation)
|
||||
ALL_STATE = %w(initiated updated replied validated submitted received closed refused without_continuation)
|
||||
ALL_STATE = %w(initiated updated replied received closed refused without_continuation)
|
||||
|
||||
def unreaded_notifications
|
||||
@unreaded_notif ||= notifications.where(already_read: false)
|
||||
|
@ -108,7 +105,7 @@ class Dossier < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def next_step! role, action
|
||||
unless %w(initiate follow update comment valid submit receive refuse without_continuation close).include?(action)
|
||||
unless %w(initiate follow update comment receive refuse without_continuation close).include?(action)
|
||||
fail 'action is not valid'
|
||||
end
|
||||
|
||||
|
@ -122,10 +119,6 @@ class Dossier < ActiveRecord::Base
|
|||
if draft?
|
||||
initiated!
|
||||
end
|
||||
when 'submit'
|
||||
if validated?
|
||||
submitted!
|
||||
end
|
||||
when 'update'
|
||||
if replied?
|
||||
updated!
|
||||
|
@ -147,18 +140,6 @@ class Dossier < ActiveRecord::Base
|
|||
if initiated?
|
||||
updated!
|
||||
end
|
||||
when 'valid'
|
||||
if updated?
|
||||
validated!
|
||||
elsif replied?
|
||||
validated!
|
||||
elsif initiated?
|
||||
validated!
|
||||
end
|
||||
when 'receive'
|
||||
if submitted?
|
||||
received!
|
||||
end
|
||||
when 'close'
|
||||
if received?
|
||||
closed!
|
||||
|
@ -208,18 +189,6 @@ class Dossier < ActiveRecord::Base
|
|||
where(state: OUVERT, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
||||
def self.valides order = 'ASC'
|
||||
where(state: VALIDES, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
||||
def self.fige 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
|
||||
|
@ -232,6 +201,8 @@ class Dossier < ActiveRecord::Base
|
|||
where(state: TERMINE, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
||||
scope :archived, -> { where(archived: true) }
|
||||
|
||||
def cerfa_available?
|
||||
procedure.cerfa_flag? && cerfa.size != 0
|
||||
end
|
||||
|
@ -324,15 +295,8 @@ class Dossier < ActiveRecord::Base
|
|||
follows.size
|
||||
end
|
||||
|
||||
def submit!
|
||||
self.deposit_datetime= DateTime.now
|
||||
|
||||
next_step! 'user', 'submit'
|
||||
NotificationMailer.dossier_submitted(self).deliver_now!
|
||||
end
|
||||
|
||||
def read_only?
|
||||
validated? || received? || submitted? || closed? || refused? || without_continuation?
|
||||
received? || closed? || refused? || without_continuation?
|
||||
end
|
||||
|
||||
def owner? email
|
||||
|
@ -343,11 +307,20 @@ class Dossier < ActiveRecord::Base
|
|||
(invites_user.pluck :email).include? email
|
||||
end
|
||||
|
||||
def can_be_initiated?
|
||||
!(procedure.archived && draft?)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def internal_notification
|
||||
if state_changed? && state == 'submitted'
|
||||
NotificationService.new('submitted', self.id).notify
|
||||
def update_state_dates
|
||||
if initiated? && !self.initiated_at
|
||||
self.initiated_at = DateTime.now
|
||||
elsif received? && !self.received_at
|
||||
self.received_at = DateTime.now
|
||||
elsif TERMINE.include?(state)
|
||||
self.processed_at = DateTime.now
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
class MailValidated < MailTemplate
|
||||
before_save :default_values
|
||||
|
||||
def default_values
|
||||
self.object ||= "[TPS] Votre dossier TPS N°--numero_dossier-- a été validé"
|
||||
self.body ||= "Bonjour,<br>
|
||||
<br>
|
||||
Votre dossier N°--numero_dossier-- est prêt à être déposé pour instruction.<br>
|
||||
<br>
|
||||
Afin de finaliser son dépôt, merci de vous rendre sur --lien_dossier--.,<br>
|
||||
<br>
|
||||
Bonne journée,<br>
|
||||
---<br>
|
||||
Merci de ne pas répondre à ce mail. Postez directement vos questions dans votre dossier sur la plateforme.<br>
|
||||
---<br>
|
||||
L'équipe TPS"
|
||||
end
|
||||
end
|
|
@ -1,5 +1,6 @@
|
|||
class Notification < ActiveRecord::Base
|
||||
belongs_to :dossier
|
||||
serialize :liste if Rails.env.test?
|
||||
|
||||
# after_save :broadcast_notification
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ class Procedure < ActiveRecord::Base
|
|||
has_many :dossiers
|
||||
has_many :mail_templates
|
||||
has_one :mail_received
|
||||
has_one :mail_validated
|
||||
|
||||
has_one :procedure_path, dependent: :destroy
|
||||
|
||||
|
@ -34,7 +33,6 @@ class Procedure < ActiveRecord::Base
|
|||
|
||||
def build_default_mails
|
||||
MailReceived.create(procedure: self) unless mail_received
|
||||
MailValidated.create(procedure: self) unless mail_validated
|
||||
end
|
||||
|
||||
def path
|
||||
|
|
|
@ -4,7 +4,10 @@ class DossierProcedureSerializer < ActiveModel::Serializer
|
|||
:updated_at,
|
||||
:archived,
|
||||
:mandataire_social,
|
||||
:state
|
||||
:state,
|
||||
:initiated_at,
|
||||
:received_at,
|
||||
:processed_at
|
||||
|
||||
attribute :followers_gestionnaires_emails, key: :emails_accompagnateurs
|
||||
end
|
||||
|
|
|
@ -8,18 +8,16 @@ class DossiersListGestionnaireService
|
|||
def dossiers_to_display
|
||||
@dossiers_to_display ||=
|
||||
{'nouveaux' => nouveaux,
|
||||
# 'suivi' => suivi,
|
||||
'a_traiter' => ouvert,
|
||||
'fige' => fige,
|
||||
'deposes' => deposes,
|
||||
'a_instruire' => a_instruire,
|
||||
'termine' => termine,
|
||||
'archive' => archive,
|
||||
'all_state' => all_state}[@liste]
|
||||
|
||||
end
|
||||
|
||||
def self.dossiers_liste_libelle
|
||||
['nouveaux', 'suivi', 'a_traiter', 'fige', 'deposes', 'a_instruire', 'termine', 'all_state']
|
||||
['nouveaux', 'suivi', 'a_traiter', 'a_instruire', 'termine', 'all_state']
|
||||
end
|
||||
|
||||
def all_state
|
||||
|
@ -38,18 +36,14 @@ class DossiersListGestionnaireService
|
|||
@ouvert ||= filter_dossiers.ouvert
|
||||
end
|
||||
|
||||
def fige
|
||||
@fige ||= filter_dossiers.fige
|
||||
end
|
||||
|
||||
def deposes
|
||||
@deposes ||= filter_dossiers.deposes
|
||||
end
|
||||
|
||||
def a_instruire
|
||||
@a_instruire ||= filter_dossiers.a_instruire
|
||||
end
|
||||
|
||||
def archive
|
||||
@archive ||= filter_dossiers.archived
|
||||
end
|
||||
|
||||
def termine
|
||||
@termine ||= filter_dossiers.termine
|
||||
end
|
||||
|
|
|
@ -7,7 +7,6 @@ class DossiersListUserService
|
|||
def dossiers_to_display
|
||||
{'brouillon' => brouillon,
|
||||
'a_traiter' => en_construction,
|
||||
'valides' => valides,
|
||||
'en_instruction' => en_instruction,
|
||||
'termine' => termine,
|
||||
'invite' => invite,
|
||||
|
@ -15,7 +14,7 @@ class DossiersListUserService
|
|||
end
|
||||
|
||||
def self.dossiers_liste_libelle
|
||||
['brouillon', 'a_traiter', 'valides', 'en_instruction', 'termine', 'invite', 'all_state']
|
||||
['brouillon', 'a_traiter', 'en_instruction', 'termine', 'invite', 'all_state']
|
||||
end
|
||||
|
||||
def all_state
|
||||
|
@ -34,10 +33,6 @@ class DossiersListUserService
|
|||
@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
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
- MailTemplate::TAGS.each do |balise|
|
||||
%tr
|
||||
%td.center
|
||||
%b.text-success
|
||||
= "--#{balise.first}--"
|
||||
%td
|
||||
=balise.second[:description]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
%table#dossiers_list.table
|
||||
%thead
|
||||
- if smart_listing.name.to_s == 'follow_dossiers'
|
||||
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
|
||||
%th.col-xs-1.center
|
||||
%i.fa.fa-bell
|
||||
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
|
||||
%th.col-xs-1
|
||||
État
|
||||
|
||||
- @facade_data_view.preference_list_dossiers_filter.each do |preference|
|
||||
|
@ -17,14 +17,14 @@
|
|||
%i.filter.fa.fa-filter{style: "color:#{(preference.filter.blank? ? 'grey' : 'orange')}", id: "filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}"}
|
||||
= render partial: 'backoffice/dossiers/filter_framed', locals:{preference: preference, filter_framed_id: "framed_filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}"}
|
||||
|
||||
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center Actions
|
||||
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center Abonnés
|
||||
%th.col-xs-1.center Actions
|
||||
%th.col-xs-1.center Abonnés
|
||||
|
||||
- unless smart_listing.empty?
|
||||
- smart_listing.collection.each do |dossier|
|
||||
%tr.dossier-row{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id)}
|
||||
- if smart_listing.name.to_s == 'follow_dossiers'
|
||||
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
|
||||
%td.col-xs-1.center
|
||||
- total_notif = dossier.notifications.where(already_read: false).count
|
||||
- if total_notif == 0
|
||||
.badge.progress-bar-default
|
||||
|
@ -32,7 +32,7 @@
|
|||
- else
|
||||
.badge.progress-bar-warning
|
||||
= total_notif
|
||||
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
|
||||
%td.col-xs-1
|
||||
= dossier.decorate.display_state
|
||||
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
|
||||
- unless preference.libelle == 'Statut' || preference.libelle == 'État'
|
||||
|
|
|
@ -3,53 +3,62 @@
|
|||
= render partial: 'backoffice/dossiers/pref_list'
|
||||
|
||||
.default_data_block
|
||||
%div.row.show-block#new_dossiers
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
||||
%div.carret-right
|
||||
%div.carret-down
|
||||
.row.show-block#new_dossiers
|
||||
.header
|
||||
.col-xs-10.title
|
||||
.carret-right
|
||||
.carret-down
|
||||
Nouveaux dossiers
|
||||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
||||
=@facade_data_view.nouveaux_total
|
||||
dossiers
|
||||
%div.body
|
||||
.col-xs-2.count
|
||||
= pluralize(@facade_data_view.nouveaux_total, "dossier")
|
||||
.body
|
||||
= smart_listing_render :new_dossiers
|
||||
|
||||
.row.center
|
||||
.col-lg-1.col-md-1.col-sm-1.col-xs-1
|
||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2
|
||||
.col-xs-3
|
||||
=link_to 'Tous les états', '?liste=all_state', class: 'text-info', style:"text-decoration: #{@facade_data_view.liste == 'all_state'? 'underline' : ''}"
|
||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2
|
||||
.col-xs-3
|
||||
=link_to 'En construction', '?liste=a_traiter', class: 'text-danger', style:"text-decoration: #{@facade_data_view.liste == 'a_traiter'? 'underline' : ''}"
|
||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2
|
||||
=link_to 'À receptionner', '?liste=deposes', class: 'text-purple', style:"text-decoration: #{@facade_data_view.liste == 'deposes'? 'underline' : ''}"
|
||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2
|
||||
=link_to 'À instruire', '?liste=a_instruire', class: 'text-warning', style:"text-decoration: #{@facade_data_view.liste == 'a_instruire'? 'underline' : ''}"
|
||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2
|
||||
.col-xs-3
|
||||
=link_to 'En instruction', '?liste=a_instruire', class: 'text-warning', style:"text-decoration: #{@facade_data_view.liste == 'a_instruire'? 'underline' : ''}"
|
||||
.col-xs-3
|
||||
=link_to 'Terminés', '?liste=termine', class: 'text-success', style:"text-decoration: #{@facade_data_view.liste == 'termine'? 'underline' : ''}"
|
||||
|
||||
.default_data_block.default_visible
|
||||
%div.row.show-block#follow_dossiers
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
||||
%div.carret-right
|
||||
%div.carret-down
|
||||
.row.show-block#follow_dossiers
|
||||
.header
|
||||
.col-xs-10.title
|
||||
.carret-right
|
||||
.carret-down
|
||||
Dossiers suivis
|
||||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
||||
=@facade_data_view.suivi_total
|
||||
dossiers
|
||||
%div.body
|
||||
.col-xs-2.count
|
||||
= pluralize(@facade_data_view.suivi_total, "dossier")
|
||||
.body
|
||||
= smart_listing_render :follow_dossiers
|
||||
|
||||
.default_data_block
|
||||
%div.row.show-block#all_dossiers
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
||||
%div.carret-right
|
||||
%div.carret-down
|
||||
.row.show-block#all_dossiers
|
||||
.header
|
||||
.col-xs-10.title
|
||||
.carret-right
|
||||
.carret-down
|
||||
Tous les dossiers
|
||||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
||||
=@facade_data_view.all_state_total
|
||||
dossiers
|
||||
%div.body
|
||||
.col-xs-2.count
|
||||
= pluralize(@facade_data_view.all_state_total, "dossier")
|
||||
.body
|
||||
= smart_listing_render :all_state_dossiers
|
||||
|
||||
|
||||
- if @archived_dossiers
|
||||
.default_data_block
|
||||
.row.show-block#archived_dossiers
|
||||
.header
|
||||
.col-xs-10.title
|
||||
.carret-right
|
||||
.carret-down
|
||||
Dossiers archivés
|
||||
.col-xs-2.count
|
||||
= pluralize(@archived_dossiers.count, "dossier")
|
||||
|
||||
.body
|
||||
= smart_listing_render :archived_dossiers
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
%div.col-lg-12.col-md-12.col-sm-12.col-xs-12#backoffice_dossier_show
|
||||
#backoffice_dossier_show.col-xs-12
|
||||
= render partial: "dossiers/dossier_show"
|
|
@ -1,4 +1,4 @@
|
|||
%div#main-container{class: "col-lg-#{main_container_size} col-md-#{main_container_size}"}
|
||||
%div#main-container{class: "col-xs-#{main_container_size}"}
|
||||
%div.row
|
||||
= render partial: 'layouts/flash_messages'
|
||||
%div.row
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2
|
||||
.col-xs-2
|
||||
%a#title_navbar{href: '/'}
|
||||
%div.row#home
|
||||
%div.col-lg-6.no-padding
|
||||
.row#home
|
||||
.col-lg-6.no-padding
|
||||
= image_tag('marianne_small.png', class: 'logo')
|
||||
%div.col-lg-6.no-padding#tps-title
|
||||
.col-lg-6.no-padding#tps-title
|
||||
TPS
|
||||
|
||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.no-padding
|
||||
%div#navbar-body
|
||||
%div.row
|
||||
.col-xs-10.no-padding
|
||||
#navbar-body
|
||||
.row
|
||||
-begin
|
||||
= render partial: @navbar_url
|
||||
-rescue
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
%div#first-block
|
||||
%div.infos
|
||||
#first-block
|
||||
.infos
|
||||
#dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
|
||||
|
||||
%div#action-block
|
||||
#action-block
|
||||
- if gestionnaire_signed_in?
|
||||
- if !@facade.dossier.read_only?
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
|
||||
%button.action{'data-toggle' => :tooltip, title: 'En cliquant ici, vous figez le dossier et autorisez le dépôt du dossier pour instruction.'}
|
||||
= 'Déclarer complet'.upcase
|
||||
- elsif @facade.dossier.submitted?
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :receive, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
|
||||
%button.action
|
||||
= 'Accuser réception'.upcase
|
||||
- if !@facade.dossier.read_only? || @facade.dossier.initiated?
|
||||
= link_to 'Passer en instruction', backoffice_dossier_receive_path(@facade.dossier), method: :post, class: 'btn btn-danger btn-block'
|
||||
|
||||
- elsif @facade.dossier.received?
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do
|
||||
%button.action.close-dossier
|
||||
|
@ -22,19 +17,26 @@
|
|||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do
|
||||
%button.action.refuse-dossier
|
||||
%i.fa.fa-times
|
||||
= link_to 'Reouvrir', backoffice_dossier_reopen_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
||||
|
||||
- unless @facade.dossier.archived?
|
||||
= link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
||||
%hr
|
||||
- if @facade.dossier.archived?
|
||||
%p
|
||||
Archivé
|
||||
= link_to 'Désarchiver', unarchive_backoffice_dossier_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
||||
|
||||
- else
|
||||
= link_to 'Archiver', archive_backoffice_dossier_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
||||
|
||||
|
||||
|
||||
%div#menu-block
|
||||
#menu-block
|
||||
|
||||
%div#infos-block
|
||||
%div.split-hr-left
|
||||
%div.dossier-state= @facade.dossier.display_state
|
||||
%div.split-hr-left
|
||||
%div.notifications
|
||||
#infos-block
|
||||
.split-hr-left
|
||||
.dossier-state= @facade.dossier.display_state
|
||||
.split-hr-left
|
||||
.notifications
|
||||
- if @facade.dossier.notifications.empty?
|
||||
Aucune notification pour le moment.
|
||||
- else
|
||||
|
|
|
@ -23,21 +23,15 @@
|
|||
.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, 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, id: 'en_instruction' }
|
||||
="En examen"
|
||||
="En instruction"
|
||||
.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, id: 'termine' }
|
||||
= "Cloturé"
|
||||
= "Terminé"
|
||||
.badge.progress-bar-success
|
||||
= @dossiers_list_facade.termine_total
|
||||
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
%div.infos
|
||||
%div= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
|
||||
|
||||
%div#action-block
|
||||
- if @facade.dossier.validated? && @facade.dossier.user == current_user
|
||||
= form_tag(url_for({controller: 'users/recapitulatif', action: :submit, dossier_id: @facade.dossier.id}), method: 'POST') do
|
||||
%button#validate_button.action= 'Procéder au dépôt définitif'
|
||||
|
||||
%div#menu-block
|
||||
|
||||
%div#infos-block
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
%div.col-lg-8.col-md-8.col-sm-8.col-xs-8.main-info
|
||||
.col-xs-7.main-info
|
||||
|
||||
%div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options
|
||||
.col-xs-3.options
|
||||
%div{ style: "decorate:none; display: flex;box-shadow:none; float:right; display: flex; margin-top: 5px" }
|
||||
%div{ style: "vertical-align: middle; margin-right: 10px; margin-top: auto; margin-bottom: auto;" }
|
||||
= current_administrateur.email
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%div.col-lg-8.col-md-8.col-sm-8.col-xs-8.main-info
|
||||
.col-xs-7.main-info
|
||||
= @facade_data_view.procedure_id.nil? ? "Tous les dossiers" : @facade_data_view.procedure.libelle
|
||||
%div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options
|
||||
%div.row
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
%div.col-lg-11.col-md-11.col-sm-11.col-xs-11.main-info
|
||||
.col-xs-10.main-info
|
||||
Recherche dans tous les dossiers
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
%div.col-lg-8.col-md-8.col-sm-8.col-xs-8.main-info
|
||||
.col-xs-7.main-info
|
||||
%span{ 'data-toggle' => :tooltip, "data-placement" => :bottom, title: @facade.dossier.procedure.libelle }
|
||||
= @facade.dossier.procedure.libelle
|
||||
%div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options
|
||||
%div.row
|
||||
%div.col-lg-12.col-md-12.col-sm-12.col-xs-12
|
||||
.col-xs-3.options
|
||||
.row
|
||||
.col-xs-12
|
||||
- if current_gestionnaire.follow?(@facade.dossier.id)
|
||||
= link_to backoffice_dossier_follow_path(dossier_id: @facade.dossier.id), "data-method" => :put, class: "button-navbar-action",id: "suivre_dossier_#{@facade.dossier.id}" do
|
||||
%i.fa.fa-user-times
|
||||
|
@ -12,14 +12,14 @@
|
|||
= link_to backoffice_dossier_follow_path(dossier_id: @facade.dossier.id), 'data-method' => :put, class: 'button-navbar-action', id: "suivre_dossier_#{@facade.dossier.id}" do
|
||||
%i.fa.fa-user-plus
|
||||
Suivre le dossier
|
||||
%div.row
|
||||
%div.col-lg-12.col-md-12.col-sm-12.col-xs-12
|
||||
%div#invitations.dropdown-toggle{ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false }
|
||||
.row
|
||||
.col-xs-12
|
||||
#invitations.dropdown-toggle{ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false }
|
||||
%i.fa.fa-user
|
||||
= t('utils.involved')
|
||||
.badge.progress-bar-info
|
||||
= @facade.dossier.invites.count
|
||||
%div.dropdown-menu.dropdown-menu-right.dropdown-pannel
|
||||
.dropdown-menu.dropdown-menu-right.dropdown-pannel
|
||||
%h4= t('dynamics.dossiers.followers.title')
|
||||
%ul
|
||||
- unless @facade.followers.empty?
|
||||
|
|
|
@ -1 +1 @@
|
|||
.col-lg-11.col-md-11.col-sm-11.col-xs-11
|
||||
.col-xs-10
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
-#%span.fa.fa-sign-out
|
||||
|
||||
-if user_signed_in?
|
||||
.col-lg-1.col-md-1.col-sm-1.col-xs-1#sign_out.no-padding
|
||||
#sign_out.col-xs-2.no-padding
|
||||
= render partial: 'users/login_banner'
|
||||
= render partial: 'layouts/credentials'
|
||||
-elsif gestionnaire_signed_in?
|
||||
.col-lg-1.col-md-1.col-sm-1.col-xs-1#sign_out.no-padding
|
||||
#sign_out.col-xs-2.no-padding
|
||||
= render partial: 'gestionnaires/login_banner'
|
||||
= render partial: 'layouts/credentials'
|
||||
-elsif administrateur_signed_in?
|
||||
.col-lg-1.col-md-1.col-sm-1.col-xs-1#sign_out.no-padding
|
||||
#sign_out.col-xs-2.no-padding
|
||||
= render partial: 'administrateurs/login_banner'
|
||||
= render partial: 'layouts/credentials'
|
||||
-else
|
||||
.col-lg-1.col-md-1.col-sm-1.col-xs-1#sign_in
|
||||
= link_to "Connexion", '/users/sign_in', :class => 'btn btn-lg'
|
||||
#sign_in.col-xs-2
|
||||
= link_to "Connexion", new_user_session_path, :class => 'btn btn-lg btn-primary'
|
|
@ -1,4 +1,4 @@
|
|||
%div.col-lg-8.col-md-8.col-sm-8.col-xs-8.main-info
|
||||
.col-xs-7.main-info
|
||||
%span{ 'data-toggle' => :tooltip, "data-placement" => :bottom, title: @facade.dossier.procedure.libelle }
|
||||
= @facade.dossier.procedure.libelle.truncate(60)
|
||||
%div.col-lg-3.col-md-3.col-sm-3.col-xs-3.options
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
<%= @dossier.procedure.mail_validated.body_for_dossier(@dossier).html_safe %>
|
|
@ -1,18 +1,20 @@
|
|||
#landing.max-size
|
||||
#title
|
||||
.center
|
||||
= image_tag 'logos/logo-tps.png', id: 'logo-tps'
|
||||
%h1.center
|
||||
%img#logo-tps{src: image_url('logos/logo-tps.png')}
|
||||
%h2.center
|
||||
TéléProcédure Simplifiée
|
||||
|
||||
%h3.center
|
||||
Plateforme publique pour réaliser des démarches administratives 100% en ligne.
|
||||
.row
|
||||
.col-md-8.col-md-push-2.center
|
||||
%h3
|
||||
Dématérialisez n'importe quelle démarche administrative en quelques minutes,
|
||||
avec un outil
|
||||
%strong
|
||||
gratuit, simple, collaboratif et sûr
|
||||
|
||||
%br
|
||||
%br
|
||||
.center
|
||||
%button.background-tps.js-scrollTo.btn.btn-lg{cible: '.demo_account'}
|
||||
Envie d'essayer ?
|
||||
%p.mt-1 Vous êtes intéressés ?
|
||||
%p= link_to 'Programmer une démo', "mailto:#{t('dynamics.contact_email')}?subject=Demande de démo TPS", target: '_blank', class: 'btn btn-danger btn-lg'
|
||||
|
||||
#landing_body.max-size
|
||||
.row#etapes.center
|
||||
|
@ -55,8 +57,7 @@
|
|||
%h3.text-success Usagers
|
||||
%h4 Profitez de démarches simplifiées et d’échanges continus avec les services traitants.
|
||||
=link_to 'Démonstration', "#{@demo_environment_host}/users/sign_in/demo", {class: 'btn btn-lg btn-success'}
|
||||
%h1
|
||||
= @demo_environment_host
|
||||
|
||||
.split-hr-left
|
||||
|
||||
.center
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
= @dossier.procedure.libelle
|
||||
|
||||
-#TODO use form_for
|
||||
= form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form', method: 'POST', multipart: true) do
|
||||
= form_tag(url_for({controller: 'users/description', action: :update, dossier_id: @dossier.id}), class: 'form', method: 'POST', multipart: true) do
|
||||
-unless @champs.nil?
|
||||
#liste_champs
|
||||
=render partial: 'users/description/champs', locals:{private: false}
|
||||
|
@ -41,16 +41,16 @@
|
|||
Vous pourrez dans tous les cas les compléter plus tard si vous ne les possédez pas de suite.
|
||||
|
||||
|
||||
-route = Rails.application.routes.recognize_path(request.referrer)
|
||||
-route = Rails.application.routes.recognize_path(request.referrer) # WTF ?
|
||||
- unless route[:controller].match('admin')
|
||||
%div{style: 'text-align:right'}
|
||||
%h6 Tous les champs portant un * sont obligatoires.
|
||||
|
||||
-if !@dossier.draft?
|
||||
=render partial: '/layouts/modifications_terminees'
|
||||
-else
|
||||
= submit_tag 'Soumettre mon dossier', id: 'suivant', name: 'submit[nouveaux]', class: %w(btn btn btn-success), style: 'float:right', data: { disable_with: 'Soumettre votre dossier', submit: true}
|
||||
= submit_tag 'Enregistrer un brouillon', id: 'brouillon', name: 'submit[brouillon]', class: %w(btn btn-xs btn-default), style: 'float:right; margin-right: 10px; margin-top: 6px', data: {disable_with: 'Enregistrer un brouillon', submit: true}
|
||||
|
||||
%br
|
||||
%br
|
||||
- if !@dossier.can_be_initiated?
|
||||
.alert.alert-danger
|
||||
= t('errors.messages.procedure_archived')
|
||||
- elsif !@dossier.draft?
|
||||
= render partial: '/layouts/modifications_terminees'
|
||||
- else
|
||||
= submit_tag 'Soumettre mon dossier', id: 'suivant', name: 'submit[nouveaux]', class: 'btn btn btn-success', style: 'float:right', disabled: @procedure.archived?, data: { disable_with: 'Soumettre votre dossier', submit: true}
|
||||
= submit_tag 'Enregistrer un brouillon', id: 'brouillon', name: 'submit[brouillon]', class: 'btn btn-xs btn-default', style: 'float:right; margin-right: 10px; margin-top: 6px', disabled: @procedure.archived?, data: {disable_with: 'Enregistrer un brouillon', submit: true}
|
||||
|
|
3
circle.yml
Normal file
3
circle.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
database:
|
||||
override:
|
||||
- bundle exec rake db:drop db:create db:migrate RAILS_ENV=test
|
|
@ -10,12 +10,7 @@ development:
|
|||
|
||||
|
||||
test:
|
||||
adapter: postgresql
|
||||
encoding: unicode
|
||||
database: tps_test<%= ENV['TEST_ENV_NUMBER'] %>
|
||||
host: localhost
|
||||
adapter: sqlite3
|
||||
pool: 5
|
||||
username: tps
|
||||
password: lol
|
||||
|
||||
|
||||
timeout: 5000
|
||||
database: db/test<%= ENV['TEST_ENV_NUMBER'] %>.sqlite3
|
||||
|
|
|
@ -87,7 +87,6 @@ set :shared_paths, [
|
|||
'config/france_connect.yml',
|
||||
'config/initializers/mailjet.rb',
|
||||
'config/initializers/storage_url.rb',
|
||||
'app/views/root/landing.html.haml',
|
||||
'app/views/layouts/_google_analytics.html',
|
||||
'app/views/cgu/index.html.haml'
|
||||
]
|
||||
|
|
|
@ -1,2 +1,14 @@
|
|||
file_path = "#{Rails.root}/config/france_connect.yml"
|
||||
FRANCE_CONNECT = Hashie::Mash.load(file_path)
|
||||
FRANCE_CONNECT = if !Rails.env.test?
|
||||
file_path = "#{Rails.root}/config/france_connect.yml"
|
||||
Hashie::Mash.load(file_path)
|
||||
else
|
||||
Hashie::Mash.new({
|
||||
particulier_identifier: 'plop',
|
||||
particulier_secret: 'plip',
|
||||
particulier_redirect_uri: 'https://bidon.com/endpoint',
|
||||
particulier_authorization_endpoint: 'https://bidon.com/endpoint',
|
||||
particulier_token_endpoint: 'https://bidon.com/endpoint',
|
||||
particulier_userinfo_endpoint: 'https://bidon.com/endpoint',
|
||||
particulier_logout_endpoint: 'https://bidon.com/endpoint',
|
||||
})
|
||||
end
|
||||
|
|
|
@ -147,6 +147,7 @@ fr:
|
|||
france_connect:
|
||||
connexion: "Erreur lors de la connexion à France Connect."
|
||||
extension_white_list_error: "Le format de fichier de la pièce jointe n'est pas valide."
|
||||
procedure_archived: "Cette démarche en ligne a été fermée, il n'est plus possible de déposer de dossier."
|
||||
|
||||
datetime:
|
||||
distance_in_words:
|
||||
|
|
|
@ -9,11 +9,9 @@ fr:
|
|||
date_previsionnelle: "La date de début prévisionnelle"
|
||||
state:
|
||||
draft: "Brouillon"
|
||||
initiated: "Nouveau"
|
||||
initiated: "En construction"
|
||||
replied: "En construction"
|
||||
updated: "En construction"
|
||||
validated: "Figé"
|
||||
submitted: "Déposé / À réceptionner"
|
||||
received: "En instruction"
|
||||
closed: "Accepté"
|
||||
refused: "Refusé"
|
||||
|
|
|
@ -63,15 +63,13 @@ Rails.application.routes.draw do
|
|||
resources :dossiers do
|
||||
get '/add_siret' => 'dossiers/add_siret#show'
|
||||
|
||||
get '/description' => 'description#show'
|
||||
# get '/description/error' => 'description#error'
|
||||
post 'description' => 'description#create'
|
||||
get 'description' => 'description#show'
|
||||
post 'description' => 'description#update'
|
||||
|
||||
patch 'pieces_justificatives' => 'description#pieces_justificatives'
|
||||
|
||||
get '/recapitulatif' => 'recapitulatif#show'
|
||||
post '/recapitulatif/initiate' => 'recapitulatif#initiate'
|
||||
post '/recapitulatif/submit' => 'recapitulatif#submit'
|
||||
|
||||
post '/commentaire' => 'commentaires#create'
|
||||
resources :commentaires, only: [:index]
|
||||
|
@ -159,18 +157,19 @@ Rails.application.routes.draw do
|
|||
resource :private_formulaire
|
||||
|
||||
resources :dossiers do
|
||||
post 'valid' => 'dossiers#valid'
|
||||
post 'receive' => 'dossiers#receive'
|
||||
post 'refuse' => 'dossiers#refuse'
|
||||
post 'without_continuation' => 'dossiers#without_continuation'
|
||||
post 'close' => 'dossiers#close'
|
||||
post 'archive' => 'dossiers#archive'
|
||||
|
||||
member do
|
||||
post 'archive'
|
||||
post 'unarchive'
|
||||
end
|
||||
post 'reopen' => 'dossiers#reopen'
|
||||
put 'follow' => 'dossiers#follow'
|
||||
resources :commentaires, only: [:index]
|
||||
end
|
||||
|
||||
|
||||
namespace :dossiers do
|
||||
post 'filter'
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ class DeviseCreateUsers < ActiveRecord::Migration
|
|||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.inet :current_sign_in_ip
|
||||
t.inet :last_sign_in_ip
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
|
|
|
@ -16,8 +16,8 @@ class DeviseCreatePros < ActiveRecord::Migration
|
|||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.inet :current_sign_in_ip
|
||||
t.inet :last_sign_in_ip
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
|
|
|
@ -16,8 +16,8 @@ class DeviseCreateGestionnaires < ActiveRecord::Migration
|
|||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.inet :current_sign_in_ip
|
||||
t.inet :last_sign_in_ip
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
|
|
|
@ -16,8 +16,8 @@ class CreateUsers < ActiveRecord::Migration
|
|||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.inet :current_sign_in_ip
|
||||
t.inet :last_sign_in_ip
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
|
|
|
@ -16,8 +16,8 @@ class DeviseCreateAdministrateurs < ActiveRecord::Migration
|
|||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.inet :current_sign_in_ip
|
||||
t.inet :last_sign_in_ip
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
class ChangeDateCreationTypeToEntreprise < ActiveRecord::Migration
|
||||
def up
|
||||
if Rails.env.test?
|
||||
change_column :entreprises, :date_creation, "timestamp"
|
||||
else
|
||||
change_column :entreprises, :date_creation, "timestamp USING to_timestamp(date_creation) at time zone 'UTC-2'"
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :entreprises, :date_creation, "integer USING extract(epoch from date_creation::timestamp with time zone)::integer"
|
||||
|
|
|
@ -16,8 +16,8 @@ class DeviseCreateAdministrations < ActiveRecord::Migration
|
|||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.inet :current_sign_in_ip
|
||||
t.inet :last_sign_in_ip
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
|
|
|
@ -4,14 +4,14 @@ class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
def up
|
||||
TypeDeChamp.where("private = false").update_all("type = 'TypeDeChampPublic'")
|
||||
TypeDeChamp.where("private = true").update_all("type = 'TypeDeChampPrivate'")
|
||||
TypeDeChamp.where(private: false).update_all("type = 'TypeDeChampPublic'")
|
||||
TypeDeChamp.where(private: true).update_all("type = 'TypeDeChampPrivate'")
|
||||
remove_column :types_de_champ, :private
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :types_de_champ, :private, :boolean, default: true
|
||||
TypeDeChamp.where("type = 'TypeDeChampPublic'").update_all("private = false")
|
||||
TypeDeChamp.where("type = 'TypeDeChampPrivate'").update_all("private = true")
|
||||
TypeDeChamp.where("type = 'TypeDeChampPublic'").update_all(private: false)
|
||||
TypeDeChamp.where("type = 'TypeDeChampPrivate'").update_all(private: true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class CreateSearches < ActiveRecord::Migration
|
|||
add_index :individuals, :dossier_id
|
||||
add_index :pieces_justificatives, :dossier_id
|
||||
add_index :rna_informations, :entreprise_id
|
||||
create_view :searches #, materialized: true
|
||||
create_view :searches unless Rails.env.test? #, materialized: true
|
||||
end
|
||||
|
||||
def down
|
||||
|
@ -22,6 +22,6 @@ class CreateSearches < ActiveRecord::Migration
|
|||
remove_index :individuals, :dossier_id
|
||||
remove_index :pieces_justificatives, :dossier_id
|
||||
remove_index :rna_informations, :entreprise_id
|
||||
drop_view :searches #, materialized: true
|
||||
drop_view :searches unless Rails.env.test? #, materialized: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
class UpdateSearchesToVersion2 < ActiveRecord::Migration
|
||||
def up
|
||||
replace_view :searches, version: 2
|
||||
replace_view :searches, version: 2 unless Rails.env.test?
|
||||
end
|
||||
|
||||
def down
|
||||
replace_view :searches, version: 1
|
||||
replace_view :searches, version: 1 unless Rails.env.test?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
class InitMailValidatedForAllProcedure < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
Procedure.all.each do |p|
|
||||
unless p.mail_validated
|
||||
p.mail_templates << MailValidated.create
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveUselessDossierStates < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
Dossier.where(state: [:validated, :submitted]).update_all(state: :initiated)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class DeleteAllMailValidatedInDb < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
MailTemplate.where(type: "MailValidated").delete_all
|
||||
end
|
||||
end
|
7
db/migrate/20170228144909_add_state_dates_to_dossiers.rb
Normal file
7
db/migrate/20170228144909_add_state_dates_to_dossiers.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class AddStateDatesToDossiers < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :dossiers, :initiated_at, :datetime
|
||||
add_column :dossiers, :received_at, :datetime
|
||||
add_column :dossiers, :processed_at, :datetime
|
||||
end
|
||||
end
|
29
db/migrate/20170228150522_move_inet_column_to_string.rb
Normal file
29
db/migrate/20170228150522_move_inet_column_to_string.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
class MoveInetColumnToString < ActiveRecord::Migration[5.0]
|
||||
def up
|
||||
change_column :users, :last_sign_in_ip, 'string'
|
||||
change_column :users, :current_sign_in_ip, 'string'
|
||||
|
||||
change_column :gestionnaires, :last_sign_in_ip, 'string'
|
||||
change_column :gestionnaires, :current_sign_in_ip, 'string'
|
||||
|
||||
change_column :administrateurs, :last_sign_in_ip, 'string'
|
||||
change_column :administrateurs, :current_sign_in_ip, 'string'
|
||||
|
||||
change_column :administrations, :last_sign_in_ip, 'string'
|
||||
change_column :administrations, :current_sign_in_ip, 'string'
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :users, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
|
||||
change_column :users, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
|
||||
|
||||
change_column :gestionnaires, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
|
||||
change_column :gestionnaires, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
|
||||
|
||||
change_column :administrateurs, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
|
||||
change_column :administrateurs, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
|
||||
|
||||
change_column :administrations, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
|
||||
change_column :administrations, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class RemoveDepositDatetimeFromDossiers < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
Dossier.where.not(deposit_datetime: nil).each do |dossier|
|
||||
dossier.update(initiated_at: dossier.deposit_datetime)
|
||||
end
|
||||
remove_column :dossiers, :deposit_datetime, :datetime
|
||||
end
|
||||
end
|
22
db/schema.rb
22
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170215142944) do
|
||||
ActiveRecord::Schema.define(version: 20170302112312) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -24,8 +24,8 @@ ActiveRecord::Schema.define(version: 20170215142944) do
|
|||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.inet "current_sign_in_ip"
|
||||
t.inet "last_sign_in_ip"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "api_token"
|
||||
|
@ -50,8 +50,8 @@ ActiveRecord::Schema.define(version: 20170215142944) do
|
|||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.inet "current_sign_in_ip"
|
||||
t.inet "last_sign_in_ip"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["email"], name: "index_administrations_on_email", unique: true, using: :btree
|
||||
|
@ -126,7 +126,9 @@ ActiveRecord::Schema.define(version: 20170215142944) do
|
|||
t.text "json_latlngs"
|
||||
t.boolean "archived", default: false
|
||||
t.boolean "mandataire_social", default: false
|
||||
t.datetime "deposit_datetime"
|
||||
t.datetime "initiated_at"
|
||||
t.datetime "received_at"
|
||||
t.datetime "processed_at"
|
||||
t.index ["procedure_id"], name: "index_dossiers_on_procedure_id", using: :btree
|
||||
t.index ["user_id"], name: "index_dossiers_on_user_id", using: :btree
|
||||
end
|
||||
|
@ -207,8 +209,8 @@ ActiveRecord::Schema.define(version: 20170215142944) do
|
|||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.inet "current_sign_in_ip"
|
||||
t.inet "last_sign_in_ip"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "procedure_filter"
|
||||
|
@ -375,8 +377,8 @@ ActiveRecord::Schema.define(version: 20170215142944) do
|
|||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.inet "current_sign_in_ip"
|
||||
t.inet "last_sign_in_ip"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "siret"
|
||||
|
|
|
@ -52,7 +52,9 @@ describe API::V1::DossiersController do
|
|||
describe 'dossier' do
|
||||
subject { super().first }
|
||||
it { expect(subject[:id]).to eq(dossier.id) }
|
||||
if ENV['PG'] == 'true'
|
||||
it { expect(subject[:updated_at]).to eq("2008-09-01T08:05:00.000Z") }
|
||||
end
|
||||
it { expect(subject.keys.size).to eq(2) }
|
||||
end
|
||||
end
|
||||
|
@ -124,8 +126,10 @@ describe API::V1::DossiersController do
|
|||
|
||||
it { expect(subject[:id]).to eq(dossier.id) }
|
||||
it { expect(subject[:state]).to eq(dossier.state) }
|
||||
if ENV['PG'] == 'true'
|
||||
it { expect(subject[:created_at]).to eq('2008-09-01T08:05:00.000Z') }
|
||||
it { expect(subject[:updated_at]).to eq('2008-09-01T08:05:00.000Z') }
|
||||
end
|
||||
it { expect(subject[:archived]).to eq(dossier.archived) }
|
||||
it { expect(subject[:mandataire_social]).to eq(dossier.mandataire_social) }
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ require 'spec_helper'
|
|||
describe Backoffice::Dossiers::ProcedureController, type: :controller do
|
||||
let(:gestionnaire) { create :gestionnaire }
|
||||
let(:procedure) { create :procedure }
|
||||
let(:archived) { false }
|
||||
let(:dossier) { create :dossier, procedure: procedure, archived: archived, state: 'initiated'}
|
||||
|
||||
before do
|
||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
||||
|
@ -28,6 +30,24 @@ describe Backoffice::Dossiers::ProcedureController, type: :controller do
|
|||
it { is_expected.to redirect_to backoffice_dossiers_path }
|
||||
it { expect(flash[:alert]).to be_present}
|
||||
end
|
||||
|
||||
context 'when procedure contains a dossier' do
|
||||
render_views
|
||||
|
||||
before do
|
||||
dossier
|
||||
subject
|
||||
end
|
||||
|
||||
it { expect(response.body).to have_content('Tous les dossiers 1 dossier') }
|
||||
|
||||
context 'archived' do
|
||||
let(:archived) { true }
|
||||
|
||||
it { expect(response.body).to have_content('Tous les dossiers 0 dossiers') }
|
||||
it { expect(response.body).to have_content('Dossiers archivés 1 dossier') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #filter' do
|
||||
|
|
|
@ -104,12 +104,6 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
context ' when dossier is archived' do
|
||||
let(:dossier_id) { dossier_archived }
|
||||
|
||||
it { expect(subject).to redirect_to('/backoffice') }
|
||||
end
|
||||
|
||||
context 'when dossier id does not exist' do
|
||||
let(:dossier_id) { bad_dossier_id }
|
||||
|
||||
|
@ -174,6 +168,8 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
if ENV['PG'] == 'true'
|
||||
describe 'POST #search' do
|
||||
describe 'by id' do
|
||||
context 'when I am logged as a gestionnaire' do
|
||||
|
@ -212,35 +208,11 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #valid' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :valid, params: {dossier_id: dossier_id} }
|
||||
|
||||
it 'change state to validated' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('validated')
|
||||
end
|
||||
|
||||
it 'Notification email is send' do
|
||||
expect(NotificationMailer).to receive(:dossier_validated).and_return(NotificationMailer)
|
||||
expect(NotificationMailer).to receive(:deliver_now!)
|
||||
|
||||
subject
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier.id) }
|
||||
end
|
||||
|
||||
describe 'POST #receive' do
|
||||
before do
|
||||
dossier.submitted!
|
||||
dossier.initiated!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
|
@ -382,6 +354,23 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'POST #reopen' do
|
||||
before do
|
||||
dossier.received!
|
||||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :reopen, params: {dossier_id: dossier_id} }
|
||||
|
||||
it 'change state to replied' do
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('replied')
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to backoffice_dossiers_path }
|
||||
end
|
||||
|
||||
describe 'POST #archive' do
|
||||
before do
|
||||
|
@ -389,7 +378,7 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :archive, params: {dossier_id: dossier_id} }
|
||||
subject { post :archive, params: {id: dossier_id} }
|
||||
|
||||
it 'change state to archived' do
|
||||
subject
|
||||
|
|
|
@ -4,7 +4,7 @@ shared_examples 'carte_controller_spec' do
|
|||
context 'when dossier’s procedure have api carto actived' do
|
||||
context 'when dossier does not have a valid state' do
|
||||
before do
|
||||
dossier.state = 'validated'
|
||||
dossier.state = 'received'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {dossier_id: dossier.id}
|
||||
|
@ -164,7 +164,7 @@ shared_examples 'carte_controller_spec' do
|
|||
subject { Cadastre.last }
|
||||
|
||||
it { expect(subject.surface_intersection).to eq('0.0006') }
|
||||
it { expect(subject.surface_parcelle).to eq(11252.6925830903) }
|
||||
it { expect(subject.surface_parcelle).to eq(11252.692583090324) }
|
||||
it { expect(subject.numero).to eq('0013') }
|
||||
it { expect(subject.feuille).to eq(1) }
|
||||
it { expect(subject.section).to eq('CD') }
|
||||
|
|
|
@ -17,12 +17,27 @@ shared_examples 'description_controller_spec' do
|
|||
context 'when all is ok' do
|
||||
before do
|
||||
dossier.entreprise = create :entreprise
|
||||
get :show, params: {dossier_id: dossier_id}
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :show, params: {dossier_id: dossier_id}
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
context 'procedure is archived' do
|
||||
render_views
|
||||
let(:archived) { true }
|
||||
|
||||
it { expect(response).to have_http_status(:success) }
|
||||
it { expect(response.body).to_not have_content(I18n.t('errors.messages.procedure_archived')) }
|
||||
|
||||
context 'dossier is a draft' do
|
||||
let(:state) { 'draft' }
|
||||
|
||||
it { expect(response).to have_http_status(:success) }
|
||||
it { expect(response.body).to have_content(I18n.t('errors.messages.procedure_archived')) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'redirection vers start si mauvais dossier ID' do
|
||||
|
@ -37,7 +52,7 @@ shared_examples 'description_controller_spec' do
|
|||
describe 'before_action authorized_routes?' do
|
||||
context 'when dossier does not have a valid state' do
|
||||
before do
|
||||
dossier.state = 'validated'
|
||||
dossier.state = 'received'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {dossier_id: dossier.id}
|
||||
|
@ -90,7 +105,7 @@ shared_examples 'description_controller_spec' do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
describe 'POST #update' do
|
||||
let(:timestamp) { Time.now }
|
||||
let(:description) { 'Description de test Coucou, je suis un saut à la ligne Je suis un double saut la ligne.' }
|
||||
|
||||
|
@ -98,7 +113,7 @@ shared_examples 'description_controller_spec' do
|
|||
describe 'Premier enregistrement des données' do
|
||||
let(:submit) { {nouveaux: 'nouveaux'} }
|
||||
|
||||
subject { post :create, params: {dossier_id: dossier_id, submit: submit} }
|
||||
subject { post :update, params: {dossier_id: dossier_id, submit: submit} }
|
||||
|
||||
before do
|
||||
dossier.draft!
|
||||
|
@ -130,7 +145,7 @@ shared_examples 'description_controller_spec' do
|
|||
context 'En train de manipuler un dossier non brouillon' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
post :create, params: {dossier_id: dossier_id}
|
||||
post :update, params: {dossier_id: dossier_id}
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
|
@ -145,7 +160,7 @@ shared_examples 'description_controller_spec' do
|
|||
end
|
||||
|
||||
context 'Quand la procédure accepte les CERFA' do
|
||||
subject { post :create, params: {dossier_id: dossier_id,
|
||||
subject { post :update, params: {dossier_id: dossier_id,
|
||||
cerfa_pdf: cerfa_pdf} }
|
||||
|
||||
it 'Notification interne is create' do
|
||||
|
@ -154,7 +169,7 @@ shared_examples 'description_controller_spec' do
|
|||
|
||||
context 'Sauvegarde du CERFA PDF', vcr: {cassette_name: 'controllers_users_description_controller_save_cerfa'} do
|
||||
before do
|
||||
post :create, params: {dossier_id: dossier_id,
|
||||
post :update, params: {dossier_id: dossier_id,
|
||||
cerfa_pdf: cerfa_pdf}
|
||||
dossier.reload
|
||||
end
|
||||
|
@ -181,7 +196,7 @@ shared_examples 'description_controller_spec' do
|
|||
let(:cerfas) { Cerfa.where(dossier_id: dossier_id) }
|
||||
|
||||
before do
|
||||
post :create, params: {dossier_id: dossier_id, cerfa_pdf: cerfa_pdf}
|
||||
post :update, params: {dossier_id: dossier_id, cerfa_pdf: cerfa_pdf}
|
||||
end
|
||||
|
||||
it "il y a deux CERFA PDF pour ce dossier" do
|
||||
|
@ -195,7 +210,7 @@ shared_examples 'description_controller_spec' do
|
|||
context 'Sauvegarde du CERFA PDF' do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
before do
|
||||
post :create, params: {dossier_id: dossier_id,
|
||||
post :update, params: {dossier_id: dossier_id,
|
||||
cerfa_pdf: cerfa_pdf}
|
||||
dossier.reload
|
||||
end
|
||||
|
@ -214,7 +229,7 @@ shared_examples 'description_controller_spec' do
|
|||
let(:dossier_minute_value) { '00' }
|
||||
|
||||
before do
|
||||
post :create, params: {dossier_id: dossier_id,
|
||||
post :update, params: {dossier_id: dossier_id,
|
||||
champs: {
|
||||
"'#{dossier.champs.first.id}'" => dossier_champs_first,
|
||||
"'#{dossier.champs.second.id}'" => dossier_date_value
|
||||
|
@ -254,7 +269,7 @@ shared_examples 'description_controller_spec' do
|
|||
context 'Sauvegarde des pièces justificatives', vcr: {cassette_name: 'controllers_users_description_controller_sauvegarde_pj'} do
|
||||
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
|
||||
before do
|
||||
post :create, params: {dossier_id: dossier_id,
|
||||
post :update, params: {dossier_id: dossier_id,
|
||||
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
|
||||
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
|
||||
dossier.reload
|
||||
|
@ -264,7 +279,7 @@ shared_examples 'description_controller_spec' do
|
|||
it 'ClamavService safe_file? is call' do
|
||||
expect(ClamavService).to receive(:safe_file?).twice
|
||||
|
||||
post :create, params: {dossier_id: dossier_id,
|
||||
post :update, params: {dossier_id: dossier_id,
|
||||
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
|
||||
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
|
||||
end
|
||||
|
@ -281,6 +296,22 @@ shared_examples 'description_controller_spec' do
|
|||
it { expect(subject.user).to eq user }
|
||||
end
|
||||
end
|
||||
|
||||
context 'La procédure est archivée' do
|
||||
let(:archived) { true }
|
||||
|
||||
before do
|
||||
post :update, params: { dossier_id: dossier.id }
|
||||
end
|
||||
|
||||
it { expect(response.status).to eq(302) }
|
||||
|
||||
context 'Le dossier est en brouillon' do
|
||||
let(:state) { 'draft' }
|
||||
|
||||
it { expect(response.status).to eq(403) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #pieces_justificatives', vcr: {cassette_name: 'controllers_users_description_controller_pieces_justificatives'} do
|
||||
|
|
|
@ -5,9 +5,11 @@ require 'controllers/users/description_controller_shared_example'
|
|||
describe Users::DescriptionController, type: :controller, vcr: {cassette_name: 'controllers_users_description_controller'} do
|
||||
let(:owner_user) { create(:user) }
|
||||
let(:invite_by_user) { create :user, email: 'invite@plop.com' }
|
||||
let(:archived) { false }
|
||||
let(:state) { 'initiated' }
|
||||
|
||||
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_datetime, cerfa_flag: true) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure, user: owner_user, state: 'initiated') }
|
||||
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_datetime, cerfa_flag: true, archived: archived) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure, user: owner_user, state: state) }
|
||||
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:bad_dossier_id) { Dossier.count + 10000 }
|
||||
|
|
|
@ -39,7 +39,7 @@ describe Users::DossiersController, type: :controller do
|
|||
describe 'before_action authorized_routes?' do
|
||||
context 'when dossier does not have a valid state' do
|
||||
before do
|
||||
dossier.state = 'validated'
|
||||
dossier.state = 'received'
|
||||
dossier.save
|
||||
|
||||
get :show, params: {id: dossier.id}
|
||||
|
@ -307,13 +307,17 @@ describe Users::DossiersController, type: :controller do
|
|||
|
||||
describe "with siret without whitespaces" do
|
||||
let(:example_siret) { siret }
|
||||
if ENV['CIRCLECI'].nil?
|
||||
it_should_behave_like "with valid siret"
|
||||
end
|
||||
end
|
||||
|
||||
describe "with siret with whitespaces" do
|
||||
let(:example_siret) { siret_with_whitespaces }
|
||||
if ENV['CIRCLECI'].nil?
|
||||
it_should_behave_like "with valid siret"
|
||||
end
|
||||
end
|
||||
|
||||
context 'with non existant siret' do
|
||||
before do
|
||||
|
@ -485,19 +489,6 @@ describe Users::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'GET #valides' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :index, params: {liste: :valides}
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #en_instruction' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
|
|
|
@ -52,40 +52,4 @@ describe Users::RecapitulatifController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #submit' do
|
||||
context 'when an user depose his dossier' do
|
||||
let(:deposit_datetime) { Time.local(2016, 8, 1, 10, 5, 0) }
|
||||
|
||||
before do
|
||||
dossier.validated!
|
||||
Timecop.freeze(deposit_datetime) { post :submit, params: {dossier_id: dossier.id} }
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it 'dossier change his state for submitted' do
|
||||
expect(dossier.state).to eq('submitted')
|
||||
end
|
||||
|
||||
it 'dossier deposit datetime is filled' do
|
||||
expect(dossier.deposit_datetime).to eq deposit_datetime
|
||||
end
|
||||
|
||||
it 'a message informe user what his dossier is initiated' do
|
||||
expect(flash[:notice]).to include('Dossier déposé avec succès.')
|
||||
end
|
||||
|
||||
it 'Notification email is send' do
|
||||
expect(NotificationMailer).to receive(:dossier_submitted).and_return(NotificationMailer)
|
||||
expect(NotificationMailer).to receive(:deliver_now!)
|
||||
|
||||
dossier.validated!
|
||||
post :submit, params: {dossier_id: dossier.id}
|
||||
end
|
||||
|
||||
it 'Internal notification is created' do
|
||||
expect(Notification.where(dossier_id: dossier.id, type_notif: 'submitted').first).not_to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ shared_examples 'current_user_dossier_spec' do
|
|||
end
|
||||
|
||||
context 'when dossier id is incorrect' do
|
||||
it { expect { subject.current_user_dossier 1 }.to raise_error ActiveRecord::RecordNotFound }
|
||||
it { expect { subject.current_user_dossier 666 }.to raise_error ActiveRecord::RecordNotFound }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ describe DossierDecorator do
|
|||
|
||||
it 'initiated is initiate' do
|
||||
dossier.initiated!
|
||||
expect(subject).to eq('Nouveau')
|
||||
expect(subject).to eq('En construction')
|
||||
end
|
||||
|
||||
it 'replied is repondu' do
|
||||
|
@ -37,16 +37,6 @@ describe DossierDecorator do
|
|||
expect(subject).to eq('En construction')
|
||||
end
|
||||
|
||||
it 'validated is valide' do
|
||||
dossier.validated!
|
||||
expect(subject).to eq('Figé')
|
||||
end
|
||||
|
||||
it 'submitted is dépose' do
|
||||
dossier.submitted!
|
||||
expect(subject).to eq('Déposé / À réceptionner')
|
||||
end
|
||||
|
||||
it 'closed is traité' do
|
||||
dossier.closed!
|
||||
expect(subject).to eq('Accepté')
|
||||
|
|
|
@ -7,10 +7,6 @@ describe MailTemplateDecorator do
|
|||
context '#name' do
|
||||
subject { decorator.name }
|
||||
|
||||
context 'when mail_template is a MailValidated' do
|
||||
it { is_expected.to eq "E-mail de validation" }
|
||||
end
|
||||
|
||||
context 'when mail_template is a MailReceived' do
|
||||
let(:mail_template) {create :mail_template, :dossier_received}
|
||||
it { is_expected.to eq "E-mail d'accusé de réception" }
|
||||
|
|
|
@ -5,10 +5,7 @@ describe AdminProceduresShowFacades do
|
|||
|
||||
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'draft') }
|
||||
let!(:dossier_1) { create(:dossier, procedure: procedure, state: 'initiated') }
|
||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'validated') }
|
||||
let!(:dossier_3) { create(:dossier, procedure: procedure, state: 'validated') }
|
||||
let!(:dossier_4) { create(:dossier, procedure: procedure, archived: true, state: 'validated') }
|
||||
let!(:dossier_5) { create(:dossier, procedure: procedure, archived: true, state: 'validated') }
|
||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'replied') }
|
||||
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'initiated') }
|
||||
let!(:dossier_7) { create(:dossier, procedure: procedure, state: 'updated') }
|
||||
|
||||
|
@ -23,37 +20,34 @@ describe AdminProceduresShowFacades do
|
|||
describe '.dossiers' do
|
||||
subject { super().dossiers }
|
||||
|
||||
it { expect(subject.size).to eq(7) }
|
||||
it { expect(subject.size).to eq(4) }
|
||||
end
|
||||
|
||||
describe '.dossiers_for_pie_highchart' do
|
||||
subject { super().dossiers_for_pie_highchart }
|
||||
|
||||
it { expect(subject).to eq({'Nouveau' => 1, 'Figé' => 2, "En construction"=>1}) }
|
||||
it { expect(subject).to eq({ 'En construction' => 3 }) }
|
||||
end
|
||||
|
||||
describe '.dossiers_archived_by_state_total' do
|
||||
subject { super().dossiers_archived_by_state_total }
|
||||
|
||||
it { expect(subject.size).to eq(2) }
|
||||
it { expect(subject.size).to eq(1) }
|
||||
|
||||
it { expect(subject.first.state).to eq('initiated') }
|
||||
it { expect(subject.first.total).to eq(1) }
|
||||
|
||||
it { expect(subject.last.state).to eq('validated') }
|
||||
it { expect(subject.last.total).to eq(2) }
|
||||
end
|
||||
|
||||
describe 'dossiers_archived_total' do
|
||||
subject { super().dossiers_archived_total }
|
||||
|
||||
it { is_expected.to eq(3) }
|
||||
it { is_expected.to eq(1) }
|
||||
end
|
||||
|
||||
describe 'dossiers_total' do
|
||||
subject { super().dossiers_total }
|
||||
|
||||
it { is_expected.to eq(7) }
|
||||
it { is_expected.to eq(4) }
|
||||
end
|
||||
|
||||
describe 'dossiers_waiting_gestionnaire_total' do
|
||||
|
@ -65,7 +59,7 @@ describe AdminProceduresShowFacades do
|
|||
describe 'dossiers_waiting_user_total' do
|
||||
subject { super().dossiers_waiting_user_total }
|
||||
|
||||
it { is_expected.to eq(2) }
|
||||
it { is_expected.to eq(1) }
|
||||
end
|
||||
|
||||
describe 'dossiers_termine_total' do
|
||||
|
|
|
@ -10,10 +10,10 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
|
|||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_1
|
||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_2
|
||||
30.times do
|
||||
Dossier.create(procedure_id: procedure_1.id.to_s, user: user, state: 'validated')
|
||||
Dossier.create(procedure_id: procedure_1.id.to_s, user: user, state: 'initiated')
|
||||
end
|
||||
22.times do
|
||||
Dossier.create(procedure_id: procedure_2.id.to_s, user: user, state: 'validated')
|
||||
Dossier.create(procedure_id: procedure_2.id.to_s, user: user, state: 'received')
|
||||
end
|
||||
login_as gestionnaire, scope: :gestionnaire
|
||||
visit backoffice_path
|
||||
|
@ -53,15 +53,15 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
|
|||
expect(page.all("#all_state_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id}")
|
||||
visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=desc"
|
||||
wait_for_ajax
|
||||
expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.last.id}")
|
||||
expect(page.all("#all_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.last.id}")
|
||||
page.find('#all_state_dossiers .next_page a').trigger('click')
|
||||
wait_for_ajax
|
||||
page.find('#all_state_dossiers .next_page a').trigger('click')
|
||||
wait_for_ajax
|
||||
expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 9}")
|
||||
expect(page.all("#all_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 9}")
|
||||
page.find('#all_state_dossiers .prev a').trigger('click')
|
||||
wait_for_ajax
|
||||
expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 19}")
|
||||
expect(page.all("#all_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 19}")
|
||||
end
|
||||
|
||||
scenario 'Using filter' do
|
||||
|
@ -79,7 +79,7 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
|
|||
expect(page.all('#follow_dossiers .count').first.text).to eq('0 dossiers')
|
||||
|
||||
visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=asc"
|
||||
page.find_by_id("suivre_dossier_#{procedure_1.dossiers.first.id}").click
|
||||
page.find("#all_dossiers #suivre_dossier_#{procedure_1.dossiers.first.id}").click
|
||||
|
||||
visit "/backoffice/dossiers/#{procedure_1.dossiers.second.id}"
|
||||
page.find_by_id("suivre_dossier_#{procedure_1.dossiers.second.id}").click
|
||||
|
@ -88,8 +88,9 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
|
|||
expect(page.all('#follow_dossiers .count').first.text).to eq('2 dossiers')
|
||||
end
|
||||
|
||||
if ENV['CIRCLECI'].nil?
|
||||
scenario 'Adding message', js: true do
|
||||
page.find_by_id("tr_dossier_#{procedure_1.dossiers.first.id}").trigger('click')
|
||||
page.find("#all_dossiers #tr_dossier_#{procedure_1.dossiers.first.id}").trigger('click')
|
||||
expect(page).to have_current_path(backoffice_dossier_path(procedure_1.dossiers.first.id), only_path: true)
|
||||
page.find_by_id('open-message').click
|
||||
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
|
||||
|
@ -97,4 +98,5 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
|
|||
expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'search file on gestionnaire backoffice' do
|
||||
if ENV['PG'] == 'true'
|
||||
feature 'search file on gestionnaire backoffice' do
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
let(:gestionnaire) { create(:gestionnaire, administrateurs: [administrateur]) }
|
||||
|
||||
|
@ -49,4 +50,5 @@ feature 'search file on gestionnaire backoffice' do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -17,7 +17,6 @@ feature 'As a User I want to edit a dossier I own' 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As a User I want to sort and paginate dossiers', js: true do
|
||||
xfeature 'As a User I want to sort and paginate dossiers', js: true do
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:procedure_for_individual) { create(:procedure, :published, :for_individual) }
|
||||
|
|
|
@ -9,8 +9,6 @@ feature 'on click on tabs button' 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')
|
||||
|
@ -33,21 +31,10 @@ feature 'on click on tabs button' do
|
|||
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 examen' do
|
||||
before do
|
||||
visit users_dossiers_url(liste: :en_instruction)
|
||||
page.click_on 'En examen 2'
|
||||
page.click_on 'En instruction 1'
|
||||
end
|
||||
|
||||
scenario 'it redirect to users dossier termine' do
|
||||
|
@ -58,7 +45,7 @@ feature 'on click on tabs button' do
|
|||
context 'when he click on tabs termine' do
|
||||
before do
|
||||
visit users_dossiers_url(liste: :termine)
|
||||
page.click_on 'Cloturé 3'
|
||||
page.click_on 'Terminé 3'
|
||||
end
|
||||
|
||||
scenario 'it redirect to users dossier termine' do
|
||||
|
|
|
@ -3,9 +3,11 @@ require 'spec_helper'
|
|||
describe Carto::Geocodeur do
|
||||
let(:address) { '50 av des champs elysees' }
|
||||
describe '.convert_adresse_to_point', vcr: { cassette_name: 'bano_octo' } do
|
||||
if ENV['CIRCLECI'].nil?
|
||||
it 'return a point' do
|
||||
expect(described_class.convert_adresse_to_point(address).class).to eq(RGeo::Cartesian::PointImpl)
|
||||
end
|
||||
end
|
||||
context 'when RestClient::Exception' do
|
||||
before do
|
||||
allow_any_instance_of(Carto::Bano::Driver).to receive(:call).and_raise(RestClient::Exception)
|
||||
|
|
|
@ -12,19 +12,6 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
it { expect(subject.subject).to eq("Nouveau message pour votre dossier TPS N°#{dossier.id}") }
|
||||
end
|
||||
|
||||
describe ".dossier_validated" do
|
||||
let(:user) { create(:user) }
|
||||
let(:dossier) { create(:dossier, user: user) }
|
||||
|
||||
subject(:subject) { described_class.dossier_validated(dossier) }
|
||||
|
||||
before { dossier.reload }
|
||||
|
||||
it { expect(subject.body).to match("Votre dossier N°#{dossier.id} est prêt à être déposé pour instruction.") }
|
||||
it { expect(subject.body).to include("Afin de finaliser son dépôt, merci de vous rendre sur", users_dossier_recapitulatif_url(dossier_id: dossier.id)) }
|
||||
it { expect(subject.subject).to eq("[TPS] Votre dossier TPS N°#{dossier.id} a été validé") }
|
||||
end
|
||||
|
||||
describe ".dossier_submitted" do
|
||||
let(:user) { create(:user) }
|
||||
let(:dossier) { create(:dossier, user: user) }
|
||||
|
|
|
@ -4,8 +4,4 @@ class NotificationMailerPreview < ActionMailer::Preview
|
|||
NotificationMailer.dossier_received(Dossier.last)
|
||||
end
|
||||
|
||||
def dossier_validated
|
||||
NotificationMailer.dossier_validated(Dossier.last)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -224,12 +224,6 @@ describe Dossier do
|
|||
|
||||
it { is_expected.to eq 'updated' }
|
||||
end
|
||||
|
||||
context 'when is validated the dossier' do
|
||||
let(:action) { 'valid' }
|
||||
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -269,11 +263,6 @@ describe Dossier do
|
|||
it { is_expected.to eq 'replied' }
|
||||
end
|
||||
|
||||
context 'when is validated the dossier' do
|
||||
let(:action) { 'valid' }
|
||||
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -307,74 +296,6 @@ describe Dossier do
|
|||
it { is_expected.to eq('replied') }
|
||||
end
|
||||
|
||||
context 'when is validated the dossier' do
|
||||
let(:action) { 'valid' }
|
||||
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state validated' do
|
||||
before do
|
||||
dossier.validated!
|
||||
end
|
||||
|
||||
context 'when user is connect' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
|
||||
context 'when is submitted the dossier' do
|
||||
let(:action) { 'submit' }
|
||||
|
||||
it { is_expected.to eq('submitted') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when is post a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('validated') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is at state submitted' do
|
||||
before do
|
||||
dossier.submitted!
|
||||
end
|
||||
|
||||
context 'when user is connected' do
|
||||
let(:role) { 'user' }
|
||||
|
||||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('submitted') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when gestionnaire is connect' do
|
||||
let(:role) { 'gestionnaire' }
|
||||
|
||||
context 'when he posts a comment' do
|
||||
let(:action) { 'comment' }
|
||||
|
||||
it { is_expected.to eq('submitted') }
|
||||
end
|
||||
|
||||
context 'when he receive the dossier' do
|
||||
let(:action) { 'receive' }
|
||||
|
||||
it { is_expected.to eq('received') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -505,14 +426,11 @@ describe Dossier do
|
|||
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
|
||||
|
@ -543,12 +461,6 @@ describe Dossier do
|
|||
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 }
|
||||
|
||||
|
@ -685,7 +597,10 @@ describe Dossier do
|
|||
let(:procedure) { create(:procedure, :with_type_de_champ) }
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
let(:follow) { create(:follow, gestionnaire: gestionnaire) }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, follows: [follow]) }
|
||||
let(:date1) { 1.day.ago }
|
||||
let(:date2) { 1.hour.ago }
|
||||
let(:date3) { 1.minute.ago }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, follows: [follow], initiated_at: date1, received_at: date2, processed_at: date3) }
|
||||
|
||||
describe '#export_headers' do
|
||||
|
||||
|
@ -696,6 +611,7 @@ describe Dossier do
|
|||
end
|
||||
|
||||
describe '#data_with_champs' do
|
||||
|
||||
subject { dossier.data_with_champs }
|
||||
|
||||
it { expect(subject[0]).to be_a_kind_of(Integer) }
|
||||
|
@ -704,14 +620,17 @@ describe Dossier do
|
|||
it { expect(subject[3]).to be_in([true, false]) }
|
||||
it { expect(subject[4]).to be_in([true, false]) }
|
||||
it { expect(subject[5]).to eq("draft") }
|
||||
it { expect(subject[6]).to eq(dossier.followers_gestionnaires_emails) }
|
||||
it { expect(subject[6]).to eq(date1) }
|
||||
it { expect(subject[7]).to eq(date2) }
|
||||
it { expect(subject[8]).to eq(date3) }
|
||||
it { expect(subject[9]).to eq(dossier.followers_gestionnaires_emails) }
|
||||
it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#Dossier.to_csv' do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, ) }
|
||||
|
||||
subject do
|
||||
dossier_hash = {}
|
||||
|
@ -969,6 +888,82 @@ describe Dossier do
|
|||
it { is_expected.to eq "#{gestionnaire.email} #{gestionnaire2.email}" }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe '#update_state_dates' do
|
||||
let(:state) { 'draft' }
|
||||
let(:dossier) { create(:dossier, state: state) }
|
||||
let(:beginning_of_day) { Time.now.beginning_of_day }
|
||||
|
||||
before do
|
||||
Timecop.freeze(beginning_of_day)
|
||||
end
|
||||
|
||||
context 'when dossier is initiated' do
|
||||
before do
|
||||
dossier.initiated!
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it { expect(dossier.state).to eq('initiated') }
|
||||
it { expect(dossier.initiated_at).to eq(beginning_of_day) }
|
||||
|
||||
it 'should keep first initiated_at date' do
|
||||
Timecop.return
|
||||
dossier.received!
|
||||
dossier.initiated!
|
||||
|
||||
expect(dossier.initiated_at).to eq(beginning_of_day)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is received' do
|
||||
let(:state) { 'initiated' }
|
||||
|
||||
before do
|
||||
dossier.received!
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it { expect(dossier.state).to eq('received') }
|
||||
it { expect(dossier.received_at).to eq(beginning_of_day) }
|
||||
|
||||
it 'should keep first received_at date if dossier is set to initiated again' do
|
||||
Timecop.return
|
||||
dossier.initiated!
|
||||
dossier.received!
|
||||
|
||||
expect(dossier.received_at).to eq(beginning_of_day)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'dossier is processed' do |new_state|
|
||||
before do
|
||||
dossier.update(state: new_state)
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it { expect(dossier.state).to eq(new_state) }
|
||||
it { expect(dossier.processed_at).to eq(beginning_of_day) }
|
||||
end
|
||||
|
||||
context 'when dossier is closed' do
|
||||
let(:state) { 'received' }
|
||||
|
||||
it_behaves_like 'dossier is processed', 'closed'
|
||||
end
|
||||
|
||||
context 'when dossier is refused' do
|
||||
let(:state) { 'received' }
|
||||
|
||||
it_behaves_like 'dossier is processed', 'refused'
|
||||
end
|
||||
|
||||
context 'when dossier is without_continuation' do
|
||||
let(:state) { 'received' }
|
||||
|
||||
it_behaves_like 'dossier is processed', 'without_continuation'
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,7 +39,7 @@ describe MailTemplate do
|
|||
end
|
||||
end
|
||||
|
||||
xdescribe '.replace_tags' do
|
||||
describe '.replace_tags' do
|
||||
let(:dossier) { create :dossier }
|
||||
let(:procedure) { dossier.procedure }
|
||||
let(:mail_received) { procedure.mail_received }
|
||||
|
|
|
@ -49,10 +49,9 @@ describe Procedure do
|
|||
subject.reload
|
||||
end
|
||||
|
||||
it { expect(subject.mail_templates.size).to eq 2 }
|
||||
it { expect(subject.mail_templates.size).to eq 1 }
|
||||
|
||||
it { expect(subject.mail_received).not_to be_nil }
|
||||
it { expect(subject.mail_validated).not_to be_nil }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Search do
|
||||
if ENV['PG'] == 'true'
|
||||
describe Search do
|
||||
describe '.results' do
|
||||
subject { liste_dossiers }
|
||||
|
||||
|
@ -76,4 +77,5 @@ describe Search do
|
|||
it { expect(subject.size).to eq(1) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,16 +33,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_falsey }
|
||||
|
@ -74,16 +64,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_falsey }
|
||||
|
@ -113,16 +93,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_falsey }
|
||||
|
@ -153,16 +123,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_falsey }
|
||||
|
@ -192,16 +152,6 @@ describe UserRoutesAuthorizationService do
|
|||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'validated' do
|
||||
let(:state) { 'validated' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
describe 'closed' do
|
||||
let(:state) { 'closed' }
|
||||
it { is_expected.to be_truthy }
|
||||
|
|
|
@ -9,8 +9,6 @@ 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 }
|
||||
|
@ -25,8 +23,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
before do
|
||||
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')
|
||||
|
@ -81,9 +77,9 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
|
||||
subject { rendered }
|
||||
|
||||
it { is_expected.to have_content('Nouveaux dossiers 1 dossiers') }
|
||||
it { is_expected.to have_content('Nouveaux dossiers 1 dossier') }
|
||||
it { is_expected.to have_content('Dossiers suivis 0 dossiers') }
|
||||
it { is_expected.to have_content('Tous les dossiers 9 dossiers') }
|
||||
it { is_expected.to have_content('Tous les dossiers 7 dossiers') }
|
||||
|
||||
it { is_expected.to have_content('État') }
|
||||
it { is_expected.to have_content('Libellé procédure') }
|
||||
|
@ -92,8 +88,6 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
|||
|
||||
it { is_expected.to have_content('plap') }
|
||||
it { is_expected.to have_content('plep') }
|
||||
it { is_expected.to have_content('plip') }
|
||||
it { is_expected.to have_content('plop') }
|
||||
it { is_expected.to have_content('plup') }
|
||||
it { is_expected.to have_content('plyp') }
|
||||
end
|
|
@ -2,8 +2,9 @@ require 'spec_helper'
|
|||
|
||||
describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.html.haml', type: :view do
|
||||
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, state: state) }
|
||||
let!(:dossier) { create(:dossier, :with_entreprise, state: state, archived: archived) }
|
||||
let(:state) { 'draft' }
|
||||
let(:archived) { false }
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
|
||||
before do
|
||||
|
@ -23,6 +24,11 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
end
|
||||
|
||||
context 'button dossier state changements' do
|
||||
|
||||
shared_examples 'button Passer en instruction is present' do
|
||||
it { expect(rendered).to have_link('Passer en instruction') }
|
||||
end
|
||||
|
||||
context 'when dossier have state initiated' do
|
||||
let(:state) { 'initiated' }
|
||||
|
||||
|
@ -30,12 +36,9 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content('Nouveau') }
|
||||
it { expect(rendered).to have_content('En construction') }
|
||||
|
||||
it 'button Déclarer complet is present' do
|
||||
expect(rendered).to have_css('.action')
|
||||
expect(rendered).to have_content('DÉCLARER COMPLET')
|
||||
end
|
||||
include_examples 'button Passer en instruction is present'
|
||||
end
|
||||
|
||||
context 'when dossier have state replied' do
|
||||
|
@ -47,10 +50,7 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
|
||||
it { expect(rendered).to have_content('En construction') }
|
||||
|
||||
it 'button Déclarer complet is present' do
|
||||
expect(rendered).to have_css('.action')
|
||||
expect(rendered).to have_content('DÉCLARER COMPLET')
|
||||
end
|
||||
include_examples 'button Passer en instruction is present'
|
||||
end
|
||||
|
||||
context 'when dossier have state update' do
|
||||
|
@ -62,44 +62,7 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
|
||||
it { expect(rendered).to have_content('En construction') }
|
||||
|
||||
it 'button Déclarer complet is present' do
|
||||
expect(rendered).to have_css('.action')
|
||||
expect(rendered).to have_content('DÉCLARER COMPLET')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier have state validated' do
|
||||
let(:state) { 'validated' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content('Figé') }
|
||||
|
||||
it 'button Déclarer complet is not present' do
|
||||
expect(rendered).not_to have_css('.action')
|
||||
expect(rendered).not_to have_content('Déclarer complet')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier have state submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content('Déposé / À réceptionner') }
|
||||
|
||||
it 'button Accuser réception is present' do
|
||||
expect(rendered).to have_css('.action')
|
||||
expect(rendered).to have_content('ACCUSER RÉCEPTION')
|
||||
end
|
||||
|
||||
it 'button Déclarer complet is not present' do
|
||||
expect(rendered).not_to have_content('Accepter le dossier')
|
||||
end
|
||||
include_examples 'button Passer en instruction is present'
|
||||
end
|
||||
|
||||
context 'when dossier have state received' do
|
||||
|
@ -165,6 +128,28 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
|
|||
expect(rendered).not_to have_css('form[data-toggle="tooltip"][title="Refuser"]')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is not archived' do
|
||||
let(:archived) { false }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_link('Archiver') }
|
||||
end
|
||||
|
||||
context 'when dossier is archived' do
|
||||
let(:archived) { true }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content('Archivé') }
|
||||
it { expect(rendered).to have_link('Désarchiver') }
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,67 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'layouts/left_panels/_left_panel_users_dossierscontroller_index.html.haml', type: :view do
|
||||
|
||||
shared_examples 'active_tab' do
|
||||
let(:user) { create :user }
|
||||
|
||||
before do
|
||||
sign_in user
|
||||
|
||||
create :dossier, user: user
|
||||
|
||||
assign :dossiers_list_facade, (DossiersListFacades.new user, param_list)
|
||||
|
||||
render
|
||||
end
|
||||
|
||||
subject { rendered }
|
||||
|
||||
let(:active_class) { 'div.procedure_list_element.active '+active_klass }
|
||||
let(:param_list) { liste }
|
||||
|
||||
it { is_expected.to have_selector(active_class) }
|
||||
end
|
||||
|
||||
describe 'list brouillon' do
|
||||
let(:active_klass) { '.progress-bar-default' }
|
||||
let(:liste) { 'brouillon' }
|
||||
|
||||
it_behaves_like 'active_tab'
|
||||
end
|
||||
|
||||
describe 'list en construction' do
|
||||
let(:active_klass) { '.progress-bar-danger' }
|
||||
let(:liste) { 'a_traiter' }
|
||||
|
||||
it_behaves_like 'active_tab'
|
||||
end
|
||||
|
||||
describe 'list a depose' do
|
||||
let(:active_klass) { '.progress-bar-purple' }
|
||||
let(:liste) { 'valides' }
|
||||
|
||||
it_behaves_like 'active_tab'
|
||||
end
|
||||
|
||||
describe 'list en examen' do
|
||||
let(:active_klass) { '.progress-bar-default' }
|
||||
let(:liste) { 'en_instruction' }
|
||||
|
||||
it_behaves_like 'active_tab'
|
||||
end
|
||||
|
||||
describe 'list cloture' do
|
||||
let(:active_klass) { '.progress-bar-success' }
|
||||
let(:liste) { 'termine' }
|
||||
|
||||
it_behaves_like 'active_tab'
|
||||
end
|
||||
|
||||
describe 'list invite' do
|
||||
let(:active_klass) { '.progress-bar-warning' }
|
||||
let(:liste) { 'invite' }
|
||||
|
||||
it_behaves_like 'active_tab'
|
||||
end
|
||||
end
|
|
@ -17,7 +17,7 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
|
|||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content('Nouveau') }
|
||||
it { expect(rendered).to have_content('En construction') }
|
||||
end
|
||||
|
||||
context 'when dossier state is replied' do
|
||||
|
@ -40,43 +40,6 @@ describe 'layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.htm
|
|||
it { expect(rendered).to have_content('En construction') }
|
||||
end
|
||||
|
||||
context 'when dossier state is validated' do
|
||||
let(:state) { 'validated' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it 'button Procéder au dépôt définitif est present' do
|
||||
expect(rendered).to have_css('#validate_button')
|
||||
expect(rendered).to have_content('Procéder au dépôt définitif')
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
it 'button Modifier les document n\'est plus present' do
|
||||
expect(rendered).not_to have_content('Modifier les documents')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier state is submitted' do
|
||||
let(:state) { 'submitted' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it { expect(rendered).to have_content('Déposé / À réceptionner') }
|
||||
|
||||
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 closed' do
|
||||
let(:state) { 'closed' }
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
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 }
|
||||
|
@ -61,27 +59,13 @@ describe 'users/dossiers/index.html.haml', type: :view do
|
|||
end
|
||||
end
|
||||
|
||||
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 examen' do
|
||||
let(:total_dossiers) { 2 }
|
||||
let(:total_dossiers) { 1 }
|
||||
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
|
||||
|
|
|
@ -107,18 +107,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
|||
expect(rendered).not_to have_content('Archiver')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is validated' do
|
||||
let(:state) { 'validated' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it 'submitted link is not present' do
|
||||
expect(rendered).not_to have_content('Procéder au dépôt définitif')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'invite is by User' do
|
||||
|
@ -148,18 +136,6 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
|||
expect(rendered).not_to have_content('Archiver')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when dossier is validated' do
|
||||
let(:state) { 'validated' }
|
||||
|
||||
before do
|
||||
render
|
||||
end
|
||||
|
||||
it 'submitted link is not present' do
|
||||
expect(rendered).not_to have_content('Procéder au dépôt définitif')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue