Merge branch 'develop' into add_dossier_workflow_dates
This commit is contained in:
commit
caf1f1b74f
21 changed files with 228 additions and 121 deletions
|
@ -46,6 +46,7 @@
|
||||||
min-height: 58px;
|
min-height: 58px;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
.options {
|
.options {
|
||||||
|
|
|
@ -151,7 +151,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive
|
def archive
|
||||||
facade = create_dossier_facade params[:dossier_id]
|
facade = create_dossier_facade params[:id]
|
||||||
unless facade.dossier.archived
|
unless facade.dossier.archived
|
||||||
facade.dossier.update(archived: true)
|
facade.dossier.update(archived: true)
|
||||||
flash.notice = 'Dossier archivé'
|
flash.notice = 'Dossier archivé'
|
||||||
|
@ -159,10 +159,20 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
||||||
redirect_to backoffice_dossiers_path
|
redirect_to backoffice_dossiers_path
|
||||||
end
|
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
|
def reopen
|
||||||
create_dossier_facade params[:dossier_id]
|
create_dossier_facade params[:dossier_id]
|
||||||
|
|
||||||
@facade.dossier.initiated!
|
@facade.dossier.replied!
|
||||||
flash.notice = 'Dossier réouvert.'
|
flash.notice = 'Dossier réouvert.'
|
||||||
|
|
||||||
redirect_to backoffice_dossiers_path
|
redirect_to backoffice_dossiers_path
|
||||||
|
|
|
@ -29,36 +29,31 @@ class Backoffice::DossiersListController < ApplicationController
|
||||||
|
|
||||||
def smartlisting_dossier dossiers_list=nil, liste='all_state'
|
def smartlisting_dossier dossiers_list=nil, liste='all_state'
|
||||||
dossiers_list_facade liste
|
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?
|
if param_page.nil?
|
||||||
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
|
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
|
||||||
end
|
end
|
||||||
|
|
||||||
smart_listing_create :new_dossiers,
|
default_smart_listing_create :new_dossiers, service.nouveaux
|
||||||
new_dossiers_list,
|
default_smart_listing_create :follow_dossiers, service.suivi
|
||||||
partial: "backoffice/dossiers/list",
|
default_smart_listing_create :all_state_dossiers, service.all_state
|
||||||
array: true,
|
default_smart_listing_create :archived_dossiers, service.archive
|
||||||
default_sort: dossiers_list_facade.service.default_sort
|
|
||||||
|
|
||||||
smart_listing_create :follow_dossiers,
|
@archived_dossiers = service.archive
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
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
|
def param_smart_listing
|
||||||
params[:dossiers_smart_listing]
|
params[:dossiers_smart_listing]
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,20 +17,21 @@ class Users::DescriptionController < UsersController
|
||||||
acc
|
acc
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless @dossier.can_be_initiated?
|
||||||
|
flash[:alert] = t('errors.messages.procedure_archived')
|
||||||
|
end
|
||||||
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
flash.alert = t('errors.messages.dossier_not_found')
|
flash.alert = t('errors.messages.dossier_not_found')
|
||||||
redirect_to url_for(root_path)
|
redirect_to url_for(root_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
# def error
|
def update
|
||||||
# show
|
|
||||||
# flash.now.alert = 'Un ou plusieurs attributs obligatoires sont manquants ou incorrects.'
|
|
||||||
# render 'show'
|
|
||||||
# end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@dossier = current_user_dossier
|
@dossier = current_user_dossier
|
||||||
@procedure = @dossier.procedure
|
@procedure = @dossier.procedure
|
||||||
|
|
||||||
|
return head :forbidden unless @dossier.can_be_initiated?
|
||||||
|
|
||||||
@champs = @dossier.ordered_champs
|
@champs = @dossier.ordered_champs
|
||||||
|
|
||||||
mandatory = true
|
mandatory = true
|
||||||
|
|
|
@ -2,7 +2,7 @@ class DossierFacades
|
||||||
|
|
||||||
#TODO rechercher en fonction de la personne/email
|
#TODO rechercher en fonction de la personne/email
|
||||||
def initialize(dossier_id, email, champ_id = nil)
|
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
|
@champ_id = champ_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,8 @@ class Dossier < ActiveRecord::Base
|
||||||
where(state: TERMINE, archived: false).order("updated_at #{order}")
|
where(state: TERMINE, archived: false).order("updated_at #{order}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scope :archived, -> { where(archived: true) }
|
||||||
|
|
||||||
def cerfa_available?
|
def cerfa_available?
|
||||||
procedure.cerfa_flag? && cerfa.size != 0
|
procedure.cerfa_flag? && cerfa.size != 0
|
||||||
end
|
end
|
||||||
|
@ -305,6 +307,7 @@ class Dossier < ActiveRecord::Base
|
||||||
(invites_user.pluck :email).include? email
|
(invites_user.pluck :email).include? email
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def update_state_dates
|
def update_state_dates
|
||||||
|
@ -316,4 +319,8 @@ class Dossier < ActiveRecord::Base
|
||||||
self.processed_at = DateTime.now
|
self.processed_at = DateTime.now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def can_be_initiated?
|
||||||
|
!(procedure.archived && draft?)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ class DossiersListGestionnaireService
|
||||||
'a_traiter' => ouvert,
|
'a_traiter' => ouvert,
|
||||||
'a_instruire' => a_instruire,
|
'a_instruire' => a_instruire,
|
||||||
'termine' => termine,
|
'termine' => termine,
|
||||||
|
'archive' => archive,
|
||||||
'all_state' => all_state}[@liste]
|
'all_state' => all_state}[@liste]
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -39,6 +40,10 @@ class DossiersListGestionnaireService
|
||||||
@a_instruire ||= filter_dossiers.a_instruire
|
@a_instruire ||= filter_dossiers.a_instruire
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def archive
|
||||||
|
@archive ||= filter_dossiers.archived
|
||||||
|
end
|
||||||
|
|
||||||
def termine
|
def termine
|
||||||
@termine ||= filter_dossiers.termine
|
@termine ||= filter_dossiers.termine
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
%table#dossiers_list.table
|
%table#dossiers_list.table
|
||||||
%thead
|
%thead
|
||||||
- if smart_listing.name.to_s == 'follow_dossiers'
|
- 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
|
%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
|
État
|
||||||
|
|
||||||
- @facade_data_view.preference_list_dossiers_filter.each do |preference|
|
- @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('.', '_')}"}
|
%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('.', '_')}"}
|
= 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-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 Abonnés
|
||||||
|
|
||||||
- unless smart_listing.empty?
|
- unless smart_listing.empty?
|
||||||
- smart_listing.collection.each do |dossier|
|
- smart_listing.collection.each do |dossier|
|
||||||
%tr.dossier-row{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id)}
|
%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'
|
- 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
|
- total_notif = dossier.notifications.where(already_read: false).count
|
||||||
- if total_notif == 0
|
- if total_notif == 0
|
||||||
.badge.progress-bar-default
|
.badge.progress-bar-default
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
- else
|
- else
|
||||||
.badge.progress-bar-warning
|
.badge.progress-bar-warning
|
||||||
= total_notif
|
= 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
|
= dossier.decorate.display_state
|
||||||
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
|
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
|
||||||
- unless preference.libelle == 'Statut' || preference.libelle == 'État'
|
- unless preference.libelle == 'Statut' || preference.libelle == 'État'
|
||||||
|
|
|
@ -3,53 +3,64 @@
|
||||||
= render partial: 'backoffice/dossiers/pref_list'
|
= render partial: 'backoffice/dossiers/pref_list'
|
||||||
|
|
||||||
.default_data_block
|
.default_data_block
|
||||||
%div.row.show-block#new_dossiers
|
.row.show-block#new_dossiers
|
||||||
%div.header
|
.header
|
||||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
.col-xs-10.title
|
||||||
%div.carret-right
|
.carret-right
|
||||||
%div.carret-down
|
.carret-down
|
||||||
Nouveaux dossiers
|
Nouveaux dossiers
|
||||||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
.col-xs-2.count
|
||||||
=@facade_data_view.nouveaux_total
|
= pluralize(@facade_data_view.nouveaux_total, "dossier")
|
||||||
dossiers
|
.body
|
||||||
%div.body
|
|
||||||
= smart_listing_render :new_dossiers
|
= smart_listing_render :new_dossiers
|
||||||
|
|
||||||
.row.center
|
.row.center
|
||||||
.col-lg-1.col-md-1.col-sm-1.col-xs-1
|
.col-xs-2.col-xs-offset-1
|
||||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2
|
|
||||||
=link_to 'Tous les états', '?liste=all_state', class: 'text-info', style:"text-decoration: #{@facade_data_view.liste == 'all_state'? 'underline' : ''}"
|
=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-2
|
||||||
=link_to 'En construction', '?liste=a_traiter', class: 'text-danger', style:"text-decoration: #{@facade_data_view.liste == 'a_traiter'? 'underline' : ''}"
|
=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
|
.col-xs-2
|
||||||
=link_to 'À receptionner', '?liste=deposes', class: 'text-purple', style:"text-decoration: #{@facade_data_view.liste == 'deposes'? 'underline' : ''}"
|
=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
|
.col-xs-2
|
||||||
=link_to 'À instruire', '?liste=a_instruire', class: 'text-warning', style:"text-decoration: #{@facade_data_view.liste == 'a_instruire'? 'underline' : ''}"
|
=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-2
|
||||||
=link_to 'Terminés', '?liste=termine', class: 'text-success', style:"text-decoration: #{@facade_data_view.liste == 'termine'? 'underline' : ''}"
|
=link_to 'Terminés', '?liste=termine', class: 'text-success', style:"text-decoration: #{@facade_data_view.liste == 'termine'? 'underline' : ''}"
|
||||||
|
|
||||||
.default_data_block.default_visible
|
.default_data_block.default_visible
|
||||||
%div.row.show-block#follow_dossiers
|
.row.show-block#follow_dossiers
|
||||||
%div.header
|
.header
|
||||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
.col-xs-10.title
|
||||||
%div.carret-right
|
.carret-right
|
||||||
%div.carret-down
|
.carret-down
|
||||||
Dossiers suivis
|
Dossiers suivis
|
||||||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
.col-xs-2.count
|
||||||
=@facade_data_view.suivi_total
|
= pluralize(@facade_data_view.suivi_total, "dossier")
|
||||||
dossiers
|
.body
|
||||||
%div.body
|
|
||||||
= smart_listing_render :follow_dossiers
|
= smart_listing_render :follow_dossiers
|
||||||
|
|
||||||
.default_data_block
|
.default_data_block
|
||||||
%div.row.show-block#all_dossiers
|
.row.show-block#all_dossiers
|
||||||
%div.header
|
.header
|
||||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
.col-xs-10.title
|
||||||
%div.carret-right
|
.carret-right
|
||||||
%div.carret-down
|
.carret-down
|
||||||
Tous les dossiers
|
Tous les dossiers
|
||||||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
.col-xs-2.count
|
||||||
=@facade_data_view.all_state_total
|
= pluralize(@facade_data_view.all_state_total, "dossier")
|
||||||
dossiers
|
.body
|
||||||
%div.body
|
|
||||||
= smart_listing_render :all_state_dossiers
|
= 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,8 +1,8 @@
|
||||||
%div#first-block
|
#first-block
|
||||||
%div.infos
|
.infos
|
||||||
#dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
|
#dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
|
||||||
|
|
||||||
%div#action-block
|
#action-block
|
||||||
- if gestionnaire_signed_in?
|
- if gestionnaire_signed_in?
|
||||||
- if !@facade.dossier.read_only? || @facade.dossier.initiated?
|
- if !@facade.dossier.read_only? || @facade.dossier.initiated?
|
||||||
= link_to 'Accuser réception', backoffice_dossier_receive_path(@facade.dossier), method: :post, class: 'btn btn-danger btn-block'
|
= link_to 'Accuser réception', backoffice_dossier_receive_path(@facade.dossier), method: :post, class: 'btn btn-danger btn-block'
|
||||||
|
@ -19,18 +19,24 @@
|
||||||
%i.fa.fa-times
|
%i.fa.fa-times
|
||||||
= link_to 'Reouvrir', backoffice_dossier_reopen_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
= link_to 'Reouvrir', backoffice_dossier_reopen_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
||||||
|
|
||||||
- unless @facade.dossier.archived?
|
%hr
|
||||||
= link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
- 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
|
#infos-block
|
||||||
%div.split-hr-left
|
.split-hr-left
|
||||||
%div.dossier-state= @facade.dossier.display_state
|
.dossier-state= @facade.dossier.display_state
|
||||||
%div.split-hr-left
|
.split-hr-left
|
||||||
%div.notifications
|
.notifications
|
||||||
- if @facade.dossier.notifications.empty?
|
- if @facade.dossier.notifications.empty?
|
||||||
Aucune notification pour le moment.
|
Aucune notification pour le moment.
|
||||||
- else
|
- else
|
||||||
|
|
|
@ -57,8 +57,7 @@
|
||||||
%h3.text-success Usagers
|
%h3.text-success Usagers
|
||||||
%h4 Profitez de démarches simplifiées et d’échanges continus avec les services traitants.
|
%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'}
|
=link_to 'Démonstration', "#{@demo_environment_host}/users/sign_in/demo", {class: 'btn btn-lg btn-success'}
|
||||||
%h1
|
|
||||||
= @demo_environment_host
|
|
||||||
.split-hr-left
|
.split-hr-left
|
||||||
|
|
||||||
.center
|
.center
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
= @dossier.procedure.libelle
|
= @dossier.procedure.libelle
|
||||||
|
|
||||||
-#TODO use form_for
|
-#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?
|
-unless @champs.nil?
|
||||||
#liste_champs
|
#liste_champs
|
||||||
=render partial: 'users/description/champs', locals:{private: false}
|
=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.
|
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')
|
- unless route[:controller].match('admin')
|
||||||
%div{style: 'text-align:right'}
|
%div{style: 'text-align:right'}
|
||||||
%h6 Tous les champs portant un * sont obligatoires.
|
%h6 Tous les champs portant un * sont obligatoires.
|
||||||
|
|
||||||
-if !@dossier.draft?
|
- if !@dossier.can_be_initiated?
|
||||||
=render partial: '/layouts/modifications_terminees'
|
.alert.alert-danger
|
||||||
-else
|
= t('errors.messages.procedure_archived')
|
||||||
= 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}
|
- elsif !@dossier.draft?
|
||||||
= 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}
|
= render partial: '/layouts/modifications_terminees'
|
||||||
|
- else
|
||||||
%br
|
= 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}
|
||||||
%br
|
= 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}
|
||||||
|
|
|
@ -147,6 +147,7 @@ fr:
|
||||||
france_connect:
|
france_connect:
|
||||||
connexion: "Erreur lors de la connexion à 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."
|
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:
|
datetime:
|
||||||
distance_in_words:
|
distance_in_words:
|
||||||
|
|
|
@ -63,9 +63,8 @@ Rails.application.routes.draw do
|
||||||
resources :dossiers do
|
resources :dossiers do
|
||||||
get '/add_siret' => 'dossiers/add_siret#show'
|
get '/add_siret' => 'dossiers/add_siret#show'
|
||||||
|
|
||||||
get '/description' => 'description#show'
|
get 'description' => 'description#show'
|
||||||
# get '/description/error' => 'description#error'
|
post 'description' => 'description#update'
|
||||||
post 'description' => 'description#create'
|
|
||||||
|
|
||||||
patch 'pieces_justificatives' => 'description#pieces_justificatives'
|
patch 'pieces_justificatives' => 'description#pieces_justificatives'
|
||||||
|
|
||||||
|
@ -162,9 +161,11 @@ Rails.application.routes.draw do
|
||||||
post 'refuse' => 'dossiers#refuse'
|
post 'refuse' => 'dossiers#refuse'
|
||||||
post 'without_continuation' => 'dossiers#without_continuation'
|
post 'without_continuation' => 'dossiers#without_continuation'
|
||||||
post 'close' => 'dossiers#close'
|
post 'close' => 'dossiers#close'
|
||||||
post 'archive' => 'dossiers#archive'
|
member do
|
||||||
|
post 'archive'
|
||||||
|
post 'unarchive'
|
||||||
|
end
|
||||||
post 'reopen' => 'dossiers#reopen'
|
post 'reopen' => 'dossiers#reopen'
|
||||||
|
|
||||||
put 'follow' => 'dossiers#follow'
|
put 'follow' => 'dossiers#follow'
|
||||||
resources :commentaires, only: [:index]
|
resources :commentaires, only: [:index]
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,8 @@ require 'spec_helper'
|
||||||
describe Backoffice::Dossiers::ProcedureController, type: :controller do
|
describe Backoffice::Dossiers::ProcedureController, type: :controller do
|
||||||
let(:gestionnaire) { create :gestionnaire }
|
let(:gestionnaire) { create :gestionnaire }
|
||||||
let(:procedure) { create :procedure }
|
let(:procedure) { create :procedure }
|
||||||
|
let(:archived) { false }
|
||||||
|
let(:dossier) { create :dossier, procedure: procedure, archived: archived, state: 'initiated'}
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
|
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 { is_expected.to redirect_to backoffice_dossiers_path }
|
||||||
it { expect(flash[:alert]).to be_present}
|
it { expect(flash[:alert]).to be_present}
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe 'GET #filter' do
|
describe 'GET #filter' do
|
||||||
|
|
|
@ -104,12 +104,6 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
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
|
context 'when dossier id does not exist' do
|
||||||
let(:dossier_id) { bad_dossier_id }
|
let(:dossier_id) { bad_dossier_id }
|
||||||
|
|
||||||
|
@ -368,11 +362,11 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
|
|
||||||
subject { post :reopen, params: {dossier_id: dossier_id} }
|
subject { post :reopen, params: {dossier_id: dossier_id} }
|
||||||
|
|
||||||
it 'change state to initiated' do
|
it 'change state to replied' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
dossier.reload
|
dossier.reload
|
||||||
expect(dossier.state).to eq('initiated')
|
expect(dossier.state).to eq('replied')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to redirect_to backoffice_dossiers_path }
|
it { is_expected.to redirect_to backoffice_dossiers_path }
|
||||||
|
@ -384,7 +378,7 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
sign_in gestionnaire
|
sign_in gestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :archive, params: {dossier_id: dossier_id} }
|
subject { post :archive, params: {id: dossier_id} }
|
||||||
|
|
||||||
it 'change state to archived' do
|
it 'change state to archived' do
|
||||||
subject
|
subject
|
||||||
|
|
|
@ -17,12 +17,27 @@ shared_examples 'description_controller_spec' do
|
||||||
context 'when all is ok' do
|
context 'when all is ok' do
|
||||||
before do
|
before do
|
||||||
dossier.entreprise = create :entreprise
|
dossier.entreprise = create :entreprise
|
||||||
|
get :show, params: {dossier_id: dossier_id}
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :show, params: {dossier_id: dossier_id}
|
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
it 'redirection vers start si mauvais dossier ID' do
|
it 'redirection vers start si mauvais dossier ID' do
|
||||||
|
@ -90,7 +105,7 @@ shared_examples 'description_controller_spec' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #create' do
|
describe 'POST #update' do
|
||||||
let(:timestamp) { Time.now }
|
let(:timestamp) { Time.now }
|
||||||
let(:description) { 'Description de test Coucou, je suis un saut à la ligne Je suis un double saut la ligne.' }
|
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
|
describe 'Premier enregistrement des données' do
|
||||||
let(:submit) { {nouveaux: 'nouveaux'} }
|
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
|
before do
|
||||||
dossier.draft!
|
dossier.draft!
|
||||||
|
@ -130,7 +145,7 @@ shared_examples 'description_controller_spec' do
|
||||||
context 'En train de manipuler un dossier non brouillon' do
|
context 'En train de manipuler un dossier non brouillon' do
|
||||||
before do
|
before do
|
||||||
dossier.initiated!
|
dossier.initiated!
|
||||||
post :create, params: {dossier_id: dossier_id}
|
post :update, params: {dossier_id: dossier_id}
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -145,7 +160,7 @@ shared_examples 'description_controller_spec' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Quand la procédure accepte les CERFA' do
|
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} }
|
cerfa_pdf: cerfa_pdf} }
|
||||||
|
|
||||||
it 'Notification interne is create' do
|
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
|
context 'Sauvegarde du CERFA PDF', vcr: {cassette_name: 'controllers_users_description_controller_save_cerfa'} do
|
||||||
before do
|
before do
|
||||||
post :create, params: {dossier_id: dossier_id,
|
post :update, params: {dossier_id: dossier_id,
|
||||||
cerfa_pdf: cerfa_pdf}
|
cerfa_pdf: cerfa_pdf}
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
@ -181,7 +196,7 @@ shared_examples 'description_controller_spec' do
|
||||||
let(:cerfas) { Cerfa.where(dossier_id: dossier_id) }
|
let(:cerfas) { Cerfa.where(dossier_id: dossier_id) }
|
||||||
|
|
||||||
before do
|
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
|
end
|
||||||
|
|
||||||
it "il y a deux CERFA PDF pour ce dossier" do
|
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
|
context 'Sauvegarde du CERFA PDF' do
|
||||||
let!(:procedure) { create(:procedure) }
|
let!(:procedure) { create(:procedure) }
|
||||||
before do
|
before do
|
||||||
post :create, params: {dossier_id: dossier_id,
|
post :update, params: {dossier_id: dossier_id,
|
||||||
cerfa_pdf: cerfa_pdf}
|
cerfa_pdf: cerfa_pdf}
|
||||||
dossier.reload
|
dossier.reload
|
||||||
end
|
end
|
||||||
|
@ -214,7 +229,7 @@ shared_examples 'description_controller_spec' do
|
||||||
let(:dossier_minute_value) { '00' }
|
let(:dossier_minute_value) { '00' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
post :create, params: {dossier_id: dossier_id,
|
post :update, params: {dossier_id: dossier_id,
|
||||||
champs: {
|
champs: {
|
||||||
"'#{dossier.champs.first.id}'" => dossier_champs_first,
|
"'#{dossier.champs.first.id}'" => dossier_champs_first,
|
||||||
"'#{dossier.champs.second.id}'" => dossier_date_value
|
"'#{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
|
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 }
|
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
|
||||||
before do
|
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[0].to_s => piece_justificative_0,
|
||||||
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
|
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
|
||||||
dossier.reload
|
dossier.reload
|
||||||
|
@ -264,7 +279,7 @@ shared_examples 'description_controller_spec' do
|
||||||
it 'ClamavService safe_file? is call' do
|
it 'ClamavService safe_file? is call' do
|
||||||
expect(ClamavService).to receive(:safe_file?).twice
|
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[0].to_s => piece_justificative_0,
|
||||||
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
|
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
|
||||||
end
|
end
|
||||||
|
@ -281,6 +296,22 @@ shared_examples 'description_controller_spec' do
|
||||||
it { expect(subject.user).to eq user }
|
it { expect(subject.user).to eq user }
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
describe 'POST #pieces_justificatives', vcr: {cassette_name: 'controllers_users_description_controller_pieces_justificatives'} do
|
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
|
describe Users::DescriptionController, type: :controller, vcr: {cassette_name: 'controllers_users_description_controller'} do
|
||||||
let(:owner_user) { create(:user) }
|
let(:owner_user) { create(:user) }
|
||||||
let(:invite_by_user) { create :user, email: 'invite@plop.com' }
|
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(: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: 'initiated') }
|
let(:dossier) { create(:dossier, procedure: procedure, user: owner_user, state: state) }
|
||||||
|
|
||||||
let(:dossier_id) { dossier.id }
|
let(:dossier_id) { dossier.id }
|
||||||
let(:bad_dossier_id) { Dossier.count + 10000 }
|
let(:bad_dossier_id) { Dossier.count + 10000 }
|
||||||
|
|
|
@ -77,7 +77,7 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
|
||||||
|
|
||||||
subject { rendered }
|
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('Dossiers suivis 0 dossiers') }
|
||||||
it { is_expected.to have_content('Tous les dossiers 7 dossiers') }
|
it { is_expected.to have_content('Tous les dossiers 7 dossiers') }
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,9 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.html.haml', type: :view do
|
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(:state) { 'draft' }
|
||||||
|
let(:archived) { false }
|
||||||
let(:gestionnaire) { create(:gestionnaire) }
|
let(:gestionnaire) { create(:gestionnaire) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -127,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"]')
|
expect(rendered).not_to have_css('form[data-toggle="tooltip"][title="Refuser"]')
|
||||||
end
|
end
|
||||||
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
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in a new issue