Merge branch 'dev'
This commit is contained in:
commit
aa12eb2c49
180 changed files with 251 additions and 12249 deletions
|
@ -579,7 +579,7 @@ Rails/PluralizationGrammar:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Rails/Present:
|
Rails/Present:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Rails/ReadWriteAttribute:
|
Rails/ReadWriteAttribute:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -1029,7 +1029,7 @@ Style/TrivialAccessors:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/UnlessElse:
|
Style/UnlessElse:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Style/UnneededCapitalW:
|
Style/UnneededCapitalW:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
// = require _turbolinks
|
// = require _turbolinks
|
||||||
// = require admin_procedures_modal
|
// = require admin_procedures_modal
|
||||||
// = require admin_type_de_champ
|
// = require admin_type_de_champ
|
||||||
// = require backoffice
|
|
||||||
// = require carte
|
// = require carte
|
||||||
// = require custom_mails
|
// = require custom_mails
|
||||||
// = require default_data_block
|
// = require default_data_block
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
#backoffice-index,
|
|
||||||
#backoffice-search {
|
|
||||||
margin-left: 2rem;
|
|
||||||
margin-right: 2rem;
|
|
||||||
|
|
||||||
.default-data-block {
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
margin-top: 20px;
|
|
||||||
|
|
||||||
.show-block {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.body {
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.fixed-right {
|
|
||||||
position: fixed;
|
|
||||||
right: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#onglets {
|
|
||||||
ul {
|
|
||||||
li,
|
|
||||||
li.active {
|
|
||||||
a {
|
|
||||||
margin-top: 12px;
|
|
||||||
height: 45px;
|
|
||||||
|
|
||||||
h5 {
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#search {
|
|
||||||
a {
|
|
||||||
margin-top: 0px;
|
|
||||||
height: 57px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#search:not(.active) {
|
|
||||||
a:hover {
|
|
||||||
background-color: transparent;
|
|
||||||
border: none;
|
|
||||||
padding: 11px 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,3 @@
|
||||||
#backoffice-dossier-show,
|
|
||||||
#users-recapitulatif-dossier-show {
|
#users-recapitulatif-dossier-show {
|
||||||
|
|
||||||
#messages {
|
#messages {
|
||||||
|
|
8
app/assets/stylesheets/new_design/manager.scss
Normal file
8
app/assets/stylesheets/new_design/manager.scss
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
.types-de-champs-table {
|
||||||
|
table-layout: fixed;
|
||||||
|
|
||||||
|
td {
|
||||||
|
white-space: normal;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,10 +12,6 @@
|
||||||
margin-bottom: -70px;
|
margin-bottom: -70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#backoffice-dossier-show .nav-tabs {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#left-panel {
|
#left-panel {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|
|
@ -30,7 +30,6 @@ class Admin::AccompagnateursController < AdminController
|
||||||
accompagnateur_service = AccompagnateurService.new gestionnaire, procedure, to
|
accompagnateur_service = AccompagnateurService.new gestionnaire, procedure, to
|
||||||
|
|
||||||
accompagnateur_service.change_assignement!
|
accompagnateur_service.change_assignement!
|
||||||
accompagnateur_service.build_default_column
|
|
||||||
|
|
||||||
flash.notice = "Assignement effectué"
|
flash.notice = "Assignement effectué"
|
||||||
redirect_to admin_procedure_accompagnateurs_path, procedure_id: params[:procedure_id]
|
redirect_to admin_procedure_accompagnateurs_path, procedure_id: params[:procedure_id]
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Admin::ChangeDossierStateController < AdminController
|
||||||
def check
|
def check
|
||||||
@dossier = Dossier.find(params[:dossier][:id])
|
@dossier = Dossier.find(params[:dossier][:id])
|
||||||
|
|
||||||
unless @dossier.procedure.administrateur.email == current_administrateur.email
|
if @dossier.procedure.administrateur.email != current_administrateur.email
|
||||||
flash.alert = 'Dossier introuvable'
|
flash.alert = 'Dossier introuvable'
|
||||||
return redirect_to admin_change_dossier_state_path
|
return redirect_to admin_change_dossier_state_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Admin::ProceduresController < AdminController
|
||||||
@procedure = Procedure.new(procedure_params)
|
@procedure = Procedure.new(procedure_params)
|
||||||
@procedure.module_api_carto = ModuleAPICarto.new(create_module_api_carto_params) if @procedure.valid?
|
@procedure.module_api_carto = ModuleAPICarto.new(create_module_api_carto_params) if @procedure.valid?
|
||||||
|
|
||||||
unless @procedure.save
|
if !@procedure.save
|
||||||
flash.now.alert = @procedure.errors.full_messages
|
flash.now.alert = @procedure.errors.full_messages
|
||||||
return render 'new'
|
return render 'new'
|
||||||
end
|
end
|
||||||
|
@ -83,7 +83,7 @@ class Admin::ProceduresController < AdminController
|
||||||
def update
|
def update
|
||||||
@procedure = current_administrateur.procedures.find(params[:id])
|
@procedure = current_administrateur.procedures.find(params[:id])
|
||||||
|
|
||||||
unless @procedure.update_attributes(procedure_params)
|
if !@procedure.update_attributes(procedure_params)
|
||||||
flash.now.alert = @procedure.errors.full_messages
|
flash.now.alert = @procedure.errors.full_messages
|
||||||
return render 'edit'
|
return render 'edit'
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,13 +3,13 @@ class APIController < ApplicationController
|
||||||
before_action :default_format_json
|
before_action :default_format_json
|
||||||
|
|
||||||
def authenticate_user
|
def authenticate_user
|
||||||
render json: {}, status: 401 unless valid_token?
|
render json: {}, status: 401 if !valid_token?
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def valid_token?
|
def valid_token?
|
||||||
!current_administrateur.nil?
|
current_administrateur.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_administrateur
|
def current_administrateur
|
||||||
|
@ -17,6 +17,6 @@ class APIController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_format_json
|
def default_format_json
|
||||||
request.format = "json" unless request.params[:format]
|
request.format = "json" if !request.params[:format]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
class Backoffice::AvisController < ApplicationController
|
|
||||||
before_action :authenticate_gestionnaire!
|
|
||||||
|
|
||||||
def create
|
|
||||||
avis = Avis.new(create_params.merge(claimant: current_gestionnaire, dossier: dossier, confidentiel: true))
|
|
||||||
|
|
||||||
if avis.save
|
|
||||||
flash[:notice] = "Votre demande d'avis a bien été envoyée à #{avis.email_to_display}"
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to backoffice_dossier_path(dossier)
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
if avis.update(update_params)
|
|
||||||
NotificationService.new('avis', params[:dossier_id]).notify
|
|
||||||
flash[:notice] = 'Merci, votre avis a été enregistré.'
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to backoffice_dossier_path(avis.dossier_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def dossier
|
|
||||||
current_gestionnaire.dossiers.find(params[:dossier_id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def avis
|
|
||||||
current_gestionnaire.avis.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def create_params
|
|
||||||
params.require(:avis).permit(:email, :introduction)
|
|
||||||
end
|
|
||||||
|
|
||||||
def update_params
|
|
||||||
params.require(:avis).permit(:answer)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,7 +0,0 @@
|
||||||
class Backoffice::CommentairesController < CommentairesController
|
|
||||||
before_action :authenticate_gestionnaire!
|
|
||||||
|
|
||||||
def is_gestionnaire?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,24 +0,0 @@
|
||||||
class Backoffice::Dossiers::ProcedureController < Backoffice::DossiersListController
|
|
||||||
def index
|
|
||||||
super
|
|
||||||
|
|
||||||
dossiers_list_facade.service.filter_procedure! params[:id]
|
|
||||||
|
|
||||||
render 'backoffice/dossiers/index'
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
|
||||||
flash.alert = "Cette procédure n'existe pas ou vous n'y avez pas accès."
|
|
||||||
redirect_to backoffice_dossiers_path
|
|
||||||
end
|
|
||||||
|
|
||||||
def filter
|
|
||||||
super
|
|
||||||
|
|
||||||
redirect_to backoffice_dossiers_procedure_path(id: params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def retrieve_procedure
|
|
||||||
current_gestionnaire.procedures.find params[:id]
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,226 +0,0 @@
|
||||||
class Backoffice::DossiersController < Backoffice::DossiersListController
|
|
||||||
include ActionView::Helpers::NumberHelper
|
|
||||||
|
|
||||||
respond_to :html, :xlsx, :ods, :csv
|
|
||||||
|
|
||||||
prepend_before_action :store_current_location, only: :show
|
|
||||||
before_action :ensure_gestionnaire_is_authorized, only: :show
|
|
||||||
|
|
||||||
def index
|
|
||||||
return redirect_to backoffice_invitations_path if current_gestionnaire.avis.any?
|
|
||||||
|
|
||||||
procedure = current_gestionnaire.procedure_filter
|
|
||||||
|
|
||||||
if procedure.nil?
|
|
||||||
procedure_list = dossiers_list_facade.gestionnaire_procedures_name_and_id_list
|
|
||||||
|
|
||||||
if procedure_list.count == 0
|
|
||||||
flash.alert = "Vous n'avez aucune procédure d'affectée."
|
|
||||||
return redirect_to root_path
|
|
||||||
end
|
|
||||||
|
|
||||||
procedure = procedure_list.first[:id]
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to backoffice_dossiers_procedure_path(id: procedure)
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
dossier_id = params[:id]
|
|
||||||
create_dossier_facade dossier_id
|
|
||||||
|
|
||||||
unless @facade.nil?
|
|
||||||
@champs_private = @facade.champs_private
|
|
||||||
|
|
||||||
@headers_private = @champs_private.select { |champ| champ.type_champ == 'header_section' }
|
|
||||||
end
|
|
||||||
|
|
||||||
# if the current_gestionnaire does not own the dossier, it is here to give an advice
|
|
||||||
# and it should not remove the notifications
|
|
||||||
if current_gestionnaire.dossiers.find_by(id: dossier_id).present?
|
|
||||||
Notification.where(dossier_id: dossier_id).update_all(already_read: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
@new_avis = Avis.new(introduction: "Bonjour, merci de me donner votre avis sur ce dossier.")
|
|
||||||
end
|
|
||||||
|
|
||||||
def filter
|
|
||||||
super
|
|
||||||
|
|
||||||
redirect_to backoffice_dossiers_path(liste: param_liste)
|
|
||||||
end
|
|
||||||
|
|
||||||
def download_dossiers_tps
|
|
||||||
procedure = current_gestionnaire.procedures.find_by(id: params[:procedure_id])
|
|
||||||
export = procedure.generate_export
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.csv { send_data(SpreadsheetArchitect.to_csv(data: export[:data], headers: export[:headers]), filename: 'dossiers.csv') }
|
|
||||||
format.xlsx { send_data(SpreadsheetArchitect.to_xlsx(data: export[:data], headers: export[:headers]), filename: 'dossiers.xlsx') }
|
|
||||||
format.ods { send_data(SpreadsheetArchitect.to_ods(data: export[:data], headers: export[:headers]), filename: 'dossiers.ods') }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def search
|
|
||||||
@search_terms = params[:q]
|
|
||||||
|
|
||||||
# exact id match?
|
|
||||||
if @search_terms.to_i != 0
|
|
||||||
@dossiers = current_gestionnaire.dossiers.where(id: @search_terms.to_i)
|
|
||||||
end
|
|
||||||
|
|
||||||
@dossiers = Dossier.none if @dossiers.nil?
|
|
||||||
|
|
||||||
# full text search
|
|
||||||
unless @dossiers.any?
|
|
||||||
@dossiers = Search.new(
|
|
||||||
gestionnaire: current_gestionnaire,
|
|
||||||
query: @search_terms,
|
|
||||||
page: params[:page]
|
|
||||||
).results
|
|
||||||
end
|
|
||||||
|
|
||||||
smart_listing_create :search,
|
|
||||||
@dossiers,
|
|
||||||
partial: "backoffice/dossiers/list",
|
|
||||||
array: true,
|
|
||||||
default_sort: dossiers_list_facade.service.default_sort
|
|
||||||
|
|
||||||
rescue RuntimeError
|
|
||||||
smart_listing_create :search,
|
|
||||||
[],
|
|
||||||
partial: "backoffice/dossiers/list",
|
|
||||||
array: true,
|
|
||||||
default_sort: dossiers_list_facade.service.default_sort
|
|
||||||
end
|
|
||||||
|
|
||||||
def receive
|
|
||||||
dossier = Dossier.find(params[:dossier_id])
|
|
||||||
|
|
||||||
dossier.en_instruction!
|
|
||||||
current_gestionnaire.follow(dossier)
|
|
||||||
flash.notice = 'Dossier passé en instruction.'
|
|
||||||
|
|
||||||
redirect_to backoffice_dossier_path(id: dossier.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def process_dossier
|
|
||||||
create_dossier_facade params[:dossier_id]
|
|
||||||
|
|
||||||
dossier = @facade.dossier
|
|
||||||
|
|
||||||
if params[:dossier] && params[:dossier][:motivation].present?
|
|
||||||
dossier.motivation = params[:dossier][:motivation]
|
|
||||||
end
|
|
||||||
|
|
||||||
case params[:process_action]
|
|
||||||
when "refuse"
|
|
||||||
dossier.refuse!
|
|
||||||
notice = "Dossier considéré comme refusé."
|
|
||||||
template = dossier.procedure.refused_mail_template
|
|
||||||
when "without_continuation"
|
|
||||||
dossier.sans_suite!
|
|
||||||
notice = "Dossier considéré comme sans suite."
|
|
||||||
template = dossier.procedure.without_continuation_mail_template
|
|
||||||
when "close"
|
|
||||||
dossier.accepte!
|
|
||||||
dossier.attestation = dossier.build_attestation
|
|
||||||
notice = "Dossier traité avec succès."
|
|
||||||
template = dossier.procedure.closed_mail_template
|
|
||||||
end
|
|
||||||
|
|
||||||
dossier.save
|
|
||||||
|
|
||||||
# needed to force Carrierwave to provide dossier.attestation.pdf.read
|
|
||||||
# when the Feature.remote_storage is true, otherwise pdf.read is a closed stream.
|
|
||||||
dossier.reload
|
|
||||||
|
|
||||||
attestation_pdf = nil
|
|
||||||
if check_attestation_emailable(dossier)
|
|
||||||
attestation_pdf = dossier.attestation.pdf.read
|
|
||||||
end
|
|
||||||
|
|
||||||
flash.notice = notice
|
|
||||||
|
|
||||||
NotificationMailer.send_notification(dossier, template, attestation_pdf).deliver_now!
|
|
||||||
|
|
||||||
redirect_to backoffice_dossier_path(id: dossier.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def reload_smartlisting
|
|
||||||
begin
|
|
||||||
@liste = URI(request.referer).query.split('=').second
|
|
||||||
rescue NoMethodError
|
|
||||||
@liste = cookies[:liste] || 'all_state'
|
|
||||||
end
|
|
||||||
|
|
||||||
smartlisting_dossier
|
|
||||||
|
|
||||||
render 'backoffice/dossiers/index', formats: :js
|
|
||||||
end
|
|
||||||
|
|
||||||
def archive
|
|
||||||
facade = create_dossier_facade params[:id]
|
|
||||||
unless facade.dossier.archived
|
|
||||||
facade.dossier.update(archived: true)
|
|
||||||
flash.notice = 'Dossier archivé'
|
|
||||||
end
|
|
||||||
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.en_construction!
|
|
||||||
flash.notice = 'Dossier repassé en construction.'
|
|
||||||
|
|
||||||
redirect_to backoffice_dossier_path(id: @facade.dossier.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def check_attestation_emailable(dossier)
|
|
||||||
if dossier&.attestation&.emailable? == false
|
|
||||||
human_size = number_to_human_size(dossier.attestation.pdf.size)
|
|
||||||
msg = "the attestation of the dossier #{dossier.id} cannot be mailed because it is too heavy: #{human_size}"
|
|
||||||
capture_message(msg, level: 'error')
|
|
||||||
end
|
|
||||||
|
|
||||||
dossier&.attestation&.emailable?
|
|
||||||
end
|
|
||||||
|
|
||||||
def store_current_location
|
|
||||||
if !gestionnaire_signed_in?
|
|
||||||
store_location_for(:gestionnaire, request.url)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def ensure_gestionnaire_is_authorized
|
|
||||||
unless current_gestionnaire.can_view_dossier?(params[:id])
|
|
||||||
flash.alert = t('errors.messages.dossier_not_found')
|
|
||||||
redirect_to url_for(controller: '/backoffice')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def create_dossier_facade dossier_id
|
|
||||||
@facade = DossierFacades.new dossier_id, current_gestionnaire.email
|
|
||||||
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
|
||||||
flash.alert = t('errors.messages.dossier_not_found')
|
|
||||||
redirect_to url_for(controller: '/backoffice')
|
|
||||||
end
|
|
||||||
|
|
||||||
def retrieve_procedure
|
|
||||||
return if params[:procedure_id].blank?
|
|
||||||
current_gestionnaire.procedures.find params[:procedure_id]
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,78 +0,0 @@
|
||||||
class Backoffice::DossiersListController < ApplicationController
|
|
||||||
include SmartListing::Helper::ControllerExtensions
|
|
||||||
helper SmartListing::Helper
|
|
||||||
|
|
||||||
before_action :authenticate_gestionnaire!
|
|
||||||
|
|
||||||
def index
|
|
||||||
cookies[:liste] = param_liste
|
|
||||||
|
|
||||||
unless DossiersListGestionnaireService.dossiers_liste_libelle.include?(param_liste)
|
|
||||||
cookies[:liste] = 'all_state'
|
|
||||||
end
|
|
||||||
|
|
||||||
dossiers_list_facade param_liste
|
|
||||||
dossiers_list_facade.service.change_sort! param_sort unless param_smart_listing.nil?
|
|
||||||
dossiers_list_facade.service.change_page! param_page
|
|
||||||
|
|
||||||
smartlisting_dossier
|
|
||||||
end
|
|
||||||
|
|
||||||
def filter
|
|
||||||
dossiers_list_facade param_liste
|
|
||||||
dossiers_list_facade.service.add_filter param_filter
|
|
||||||
end
|
|
||||||
|
|
||||||
def dossiers_list_facade liste='all_state'
|
|
||||||
@facade_data_view ||= DossiersListFacades.new current_gestionnaire, liste, retrieve_procedure
|
|
||||||
end
|
|
||||||
|
|
||||||
def smartlisting_dossier dossiers_list=nil, liste='all_state'
|
|
||||||
dossiers_list_facade liste
|
|
||||||
service = dossiers_list_facade.service
|
|
||||||
|
|
||||||
if param_page.nil?
|
|
||||||
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
|
|
||||||
end
|
|
||||||
|
|
||||||
default_smart_listing_create :new_dossiers, service.nouveaux.without_followers.order_by_updated_at('asc')
|
|
||||||
default_smart_listing_create :follow_dossiers, service.suivi.order_by_updated_at('asc')
|
|
||||||
default_smart_listing_create :all_state_dossiers, service.all_state.order_by_updated_at('asc')
|
|
||||||
default_smart_listing_create :archived_dossiers, service.archive
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
||||||
def param_page
|
|
||||||
unless param_smart_listing.nil?
|
|
||||||
return 1 if params[:dossiers_smart_listing][:page].blank?
|
|
||||||
params[:dossiers_smart_listing][:page]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def param_sort
|
|
||||||
params[:dossiers_smart_listing][:sort] unless param_smart_listing.nil?
|
|
||||||
end
|
|
||||||
|
|
||||||
def param_filter
|
|
||||||
params[:filter_input]
|
|
||||||
end
|
|
||||||
|
|
||||||
def param_liste
|
|
||||||
@liste ||= params[:liste] || cookies[:liste] || 'all_state'
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,50 +0,0 @@
|
||||||
class Backoffice::PreferenceListDossierController < Backoffice::DossiersListController
|
|
||||||
include SmartListing::Helper::ControllerExtensions
|
|
||||||
helper SmartListing::Helper
|
|
||||||
|
|
||||||
before_action :authenticate_gestionnaire!
|
|
||||||
before_action :params_procedure_id
|
|
||||||
|
|
||||||
def add
|
|
||||||
PreferenceListDossier.create(
|
|
||||||
libelle: params[:libelle],
|
|
||||||
table: (params[:table].empty? ? nil : params[:table]),
|
|
||||||
attr: params[:attr],
|
|
||||||
attr_decorate: params[:attr_decorate],
|
|
||||||
bootstrap_lg: params[:bootstrap_lg],
|
|
||||||
order: nil,
|
|
||||||
filter: nil,
|
|
||||||
gestionnaire: current_gestionnaire,
|
|
||||||
procedure_id: params_procedure_id
|
|
||||||
)
|
|
||||||
|
|
||||||
render partial: path, formats: :js
|
|
||||||
end
|
|
||||||
|
|
||||||
def reload_pref_list
|
|
||||||
dossiers_list_facade
|
|
||||||
|
|
||||||
render partial: 'backoffice/dossiers/pref_list', id: params_procedure_id
|
|
||||||
end
|
|
||||||
|
|
||||||
def delete
|
|
||||||
PreferenceListDossier.delete(params[:pref_id])
|
|
||||||
|
|
||||||
render partial: path, formats: :js
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def path
|
|
||||||
'backoffice/dossiers/pref_list'
|
|
||||||
end
|
|
||||||
|
|
||||||
def params_procedure_id
|
|
||||||
@procedure_id ||= params[:procedure_id]
|
|
||||||
end
|
|
||||||
|
|
||||||
def retrieve_procedure
|
|
||||||
return if params[:procedure_id].blank?
|
|
||||||
current_gestionnaire.procedures.find params_procedure_id
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,20 +0,0 @@
|
||||||
class Backoffice::PrivateFormulairesController < ApplicationController
|
|
||||||
before_action :authenticate_gestionnaire!
|
|
||||||
|
|
||||||
def update
|
|
||||||
dossier = current_gestionnaire.dossiers.find(params[:dossier_id])
|
|
||||||
|
|
||||||
unless params[:champs].nil?
|
|
||||||
ChampsService.save_champs dossier.champs_private, params
|
|
||||||
champs_service_errors = ChampsService.build_error_messages(dossier.champs_private)
|
|
||||||
|
|
||||||
if champs_service_errors.empty?
|
|
||||||
flash[:notice] = "Formulaire enregistré"
|
|
||||||
else
|
|
||||||
flash[:alert] = champs_service_errors
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
render 'backoffice/dossiers/formulaire_private', formats: :js
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,28 +0,0 @@
|
||||||
class BackofficeController < ApplicationController
|
|
||||||
include SmartListing::Helper::ControllerExtensions
|
|
||||||
helper SmartListing::Helper
|
|
||||||
|
|
||||||
before_action :authenticate_gestionnaire!, only: [:invitations]
|
|
||||||
|
|
||||||
def index
|
|
||||||
if !gestionnaire_signed_in?
|
|
||||||
redirect_to(controller: '/gestionnaires/sessions', action: :new)
|
|
||||||
else
|
|
||||||
redirect_to(:backoffice_dossiers)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def invitations
|
|
||||||
pending_avis = current_gestionnaire.avis.without_answer.includes(dossier: [:procedure]).by_latest
|
|
||||||
@pending_avis = smart_listing_create :pending_avis,
|
|
||||||
pending_avis,
|
|
||||||
partial: 'backoffice/dossiers/list_invitations',
|
|
||||||
array: true
|
|
||||||
|
|
||||||
avis_with_answer = current_gestionnaire.avis.with_answer.includes(dossier: [:procedure]).by_latest
|
|
||||||
@avis_with_answer = smart_listing_create :avis_with_answer,
|
|
||||||
avis_with_answer,
|
|
||||||
partial: 'backoffice/dossiers/list_invitations',
|
|
||||||
array: true
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -10,7 +10,7 @@ class Ban::SearchController < ApplicationController
|
||||||
def get_address_point
|
def get_address_point
|
||||||
point = Carto::Geocodeur.convert_adresse_to_point(params[:request])
|
point = Carto::Geocodeur.convert_adresse_to_point(params[:request])
|
||||||
|
|
||||||
unless point.nil?
|
if point.present?
|
||||||
lon = point.x.to_s
|
lon = point.x.to_s
|
||||||
lat = point.y.to_s
|
lat = point.y.to_s
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,13 +16,8 @@ class CommentairesController < ApplicationController
|
||||||
@commentaire.champ = @commentaire.dossier.champs.find(params[:champ_id]) if params[:champ_id]
|
@commentaire.champ = @commentaire.dossier.champs.find(params[:champ_id]) if params[:champ_id]
|
||||||
|
|
||||||
dossier_id = params['dossier_id']
|
dossier_id = params['dossier_id']
|
||||||
if is_gestionnaire?
|
|
||||||
@commentaire.email = current_gestionnaire.email
|
|
||||||
@commentaire.dossier = current_gestionnaire.dossiers.find_by(id: dossier_id) || current_gestionnaire.avis.find_by!(dossier_id: dossier_id).dossier
|
|
||||||
else
|
|
||||||
@commentaire.email = current_user.email
|
@commentaire.email = current_user.email
|
||||||
@commentaire.dossier = current_user.dossiers.find_by(id: dossier_id) || current_user.invites.find_by!(dossier_id: dossier_id).dossier
|
@commentaire.dossier = current_user.dossiers.find_by(id: dossier_id) || current_user.invites.find_by!(dossier_id: dossier_id).dossier
|
||||||
end
|
|
||||||
|
|
||||||
@commentaire.file = params["file"]
|
@commentaire.file = params["file"]
|
||||||
|
|
||||||
|
@ -33,11 +28,6 @@ class CommentairesController < ApplicationController
|
||||||
flash.alert = "Veuillez rédiger un message ou ajouter une pièce jointe (maximum 20 Mo)"
|
flash.alert = "Veuillez rédiger un message ou ajouter une pièce jointe (maximum 20 Mo)"
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_gestionnaire?
|
|
||||||
current_gestionnaire.follow(@commentaire.dossier)
|
|
||||||
|
|
||||||
redirect_to url_for(controller: 'backoffice/dossiers', action: :show, id: params['dossier_id'])
|
|
||||||
else
|
|
||||||
if current_user.email != @commentaire.dossier.user.email
|
if current_user.email != @commentaire.dossier.user.email
|
||||||
invite = Invite.where(dossier: @commentaire.dossier, email: current_user.email).first
|
invite = Invite.where(dossier: @commentaire.dossier, email: current_user.email).first
|
||||||
redirect_to url_for(controller: 'users/dossiers/invites', action: :show, id: invite.id)
|
redirect_to url_for(controller: 'users/dossiers/invites', action: :show, id: invite.id)
|
||||||
|
@ -46,8 +36,3 @@ class CommentairesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_gestionnaire?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ class FranceConnect::ParticulierController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def callback
|
def callback
|
||||||
return redirect_to new_user_session_path unless params.has_key?(:code)
|
return redirect_to new_user_session_path if !params.has_key?(:code)
|
||||||
|
|
||||||
user_infos = FranceConnectService.retrieve_user_informations_particulier(params[:code])
|
user_infos = FranceConnectService.retrieve_user_informations_particulier(params[:code])
|
||||||
|
|
||||||
unless user_infos.nil?
|
if user_infos.present?
|
||||||
france_connect_information = FranceConnectInformation.find_by_france_connect_particulier user_infos
|
france_connect_information = FranceConnectInformation.find_by_france_connect_particulier user_infos
|
||||||
|
|
||||||
france_connect_information = FranceConnectInformation.create(
|
france_connect_information = FranceConnectInformation.create(
|
||||||
|
@ -44,7 +44,7 @@ class FranceConnect::ParticulierController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
return redirect_france_connect_error_connection unless valid_salt_and_fci_id_params?
|
return redirect_france_connect_error_connection if !valid_salt_and_fci_id_params?
|
||||||
|
|
||||||
france_connect_information = FranceConnectInformation.find(params[:fci_id])
|
france_connect_information = FranceConnectInformation.find(params[:fci_id])
|
||||||
@user = User.new(france_connect_information: france_connect_information).decorate
|
@user = User.new(france_connect_information: france_connect_information).decorate
|
||||||
|
@ -53,13 +53,13 @@ class FranceConnect::ParticulierController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_email
|
def check_email
|
||||||
return redirect_france_connect_error_connection unless valid_salt_and_fci_id_params?
|
return redirect_france_connect_error_connection if !valid_salt_and_fci_id_params?
|
||||||
|
|
||||||
user = User.find_by_email(params[:user][:email_france_connect])
|
user = User.find_by_email(params[:user][:email_france_connect])
|
||||||
|
|
||||||
return create if user.nil?
|
return create if user.nil?
|
||||||
|
|
||||||
unless params[:user][:password].nil?
|
if params[:user][:password].present?
|
||||||
|
|
||||||
if user.valid_password?(params[:user][:password])
|
if user.valid_password?(params[:user][:password])
|
||||||
user.france_connect_information = FranceConnectInformation.find(params[:fci_id])
|
user.france_connect_information = FranceConnectInformation.find(params[:fci_id])
|
||||||
|
@ -80,7 +80,7 @@ class FranceConnect::ParticulierController < ApplicationController
|
||||||
user = User.new email: params[:user][:email_france_connect]
|
user = User.new email: params[:user][:email_france_connect]
|
||||||
user.password = Devise.friendly_token[0, 20]
|
user.password = Devise.friendly_token[0, 20]
|
||||||
|
|
||||||
unless user.valid?
|
if !user.valid?
|
||||||
flash.alert = 'Email non valide'
|
flash.alert = 'Email non valide'
|
||||||
|
|
||||||
return redirect_to france_connect_particulier_new_path fci_id: params[:fci_id], salt: params[:salt], user: {email_france_connect: params[:user]['email_france_connect']}
|
return redirect_to france_connect_particulier_new_path fci_id: params[:fci_id], salt: params[:salt], user: {email_france_connect: params[:user]['email_france_connect']}
|
||||||
|
|
|
@ -13,25 +13,26 @@ class InvitesController < ApplicationController
|
||||||
invite = class_var.create(dossier: dossier, user: user, email: email, email_sender: email_sender)
|
invite = class_var.create(dossier: dossier, user: user, email: email, email_sender: email_sender)
|
||||||
|
|
||||||
if invite.valid?
|
if invite.valid?
|
||||||
InviteMailer.invite_user(invite).deliver_now! unless invite.user.nil?
|
if invite.user.present?
|
||||||
InviteMailer.invite_guest(invite).deliver_now! if invite.user.nil?
|
InviteMailer.invite_user(invite).deliver_now!
|
||||||
|
else
|
||||||
|
InviteMailer.invite_guest(invite).deliver_now!
|
||||||
|
end
|
||||||
|
|
||||||
flash.notice = "Invitation envoyée (#{invite.email})"
|
flash.notice = "Invitation envoyée (#{invite.email})"
|
||||||
else
|
else
|
||||||
flash.alert = invite.errors.full_messages
|
flash.alert = invite.errors.full_messages
|
||||||
end
|
end
|
||||||
|
|
||||||
if gestionnaire_signed_in?
|
|
||||||
redirect_to url_for(controller: 'backoffice/dossiers', action: :show, id: params['dossier_id'])
|
|
||||||
else
|
|
||||||
redirect_to url_for(controller: 'users/recapitulatif', action: :show, dossier_id: params['dossier_id'])
|
redirect_to url_for(controller: 'users/recapitulatif', action: :show, dossier_id: params['dossier_id'])
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def gestionnaire_or_user?
|
def gestionnaire_or_user?
|
||||||
return redirect_to root_path unless user_signed_in? || gestionnaire_signed_in?
|
if !user_signed_in? && !gestionnaire_signed_in?
|
||||||
|
return redirect_to root_path
|
||||||
|
end
|
||||||
|
|
||||||
@current_devise_profil = current_user if user_signed_in?
|
@current_devise_profil = current_user if user_signed_in?
|
||||||
@current_devise_profil = current_gestionnaire if gestionnaire_signed_in?
|
@current_devise_profil = current_gestionnaire if gestionnaire_signed_in?
|
||||||
|
|
|
@ -136,13 +136,13 @@ module NewGestionnaire
|
||||||
|
|
||||||
def position
|
def position
|
||||||
etablissement = dossier.etablissement
|
etablissement = dossier.etablissement
|
||||||
point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse) unless etablissement.nil?
|
point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse) if etablissement.present?
|
||||||
|
|
||||||
lon = "2.428462"
|
lon = "2.428462"
|
||||||
lat = "46.538192"
|
lat = "46.538192"
|
||||||
zoom = "13"
|
zoom = "13"
|
||||||
|
|
||||||
unless point.nil?
|
if point.present?
|
||||||
lon = point.x.to_s
|
lon = point.x.to_s
|
||||||
lat = point.y.to_s
|
lat = point.y.to_s
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,16 +2,9 @@ class RootController < ApplicationController
|
||||||
layout 'new_application'
|
layout 'new_application'
|
||||||
|
|
||||||
def index
|
def index
|
||||||
# TODO delete new_ui when old UI is no longer used
|
if administrateur_signed_in?
|
||||||
if params[:new_ui].present? && gestionnaire_signed_in?
|
|
||||||
return redirect_to procedures_path
|
|
||||||
elsif administrateur_signed_in?
|
|
||||||
return redirect_to admin_procedures_path
|
return redirect_to admin_procedures_path
|
||||||
elsif gestionnaire_signed_in?
|
elsif gestionnaire_signed_in?
|
||||||
# to be removed when old ui is deleted
|
|
||||||
if params[:old_ui].present?
|
|
||||||
return redirect_to backoffice_path
|
|
||||||
end
|
|
||||||
return redirect_to procedures_path
|
return redirect_to procedures_path
|
||||||
elsif user_signed_in?
|
elsif user_signed_in?
|
||||||
return redirect_to users_dossiers_path
|
return redirect_to users_dossiers_path
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Users::CarteController < UsersController
|
||||||
dossier.quartier_prioritaires.each(&:destroy)
|
dossier.quartier_prioritaires.each(&:destroy)
|
||||||
dossier.cadastres.each(&:destroy)
|
dossier.cadastres.each(&:destroy)
|
||||||
|
|
||||||
unless params[:json_latlngs].blank?
|
if params[:json_latlngs].present?
|
||||||
ModuleApiCartoService.save_qp! dossier, params[:json_latlngs]
|
ModuleApiCartoService.save_qp! dossier, params[:json_latlngs]
|
||||||
ModuleApiCartoService.save_cadastre! dossier, params[:json_latlngs]
|
ModuleApiCartoService.save_cadastre! dossier, params[:json_latlngs]
|
||||||
end
|
end
|
||||||
|
@ -37,13 +37,13 @@ class Users::CarteController < UsersController
|
||||||
etablissement = nil
|
etablissement = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse) unless etablissement.nil?
|
point = Carto::Geocodeur.convert_adresse_to_point(etablissement.geo_adresse) if etablissement.present?
|
||||||
|
|
||||||
lon = '2.428462'
|
lon = '2.428462'
|
||||||
lat = '46.538192'
|
lat = '46.538192'
|
||||||
zoom = '13'
|
zoom = '13'
|
||||||
|
|
||||||
unless point.nil?
|
if point.present?
|
||||||
lon = point.x.to_s
|
lon = point.x.to_s
|
||||||
lat = point.y.to_s
|
lat = point.y.to_s
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Users::DescriptionController < UsersController
|
||||||
|
|
||||||
@headers = @champs.select { |c| c.type_champ == 'header_section' }
|
@headers = @champs.select { |c| c.type_champ == 'header_section' }
|
||||||
|
|
||||||
unless @dossier.can_be_en_construction?
|
if !@dossier.can_be_en_construction?
|
||||||
flash[:alert] = t('errors.messages.procedure_archived')
|
flash[:alert] = t('errors.messages.procedure_archived')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,13 +27,13 @@ class Users::DescriptionController < UsersController
|
||||||
dossier = current_user_dossier
|
dossier = current_user_dossier
|
||||||
procedure = dossier.procedure
|
procedure = dossier.procedure
|
||||||
|
|
||||||
return head :forbidden unless dossier.can_be_en_construction?
|
return head :forbidden if !dossier.can_be_en_construction?
|
||||||
|
|
||||||
ChampsService.save_champs(dossier.champs, params) if params[:champs]
|
ChampsService.save_champs(dossier.champs, params) if params[:champs]
|
||||||
|
|
||||||
if procedure.cerfa_flag? && params[:cerfa_pdf]
|
if procedure.cerfa_flag? && params[:cerfa_pdf]
|
||||||
cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: dossier, user: current_user)
|
cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: dossier, user: current_user)
|
||||||
return redirect_to_description_with_errors(dossier, cerfa.errors.full_messages) unless cerfa.save
|
return redirect_to_description_with_errors(dossier, cerfa.errors.full_messages) if !cerfa.save
|
||||||
end
|
end
|
||||||
|
|
||||||
errors_upload = PiecesJustificativesService.upload!(dossier, current_user, params)
|
errors_upload = PiecesJustificativesService.upload!(dossier, current_user, params)
|
||||||
|
@ -69,15 +69,15 @@ class Users::DescriptionController < UsersController
|
||||||
@dossier ||= current_user_dossier
|
@dossier ||= current_user_dossier
|
||||||
|
|
||||||
if @dossier.procedure.cerfa_flag?
|
if @dossier.procedure.cerfa_flag?
|
||||||
unless params[:cerfa_pdf].nil?
|
if params[:cerfa_pdf].present?
|
||||||
cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: @dossier, user: current_user)
|
cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: @dossier, user: current_user)
|
||||||
unless cerfa.save
|
if !cerfa.save
|
||||||
flash.alert = cerfa.errors.full_messages
|
flash.alert = cerfa.errors.full_messages
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if !((errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).empty?)
|
if (errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).present?
|
||||||
if flash.alert.nil?
|
if flash.alert.nil?
|
||||||
flash.alert = errors_upload
|
flash.alert = errors_upload
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,9 +2,9 @@ class Users::Dossiers::AddSiretController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@facade = DossierFacades.new params[:dossier_id], current_user.email
|
@facade = DossierFacades.new params[:dossier_id], current_user.email
|
||||||
|
|
||||||
raise ActiveRecord::RecordNotFound unless @facade.procedure.individual_with_siret?
|
raise ActiveRecord::RecordNotFound if !@facade.procedure.individual_with_siret?
|
||||||
|
|
||||||
@siret = current_user.siret unless current_user.siret.nil?
|
@siret = current_user.siret if current_user.siret.present?
|
||||||
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
flash.alert = t('errors.messages.dossier_not_found')
|
flash.alert = t('errors.messages.dossier_not_found')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class Users::Dossiers::InvitesController < UsersController
|
class Users::Dossiers::InvitesController < UsersController
|
||||||
def authenticate_user!
|
def authenticate_user!
|
||||||
session["user_return_to"] = request.fullpath
|
session["user_return_to"] = request.fullpath
|
||||||
return redirect_to new_user_registration_path(user_email: params[:email]) if !params[:email].blank? && User.find_by_email(params[:email]).nil?
|
return redirect_to new_user_registration_path(user_email: params[:email]) if params[:email].present? && User.find_by_email(params[:email]).nil?
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Users::DossiersController < UsersController
|
||||||
end
|
end
|
||||||
|
|
||||||
def commencer
|
def commencer
|
||||||
unless params[:procedure_path].nil?
|
if params[:procedure_path].present?
|
||||||
procedure_path = ProcedurePath.where(path: params[:procedure_path]).last
|
procedure_path = ProcedurePath.where(path: params[:procedure_path]).last
|
||||||
|
|
||||||
if procedure_path.nil? || procedure_path.procedure.nil?
|
if procedure_path.nil? || procedure_path.procedure.nil?
|
||||||
|
@ -65,7 +65,7 @@ class Users::DossiersController < UsersController
|
||||||
dossier = Dossier.create(procedure: procedure, user: current_user, state: 'brouillon')
|
dossier = Dossier.create(procedure: procedure, user: current_user, state: 'brouillon')
|
||||||
siret = params[:siret] || current_user.siret
|
siret = params[:siret] || current_user.siret
|
||||||
|
|
||||||
update_current_user_siret! siret unless siret.nil?
|
update_current_user_siret! siret if siret.present?
|
||||||
|
|
||||||
redirect_to users_dossier_path(id: dossier.id)
|
redirect_to users_dossier_path(id: dossier.id)
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
@ -74,7 +74,7 @@ class Users::DossiersController < UsersController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@facade = facade
|
@facade = facade
|
||||||
@siret = current_user.siret unless current_user.siret.nil?
|
@siret = current_user.siret if current_user.siret.present?
|
||||||
|
|
||||||
if @facade.procedure.for_individual? && current_user.loged_in_with_france_connect?
|
if @facade.procedure.for_individual? && current_user.loged_in_with_france_connect?
|
||||||
individual = @facade.dossier.individual
|
individual = @facade.dossier.individual
|
||||||
|
@ -135,7 +135,7 @@ class Users::DossiersController < UsersController
|
||||||
flash.alert = individual_errors
|
flash.alert = individual_errors
|
||||||
redirect_to users_dossier_path(id: @facade.dossier.id)
|
redirect_to users_dossier_path(id: @facade.dossier.id)
|
||||||
else
|
else
|
||||||
unless Dossier.find(@facade.dossier.id).update_attributes update_params_with_formatted_birthdate
|
if !Dossier.find(@facade.dossier.id).update_attributes update_params_with_formatted_birthdate
|
||||||
flash.alert = @facade.dossier.errors.full_messages
|
flash.alert = @facade.dossier.errors.full_messages
|
||||||
|
|
||||||
return redirect_to users_dossier_path(id: @facade.dossier.id)
|
return redirect_to users_dossier_path(id: @facade.dossier.id)
|
||||||
|
@ -174,7 +174,7 @@ class Users::DossiersController < UsersController
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_siret
|
def check_siret
|
||||||
errors_valid_siret unless Siret.new(siret: siret).valid?
|
errors_valid_siret if !Siret.new(siret: siret).valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
def errors_valid_siret
|
def errors_valid_siret
|
||||||
|
|
|
@ -3,7 +3,7 @@ class Users::SessionsController < Sessions::SessionsController
|
||||||
|
|
||||||
# GET /resource/sign_in
|
# GET /resource/sign_in
|
||||||
def new
|
def new
|
||||||
unless user_return_to_procedure_id.nil? # WTF ?
|
if user_return_to_procedure_id.present? # WTF ?
|
||||||
@dossier = Dossier.new(procedure: Procedure.active(user_return_to_procedure_id))
|
@dossier = Dossier.new(procedure: Procedure.active(user_return_to_procedure_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def authorized_routes? controller
|
def authorized_routes? controller
|
||||||
redirect_to_root_path 'Le statut de votre dossier n\'autorise pas cette URL' unless UserRoutesAuthorizationService.authorized_route?(
|
redirect_to_root_path 'Le statut de votre dossier n\'autorise pas cette URL' if !UserRoutesAuthorizationService.authorized_route?(
|
||||||
controller,
|
controller,
|
||||||
current_user_dossier)
|
current_user_dossier)
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
|
|
@ -17,9 +17,7 @@ class DossierDecorator < Draper::Decorator
|
||||||
end
|
end
|
||||||
|
|
||||||
def url(gestionnaire_signed_in)
|
def url(gestionnaire_signed_in)
|
||||||
if gestionnaire_signed_in
|
if brouillon?
|
||||||
backoffice_dossier_path(id)
|
|
||||||
elsif brouillon?
|
|
||||||
users_dossier_description_path(id)
|
users_dossier_description_path(id)
|
||||||
else
|
else
|
||||||
users_dossier_recapitulatif_path(id)
|
users_dossier_recapitulatif_path(id)
|
||||||
|
|
|
@ -2,7 +2,7 @@ class ProcedureDecorator < Draper::Decorator
|
||||||
delegate_all
|
delegate_all
|
||||||
|
|
||||||
def lien
|
def lien
|
||||||
h.commencer_url(procedure_path: path) unless path.nil?
|
h.commencer_url(procedure_path: path) if path.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def created_at_fr
|
def created_at_fr
|
||||||
|
|
|
@ -18,7 +18,7 @@ class DossierFacades
|
||||||
end
|
end
|
||||||
|
|
||||||
def entreprise
|
def entreprise
|
||||||
@dossier.entreprise.decorate unless @dossier.entreprise.nil? || @dossier.entreprise.siren.blank?
|
@dossier.entreprise.decorate if @dossier.entreprise.present? && @dossier.entreprise.siren.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def etablissement
|
def etablissement
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
class DossiersListFacades
|
|
||||||
include Rails.application.routes.url_helpers
|
|
||||||
|
|
||||||
attr_accessor :procedure, :current_devise_profil, :liste
|
|
||||||
|
|
||||||
def initialize current_devise_profil, liste, procedure = nil
|
|
||||||
@current_devise_profil = current_devise_profil
|
|
||||||
@liste = liste
|
|
||||||
@procedure = procedure
|
|
||||||
end
|
|
||||||
|
|
||||||
def service
|
|
||||||
@service ||= DossiersListGestionnaireService.new @current_devise_profil, @liste, @procedure
|
|
||||||
end
|
|
||||||
|
|
||||||
def total_dossier
|
|
||||||
current_devise_profil.dossiers.not_archived.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def total_dossier_follow
|
|
||||||
@current_devise_profil.followed_dossiers.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def gestionnaire_procedures_name_and_id_list
|
|
||||||
@current_devise_profil.procedures.order('libelle ASC').inject([]) { |acc, procedure| acc.push({id: procedure.id, libelle: procedure.libelle, unread_notifications: @current_devise_profil.dossiers_with_notifications_count_for_procedure(procedure)}) }
|
|
||||||
end
|
|
||||||
|
|
||||||
def unread_notifications
|
|
||||||
current_devise_profil.notifications
|
|
||||||
end
|
|
||||||
|
|
||||||
def dossiers_with_unread_notifications
|
|
||||||
(unread_notifications.inject([]) { |acc, notif| acc.push(notif.dossier) }).uniq
|
|
||||||
end
|
|
||||||
|
|
||||||
def procedure_id
|
|
||||||
@procedure.nil? ? nil : @procedure.id
|
|
||||||
end
|
|
||||||
|
|
||||||
def dossiers_to_display
|
|
||||||
service.dossiers_to_display
|
|
||||||
end
|
|
||||||
|
|
||||||
def preference_list_dossiers_filter
|
|
||||||
@list_table_columns ||= @current_devise_profil.preference_list_dossiers.where(procedure: @procedure).order(:id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def active_filter? preference
|
|
||||||
return true if @procedure.nil? || preference.table != 'champs' || (preference.table == 'champs' && !preference.filter.blank?)
|
|
||||||
|
|
||||||
preference_list_dossiers_filter.where(table: :champs).where.not(filter: '').size == 0
|
|
||||||
end
|
|
||||||
|
|
||||||
def all_state_total
|
|
||||||
service.all_state.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def nouveaux_total
|
|
||||||
service.nouveaux.without_followers.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def suivi_total
|
|
||||||
service.suivi.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def filter_url
|
|
||||||
@procedure.nil? ? backoffice_dossiers_filter_path(liste: liste) : backoffice_dossiers_procedure_filter_path(id: @procedure.id, liste: liste)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def base_url liste
|
|
||||||
@procedure.nil? ? backoffice_dossiers_path(liste: liste) : backoffice_dossiers_procedure_path(id: @procedure.id, liste: liste)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -8,7 +8,7 @@ class FileSizeValidator < ActiveModel::EachValidator
|
||||||
|
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
if range = (options.delete(:in) || options.delete(:within))
|
if range = (options.delete(:in) || options.delete(:within))
|
||||||
raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range)
|
raise ArgumentError, ":in and :within must be a Range" if !range.is_a?(Range)
|
||||||
options[:minimum], options[:maximum] = range.begin, range.end
|
options[:minimum], options[:maximum] = range.begin, range.end
|
||||||
options[:maximum] -= 1 if range.exclude_end?
|
options[:maximum] -= 1 if range.exclude_end?
|
||||||
end
|
end
|
||||||
|
@ -26,19 +26,19 @@ class FileSizeValidator < ActiveModel::EachValidator
|
||||||
keys.each do |key|
|
keys.each do |key|
|
||||||
value = options[key]
|
value = options[key]
|
||||||
|
|
||||||
unless (value.is_a?(Integer) && value >= 0) || value.is_a?(Symbol)
|
if !(value.is_a?(Integer) && value >= 0) && !value.is_a?(Symbol)
|
||||||
raise ArgumentError, ":#{key} must be a nonnegative Integer or symbol"
|
raise ArgumentError, ":#{key} must be a nonnegative Integer or symbol"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_each(record, attribute, value)
|
def validate_each(record, attribute, value)
|
||||||
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
|
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") if !value.kind_of? CarrierWave::Uploader::Base
|
||||||
|
|
||||||
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
|
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
|
||||||
|
|
||||||
CHECKS.each do |key, validity_check|
|
CHECKS.each do |key, validity_check|
|
||||||
next unless check_value = options[key]
|
next if !check_value = options[key]
|
||||||
|
|
||||||
check_value =
|
check_value =
|
||||||
case check_value
|
case check_value
|
||||||
|
|
|
@ -33,7 +33,9 @@ class SIADE::EtablissementAdapter
|
||||||
def adresse
|
def adresse
|
||||||
adresse = ''
|
adresse = ''
|
||||||
[:l1, :l2, :l3, :l4, :l5, :l6, :l7].each do |line|
|
[:l1, :l2, :l3, :l4, :l5, :l6, :l7].each do |line|
|
||||||
adresse = adresse + data_source[:etablissement][:adresse][line] + "\r\n" unless data_source[:etablissement][:adresse][line].nil?
|
if data_source[:etablissement][:adresse][line].present?
|
||||||
|
adresse = adresse + data_source[:etablissement][:adresse][line] + "\r\n"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
adresse
|
adresse
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ class InviteMailer < ApplicationMailer
|
||||||
def invite_user invite
|
def invite_user invite
|
||||||
vars_mailer invite
|
vars_mailer invite
|
||||||
|
|
||||||
send_mail invite.email, "TPS - Participez à l'élaboration d'un dossier", invite.email_sender unless invite.user.nil?
|
send_mail invite.email, "TPS - Participez à l'élaboration d'un dossier", invite.email_sender if invite.user.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def invite_guest invite
|
def invite_guest invite
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Administrateur < ActiveRecord::Base
|
||||||
def generate_api_token
|
def generate_api_token
|
||||||
loop do
|
loop do
|
||||||
token = SecureRandom.hex(20)
|
token = SecureRandom.hex(20)
|
||||||
break token unless Administrateur.find_by(api_token: token)
|
break token if !Administrateur.find_by(api_token: token)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,14 +5,14 @@ class Cerfa < ActiveRecord::Base
|
||||||
mount_uploader :content, CerfaUploader
|
mount_uploader :content, CerfaUploader
|
||||||
validates :content, :file_size => {:maximum => 20.megabytes}
|
validates :content, :file_size => {:maximum => 20.megabytes}
|
||||||
|
|
||||||
after_save :internal_notification, if: Proc.new { !dossier.nil? }
|
after_save :internal_notification, if: Proc.new { dossier.present? }
|
||||||
|
|
||||||
def empty?
|
def empty?
|
||||||
content.blank?
|
content.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_url
|
def content_url
|
||||||
unless content.url.nil?
|
if content.url.present?
|
||||||
if Features.remote_storage
|
if Features.remote_storage
|
||||||
(RemoteDownloader.new content.filename).url
|
(RemoteDownloader.new content.filename).url
|
||||||
else
|
else
|
||||||
|
@ -24,7 +24,7 @@ class Cerfa < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def internal_notification
|
def internal_notification
|
||||||
unless dossier.state == 'brouillon'
|
if dossier.state != 'brouillon'
|
||||||
NotificationService.new('cerfa', self.dossier.id).notify
|
NotificationService.new('cerfa', self.dossier.id).notify
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Champ < ActiveRecord::Base
|
||||||
before_save :serialize_datetime_if_needed, if: Proc.new { type_champ == 'datetime' }
|
before_save :serialize_datetime_if_needed, if: Proc.new { type_champ == 'datetime' }
|
||||||
before_save :multiple_select_to_string, if: Proc.new { type_champ == 'multiple_drop_down_list' }
|
before_save :multiple_select_to_string, if: Proc.new { type_champ == 'multiple_drop_down_list' }
|
||||||
|
|
||||||
after_save :internal_notification, if: Proc.new { !dossier.nil? }
|
after_save :internal_notification, if: Proc.new { dossier.present? }
|
||||||
|
|
||||||
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
|
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class Champ < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def same_date? num, compare
|
def same_date? num, compare
|
||||||
if type_champ == 'datetime' && !value.nil?
|
if type_champ == 'datetime' && value.present?
|
||||||
if value.to_datetime.strftime(compare) == num
|
if value.to_datetime.strftime(compare) == num
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -167,7 +167,7 @@ class Dossier < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def export_entreprise_data
|
def export_entreprise_data
|
||||||
unless entreprise.nil?
|
if entreprise.present?
|
||||||
etablissement_attr = EtablissementCsvSerializer.new(self.etablissement).attributes.map { |k, v| ["etablissement.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
etablissement_attr = EtablissementCsvSerializer.new(self.etablissement).attributes.map { |k, v| ["etablissement.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||||
entreprise_attr = EntrepriseSerializer.new(self.entreprise).attributes.map { |k, v| ["entreprise.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
entreprise_attr = EntrepriseSerializer.new(self.entreprise).attributes.map { |k, v| ["entreprise.#{k}".parameterize.underscore.to_sym, v] }.to_h
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,7 +7,7 @@ class DropDownList < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def disabled_options
|
def disabled_options
|
||||||
options.select{ |v| !(v =~ /^--.*--$/).nil? }
|
options.select{ |v| (v =~ /^--.*--$/).present? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def selected_options(champ)
|
def selected_options(champ)
|
||||||
|
|
|
@ -4,19 +4,13 @@ class Gestionnaire < ActiveRecord::Base
|
||||||
|
|
||||||
has_and_belongs_to_many :administrateurs
|
has_and_belongs_to_many :administrateurs
|
||||||
|
|
||||||
has_one :preference_smart_listing_page, dependent: :destroy
|
|
||||||
|
|
||||||
has_many :assign_to, dependent: :destroy
|
has_many :assign_to, dependent: :destroy
|
||||||
has_many :procedures, -> { publiees_ou_archivees }, through: :assign_to
|
has_many :procedures, -> { publiees_ou_archivees }, through: :assign_to
|
||||||
has_many :dossiers, -> { state_not_brouillon }, through: :procedures
|
has_many :dossiers, -> { state_not_brouillon }, through: :procedures
|
||||||
has_many :followed_dossiers, through: :follows, source: :dossier
|
has_many :followed_dossiers, through: :follows, source: :dossier
|
||||||
has_many :follows
|
has_many :follows
|
||||||
has_many :preference_list_dossiers
|
|
||||||
has_many :avis
|
has_many :avis
|
||||||
|
|
||||||
after_create :build_default_preferences_list_dossier
|
|
||||||
after_create :build_default_preferences_smart_listing_page
|
|
||||||
|
|
||||||
include CredentialsSyncableConcern
|
include CredentialsSyncableConcern
|
||||||
|
|
||||||
def procedure_filter
|
def procedure_filter
|
||||||
|
@ -52,30 +46,6 @@ class Gestionnaire < ActiveRecord::Base
|
||||||
procedures.find_by(id: procedure_id).present?
|
procedures.find_by(id: procedure_id).present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_default_preferences_list_dossier procedure_id=nil
|
|
||||||
PreferenceListDossier.available_columns_for(procedure_id).each do |table|
|
|
||||||
table.second.each do |column|
|
|
||||||
if valid_couple_table_attr? table.first, column.first
|
|
||||||
PreferenceListDossier.create(
|
|
||||||
libelle: column.second[:libelle],
|
|
||||||
table: column.second[:table],
|
|
||||||
attr: column.second[:attr],
|
|
||||||
attr_decorate: column.second[:attr_decorate],
|
|
||||||
bootstrap_lg: column.second[:bootstrap_lg],
|
|
||||||
order: nil,
|
|
||||||
filter: nil,
|
|
||||||
procedure_id: procedure_id,
|
|
||||||
gestionnaire: self
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_default_preferences_smart_listing_page
|
|
||||||
PreferenceSmartListingPage.create(page: 1, procedure: nil, gestionnaire: self, liste: 'a_traiter')
|
|
||||||
end
|
|
||||||
|
|
||||||
def notifications
|
def notifications
|
||||||
Notification.where(already_read: false, dossier_id: follows.pluck(:dossier_id)).order("updated_at DESC")
|
Notification.where(already_read: false, dossier_id: follows.pluck(:dossier_id)).order("updated_at DESC")
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ class PieceJustificative < ActiveRecord::Base
|
||||||
validates :content, :file_size => {:maximum => 20.megabytes}
|
validates :content, :file_size => {:maximum => 20.megabytes}
|
||||||
validates :content, presence: true, allow_blank: false, allow_nil: false
|
validates :content, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
||||||
after_save :internal_notification, if: Proc.new { !dossier.nil? }
|
after_save :internal_notification, if: Proc.new { dossier.present? }
|
||||||
|
|
||||||
scope :updated_since?, -> (date) { where('pieces_justificatives.updated_at > ?', date) }
|
scope :updated_since?, -> (date) { where('pieces_justificatives.updated_at > ?', date) }
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class PieceJustificative < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_url
|
def content_url
|
||||||
unless content.url.nil?
|
if content.url.present?
|
||||||
if Features.remote_storage
|
if Features.remote_storage
|
||||||
(RemoteDownloader.new content.filename).url
|
(RemoteDownloader.new content.filename).url
|
||||||
else
|
else
|
||||||
|
@ -59,7 +59,7 @@ class PieceJustificative < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def internal_notification
|
def internal_notification
|
||||||
unless self.type_de_piece_justificative.nil? && dossier.state == 'brouillon'
|
if self.type_de_piece_justificative.present? || dossier.state != 'brouillon'
|
||||||
NotificationService.new('piece_justificative', self.dossier.id, self.libelle).notify
|
NotificationService.new('piece_justificative', self.dossier.id, self.libelle).notify
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,133 +0,0 @@
|
||||||
class PreferenceListDossier < ActiveRecord::Base
|
|
||||||
belongs_to :gestionnaire
|
|
||||||
belongs_to :procedure
|
|
||||||
|
|
||||||
def table_attr
|
|
||||||
return self.attr if table.nil? || table.empty?
|
|
||||||
table + '.' + attr
|
|
||||||
end
|
|
||||||
|
|
||||||
def table_with_s_attr
|
|
||||||
return 'dossiers.' + self.attr if table.nil? || table.empty?
|
|
||||||
table + 's' + '.' + attr
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.available_columns_for procedure_id = nil
|
|
||||||
columns = {
|
|
||||||
dossier: columns_dossier,
|
|
||||||
procedure: columns_procedure,
|
|
||||||
entreprise: columns_entreprise,
|
|
||||||
etablissement: columns_etablissement,
|
|
||||||
user: columns_user,
|
|
||||||
france_connect: columns_france_connect
|
|
||||||
}
|
|
||||||
|
|
||||||
columns = columns.merge({
|
|
||||||
champs: columns_champs_procedure(procedure_id),
|
|
||||||
champs_private: columns_champs_private_procedure(procedure_id)
|
|
||||||
}) unless procedure_id.nil?
|
|
||||||
|
|
||||||
columns
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def self.columns_dossier
|
|
||||||
table = nil
|
|
||||||
|
|
||||||
{
|
|
||||||
dossier_id: create_column('Nº', table, 'id', 'id', 1),
|
|
||||||
created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2),
|
|
||||||
updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2),
|
|
||||||
state: create_column('État', table, 'state', 'display_state', 1)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.columns_procedure
|
|
||||||
table = 'procedure'
|
|
||||||
|
|
||||||
{
|
|
||||||
libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4),
|
|
||||||
organisation: create_column('Organisme', table, 'organisation', 'organisation', 3),
|
|
||||||
direction: create_column('Direction', table, 'direction', 'direction', 3)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.columns_entreprise
|
|
||||||
table = 'entreprise'
|
|
||||||
|
|
||||||
{
|
|
||||||
siren: create_column('SIREN', table, 'siren', 'siren', 2),
|
|
||||||
forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3),
|
|
||||||
nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3),
|
|
||||||
raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3),
|
|
||||||
siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2),
|
|
||||||
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2),
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.columns_etablissement
|
|
||||||
table = 'etablissement'
|
|
||||||
|
|
||||||
{
|
|
||||||
siret: create_column('SIRET', table, 'siret', 'siret', 2),
|
|
||||||
libelle: create_column('Libellé NAF', table, 'libelle_naf', 'libelle_naf', 3),
|
|
||||||
code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.columns_user
|
|
||||||
table = 'user'
|
|
||||||
{
|
|
||||||
email: create_column('Email', table, 'email', 'email', 2)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.columns_france_connect
|
|
||||||
table = 'france_connect_information'
|
|
||||||
|
|
||||||
{
|
|
||||||
gender: create_column('Civilité (FC)', table, 'gender', 'gender_fr', 1),
|
|
||||||
given_name: create_column('Prénom (FC)', table, 'given_name', 'given_name', 2),
|
|
||||||
family_name: create_column('Nom (FC)', table, 'family_name', 'family_name', 2)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.columns_champs_procedure procedure_id
|
|
||||||
table = 'champs'
|
|
||||||
|
|
||||||
if procedure = Procedure.find_by(id: procedure_id)
|
|
||||||
procedure.types_de_champ.inject({}) do |acc, type_de_champ|
|
|
||||||
acc = acc.merge({
|
|
||||||
"type_de_champ_#{type_de_champ.id}" => create_column(type_de_champ.libelle, table, type_de_champ.id, 'value', 2)
|
|
||||||
}) if type_de_champ.field_for_list?
|
|
||||||
acc
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.columns_champs_private_procedure procedure_id
|
|
||||||
table = 'champs_private'
|
|
||||||
|
|
||||||
if procedure = Procedure.find_by(id: procedure_id)
|
|
||||||
procedure.types_de_champ_private.inject({}) do |acc, type_de_champ|
|
|
||||||
acc = acc.merge({
|
|
||||||
"type_de_champ_private_#{type_de_champ.id}" => create_column(type_de_champ.libelle, table, type_de_champ.id, 'value', 2)
|
|
||||||
}) if type_de_champ.field_for_list?
|
|
||||||
acc
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.create_column libelle, table, attr, attr_decorate, bootstrap_lg
|
|
||||||
{
|
|
||||||
libelle: libelle,
|
|
||||||
table: table,
|
|
||||||
attr: attr,
|
|
||||||
attr_decorate: attr_decorate,
|
|
||||||
bootstrap_lg: bootstrap_lg,
|
|
||||||
order: nil,
|
|
||||||
filter: nil
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,11 +0,0 @@
|
||||||
class PreferenceSmartListingPage < ActiveRecord::Base
|
|
||||||
belongs_to :gestionnaire
|
|
||||||
belongs_to :procedure
|
|
||||||
|
|
||||||
validates :page, presence: true, allow_blank: false, allow_nil: false
|
|
||||||
validates :liste, presence: true, allow_blank: false, allow_nil: false
|
|
||||||
validates :procedure, presence: true, allow_blank: true, allow_nil: true
|
|
||||||
validates :gestionnaire, presence: true, allow_blank: false, allow_nil: false
|
|
||||||
|
|
||||||
validates_uniqueness_of :gestionnaire_id
|
|
||||||
end
|
|
|
@ -14,8 +14,6 @@ class Procedure < ActiveRecord::Base
|
||||||
has_many :assign_to, dependent: :destroy
|
has_many :assign_to, dependent: :destroy
|
||||||
has_many :gestionnaires, through: :assign_to
|
has_many :gestionnaires, through: :assign_to
|
||||||
|
|
||||||
has_many :preference_list_dossiers
|
|
||||||
|
|
||||||
has_one :initiated_mail, class_name: "Mails::InitiatedMail", dependent: :destroy
|
has_one :initiated_mail, class_name: "Mails::InitiatedMail", dependent: :destroy
|
||||||
has_one :received_mail, class_name: "Mails::ReceivedMail", dependent: :destroy
|
has_one :received_mail, class_name: "Mails::ReceivedMail", dependent: :destroy
|
||||||
has_one :closed_mail, class_name: "Mails::ClosedMail", dependent: :destroy
|
has_one :closed_mail, class_name: "Mails::ClosedMail", dependent: :destroy
|
||||||
|
@ -49,7 +47,7 @@ class Procedure < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def path
|
def path
|
||||||
procedure_path.path unless procedure_path.nil?
|
procedure_path.path if procedure_path.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_path
|
def default_path
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Search < ActiveRecord::Base
|
||||||
belongs_to :dossier
|
belongs_to :dossier
|
||||||
|
|
||||||
def results
|
def results
|
||||||
unless @query.present?
|
if @query.blank?
|
||||||
return Search.none
|
return Search.none
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@ class Siret
|
||||||
before_validation :remove_whitespace
|
before_validation :remove_whitespace
|
||||||
|
|
||||||
def remove_whitespace
|
def remove_whitespace
|
||||||
siret.delete!(' ') unless siret.nil?
|
siret.delete!(' ') if siret.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def loged_in_with_france_connect?
|
def loged_in_with_france_connect?
|
||||||
!loged_in_with_france_connect.nil?
|
loged_in_with_france_connect.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def invite? dossier_id
|
def invite? dossier_id
|
||||||
|
|
|
@ -16,11 +16,4 @@ class AccompagnateurService
|
||||||
AssignTo.where(gestionnaire: @accompagnateur, procedure: @procedure).delete_all
|
AssignTo.where(gestionnaire: @accompagnateur, procedure: @procedure).delete_all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_default_column
|
|
||||||
return unless @to == ASSIGN
|
|
||||||
return unless PreferenceListDossier.where(gestionnaire: @accompagnateur, procedure: @procedure).empty?
|
|
||||||
|
|
||||||
@accompagnateur.build_default_preferences_list_dossier @procedure.id
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,7 +40,7 @@ class DossierService
|
||||||
private
|
private
|
||||||
|
|
||||||
def mandataire_social? mandataires_list
|
def mandataire_social? mandataires_list
|
||||||
unless @france_connect_information.nil?
|
if @france_connect_information.present?
|
||||||
|
|
||||||
mandataires_list.each do |mandataire|
|
mandataires_list.each do |mandataire|
|
||||||
return true if mandataire[:nom].casecmp(@france_connect_information.family_name).zero? &&
|
return true if mandataire[:nom].casecmp(@france_connect_information.family_name).zero? &&
|
||||||
|
|
|
@ -1,184 +0,0 @@
|
||||||
class DossiersListGestionnaireService
|
|
||||||
def initialize current_devise_profil, liste, procedure = nil
|
|
||||||
@current_devise_profil = current_devise_profil
|
|
||||||
@liste = (DossiersListGestionnaireService.dossiers_liste_libelle.include?(liste) ? liste : 'all_state')
|
|
||||||
@procedure = procedure
|
|
||||||
end
|
|
||||||
|
|
||||||
def dossiers_to_display
|
|
||||||
@dossiers_to_display ||=
|
|
||||||
{'nouveaux' => nouveaux,
|
|
||||||
'a_traiter' => nouveaux,
|
|
||||||
'a_instruire' => a_instruire,
|
|
||||||
'termine' => termine,
|
|
||||||
'archive' => archive,
|
|
||||||
'all_state' => all_state}[@liste]
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.dossiers_liste_libelle
|
|
||||||
['nouveaux', 'suivi', 'a_traiter', 'a_instruire', 'termine', 'all_state']
|
|
||||||
end
|
|
||||||
|
|
||||||
def all_state
|
|
||||||
@all_state ||= filter_dossiers.all_state.order_by_updated_at('asc')
|
|
||||||
end
|
|
||||||
|
|
||||||
def suivi
|
|
||||||
@suivi ||= @current_devise_profil.followed_dossiers.merge(dossiers_to_display)
|
|
||||||
end
|
|
||||||
|
|
||||||
def nouveaux
|
|
||||||
@nouveaux ||= filter_dossiers.en_construction.order_by_updated_at('asc')
|
|
||||||
end
|
|
||||||
|
|
||||||
def a_instruire
|
|
||||||
@a_instruire ||= filter_dossiers.en_instruction.order_by_updated_at('asc')
|
|
||||||
end
|
|
||||||
|
|
||||||
def archive
|
|
||||||
@archive ||= filter_dossiers.archived
|
|
||||||
end
|
|
||||||
|
|
||||||
def termine
|
|
||||||
@termine ||= filter_dossiers.termine.order_by_updated_at('asc')
|
|
||||||
end
|
|
||||||
|
|
||||||
def filter_dossiers
|
|
||||||
@filter_dossiers ||= @procedure.nil? ? @current_devise_profil.dossiers.joins(joins_filter).where(where_filter) : @procedure.dossiers.joins(joins_filter).where(where_filter)
|
|
||||||
@filter_dossiers.distinct
|
|
||||||
end
|
|
||||||
|
|
||||||
def filter_procedure_reset!
|
|
||||||
filter_procedure! nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def filter_procedure! procedure_id
|
|
||||||
@current_devise_profil.update_column :procedure_filter, procedure_id
|
|
||||||
end
|
|
||||||
|
|
||||||
def default_sort
|
|
||||||
sort_preference = @current_devise_profil.preference_list_dossiers
|
|
||||||
.where(procedure: @procedure)
|
|
||||||
.where.not(order: nil).first
|
|
||||||
|
|
||||||
return {'nil' => 'nil'} if sort_preference.nil?
|
|
||||||
|
|
||||||
{
|
|
||||||
[sort_preference.table, sort_preference.attr]
|
|
||||||
.reject(&:nil?)
|
|
||||||
.join('.') => sort_preference.order
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def default_page
|
|
||||||
pref = current_preference_smart_listing_page
|
|
||||||
return pref.page if pref.procedure == @procedure && pref.liste == @liste
|
|
||||||
|
|
||||||
1
|
|
||||||
end
|
|
||||||
|
|
||||||
def change_page! new_page
|
|
||||||
pref = current_preference_smart_listing_page
|
|
||||||
|
|
||||||
if pref
|
|
||||||
unless pref.liste == @liste && pref.procedure == @procedure
|
|
||||||
pref.liste = @liste
|
|
||||||
pref.procedure = @procedure
|
|
||||||
|
|
||||||
if new_page.nil?
|
|
||||||
pref.page = 1
|
|
||||||
pref.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
unless new_page.nil?
|
|
||||||
pref.page = new_page
|
|
||||||
pref.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def change_sort! new_sort
|
|
||||||
return if new_sort.blank?
|
|
||||||
|
|
||||||
raw_table_attr = new_sort.keys.first.split('.')
|
|
||||||
order = new_sort.values.first
|
|
||||||
|
|
||||||
table = (raw_table_attr.size == 2 ? raw_table_attr.first : nil)
|
|
||||||
attr = (raw_table_attr.size == 2 ? raw_table_attr.second : raw_table_attr.first)
|
|
||||||
|
|
||||||
reset_sort!
|
|
||||||
|
|
||||||
preference = @current_devise_profil.preference_list_dossiers
|
|
||||||
.find_by(table: table, attr: attr, procedure: @procedure)
|
|
||||||
|
|
||||||
preference.update order: order unless (preference.nil?)
|
|
||||||
end
|
|
||||||
|
|
||||||
def reset_sort!
|
|
||||||
@current_devise_profil.preference_list_dossiers
|
|
||||||
.where(procedure: @procedure)
|
|
||||||
.where.not(order: nil)
|
|
||||||
.update_all order: nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def joins_filter
|
|
||||||
filter_preference_list.inject([]) do |acc, preference|
|
|
||||||
acc.push(preference.table.to_sym) unless preference.table.blank? || preference.filter.blank?
|
|
||||||
acc
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def where_filter
|
|
||||||
filter_preference_list.inject('') do |acc, preference|
|
|
||||||
unless preference.filter.blank?
|
|
||||||
filter = preference.filter.tr('*', '%').gsub("'", "''")
|
|
||||||
filter = "%" + filter + "%" unless filter.include? '%'
|
|
||||||
|
|
||||||
value = preference.table_with_s_attr
|
|
||||||
|
|
||||||
if preference.table_attr.include?('champs')
|
|
||||||
value = 'champs.value'
|
|
||||||
|
|
||||||
acc += (acc.to_s.empty? ? ''.to_s : " AND ") +
|
|
||||||
'champs.type_de_champ_id = ' + preference.attr
|
|
||||||
end
|
|
||||||
|
|
||||||
acc += (acc.to_s.empty? ? ''.to_s : " AND ") +
|
|
||||||
"CAST(" +
|
|
||||||
value +
|
|
||||||
" as TEXT)" +
|
|
||||||
" LIKE " +
|
|
||||||
"'" +
|
|
||||||
filter +
|
|
||||||
"'"
|
|
||||||
end
|
|
||||||
acc
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def add_filter new_filter
|
|
||||||
raw_table_attr = new_filter.keys.first.split('.')
|
|
||||||
filter = new_filter.values.first
|
|
||||||
|
|
||||||
table = (raw_table_attr.size == 2 ? raw_table_attr.first : nil)
|
|
||||||
attr = (raw_table_attr.size == 2 ? raw_table_attr.second : raw_table_attr.first)
|
|
||||||
|
|
||||||
@current_devise_profil.preference_list_dossiers
|
|
||||||
.find_by(table: table, attr: attr, procedure: @procedure)
|
|
||||||
.update filter: filter.strip
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def filter_preference_list
|
|
||||||
@filter_preference ||= @current_devise_profil.preference_list_dossiers
|
|
||||||
.where(procedure: @procedure)
|
|
||||||
.where.not(filter: nil)
|
|
||||||
.order(:id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def current_preference_smart_listing_page
|
|
||||||
@current_devise_profil.preference_smart_listing_page
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -2,7 +2,7 @@ class FranceConnectSaltService
|
||||||
attr_reader :model
|
attr_reader :model
|
||||||
|
|
||||||
def initialize france_connect_information
|
def initialize france_connect_information
|
||||||
raise 'Not a FranceConnectInformation class' unless france_connect_information.class == FranceConnectInformation
|
raise 'Not a FranceConnectInformation class' if france_connect_information.class != FranceConnectInformation
|
||||||
@model = france_connect_information
|
@model = france_connect_information
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,14 @@ class SwitchDeviseProfileService
|
||||||
private
|
private
|
||||||
|
|
||||||
def user_signed_in?
|
def user_signed_in?
|
||||||
!@warden.authenticate(:scope => :user).nil?
|
@warden.authenticate(:scope => :user).present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def gestionnaire_signed_in?
|
def gestionnaire_signed_in?
|
||||||
!@warden.authenticate(:scope => :gestionnaire).nil?
|
@warden.authenticate(:scope => :gestionnaire).present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def administrateur_signed_in?
|
def administrateur_signed_in?
|
||||||
!@warden.authenticate(:scope => :administrateur).nil?
|
@warden.authenticate(:scope => :administrateur).present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,28 +7,28 @@ class SyncCredentialsService
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_credentials!
|
def change_credentials!
|
||||||
unless @klass == User
|
if @klass != User
|
||||||
user = User.find_by(email: @email_was)
|
user = User.find_by(email: @email_was)
|
||||||
if user
|
if user
|
||||||
return false unless user.update_columns(
|
return false if !user.update_columns(
|
||||||
email: @email,
|
email: @email,
|
||||||
encrypted_password: @encrypted_password)
|
encrypted_password: @encrypted_password)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
unless @klass == Gestionnaire
|
if @klass != Gestionnaire
|
||||||
gestionnaire = Gestionnaire.find_by(email: @email_was)
|
gestionnaire = Gestionnaire.find_by(email: @email_was)
|
||||||
if gestionnaire
|
if gestionnaire
|
||||||
return false unless gestionnaire.update_columns(
|
return false if !gestionnaire.update_columns(
|
||||||
email: @email,
|
email: @email,
|
||||||
encrypted_password: @encrypted_password)
|
encrypted_password: @encrypted_password)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
unless @klass == Administrateur
|
if @klass != Administrateur
|
||||||
administrateur = Administrateur.find_by(email: @email_was)
|
administrateur = Administrateur.find_by(email: @email_was)
|
||||||
if administrateur
|
if administrateur
|
||||||
return false unless administrateur.update_columns(
|
return false if !administrateur.update_columns(
|
||||||
email: @email,
|
email: @email,
|
||||||
encrypted_password: @encrypted_password)
|
encrypted_password: @encrypted_password)
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ class AttestationTemplateLogoUploader < BaseUploader
|
||||||
# Override the directory where uploaded files will be stored.
|
# Override the directory where uploaded files will be stored.
|
||||||
# This is a sensible default for uploaders that are meant to be mounted:
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
def store_dir
|
def store_dir
|
||||||
unless Features.remote_storage
|
if !Features.remote_storage
|
||||||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ class AttestationTemplateSignatureUploader < BaseUploader
|
||||||
# Override the directory where uploaded files will be stored.
|
# Override the directory where uploaded files will be stored.
|
||||||
# This is a sensible default for uploaders that are meant to be mounted:
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
def store_dir
|
def store_dir
|
||||||
unless Features.remote_storage
|
if !Features.remote_storage
|
||||||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ class AttestationUploader < BaseUploader
|
||||||
# Override the directory where uploaded files will be stored.
|
# Override the directory where uploaded files will be stored.
|
||||||
# This is a sensible default for uploaders that are meant to be mounted:
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
def store_dir
|
def store_dir
|
||||||
unless Features.remote_storage
|
if !Features.remote_storage
|
||||||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class CerfaUploader < BaseUploader
|
||||||
# Override the directory where uploaded files will be stored.
|
# Override the directory where uploaded files will be stored.
|
||||||
# This is a sensible default for uploaders that are meant to be mounted:
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
def store_dir
|
def store_dir
|
||||||
unless Features.remote_storage
|
if !Features.remote_storage
|
||||||
"./uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
"./uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,11 +27,11 @@ class LocalDownloader
|
||||||
self.random_folder_name = SecureRandom.hex
|
self.random_folder_name = SecureRandom.hex
|
||||||
base_path = File.join(BASE_PATH_DISK, self.random_folder_name)
|
base_path = File.join(BASE_PATH_DISK, self.random_folder_name)
|
||||||
|
|
||||||
unless File.directory?(BASE_PATH_DISK)
|
if !File.directory?(BASE_PATH_DISK)
|
||||||
Dir.mkdir(BASE_PATH_DISK)
|
Dir.mkdir(BASE_PATH_DISK)
|
||||||
end
|
end
|
||||||
|
|
||||||
unless File.directory?(base_path)
|
if !File.directory?(base_path)
|
||||||
Dir.mkdir(base_path)
|
Dir.mkdir(base_path)
|
||||||
break base_path
|
break base_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class PieceJustificativeUploader < BaseUploader
|
||||||
# Override the directory where uploaded files will be stored.
|
# Override the directory where uploaded files will be stored.
|
||||||
# This is a sensible default for uploaders that are meant to be mounted:
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
def store_dir
|
def store_dir
|
||||||
unless Features.remote_storage
|
if !Features.remote_storage
|
||||||
"./uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
"./uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ class ProcedureLogoUploader < BaseUploader
|
||||||
# Override the directory where uploaded files will be stored.
|
# Override the directory where uploaded files will be stored.
|
||||||
# This is a sensible default for uploaders that are meant to be mounted:
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
def store_dir
|
def store_dir
|
||||||
unless Features.remote_storage
|
if !Features.remote_storage
|
||||||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,6 @@ class EmailFormatValidator < ActiveModel::Validator
|
||||||
|
|
||||||
def validate(record)
|
def validate(record)
|
||||||
return if record.email.blank?
|
return if record.email.blank?
|
||||||
record.errors[:base] << "Email invalide" unless email_regex.match(record.email)
|
record.errors[:base] << "Email invalide" if !email_regex.match(record.email)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,6 @@ class ProcedurePathFormatValidator < ActiveModel::Validator
|
||||||
|
|
||||||
def validate(record)
|
def validate(record)
|
||||||
return false if record.path.blank?
|
return false if record.path.blank?
|
||||||
record.errors[:path] << "Path invalide" unless path_regex.match(record.path)
|
record.errors[:path] << "Path invalide" if !path_regex.match(record.path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
class SiretFormatValidator < ActiveModel::EachValidator
|
class SiretFormatValidator < ActiveModel::EachValidator
|
||||||
def validate_each(record,attribute,value)
|
def validate_each(record,attribute,value)
|
||||||
unless value =~ /^\d{14}$/
|
if !(value =~ /^\d{14}$/)
|
||||||
record.errors.add(attribute, :format)
|
record.errors.add(attribute, :format)
|
||||||
end
|
end
|
||||||
unless value != nil && (luhn_checksum(value) % 10 == 0)
|
if value.nil? || (luhn_checksum(value) % 10 != 0)
|
||||||
record.errors.add(attribute, :checksum)
|
record.errors.add(attribute, :checksum)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.row{ style: 'height: 34px;' }
|
.row{ style: 'height: 34px;' }
|
||||||
|
|
||||||
- unless smart_listing.empty?
|
- if smart_listing.present?
|
||||||
%table.table#liste-gestionnaire
|
%table.table#liste-gestionnaire
|
||||||
%thead
|
%thead
|
||||||
%th Enlever
|
%th Enlever
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
%button.btn.btn-primary{ type: :submit }
|
%button.btn.btn-primary{ type: :submit }
|
||||||
%span.fa.fa-search
|
%span.fa.fa-search
|
||||||
|
|
||||||
- unless smart_listing.empty?
|
- if smart_listing.present?
|
||||||
|
|
||||||
%table.table#liste-gestionnaire
|
%table.table#liste-gestionnaire
|
||||||
%thead
|
%thead
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- unless smart_listing.empty?
|
- if smart_listing.present?
|
||||||
%table.table#liste-gestionnaire
|
%table.table#liste-gestionnaire
|
||||||
%thead
|
%thead
|
||||||
%th#libelle= smart_listing.sortable 'Email', 'email'
|
%th#libelle= smart_listing.sortable 'Email', 'email'
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
.form-group
|
.form-group
|
||||||
= ff.hidden_field :order_place, value: ff.index
|
= ff.hidden_field :order_place, value: ff.index
|
||||||
= ff.hidden_field :id
|
= ff.hidden_field :id
|
||||||
- unless ff.object.id.nil?
|
- if ff.object.id.present?
|
||||||
.form-group
|
.form-group
|
||||||
%br
|
%br
|
||||||
= ff.object.button_up(index: ff.index, url: move_up_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
|
= ff.object.button_up(index: ff.index, url: move_up_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
.row
|
.row
|
||||||
.col-md-6
|
.col-md-6
|
||||||
%h4 Logo de la procédure
|
%h4 Logo de la procédure
|
||||||
- unless @procedure.logo.blank?
|
- if @procedure.logo.present?
|
||||||
= image_tag @procedure.decorate.logo_img, { style: 'height: 40px; display: inline; margin-right: 6px;', id: 'preview_procedure_logo' }
|
= image_tag @procedure.decorate.logo_img, { style: 'height: 40px; display: inline; margin-right: 6px;', id: 'preview_procedure_logo' }
|
||||||
= f.file_field :logo, accept: 'image/png, image/jpg, image/jpeg', style: 'display: inline'
|
= f.file_field :logo, accept: 'image/png, image/jpg, image/jpeg', style: 'display: inline'
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
= f.check_box :euro_flag
|
= f.check_box :euro_flag
|
||||||
Afficher le drapeau européen
|
Afficher le drapeau européen
|
||||||
|
|
||||||
- unless @procedure.locked?
|
- if !@procedure.locked?
|
||||||
.row
|
.row
|
||||||
.col-md-6
|
.col-md-6
|
||||||
%h4 Cartographie
|
%h4 Cartographie
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- unless smart_listing.empty?
|
- if smart_listing.present?
|
||||||
%table.table#dossiers-list
|
%table.table#dossiers-list
|
||||||
%thead
|
%thead
|
||||||
%th#ID= smart_listing.sortable 'ID', 'id'
|
%th#ID= smart_listing.sortable 'ID', 'id'
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
= procedure.created_at_fr
|
= procedure.created_at_fr
|
||||||
%td
|
%td
|
||||||
= link_to('Cloner', admin_procedure_clone_path(procedure.id), 'data-method' => :put, class: 'btn-sm btn-primary clone-btn')
|
= link_to('Cloner', admin_procedure_clone_path(procedure.id), 'data-method' => :put, class: 'btn-sm btn-primary clone-btn')
|
||||||
- unless procedure.publiee_ou_archivee?
|
- if !procedure.publiee_ou_archivee?
|
||||||
= link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), 'data-method' => :delete, class: 'btn-sm btn-danger')
|
= link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), 'data-method' => :delete, class: 'btn-sm btn-danger')
|
||||||
|
|
||||||
= smart_listing.paginate
|
= smart_listing.paginate
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
Vous vous apprêtez à
|
Vous vous apprêtez à
|
||||||
= @procedure.archivee? ? 'republier' : 'publier'
|
= @procedure.archivee? ? 'republier' : 'publier'
|
||||||
votre procédure au public.
|
votre procédure au public.
|
||||||
- unless @procedure.archivee?
|
- if !@procedure.archivee?
|
||||||
%b
|
%b
|
||||||
Elle ne pourra plus être modifiée à l'issue de cette publication.
|
Elle ne pourra plus être modifiée à l'issue de cette publication.
|
||||||
%br
|
%br
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
%h4 Archivé
|
%h4 Archivé
|
||||||
|
|
||||||
- unless @facade.dossiers_archived_total == 0
|
- if @facade.dossiers_archived_total != 0
|
||||||
%ul
|
%ul
|
||||||
- @facade.dossiers_archived_by_state_total.each do |dossier|
|
- @facade.dossiers_archived_by_state_total.each do |dossier|
|
||||||
%li
|
%li
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
= ff.hidden_field :type
|
= ff.hidden_field :type
|
||||||
= ff.hidden_field :id
|
= ff.hidden_field :id
|
||||||
|
|
||||||
- unless ff.object.id.nil?
|
- if ff.object.id.present?
|
||||||
.form-group
|
.form-group
|
||||||
%br
|
%br
|
||||||
= ff.object.button_up(index: ff.index, url: @types_de_champ_facade.move_up_url(ff), private: @types_de_champ_facade.private)
|
= ff.object.button_up(index: ff.index, url: @types_de_champ_facade.move_up_url(ff), private: @types_de_champ_facade.private)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.card
|
.card
|
||||||
- unless smart_listing.empty?
|
- if smart_listing.present?
|
||||||
%table.table
|
%table.table
|
||||||
%thead
|
%thead
|
||||||
%th.col-xs-4= smart_listing.sortable 'Email', :email
|
%th.col-xs-4= smart_listing.sortable 'Email', :email
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
%td
|
%td
|
||||||
= admin.email
|
= admin.email
|
||||||
%td
|
%td
|
||||||
- unless admin.last_sign_in_at.nil?
|
- if admin.last_sign_in_at.present?
|
||||||
= time_ago_in_words(l(admin.last_sign_in_at, format: "%d/%m/%Y %H:%M UTC +02:00"))
|
= time_ago_in_words(l(admin.last_sign_in_at, format: "%d/%m/%Y %H:%M UTC +02:00"))
|
||||||
(
|
(
|
||||||
= admin.last_sign_in_at.localtime.strftime('%d/%m/%Y')
|
= admin.last_sign_in_at.localtime.strftime('%d/%m/%Y')
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
= render partial: '/users/recapitulatif/commentaires_flux'
|
|
|
@ -1,10 +0,0 @@
|
||||||
.filter_framed.panel.panel-primary{ id: "#{filter_framed_id}", style: 'width: 300px; height: 100px; position: absolute; top: 0; left: 0; display: none;' }
|
|
||||||
.panel-heading
|
|
||||||
= preference.libelle
|
|
||||||
|
|
||||||
= form_tag @facade_data_view.filter_url, { class: 'panel-body form-inline', method: :post } do
|
|
||||||
%input.form-control.filter_input{ name: "filter_input[#{preference.table_attr}]", style: 'width: 69%;', value: "#{preference.filter}" }
|
|
||||||
%button.btn.btn-sm.btn-success
|
|
||||||
%i.fa.fa-check
|
|
||||||
.btn.btn-sm.btn-danger.erase-filter
|
|
||||||
%i.fa.fa-remove
|
|
|
@ -1,13 +0,0 @@
|
||||||
%h3
|
|
||||||
= t('dynamics.dossiers.followers.title')
|
|
||||||
|
|
||||||
%br
|
|
||||||
.row
|
|
||||||
.col-xs-4
|
|
||||||
- if @facade.followers.size > 0
|
|
||||||
%ul
|
|
||||||
- @facade.followers.each do |follower|
|
|
||||||
%li
|
|
||||||
= follower.email
|
|
||||||
- else
|
|
||||||
Aucune personne ne suit ce dossier
|
|
|
@ -1,70 +0,0 @@
|
||||||
%table#dossiers-list.table
|
|
||||||
%thead
|
|
||||||
- if smart_listing.name.to_s == 'follow_dossiers'
|
|
||||||
%th.col-xs-1.center
|
|
||||||
%i.fa.fa-bell
|
|
||||||
%th.col-xs-1
|
|
||||||
État
|
|
||||||
|
|
||||||
- @facade_data_view.preference_list_dossiers_filter.each do |preference|
|
|
||||||
- unless preference.libelle == 'Statut' || preference.libelle == 'État'
|
|
||||||
%th{ class: "col-md-#{preference.bootstrap_lg} col-lg-#{preference.bootstrap_lg}" }
|
|
||||||
- if preference.table.to_s.include? 'champs'
|
|
||||||
= preference.libelle
|
|
||||||
- else
|
|
||||||
= smart_listing.sortable preference.libelle, preference.table_attr
|
|
||||||
- if @facade_data_view.active_filter? preference
|
|
||||||
%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-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-xs-1.center
|
|
||||||
- total_notif = dossier.notifications.where(already_read: false).count
|
|
||||||
- if total_notif == 0
|
|
||||||
.badge.progress-bar-default
|
|
||||||
= total_notif
|
|
||||||
- else
|
|
||||||
.badge.progress-bar-warning
|
|
||||||
= total_notif
|
|
||||||
%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'
|
|
||||||
%td
|
|
||||||
- if preference.table.nil? || preference.table.empty?
|
|
||||||
- value = dossier.decorate.public_send(preference.attr_decorate)
|
|
||||||
- elsif preference.table == 'champs'
|
|
||||||
- value = dossier.champs.find_by_type_de_champ_id(preference.attr).value rescue nil
|
|
||||||
- elsif preference.table == 'champs_private'
|
|
||||||
- value = dossier.champs_private.find_by_type_de_champ_id(preference.attr).value rescue nil
|
|
||||||
- else
|
|
||||||
- begin
|
|
||||||
- value = dossier.public_send(preference.table).decorate.public_send(preference.attr_decorate)
|
|
||||||
- rescue NoMethodError
|
|
||||||
- value = ''
|
|
||||||
|
|
||||||
= value
|
|
||||||
|
|
||||||
%td.center
|
|
||||||
- if current_gestionnaire.follow?(dossier)
|
|
||||||
= link_to('Quitter', unfollow_dossier_path(dossier.procedure, dossier), method: :patch, class: 'btn-sm btn-danger', id: "suivre_dossier_#{dossier.id}")
|
|
||||||
- else
|
|
||||||
= link_to('Suivre', follow_dossier_path(dossier.procedure, dossier), method: :patch, class: 'btn-sm btn-primary', id: "suivre_dossier_#{dossier.id}")
|
|
||||||
%td.center{ style: "color: #{dossier.total_follow == 0 ? 'red' : ''}" }
|
|
||||||
= dossier.total_follow
|
|
||||||
|
|
||||||
= smart_listing.paginate
|
|
||||||
- if smart_listing.name.to_s == 'follow_dossiers' && smart_listing.collection.count > 0
|
|
||||||
= smart_listing.pagination_per_page_links
|
|
||||||
%br
|
|
||||||
|
|
||||||
|
|
||||||
- if smart_listing.empty?
|
|
||||||
%h4.center
|
|
||||||
Aucun dossier
|
|
|
@ -1,20 +0,0 @@
|
||||||
- if smart_listing.collection.any?
|
|
||||||
%table#dossiers-list.table
|
|
||||||
%thead
|
|
||||||
%th
|
|
||||||
Nº
|
|
||||||
%th
|
|
||||||
Procédure
|
|
||||||
%th
|
|
||||||
Invité le
|
|
||||||
%tbody
|
|
||||||
- smart_listing.collection.each do |avis|
|
|
||||||
%tr.dossier-row{ id: "tr_dossier_#{avis.dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: avis.dossier.id) }
|
|
||||||
%td= avis.dossier.id
|
|
||||||
%td= avis.dossier.procedure.libelle
|
|
||||||
%td= avis.created_at.strftime('%d/%m/%Y %H:%M')
|
|
||||||
= smart_listing.paginate
|
|
||||||
|
|
||||||
- else
|
|
||||||
.center{ colspan: 2 }
|
|
||||||
%em Aucun dossier
|
|
|
@ -1,46 +0,0 @@
|
||||||
%button#pref-list-dossier-close-action.btn.btn-danger.btn-xs.fixed-right
|
|
||||||
%i.fa.fa-close
|
|
||||||
%h3
|
|
||||||
= t('dynamics.backoffice.pref_list.title')
|
|
||||||
|
|
||||||
%p{ style: 'margin-top: 15px; margin-bottom: 20px;' }
|
|
||||||
= t('dynamics.backoffice.pref_list.description')
|
|
||||||
|
|
||||||
%h4.text-primary
|
|
||||||
Actuelles
|
|
||||||
|
|
||||||
%ul
|
|
||||||
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
|
|
||||||
%li
|
|
||||||
= form_tag backoffice_preference_list_dossier_delete_path, method: :delete, remote: true do
|
|
||||||
= hidden_field_tag :pref_id, preference.id
|
|
||||||
= hidden_field_tag :procedure_id, preference.procedure_id
|
|
||||||
= preference.libelle
|
|
||||||
%button.btn.btn-default.btn-xs{ type: :submit, id: "delete_pref_list_#{preference[:table]}_#{preference[:attr]}" }
|
|
||||||
%i.fa.fa-minus
|
|
||||||
|
|
||||||
%h4.text-success{ style: 'margin-top: 15px;' }
|
|
||||||
Disponibles
|
|
||||||
|
|
||||||
%table
|
|
||||||
- PreferenceListDossier.available_columns_for(@facade_data_view.procedure_id).each_with_index do |tables, index|
|
|
||||||
- if index%2 == 0 || tables.first.to_s.include?('champs')
|
|
||||||
%tr
|
|
||||||
|
|
||||||
%td.col-xs-5{ style: 'vertical-align: top;', colspan: (tables.first == :champs ? 2 : 1) }
|
|
||||||
%h5= tables.first.to_s.gsub('_', ' ').capitalize
|
|
||||||
%ul
|
|
||||||
- if tables.second
|
|
||||||
- tables.second.each do |columns|
|
|
||||||
%li
|
|
||||||
= form_tag backoffice_preference_list_dossier_add_path, method: :post, remote: true do
|
|
||||||
= hidden_field_tag :libelle, columns.second[:libelle]
|
|
||||||
= hidden_field_tag :table, columns.second[:table]
|
|
||||||
= hidden_field_tag :attr, columns.second[:attr]
|
|
||||||
= hidden_field_tag :attr_decorate, columns.second[:attr_decorate]
|
|
||||||
= hidden_field_tag :bootstrap_lg, columns.second[:bootstrap_lg]
|
|
||||||
= hidden_field_tag :procedure_id, @facade_data_view.procedure_id
|
|
||||||
|
|
||||||
= columns.second[:libelle]
|
|
||||||
%button.btn.btn-default.btn-xs{ type: :submit, id: "add_pref_list_#{columns.second[:table]}_#{columns.second[:attr]}" }
|
|
||||||
%i.fa.fa-plus
|
|
|
@ -1,14 +0,0 @@
|
||||||
$.ajax({
|
|
||||||
method: 'get',
|
|
||||||
url: '/backoffice/preference_list_dossier/reload_smartlisting?procedure_id=<%= @procedure_id %>',
|
|
||||||
async: true
|
|
||||||
});
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
methd: 'get',
|
|
||||||
url: '/backoffice/preference_list_dossier/reload_pref_list?procedure_id=<%= @procedure_id %>',
|
|
||||||
async: true
|
|
||||||
}).done(function (data) {
|
|
||||||
$("#pref-list-menu").html(data);
|
|
||||||
pref_list_dossier_actions();
|
|
||||||
});
|
|
|
@ -1,4 +0,0 @@
|
||||||
<% flash.each do |type, message| %>
|
|
||||||
$("#flash_message").html("<div class=\"alert alert-success move-up\" style=\"display: block:\"> <%= sanitize(message) %></div>").children().fadeOut(5000)
|
|
||||||
<% end %>
|
|
||||||
<% flash.clear %>
|
|
|
@ -1,64 +0,0 @@
|
||||||
#backoffice-index
|
|
||||||
#pref-list-menu
|
|
||||||
= render partial: 'backoffice/dossiers/pref_list'
|
|
||||||
|
|
||||||
.default-data-block
|
|
||||||
.row.show-block#new_dossiers
|
|
||||||
.header
|
|
||||||
.col-xs-10.title
|
|
||||||
.carret-right
|
|
||||||
.carret-down
|
|
||||||
Nouveaux dossiers
|
|
||||||
.col-xs-2.count
|
|
||||||
= pluralize(@facade_data_view.nouveaux_total, "dossier")
|
|
||||||
.body
|
|
||||||
= smart_listing_render :new_dossiers
|
|
||||||
|
|
||||||
.row.center
|
|
||||||
.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-xs-3
|
|
||||||
= link_to 'En construction', '?liste=a_traiter', class: 'text-danger', style: "text-decoration: #{@facade_data_view.liste == 'a_traiter'? 'underline' : ''}"
|
|
||||||
.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
|
|
||||||
.row.show-block#follow_dossiers
|
|
||||||
.header
|
|
||||||
.col-xs-10.title
|
|
||||||
.carret-right
|
|
||||||
.carret-down
|
|
||||||
Dossiers suivis
|
|
||||||
.col-xs-2.count
|
|
||||||
= pluralize(@facade_data_view.suivi_total, "dossier")
|
|
||||||
.body
|
|
||||||
= smart_listing_render :follow_dossiers
|
|
||||||
|
|
||||||
.default-data-block
|
|
||||||
.row.show-block#all_dossiers
|
|
||||||
.header
|
|
||||||
.col-xs-10.title
|
|
||||||
.carret-right
|
|
||||||
.carret-down
|
|
||||||
Tous les dossiers
|
|
||||||
.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,6 +0,0 @@
|
||||||
<%= smart_listing_update :new_dossiers, {force: true} %>
|
|
||||||
<%= smart_listing_update :follow_dossiers, {force: true} %>
|
|
||||||
<%= smart_listing_update :all_state_dossiers, {force: true} %>
|
|
||||||
|
|
||||||
filters_init();
|
|
||||||
link_init();
|
|
|
@ -1,16 +0,0 @@
|
||||||
#backoffice-search
|
|
||||||
#pref-list-menu
|
|
||||||
= render partial: 'backoffice/dossiers/pref_list'
|
|
||||||
|
|
||||||
.default-data-block.default_visible
|
|
||||||
.row.show-block#new_dossiers
|
|
||||||
.header
|
|
||||||
.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
|
||||||
.carret-right
|
|
||||||
.carret-down
|
|
||||||
Résultat de la recherche
|
|
||||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
|
||||||
= @dossiers.count
|
|
||||||
dossiers
|
|
||||||
.body
|
|
||||||
= smart_listing_render :search
|
|
|
@ -1,4 +0,0 @@
|
||||||
<%= smart_listing_update :search %>
|
|
||||||
|
|
||||||
filters_init();
|
|
||||||
link_init();
|
|
|
@ -1,2 +0,0 @@
|
||||||
#backoffice-dossier-show.col-xs-12
|
|
||||||
= render partial: "dossiers/dossier_show"
|
|
|
@ -1,22 +0,0 @@
|
||||||
.col-md-12
|
|
||||||
.default-data-block.default_visible
|
|
||||||
.row.show-block
|
|
||||||
.header
|
|
||||||
.title
|
|
||||||
.carret-right
|
|
||||||
.carret-down
|
|
||||||
= "#{@pending_avis.count} avis à rendre"
|
|
||||||
.body
|
|
||||||
= smart_listing_render :pending_avis
|
|
||||||
|
|
||||||
%br
|
|
||||||
|
|
||||||
.default-data-block
|
|
||||||
.row.show-block
|
|
||||||
.header
|
|
||||||
.title
|
|
||||||
.carret-right
|
|
||||||
.carret-down
|
|
||||||
= "#{@avis_with_answer.count} avis #{"rendu".pluralize(@avis_with_answer.count)}"
|
|
||||||
.body
|
|
||||||
= smart_listing_render :avis_with_answer
|
|
|
@ -1,4 +0,0 @@
|
||||||
<%= smart_listing_update :pending_avis %>
|
|
||||||
<%= smart_listing_update :avis_with_answer %>
|
|
||||||
|
|
||||||
link_init();
|
|
|
@ -1,56 +0,0 @@
|
||||||
- if current_gestionnaire && current_gestionnaire.assigned_on_procedure?(@facade.dossier.procedure_id)
|
|
||||||
|
|
||||||
.default-data-block.default_visible
|
|
||||||
.row.show-block.infos
|
|
||||||
.header
|
|
||||||
.col-xs-12.title
|
|
||||||
.carret-right
|
|
||||||
.carret-down
|
|
||||||
AVIS EXTERNES
|
|
||||||
.body
|
|
||||||
.display-block-on-print
|
|
||||||
- dossier_facade.dossier.avis.by_latest.each do |avis|
|
|
||||||
- if avis.answer
|
|
||||||
.panel.panel-success
|
|
||||||
.panel-heading
|
|
||||||
%strong= avis.email_to_display
|
|
||||||
a donné son avis le
|
|
||||||
= avis.updated_at.localtime.strftime('%d/%m/%Y à %H:%M')
|
|
||||||
.panel-body
|
|
||||||
%strong Vous :
|
|
||||||
= avis.introduction
|
|
||||||
%hr
|
|
||||||
%strong= "#{avis.email_to_display} :"
|
|
||||||
= avis.answer
|
|
||||||
- else
|
|
||||||
.panel.panel-info
|
|
||||||
.panel-heading
|
|
||||||
Avis demandé à
|
|
||||||
%strong= avis.email_to_display
|
|
||||||
le
|
|
||||||
= avis.created_at.localtime.strftime('%d/%m/%Y à %H:%M')
|
|
||||||
.panel-body
|
|
||||||
%strong Vous :
|
|
||||||
= avis.introduction
|
|
||||||
%hr
|
|
||||||
.center
|
|
||||||
%em Avis en attente
|
|
||||||
|
|
||||||
-# FIXME prevent bug when the user is also a gestionnaire on the procedure #375
|
|
||||||
- if @new_avis.present?
|
|
||||||
.hidden-print
|
|
||||||
.panel.panel-default
|
|
||||||
.panel-heading
|
|
||||||
Demander un avis externe
|
|
||||||
.panel-body
|
|
||||||
.help-block
|
|
||||||
Invitez une personne externe à consulter le dossier et à vous donner un avis sur celui ci.
|
|
||||||
%br
|
|
||||||
Cette personne pourra également contribuer au fil de messagerie, mais ne pourra pas modifier le dossier.
|
|
||||||
|
|
||||||
= simple_form_for @new_avis, url: backoffice_dossier_avis_index_path(dossier_facade.dossier.object.id) do |f|
|
|
||||||
|
|
||||||
= f.input 'email', label: "Email de la personne qui doit donner un avis"
|
|
||||||
= f.input 'introduction', label: "Message"
|
|
||||||
|
|
||||||
= f.submit "Envoyer la demande d'avis", class: 'btn btn-default'
|
|
|
@ -1,5 +1,3 @@
|
||||||
= render partial: 'dossiers/edit_avis', locals: { dossier_facade: @facade }
|
|
||||||
|
|
||||||
= render partial: 'dossiers/attestation', locals: { dossier: @facade.dossier }
|
= render partial: 'dossiers/attestation', locals: { dossier: @facade.dossier }
|
||||||
|
|
||||||
= render partial: 'dossiers/messagerie', locals: { dossier_facade: @facade }
|
= render partial: 'dossiers/messagerie', locals: { dossier_facade: @facade }
|
||||||
|
@ -18,7 +16,7 @@
|
||||||
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
|
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
|
||||||
Renseigner un SIRET
|
Renseigner un SIRET
|
||||||
|
|
||||||
- unless @facade.entreprise.nil?
|
- if @facade.entreprise.present?
|
||||||
.default-data-block
|
.default-data-block
|
||||||
.row.show-block.infos#infos_entreprise
|
.row.show-block.infos#infos_entreprise
|
||||||
.header
|
.header
|
||||||
|
@ -56,19 +54,3 @@
|
||||||
|
|
||||||
= render partial: '/users/carte/map', locals: { dossier: @facade.dossier }
|
= render partial: '/users/carte/map', locals: { dossier: @facade.dossier }
|
||||||
= render partial: 'users/carte/init_carto', locals: { dossier: @facade.dossier }
|
= render partial: 'users/carte/init_carto', locals: { dossier: @facade.dossier }
|
||||||
|
|
||||||
- if @current_gestionnaire && gestionnaire_signed_in? && current_gestionnaire.assigned_on_procedure?(@facade.dossier.procedure_id) && @champs_private.present?
|
|
||||||
.default-data-block.default_visible
|
|
||||||
.row.show-block#private-fields
|
|
||||||
.header
|
|
||||||
.col-xs-10.title
|
|
||||||
.carret-right
|
|
||||||
.carret-down
|
|
||||||
= "formulaire privé".upcase
|
|
||||||
.col-xs-2.count
|
|
||||||
- private_fields_count = @champs_private.count
|
|
||||||
= (private_fields_count == 1) ? "1 champ" : "#{private_fields_count} champs"
|
|
||||||
.body
|
|
||||||
= render partial: '/dossiers/infos_private_fields'
|
|
||||||
|
|
||||||
= render partial: 'dossiers/avis', locals: { dossier_facade: @facade }
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
.dropdown.pull-right#download-menu
|
|
||||||
%a.dropdown-toggle.button-navbar{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false }
|
|
||||||
%i.fa.fa-download
|
|
||||||
Télécharger tous les dossiers
|
|
||||||
%span.caret
|
|
||||||
%ul.dropdown-menu.dropdown-menu-right
|
|
||||||
%li
|
|
||||||
= link_to backoffice_download_dossiers_tps_path(format: :csv, procedure_id: params[:id]), { class: 'btn btn-sm export-link' } do
|
|
||||||
= t('dynamics.backoffice.format_csv')
|
|
||||||
%li
|
|
||||||
= link_to backoffice_download_dossiers_tps_path(format: :xlsx, procedure_id: params[:id]), { class: 'btn btn-sm export-link' } do
|
|
||||||
= t('dynamics.backoffice.format_xlsx')
|
|
||||||
%li
|
|
||||||
= link_to backoffice_download_dossiers_tps_path(format: :ods, procedure_id: params[:id]), { class: 'btn btn-sm export-link' } do
|
|
||||||
= t('dynamics.backoffice.format_ods')
|
|
|
@ -1,13 +0,0 @@
|
||||||
- if current_gestionnaire
|
|
||||||
- avis_for_dossier = current_gestionnaire.avis.for_dossier(dossier_facade.dossier.id).by_latest
|
|
||||||
- if avis_for_dossier.any?
|
|
||||||
.panel.panel-default
|
|
||||||
.panel-body
|
|
||||||
%h4 Votre avis est sollicité sur le dossier :
|
|
||||||
- avis_for_dossier.each do |avis|
|
|
||||||
%hr
|
|
||||||
%p= avis.introduction
|
|
||||||
= simple_form_for avis, url: backoffice_dossier_avis_path(dossier_facade.dossier, avis) do |f|
|
|
||||||
= f.input 'answer', label: "Votre avis"
|
|
||||||
- submit_label = if avis.answer then "Modifier votre avis" else "Enregistrer votre avis" end
|
|
||||||
= f.submit submit_label, class: 'btn btn-default'
|
|
|
@ -1,4 +1,4 @@
|
||||||
- unless @facade.dossier.read_only?
|
- if !@facade.dossier.read_only?
|
||||||
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
||||||
%a#maj_carte.action{ href: "/users/dossiers/#{@facade.dossier.id}/carte" }
|
%a#maj_carte.action{ href: "/users/dossiers/#{@facade.dossier.id}/carte" }
|
||||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- unless @facade.dossier.read_only?
|
- if !@facade.dossier.read_only?
|
||||||
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
||||||
%a#maj_infos.action{ href: "/users/dossiers/#{@facade.dossier.id}/description" }
|
%a#maj_infos.action{ href: "/users/dossiers/#{@facade.dossier.id}/description" }
|
||||||
#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- unless @facade.dossier.read_only?
|
- if !@facade.dossier.read_only?
|
||||||
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
||||||
- if @facade.procedure.cerfa_flag? || @facade.dossier.types_de_piece_justificative.size > 0
|
- if @facade.procedure.cerfa_flag? || @facade.dossier.types_de_piece_justificative.size > 0
|
||||||
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
|
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
.col-xs-5.depositaire-info= @facade.individual.birthdate
|
.col-xs-5.depositaire-info= @facade.individual.birthdate
|
||||||
.row.margin-top-20
|
.row.margin-top-20
|
||||||
|
|
||||||
- unless @facade.champs.nil?
|
- if @facade.champs.present?
|
||||||
- @facade.champs.each do |champ|
|
- @facade.champs.each do |champ|
|
||||||
- next if champ.type_champ == 'explication'
|
- next if champ.type_champ == 'explication'
|
||||||
- if champ.type_champ == 'header_section'
|
- if champ.type_champ == 'header_section'
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
.col-xs-1.comments-off
|
.col-xs-1.comments-off
|
||||||
= "-"
|
= "-"
|
||||||
.col-xs-5.depositaire-info{ id: "champ-#{champ.id}-value" }
|
.col-xs-5.depositaire-info{ id: "champ-#{champ.id}-value" }
|
||||||
- unless champ.decorate.value.blank?
|
- if champ.decorate.value.present?
|
||||||
- if champ.type_champ == 'dossier_link'
|
- if champ.type_champ == 'dossier_link'
|
||||||
- dossier = Dossier.includes(:procedure).find_by(id: champ.decorate.value)
|
- dossier = Dossier.includes(:procedure).find_by(id: champ.decorate.value)
|
||||||
- if dossier
|
- if dossier
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
.col-xs-5.despositaire-info
|
.col-xs-5.despositaire-info
|
||||||
- if type_de_piece_justificative.api_entreprise
|
- if type_de_piece_justificative.api_entreprise
|
||||||
%span.text-success Nous l'avons récupéré pour vous.
|
%span.text-success Nous l'avons récupéré pour vous.
|
||||||
- elsif !(@pj = @facade.dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)).nil?
|
- elsif (@pj = @facade.dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)).present?
|
||||||
%a{ href: "#{@pj.content_url}", target: '_blank' } Consulter
|
%a{ href: "#{@pj.content_url}", target: '_blank' } Consulter
|
||||||
%span{ style: 'margin-left: 12px;' }
|
%span{ style: 'margin-left: 12px;' }
|
||||||
\-
|
\-
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
- else
|
- else
|
||||||
Pièce non fournie
|
Pièce non fournie
|
||||||
|
|
||||||
- unless @facade.dossier.read_only?
|
- if !@facade.dossier.read_only?
|
||||||
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
|
||||||
- if @facade.procedure.cerfa_flag? || @facade.dossier.types_de_piece_justificative.size > 0
|
- if @facade.procedure.cerfa_flag? || @facade.dossier.types_de_piece_justificative.size > 0
|
||||||
.row
|
.row
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue