commit
84aba2c2ad
7 changed files with 109 additions and 37 deletions
|
@ -1,5 +1,21 @@
|
|||
module Manager
|
||||
class ProceduresController < Manager::ApplicationController
|
||||
#
|
||||
# Administrate overrides
|
||||
#
|
||||
|
||||
# Override this if you have certain roles that require a subset
|
||||
# this will be used to set the records shown on the `index` action.
|
||||
def scoped_resource
|
||||
if unfiltered_list?
|
||||
# Don't display deleted dossiers in the unfiltered list…
|
||||
Procedure
|
||||
else
|
||||
# … but allow them to be searched and displayed.
|
||||
Procedure.unscope(:where)
|
||||
end
|
||||
end
|
||||
|
||||
def whitelist
|
||||
procedure.whitelist!
|
||||
flash[:notice] = "Démarche whitelistée."
|
||||
|
@ -55,5 +71,9 @@ module Manager
|
|||
def type_de_champ_params
|
||||
params.require(:type_de_champ).permit(:piece_justificative_template)
|
||||
end
|
||||
|
||||
def unfiltered_list?
|
||||
action_name == "index" && !params[:search]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -475,11 +475,21 @@ class Dossier < ApplicationRecord
|
|||
def spreadsheet_columns
|
||||
columns = [
|
||||
['ID', id.to_s],
|
||||
['Email', user.email],
|
||||
['Civilité', individual&.gender],
|
||||
['Nom', individual&.nom],
|
||||
['Prénom', individual&.prenom],
|
||||
['Date de naissance', individual&.birthdate],
|
||||
['Email', user.email]
|
||||
]
|
||||
|
||||
if procedure.for_individual?
|
||||
columns += [
|
||||
['Civilité', individual&.gender],
|
||||
['Nom', individual&.nom],
|
||||
['Prénom', individual&.prenom],
|
||||
['Date de naissance', individual&.birthdate]
|
||||
]
|
||||
else
|
||||
columns << ['Entreprise raison sociale', etablissement&.entreprise_raison_sociale]
|
||||
end
|
||||
|
||||
columns += [
|
||||
['Archivé', :archived],
|
||||
['État du dossier', I18n.t(state, scope: [:activerecord, :attributes, :dossier, :state])],
|
||||
['Dernière mise à jour le', :updated_at],
|
||||
|
|
|
@ -2,36 +2,35 @@
|
|||
%span.dropdown
|
||||
%button.button.dropdown-button
|
||||
Télécharger tous les dossiers
|
||||
- old_format_limit_date = Date.parse("Oct 31 2019")
|
||||
- old_format_limit_date = Date.parse("Nov 15 2019")
|
||||
- export_v1_enabled = old_format_limit_date > Time.zone.today
|
||||
- export_v2_enabled = Flipper[:procedure_export_v2_enabled] || !export_v1_enabled
|
||||
.dropdown-content.fade-in-down{ style: !export_v1_enabled ? 'width: 330px' : '' }
|
||||
%ul.dropdown-items
|
||||
- if export_v2_enabled
|
||||
%li
|
||||
- if procedure.xlsx_export_stale?
|
||||
- if procedure.xlsx_export_queued?
|
||||
L'export au format .xlsx est en cours de préparation, vous recevrez un email lorsqu'il sera disponible.
|
||||
- else
|
||||
= link_to "Exporter au format .xlsx", download_export_instructeur_procedure_path(procedure, export_format: :xlsx), remote: true
|
||||
%li
|
||||
- if procedure.xlsx_export_stale?
|
||||
- if procedure.xlsx_export_queued?
|
||||
L'export au format .xlsx est en cours de préparation, vous recevrez un email lorsqu'il sera disponible.
|
||||
- else
|
||||
= link_to "Au format .xlsx", url_for(procedure.xlsx_export_file), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
- if procedure.ods_export_stale?
|
||||
- if procedure.ods_export_queued?
|
||||
L'export au format .ods est en cours de préparation, vous recevrez un email lorsqu'il sera disponible.
|
||||
- else
|
||||
= link_to "Exporter au format .ods", download_export_instructeur_procedure_path(procedure, export_format: :ods), remote: true
|
||||
= link_to "Exporter au format .xlsx", download_export_instructeur_procedure_path(procedure, export_format: :xlsx), remote: true
|
||||
- else
|
||||
= link_to "Au format .xlsx", url_for(procedure.xlsx_export_file), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
- if procedure.ods_export_stale?
|
||||
- if procedure.ods_export_queued?
|
||||
L'export au format .ods est en cours de préparation, vous recevrez un email lorsqu'il sera disponible.
|
||||
- else
|
||||
= link_to "Au format .ods", url_for(procedure.ods_export_file), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
- if procedure.csv_export_stale?
|
||||
- if procedure.csv_export_queued?
|
||||
L'export au format .csv est en cours de préparation, vous recevrez un email lorsqu'il sera disponible.
|
||||
- else
|
||||
= link_to "Exporter au format .csv", download_export_instructeur_procedure_path(procedure, export_format: :csv), remote: true
|
||||
= link_to "Exporter au format .ods", download_export_instructeur_procedure_path(procedure, export_format: :ods), remote: true
|
||||
- else
|
||||
= link_to "Au format .ods", url_for(procedure.ods_export_file), target: "_blank", rel: "noopener"
|
||||
%li
|
||||
- if procedure.csv_export_stale?
|
||||
- if procedure.csv_export_queued?
|
||||
L'export au format .csv est en cours de préparation, vous recevrez un email lorsqu'il sera disponible.
|
||||
- else
|
||||
= link_to "Au format .csv", url_for(procedure.csv_export_file), target: "_blank", rel: "noopener"
|
||||
= link_to "Exporter au format .csv", download_export_instructeur_procedure_path(procedure, export_format: :csv), remote: true
|
||||
- else
|
||||
= link_to "Au format .csv", url_for(procedure.csv_export_file), target: "_blank", rel: "noopener"
|
||||
|
||||
- if export_v1_enabled
|
||||
- old_format_message = "(ancien format, jusqu’au #{old_format_limit_date.strftime('%d/%m/%Y')})"
|
||||
%li
|
||||
|
|
|
@ -43,7 +43,9 @@ as well as a link to its edit page.
|
|||
<%= link_to 'repasser en test', draft_manager_procedure_path(procedure), method: :post, class: 'button' %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'supprimer la démarche', hide_manager_procedure_path(procedure), method: :post, class: 'button', data: { confirm: "Confirmez-vous la suppression de la démarche ?" } %>
|
||||
<% if !procedure.hidden? %>
|
||||
<%= link_to 'supprimer la démarche', hide_manager_procedure_path(procedure), method: :post, class: 'button', data: { confirm: "Confirmez-vous la suppression de la démarche ?" } %>
|
||||
<% end %>
|
||||
<div>
|
||||
|
||||
</header>
|
||||
|
|
|
@ -103,12 +103,11 @@
|
|||
- if feature_enabled?(:administrateur_web_hook)
|
||||
= f.label :web_hook_url do
|
||||
Lien de rappel HTTP (webhook)
|
||||
.notice
|
||||
%p
|
||||
Vous pouvez définir un lien de rappel HTTP (aussi appelé webhook) pour notifier un service tiers du changement de l'état d’un dossier de cette démarche sur demarches-simplifiees.fr.
|
||||
= link_to("Consulter la documentation du webhook", WEBHOOK_DOC_URL, target: "_blank", rel: "noopener")
|
||||
= f.text_field :web_hook_url, class: 'form-control', placeholder: 'https://callback.exemple.fr/'
|
||||
%p.help-block
|
||||
%i.fa.fa-info-circle
|
||||
Vous pouvez définir un lien de rappel HTTP (aussi appelé webhook) pour notifier un service tiers du changement de l'état d’un dossier de cette démarche sur demarches-simplifiees.fr.
|
||||
= link_to("Consulter la documentation du webhook", WEBHOOK_DOC_URL, target: "_blank", rel: "noopener")
|
||||
\.
|
||||
|
||||
= f.label :auto_archive_on do
|
||||
Clôture automatique à 00h01 le :
|
||||
|
|
|
@ -34,7 +34,6 @@ features = [
|
|||
:mini_profiler,
|
||||
:operation_log_serialize_subject,
|
||||
:pre_maintenance_mode,
|
||||
:procedure_export_v2_enabled,
|
||||
:xray
|
||||
]
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe ProcedureExportV2Service do
|
||||
describe 'to_data' do
|
||||
let(:procedure) { create(:procedure, :published, :with_all_champs) }
|
||||
let(:procedure) { create(:procedure, :published, :for_individual, :with_all_champs) }
|
||||
subject do
|
||||
Tempfile.create do |f|
|
||||
f << ProcedureExportV2Service.new(procedure, procedure.dossiers).to_xlsx
|
||||
|
@ -104,12 +104,55 @@ describe ProcedureExportV2Service do
|
|||
end
|
||||
|
||||
context 'with etablissement' do
|
||||
let(:procedure) { create(:procedure, :published, :with_all_champs) }
|
||||
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_entreprise, procedure: procedure) }
|
||||
|
||||
let(:dossier_etablissement) { etablissements_sheet.data[1] }
|
||||
let(:champ_etablissement) { etablissements_sheet.data[0] }
|
||||
|
||||
let(:nominal_headers) do
|
||||
[
|
||||
"ID",
|
||||
"Email",
|
||||
"Entreprise raison sociale",
|
||||
"Archivé",
|
||||
"État du dossier",
|
||||
"Dernière mise à jour le",
|
||||
"Déposé le",
|
||||
"Passé en instruction le",
|
||||
"Traité le",
|
||||
"Motivation de la décision",
|
||||
"Instructeurs",
|
||||
"textarea",
|
||||
"date",
|
||||
"datetime",
|
||||
"number",
|
||||
"decimal_number",
|
||||
"integer_number",
|
||||
"checkbox",
|
||||
"civilite",
|
||||
"email",
|
||||
"phone",
|
||||
"address",
|
||||
"yes_no",
|
||||
"simple_drop_down_list",
|
||||
"multiple_drop_down_list",
|
||||
"linked_drop_down_list",
|
||||
"pays",
|
||||
"regions",
|
||||
"departements",
|
||||
"engagement",
|
||||
"dossier_link",
|
||||
"piece_justificative",
|
||||
"siret",
|
||||
"carte",
|
||||
"text"
|
||||
]
|
||||
end
|
||||
|
||||
it 'should have headers' do
|
||||
expect(dossiers_sheet.headers).to match(nominal_headers)
|
||||
|
||||
expect(etablissements_sheet.headers).to eq([
|
||||
"Dossier ID",
|
||||
"Champ",
|
||||
|
|
Loading…
Reference in a new issue