commit
667880db9e
4 changed files with 27 additions and 35 deletions
|
@ -175,8 +175,16 @@ class Dossier < ApplicationRecord
|
||||||
:user,
|
:user,
|
||||||
:individual,
|
:individual,
|
||||||
:followers_instructeurs,
|
:followers_instructeurs,
|
||||||
:avis,
|
|
||||||
:traitements,
|
:traitements,
|
||||||
|
:groupe_instructeur,
|
||||||
|
procedure: [
|
||||||
|
:groupe_instructeurs,
|
||||||
|
:draft_types_de_champ,
|
||||||
|
:draft_types_de_champ_private,
|
||||||
|
:published_types_de_champ,
|
||||||
|
:published_types_de_champ_private
|
||||||
|
],
|
||||||
|
avis: [:claimant, :expert],
|
||||||
etablissement: :champ,
|
etablissement: :champ,
|
||||||
champs: {
|
champs: {
|
||||||
type_de_champ: [],
|
type_de_champ: [],
|
||||||
|
@ -195,8 +203,7 @@ class Dossier < ApplicationRecord
|
||||||
type_de_champ: [],
|
type_de_champ: [],
|
||||||
piece_justificative_file_attachment: :blob
|
piece_justificative_file_attachment: :blob
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
procedure: :groupe_instructeurs
|
|
||||||
).order(en_construction_at: 'asc')
|
).order(en_construction_at: 'asc')
|
||||||
}
|
}
|
||||||
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
||||||
|
|
|
@ -66,9 +66,6 @@ class Procedure < ApplicationRecord
|
||||||
has_many :draft_types_de_champ, through: :draft_revision, source: :types_de_champ
|
has_many :draft_types_de_champ, through: :draft_revision, source: :types_de_champ
|
||||||
has_many :draft_types_de_champ_private, through: :draft_revision, source: :types_de_champ_private
|
has_many :draft_types_de_champ_private, through: :draft_revision, source: :types_de_champ_private
|
||||||
|
|
||||||
has_many :all_types_de_champ, -> { joins(:procedure).where('types_de_champ.revision_id != procedures.draft_revision_id') }, through: :revisions, source: :types_de_champ
|
|
||||||
has_many :all_types_de_champ_private, -> { joins(:procedure).where('types_de_champ.revision_id != procedures.draft_revision_id') }, through: :revisions, source: :types_de_champ_private
|
|
||||||
|
|
||||||
has_many :experts_procedures, dependent: :destroy
|
has_many :experts_procedures, dependent: :destroy
|
||||||
has_many :experts, through: :experts_procedures
|
has_many :experts, through: :experts_procedures
|
||||||
|
|
||||||
|
@ -92,31 +89,11 @@ class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def types_de_champ_for_export
|
def types_de_champ_for_export
|
||||||
if brouillon?
|
types_de_champ.reject(&:exclude_from_export?)
|
||||||
draft_types_de_champ.reject(&:exclude_from_export?)
|
|
||||||
else
|
|
||||||
all_types_de_champ
|
|
||||||
.uniq
|
|
||||||
.reject(&:exclude_from_export?)
|
|
||||||
.filter(&:active_revision?)
|
|
||||||
.group_by(&:stable_id).values.map do |types_de_champ|
|
|
||||||
types_de_champ.sort_by(&:created_at).last
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def types_de_champ_private_for_export
|
def types_de_champ_private_for_export
|
||||||
if brouillon?
|
types_de_champ_private.reject(&:exclude_from_export?)
|
||||||
draft_types_de_champ_private
|
|
||||||
else
|
|
||||||
all_types_de_champ_private
|
|
||||||
.uniq
|
|
||||||
.reject(&:exclude_from_export?)
|
|
||||||
.filter(&:active_revision?)
|
|
||||||
.group_by(&:stable_id).values.map do |types_de_champ|
|
|
||||||
types_de_champ.sort_by(&:created_at).last
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
has_many :administrateurs_procedures
|
has_many :administrateurs_procedures
|
||||||
|
@ -596,7 +573,7 @@ class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def routee?
|
def routee?
|
||||||
groupe_instructeurs.count > 1
|
groupe_instructeurs.size > 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def defaut_groupe_instructeur_for_new_dossier
|
def defaut_groupe_instructeur_for_new_dossier
|
||||||
|
|
|
@ -206,10 +206,6 @@ class TypeDeChamp < ApplicationRecord
|
||||||
!private?
|
!private?
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_revision?
|
|
||||||
revisions.include?(procedure.active_revision)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.type_champ_to_class_name(type_champ)
|
def self.type_champ_to_class_name(type_champ)
|
||||||
"TypesDeChamp::#{type_champ.classify}TypeDeChamp"
|
"TypesDeChamp::#{type_champ.classify}TypeDeChamp"
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,9 +32,21 @@
|
||||||
- if current_instructeur.procedures.count > 0
|
- if current_instructeur.procedures.count > 0
|
||||||
%li
|
%li
|
||||||
= active_link_to "Démarches", instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'tab-link'
|
= active_link_to "Démarches", instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'tab-link'
|
||||||
|
- if current_instructeur.user.expert && current_expert.avis.count > 0
|
||||||
|
%li
|
||||||
|
= active_link_to expert_all_avis_path, active: controller_name == 'avis', class: 'tab-link' do
|
||||||
|
Avis
|
||||||
|
- avis_counter = current_expert.avis.without_answer.count
|
||||||
|
- if avis_counter > 0
|
||||||
|
%span.badge.warning= avis_counter
|
||||||
|
|
||||||
- if nav_bar_profile == :expert && expert_signed_in?
|
- if nav_bar_profile == :expert && expert_signed_in?
|
||||||
- if current_expert.avis.count > 0
|
|
||||||
%ul.header-tabs
|
%ul.header-tabs
|
||||||
|
- if current_expert.user.instructeur && current_instructeur.procedures.count > 0
|
||||||
|
%li
|
||||||
|
= active_link_to "Démarches", instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'tab-link'
|
||||||
|
|
||||||
|
- if current_expert.avis.count > 0
|
||||||
%li
|
%li
|
||||||
= active_link_to expert_all_avis_path, active: controller_name == 'avis', class: 'tab-link' do
|
= active_link_to expert_all_avis_path, active: controller_name == 'avis', class: 'tab-link' do
|
||||||
Avis
|
Avis
|
||||||
|
|
Loading…
Reference in a new issue