commit
bd4b2e3d47
21 changed files with 237 additions and 114 deletions
|
@ -43,7 +43,7 @@ module Instructeurs
|
|||
end
|
||||
|
||||
def show
|
||||
@demande_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.demande_seen_at
|
||||
@demande_seen_at = current_instructeur.follows.find_by(dossier: dossier_with_champs)&.demande_seen_at
|
||||
|
||||
respond_to do |format|
|
||||
format.pdf do
|
||||
|
@ -96,24 +96,24 @@ module Instructeurs
|
|||
def follow
|
||||
current_instructeur.follow(dossier)
|
||||
flash.notice = 'Dossier suivi'
|
||||
redirect_back(fallback_location: instructeur_procedures_url)
|
||||
redirect_back(fallback_location: instructeur_procedure_path(procedure))
|
||||
end
|
||||
|
||||
def unfollow
|
||||
current_instructeur.unfollow(dossier)
|
||||
flash.notice = "Vous ne suivez plus le dossier nº #{dossier.id}"
|
||||
|
||||
redirect_back(fallback_location: instructeur_procedures_url)
|
||||
redirect_back(fallback_location: instructeur_procedure_path(procedure))
|
||||
end
|
||||
|
||||
def archive
|
||||
dossier.archiver!(current_instructeur)
|
||||
redirect_back(fallback_location: instructeur_procedures_url)
|
||||
redirect_back(fallback_location: instructeur_procedure_path(procedure))
|
||||
end
|
||||
|
||||
def unarchive
|
||||
dossier.desarchiver!(current_instructeur)
|
||||
redirect_back(fallback_location: instructeur_procedures_url)
|
||||
redirect_back(fallback_location: instructeur_procedure_path(procedure))
|
||||
end
|
||||
|
||||
def passer_en_instruction
|
||||
|
@ -226,14 +226,25 @@ module Instructeurs
|
|||
zipline(files, "dossier-#{dossier.id}.zip")
|
||||
end
|
||||
|
||||
def delete_dossier
|
||||
def destroy
|
||||
if dossier.termine?
|
||||
dossier.hide_and_keep_track!(current_instructeur, :instructeur_request)
|
||||
flash.notice = t('instructeurs.dossiers.deleted_by_instructeur')
|
||||
redirect_to instructeur_procedure_path(procedure)
|
||||
else
|
||||
flash.alert = t('instructeurs.dossiers.impossible_deletion')
|
||||
redirect_back(fallback_location: instructeur_procedures_url)
|
||||
end
|
||||
redirect_back(fallback_location: instructeur_procedure_path(procedure))
|
||||
end
|
||||
|
||||
def restore
|
||||
dossier = current_instructeur.dossiers.find(params[:dossier_id])
|
||||
dossier.restore(current_instructeur)
|
||||
flash.notice = t('instructeurs.dossiers.restore')
|
||||
|
||||
if dossier.termine?
|
||||
redirect_to instructeur_procedure_path(procedure, statut: :traites)
|
||||
else
|
||||
redirect_back(fallback_location: instructeur_procedure_path(procedure))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -243,7 +254,15 @@ module Instructeurs
|
|||
@dossier ||= current_instructeur
|
||||
.dossiers
|
||||
.visible_by_administration
|
||||
.includes(champs: :type_de_champ)
|
||||
.find(params[:dossier_id])
|
||||
end
|
||||
|
||||
def dossier_with_champs
|
||||
@dossier ||= current_instructeur
|
||||
.dossiers
|
||||
.visible_by_administration
|
||||
.with_champs
|
||||
.with_annotations
|
||||
.find(params[:dossier_id])
|
||||
end
|
||||
|
||||
|
@ -259,19 +278,19 @@ module Instructeurs
|
|||
end
|
||||
|
||||
def mark_demande_as_read
|
||||
current_instructeur.mark_tab_as_seen(dossier, :demande)
|
||||
current_instructeur.mark_tab_as_seen(@dossier, :demande)
|
||||
end
|
||||
|
||||
def mark_messagerie_as_read
|
||||
current_instructeur.mark_tab_as_seen(dossier, :messagerie)
|
||||
current_instructeur.mark_tab_as_seen(@dossier, :messagerie)
|
||||
end
|
||||
|
||||
def mark_avis_as_read
|
||||
current_instructeur.mark_tab_as_seen(dossier, :avis)
|
||||
current_instructeur.mark_tab_as_seen(@dossier, :avis)
|
||||
end
|
||||
|
||||
def mark_annotations_privees_as_read
|
||||
current_instructeur.mark_tab_as_seen(dossier, :annotations_privees)
|
||||
current_instructeur.mark_tab_as_seen(@dossier, :annotations_privees)
|
||||
end
|
||||
|
||||
def aasm_error_message(exception, target_state:)
|
||||
|
|
|
@ -39,7 +39,7 @@ module Instructeurs
|
|||
'dossiers' => @dossiers_count_per_procedure.sum { |_, v| v },
|
||||
'expirant' => @dossiers_expirant_count_per_procedure.sum { |_, v| v },
|
||||
'archivés' => @dossiers_archived_count_per_procedure.sum { |_, v| v },
|
||||
'supprimes_recemment' => @dossiers_supprimes_recemment_count_per_procedure.sum { |_, v| v }
|
||||
'supprimés récemment' => @dossiers_supprimes_recemment_count_per_procedure.sum { |_, v| v }
|
||||
}
|
||||
|
||||
@procedure_ids_en_cours_with_notifications = current_instructeur.procedure_ids_with_notifications(:en_cours)
|
||||
|
@ -137,15 +137,18 @@ module Instructeurs
|
|||
.order(:dossier_id)
|
||||
.page params[:page]
|
||||
|
||||
@a_suivre_count, @suivis_count, @traites_count, @tous_count, @archives_count = current_instructeur
|
||||
@a_suivre_count, @suivis_count, @traites_count, @tous_count, @archives_count, @supprimes_recemment_count, @expirant_count = current_instructeur
|
||||
.dossiers_count_summary(groupe_instructeur_ids)
|
||||
.fetch_values('a_suivre', 'suivis', 'traites', 'tous', 'archives')
|
||||
.fetch_values('a_suivre', 'suivis', 'traites', 'tous', 'archives', 'supprimes_recemment', 'expirant')
|
||||
@can_download_dossiers = (@tous_count + @archives_count) > 0
|
||||
|
||||
notifications = current_instructeur.notifications_for_groupe_instructeurs(groupe_instructeur_ids)
|
||||
@has_en_cours_notifications = notifications[:en_cours].present?
|
||||
@has_termine_notifications = notifications[:termines].present?
|
||||
|
||||
@statut = 'supprime'
|
||||
|
||||
assign_exports
|
||||
end
|
||||
|
||||
def update_displayed_fields
|
||||
|
@ -278,6 +281,8 @@ module Instructeurs
|
|||
redirect_to instructeur_procedure_path(@procedure)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_bulk_message_mail(dossier_count, dossier_state)
|
||||
BulkMessage.create(
|
||||
dossier_count: dossier_count,
|
||||
|
@ -290,15 +295,6 @@ module Instructeurs
|
|||
)
|
||||
end
|
||||
|
||||
def restore
|
||||
dossier = current_instructeur.dossiers.find(params[:dossier_id])
|
||||
dossier.restore(current_instructeur)
|
||||
flash.notice = t('instructeurs.dossiers.restore')
|
||||
redirect_to instructeur_procedure_path(procedure)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assign_to_params
|
||||
params.require(:assign_to)
|
||||
.permit(:instant_email_dossier_notifications_enabled, :instant_email_message_notifications_enabled, :daily_email_notifications_enabled, :weekly_email_notifications_enabled)
|
||||
|
|
|
@ -727,6 +727,11 @@ type Dossier {
|
|||
"""
|
||||
dateDerniereModification: ISO8601DateTime!
|
||||
|
||||
"""
|
||||
Date d’expiration.
|
||||
"""
|
||||
dateExpiration: ISO8601DateTime
|
||||
|
||||
"""
|
||||
Date du dernier passage en construction.
|
||||
"""
|
||||
|
@ -737,6 +742,16 @@ type Dossier {
|
|||
"""
|
||||
datePassageEnInstruction: ISO8601DateTime
|
||||
|
||||
"""
|
||||
Date de la suppression par l’administration.
|
||||
"""
|
||||
dateSuppressionParAdministration: ISO8601DateTime
|
||||
|
||||
"""
|
||||
Date de la suppression par l’usager.
|
||||
"""
|
||||
dateSuppressionParUsager: ISO8601DateTime
|
||||
|
||||
"""
|
||||
Date du dernier traitement.
|
||||
"""
|
||||
|
@ -770,6 +785,7 @@ type Dossier {
|
|||
L’état du dossier.
|
||||
"""
|
||||
state: DossierState!
|
||||
traitements: [Traitement!]!
|
||||
usager: Profile!
|
||||
}
|
||||
|
||||
|
@ -1877,6 +1893,14 @@ enum TitreIdentiteGrantType {
|
|||
piece_justificative
|
||||
}
|
||||
|
||||
type Traitement {
|
||||
dateTraitement: ISO8601DateTime!
|
||||
emailAgentTraitant: String
|
||||
id: ID!
|
||||
motivation: String
|
||||
state: DossierState!
|
||||
}
|
||||
|
||||
enum TypeDeChamp {
|
||||
"""
|
||||
Adresse
|
||||
|
@ -2104,4 +2128,4 @@ type ValidationError {
|
|||
A description of the error
|
||||
"""
|
||||
message: String!
|
||||
}
|
||||
}
|
|
@ -20,6 +20,10 @@ module Types
|
|||
field :date_traitement, GraphQL::Types::ISO8601DateTime, "Date du dernier traitement.", null: true, method: :processed_at
|
||||
field :date_derniere_modification, GraphQL::Types::ISO8601DateTime, "Date de la dernière modification.", null: false, method: :updated_at
|
||||
|
||||
field :date_suppression_par_usager, GraphQL::Types::ISO8601DateTime, "Date de la suppression par l’usager.", null: true, method: :hidden_by_user_at
|
||||
field :date_suppression_par_administration, GraphQL::Types::ISO8601DateTime, "Date de la suppression par l’administration.", null: true, method: :hidden_by_administration_at
|
||||
field :date_expiration, GraphQL::Types::ISO8601DateTime, "Date d’expiration.", null: true
|
||||
|
||||
field :archived, Boolean, null: false
|
||||
|
||||
field :motivation, String, null: true
|
||||
|
@ -51,11 +55,18 @@ module Types
|
|||
field :annotations, [Types::ChampType], null: false do
|
||||
argument :id, ID, required: false
|
||||
end
|
||||
field :traitements, [Types::TraitementType], null: false
|
||||
|
||||
def state
|
||||
object.state
|
||||
end
|
||||
|
||||
def date_expiration
|
||||
if !object.en_instruction?
|
||||
object.expiration_date.presence || object.approximative_expiration_date
|
||||
end
|
||||
end
|
||||
|
||||
def usager
|
||||
if object.user_deleted?
|
||||
{ email: object.user_email_for(:display), id: -1 }
|
||||
|
@ -84,6 +95,10 @@ module Types
|
|||
Loaders::Association.for(object.class, :followers_instructeurs).load(object)
|
||||
end
|
||||
|
||||
def traitements
|
||||
Loaders::Association.for(object.class, :traitements).load(object)
|
||||
end
|
||||
|
||||
def messages(id: nil)
|
||||
if id.present?
|
||||
Loaders::Record
|
||||
|
|
9
app/graphql/types/traitement_type.rb
Normal file
9
app/graphql/types/traitement_type.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
module Types
|
||||
class TraitementType < Types::BaseObject
|
||||
global_id_field :id
|
||||
field :state, Types::DossierType::DossierState, null: false
|
||||
field :date_traitement, GraphQL::Types::ISO8601DateTime, null: false, method: :processed_at
|
||||
field :email_agent_traitant, String, null: true, method: :instructeur_email
|
||||
field :motivation, String, null: true
|
||||
end
|
||||
end
|
|
@ -81,18 +81,8 @@ class Champ < ApplicationRecord
|
|||
!private?
|
||||
end
|
||||
|
||||
def siblings
|
||||
if parent
|
||||
parent&.champs
|
||||
elsif public?
|
||||
dossier&.champs
|
||||
else
|
||||
dossier&.champs_private
|
||||
end
|
||||
end
|
||||
|
||||
def sections
|
||||
siblings&.filter(&:header_section?)
|
||||
@sections ||= dossier.sections_for(self)
|
||||
end
|
||||
|
||||
def mandatory_and_blank?
|
||||
|
|
|
@ -261,32 +261,33 @@ class Dossier < ApplicationRecord
|
|||
}
|
||||
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
||||
scope :without_followers, -> { left_outer_joins(:follows).where(follows: { id: nil }) }
|
||||
scope :with_champs, -> { includes(champs: :type_de_champ) }
|
||||
scope :with_champs, -> {
|
||||
includes(champs: [
|
||||
:type_de_champ,
|
||||
:geo_areas,
|
||||
piece_justificative_file_attachment: :blob,
|
||||
champs: [:type_de_champ, piece_justificative_file_attachment: :blob]
|
||||
])
|
||||
}
|
||||
scope :with_annotations, -> {
|
||||
includes(champs_private: [
|
||||
:type_de_champ,
|
||||
:geo_areas,
|
||||
piece_justificative_file_attachment: :blob,
|
||||
champs: [:type_de_champ, piece_justificative_file_attachment: :blob]
|
||||
])
|
||||
}
|
||||
scope :for_api, -> {
|
||||
includes(commentaires: { piece_jointe_attachment: :blob },
|
||||
champs: [
|
||||
:geo_areas,
|
||||
:etablissement,
|
||||
piece_justificative_file_attachment: :blob,
|
||||
champs: [
|
||||
piece_justificative_file_attachment: :blob
|
||||
]
|
||||
],
|
||||
champs_private: [
|
||||
:geo_areas,
|
||||
:etablissement,
|
||||
piece_justificative_file_attachment: :blob,
|
||||
champs: [
|
||||
piece_justificative_file_attachment: :blob
|
||||
]
|
||||
],
|
||||
justificatif_motivation_attachment: :blob,
|
||||
attestation: [],
|
||||
avis: { piece_justificative_file_attachment: :blob },
|
||||
traitement: [],
|
||||
etablissement: [],
|
||||
individual: [],
|
||||
user: [])
|
||||
with_champs
|
||||
.with_annotations
|
||||
.includes(commentaires: { piece_jointe_attachment: :blob },
|
||||
justificatif_motivation_attachment: :blob,
|
||||
attestation: [],
|
||||
avis: { piece_justificative_file_attachment: :blob },
|
||||
traitement: [],
|
||||
etablissement: [],
|
||||
individual: [],
|
||||
user: [])
|
||||
}
|
||||
|
||||
scope :with_notifiable_procedure, -> (opts = { notify_on_closed: false }) do
|
||||
|
@ -1122,6 +1123,20 @@ class Dossier < ApplicationRecord
|
|||
termine_expired_to_delete.find_each(&:purge_discarded)
|
||||
end
|
||||
|
||||
def sections_for(champ)
|
||||
@sections = Hash.new do |hash, parent|
|
||||
case parent
|
||||
when :public
|
||||
hash[parent] = champs.filter(&:header_section?)
|
||||
when :private
|
||||
hash[parent] = champs_private.filter(&:header_section?)
|
||||
else
|
||||
hash[parent] = parent.champs.filter(&:header_section?)
|
||||
end
|
||||
end
|
||||
@sections[champ.parent || (champ.public? ? :public : :private)]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_missing_traitemets
|
||||
|
@ -1143,7 +1158,7 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
|
||||
def geo_areas
|
||||
champs.includes(:geo_areas).flat_map(&:geo_areas) + champs_private.includes(:geo_areas).flat_map(&:geo_areas)
|
||||
champs.flat_map(&:geo_areas) + champs_private.flat_map(&:geo_areas)
|
||||
end
|
||||
|
||||
def bounding_box
|
||||
|
|
|
@ -140,6 +140,7 @@ class Instructeur < ApplicationRecord
|
|||
|
||||
def notifications_for_groupe_instructeurs(groupe_instructeurs)
|
||||
Dossier
|
||||
.visible_by_administration
|
||||
.not_archived
|
||||
.where(groupe_instructeur: groupe_instructeurs)
|
||||
.merge(followed_dossiers)
|
||||
|
@ -180,8 +181,8 @@ class Instructeur < ApplicationRecord
|
|||
nb_notification = notifications[:en_cours].count + notifications[:termines].count
|
||||
|
||||
h = {
|
||||
nb_en_construction: groupe.dossiers.en_construction.count,
|
||||
nb_en_instruction: groupe.dossiers.en_instruction.count,
|
||||
nb_en_construction: groupe.dossiers.visible_by_administration.en_construction.count,
|
||||
nb_en_instruction: groupe.dossiers.visible_by_administration.en_instruction.count,
|
||||
nb_accepted: Traitement.where(dossier: groupe.dossiers.accepte, processed_at: Time.zone.yesterday.beginning_of_day..Time.zone.yesterday.end_of_day).count,
|
||||
nb_notification: nb_notification
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ class SerializerService
|
|||
datePassageEnConstruction
|
||||
datePassageEnInstruction
|
||||
dateTraitement
|
||||
dateSuppressionParUsager
|
||||
dateSuppressionParAdministration
|
||||
instructeurs {
|
||||
email
|
||||
}
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
state: dossier.state,
|
||||
archived: dossier.archived,
|
||||
dossier_is_followed: current_instructeur&.follow?(dossier),
|
||||
close_to_expiration: dossier.close_to_expiration? }
|
||||
close_to_expiration: dossier.close_to_expiration?,
|
||||
hidden_by_administration: dossier.hidden_by_administration? }
|
||||
|
||||
|
||||
.state-button
|
||||
|
|
|
@ -114,8 +114,7 @@
|
|||
L’usager a supprimé son compte. Vous pouvez archiver puis supprimer le dossier.
|
||||
|
||||
%li
|
||||
= link_to supprimer_dossier_instructeur_dossier_path(dossier.procedure, dossier), method: :patch, data: { confirm: "Voulez vous vraiment supprimer le dossier #{dossier.id} ? Cette action est irréversible. \nNous vous suggérons de télécharger le dossier au format PDF au préalable." } do
|
||||
= link_to instructeur_dossier_path(dossier.procedure, dossier), method: :delete do
|
||||
%span.icon.delete
|
||||
.dropdown-description
|
||||
%h4 Supprimer le dossier
|
||||
L’usager sera notifié que son dossier est supprimé.
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
- if close_to_expiration || Dossier::TERMINE.include?(state)
|
||||
- if hidden_by_administration
|
||||
= link_to restore_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: "button" do
|
||||
= t('views.instructeurs.dossiers.restore')
|
||||
- elsif close_to_expiration || Dossier::TERMINE.include?(state)
|
||||
.dropdown.user-dossier-actions
|
||||
%button.button.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'actions-menu' }
|
||||
Actions
|
||||
|
@ -23,7 +26,7 @@
|
|||
Archiver le dossier
|
||||
|
||||
%li.danger
|
||||
= link_to supprimer_dossier_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, data: { confirm: "Voulez vous vraiment supprimer le dossier #{dossier_id} ? Cette action est irréversible. \nNous vous suggérons de télécharger le dossier au format PDF au préalable." } do
|
||||
= link_to instructeur_dossier_path(procedure_id, dossier_id), method: :delete do
|
||||
%span.icon.delete
|
||||
.dropdown-description
|
||||
= t('views.instructeurs.dossiers.delete_dossier')
|
||||
|
|
|
@ -7,13 +7,21 @@
|
|||
.procedure-logo{ style: "background-image: url(#{@procedure.logo_url})",
|
||||
role: 'img', 'aria-label': "logo de la démarche #{@procedure.libelle}" }
|
||||
|
||||
= render partial: 'header', locals: { procedure: @procedure,
|
||||
= render partial: 'header', locals: { procedure: @procedure, statut: @statut }
|
||||
|
||||
.procedure-actions
|
||||
- if @can_download_dossiers
|
||||
= render partial: "download_dossiers", locals: { procedure: @procedure, exports: @exports }
|
||||
|
||||
.container.flex= render partial: "tabs", locals: { procedure: @procedure,
|
||||
statut: @statut,
|
||||
a_suivre_count: @a_suivre_count,
|
||||
suivis_count: @suivis_count,
|
||||
traites_count: @traites_count,
|
||||
tous_count: @tous_count,
|
||||
supprimes_recemment_count: @supprimes_recemment_count,
|
||||
archives_count: @archives_count,
|
||||
expirant_count: @expirant_count,
|
||||
has_en_cours_notifications: @has_en_cours_notifications,
|
||||
has_termine_notifications: @has_termine_notifications }
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
.procedure-actions
|
||||
- if @can_download_dossiers
|
||||
= render partial: "download_dossiers", locals: { procedure: @procedure, exports: @exports }
|
||||
|
||||
.container.flex= render partial: "tabs", locals: { procedure: @procedure,
|
||||
statut: @statut,
|
||||
a_suivre_count: @a_suivre_count,
|
||||
|
@ -116,36 +117,46 @@
|
|||
- path = instructeur_dossier_path(@procedure, p.dossier_id)
|
||||
%tr{ class: [p.hidden_by_user_at.present? && "file-hidden-by-user"] }
|
||||
%td.folder-col
|
||||
%a.cell-link{ href: path }
|
||||
%span.icon.folder
|
||||
- if @not_archived_notifications_dossier_ids.include?(p.dossier_id)
|
||||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
- if p.hidden_by_administration_at.present?
|
||||
%span.cell-link
|
||||
%span.icon.folder
|
||||
- else
|
||||
%a.cell-link{ href: path }
|
||||
%span.icon.folder
|
||||
- if @not_archived_notifications_dossier_ids.include?(p.dossier_id)
|
||||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
|
||||
%td.number-col
|
||||
%a.cell-link{ href: path }= p.dossier_id
|
||||
- if p.hidden_by_administration_at.present?
|
||||
%span.cell-link= p.dossier_id
|
||||
- else
|
||||
%a.cell-link{ href: path }= p.dossier_id
|
||||
|
||||
- p.columns.each do |column|
|
||||
%td
|
||||
%a.cell-link{ href: path }
|
||||
= column
|
||||
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
||||
- if p.hidden_by_administration_at.present?
|
||||
%span.cell-link
|
||||
= column
|
||||
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
||||
- else
|
||||
%a.cell-link{ href: path }
|
||||
= column
|
||||
= "- #{t('views.instructeurs.dossiers.deleted_by_user')}" if p.hidden_by_user_at.present?
|
||||
|
||||
%td.status-col
|
||||
%a.cell-link{ href: path }= status_badge(p.state)
|
||||
- if p.hidden_by_administration_at.present?
|
||||
%span.cell-link= status_badge(p.state)
|
||||
- else
|
||||
%a.cell-link{ href: path }= status_badge(p.state)
|
||||
|
||||
- if @statut == 'supprimes_recemment'
|
||||
%td.action-col.follow-col
|
||||
= link_to restore_instructeur_dossier_path(@procedure, p.dossier_id), method: :patch, class: "button primary" do
|
||||
= t('views.instructeurs.dossiers.restore')
|
||||
|
||||
- else
|
||||
%td.action-col.follow-col= render partial: 'dossier_actions',
|
||||
locals: { procedure_id: @procedure.id,
|
||||
dossier_id: p.dossier_id,
|
||||
state: p.state,
|
||||
archived: p.archived,
|
||||
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
||||
close_to_expiration: @statut == 'expirant' }
|
||||
%td.action-col.follow-col= render partial: 'dossier_actions',
|
||||
locals: { procedure_id: @procedure.id,
|
||||
dossier_id: p.dossier_id,
|
||||
state: p.state,
|
||||
archived: p.archived,
|
||||
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
||||
close_to_expiration: @statut == 'expirant',
|
||||
hidden_by_administration: @statut == 'supprimes_recemment' }
|
||||
|
||||
= pagination
|
||||
- else
|
||||
|
|
|
@ -93,7 +93,8 @@
|
|||
state: p.state,
|
||||
archived: p.archived,
|
||||
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
|
||||
close_to_expiration: nil }
|
||||
close_to_expiration: nil,
|
||||
hidden_by_administration: nil }
|
||||
|
||||
- else
|
||||
%td
|
||||
|
|
|
@ -359,7 +359,7 @@ Rails.application.routes.draw do
|
|||
get 'email_usagers'
|
||||
post 'create_multiple_commentaire'
|
||||
|
||||
resources :dossiers, only: [:show], param: :dossier_id do
|
||||
resources :dossiers, only: [:show, :destroy], param: :dossier_id do
|
||||
member do
|
||||
resources :commentaires, only: [:destroy]
|
||||
post 'repousser-expiration' => 'dossiers#extend_conservation'
|
||||
|
@ -375,7 +375,7 @@ Rails.application.routes.draw do
|
|||
patch 'unfollow'
|
||||
patch 'archive'
|
||||
patch 'unarchive'
|
||||
patch 'supprimer-dossier' => 'dossiers#delete_dossier'
|
||||
patch 'restore'
|
||||
patch 'annotations' => 'dossiers#update_annotations'
|
||||
post 'commentaire' => 'dossiers#create_commentaire'
|
||||
post 'passer-en-instruction' => 'dossiers#passer_en_instruction'
|
||||
|
@ -386,7 +386,6 @@ Rails.application.routes.draw do
|
|||
post 'avis' => 'dossiers#create_avis'
|
||||
get 'print' => 'dossiers#print'
|
||||
get 'telecharger_pjs' => 'dossiers#telecharger_pjs'
|
||||
patch 'restore'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
namespace :after_party do
|
||||
desc 'Deployment task: null_exports_key_to_uuid'
|
||||
task null_exports_key_to_uuid: :environment do
|
||||
puts "Running deploy task 'null_exports_key_to_uuid'"
|
||||
|
||||
Export.where(key: nil).update_all(key: SecureRandom.uuid)
|
||||
|
||||
# Update task as completed. If you remove the line below, the task will
|
||||
# run with every deploy (or every time you call after_party:run).
|
||||
AfterParty::TaskRecord
|
||||
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
|
||||
end
|
||||
end
|
|
@ -56,7 +56,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
|||
|
||||
it { expect(instructeur.followed_dossiers).to match([dossier]) }
|
||||
it { expect(flash.notice).to eq('Dossier suivi') }
|
||||
it { expect(response).to redirect_to(instructeur_procedures_url) }
|
||||
it { expect(response).to redirect_to(instructeur_procedure_path(dossier.procedure)) }
|
||||
end
|
||||
|
||||
describe '#unfollow' do
|
||||
|
@ -68,7 +68,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
|||
|
||||
it { expect(instructeur.followed_dossiers).to match([]) }
|
||||
it { expect(flash.notice).to eq("Vous ne suivez plus le dossier nº #{dossier.id}") }
|
||||
it { expect(response).to redirect_to(instructeur_procedures_url) }
|
||||
it { expect(response).to redirect_to(instructeur_procedure_path(dossier.procedure)) }
|
||||
end
|
||||
|
||||
describe '#archive' do
|
||||
|
@ -80,7 +80,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
it { expect(dossier.archived).to be true }
|
||||
it { expect(response).to redirect_to(instructeur_procedures_url) }
|
||||
it { expect(response).to redirect_to(instructeur_procedure_path(dossier.procedure)) }
|
||||
end
|
||||
|
||||
describe '#unarchive' do
|
||||
|
@ -91,7 +91,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
|||
end
|
||||
|
||||
it { expect(dossier.archived).to be false }
|
||||
it { expect(response).to redirect_to(instructeur_procedures_url) }
|
||||
it { expect(response).to redirect_to(instructeur_procedure_path(dossier.procedure)) }
|
||||
end
|
||||
|
||||
describe '#passer_en_instruction' do
|
||||
|
@ -740,9 +740,9 @@ describe Instructeurs::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#delete_dossier" do
|
||||
describe "#destroy" do
|
||||
subject do
|
||||
patch :delete_dossier, params: {
|
||||
delete :destroy, params: {
|
||||
procedure_id: procedure.id,
|
||||
dossier_id: dossier.id
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ RSpec.describe Types::DossierType, type: :graphql do
|
|||
let(:variables) { { number: dossier.id } }
|
||||
|
||||
it { expect(data[:dossier][:attestation]).not_to be_nil }
|
||||
it { expect(data[:dossier][:traitements]).to eq([{ state: 'accepte' }]) }
|
||||
it { expect(data[:dossier][:dateExpiration]).not_to be_nil }
|
||||
|
||||
context 'when attestation is nil' do
|
||||
before do
|
||||
|
@ -39,6 +41,10 @@ RSpec.describe Types::DossierType, type: :graphql do
|
|||
attestation {
|
||||
url
|
||||
}
|
||||
traitements {
|
||||
state
|
||||
}
|
||||
dateExpiration
|
||||
}
|
||||
}
|
||||
GRAPHQL
|
||||
|
|
|
@ -69,19 +69,32 @@ describe Champ do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#siblings' do
|
||||
let(:procedure) { create(:procedure, :with_type_de_champ, :with_type_de_champ_private, :with_repetition, types_de_champ_count: 1, types_de_champ_private_count: 1) }
|
||||
describe '#sections' do
|
||||
let(:procedure) do
|
||||
create(:procedure, :with_type_de_champ, :with_type_de_champ_private, :with_repetition, types_de_champ_count: 1, types_de_champ_private_count: 1).tap do |procedure|
|
||||
create(:type_de_champ_header_section, procedure: procedure)
|
||||
create(:type_de_champ_header_section, procedure: procedure, private: true)
|
||||
create(:type_de_champ_header_section, parent: procedure.types_de_champ.find(&:repetition?))
|
||||
end
|
||||
end
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
let(:public_champ) { dossier.champs.first }
|
||||
let(:private_champ) { dossier.champs_private.first }
|
||||
let(:champ_in_repetition) { dossier.champs.find(&:repetition?).champs.first }
|
||||
let(:standalone_champ) { build(:champ, type_de_champ: build(:type_de_champ), dossier: nil) }
|
||||
let(:standalone_champ) { build(:champ, type_de_champ: build(:type_de_champ), dossier: build(:dossier)) }
|
||||
let(:public_sections) { dossier.champs.filter(&:header_section?) }
|
||||
let(:private_sections) { dossier.champs_private.filter(&:header_section?) }
|
||||
let(:sections_in_repetition) { champ_in_repetition.parent.champs.filter(&:header_section?) }
|
||||
|
||||
it 'returns the sibling champs of a champ' do
|
||||
expect(public_champ.siblings).to eq(dossier.champs)
|
||||
expect(private_champ.siblings).to eq(dossier.champs_private)
|
||||
expect(champ_in_repetition.siblings).to eq(champ_in_repetition.parent.champs)
|
||||
expect(standalone_champ.siblings).to be_nil
|
||||
it 'returns the sibling sections of a champ' do
|
||||
expect(public_sections).not_to be_empty
|
||||
expect(private_sections).not_to be_empty
|
||||
expect(sections_in_repetition).not_to be_empty
|
||||
|
||||
expect(public_champ.sections).to eq(public_sections)
|
||||
expect(private_champ.sections).to eq(private_sections)
|
||||
expect(champ_in_repetition.sections).to eq(sections_in_repetition)
|
||||
expect(standalone_champ.sections).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -70,9 +70,7 @@ describe 'Instructing a dossier:', js: true do
|
|||
click_on procedure.libelle
|
||||
click_on 'traité'
|
||||
click_on 'Actions'
|
||||
accept_confirm do
|
||||
click_on 'Supprimer le dossier'
|
||||
end
|
||||
click_on 'Supprimer le dossier'
|
||||
click_on 'traité'
|
||||
expect(page).not_to have_button('Actions')
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue