From 6c00b652e8e7d734ce2b5371989f12be67aa7299 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 24 Oct 2016 14:56:01 +0200 Subject: [PATCH 1/6] Disable state description (opensimplif) --- app/views/backoffice/dossiers/index.html.haml | 3 ++- app/views/users/dossiers/index.html.haml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/backoffice/dossiers/index.html.haml b/app/views/backoffice/dossiers/index.html.haml index c37cde902..e38066977 100644 --- a/app/views/backoffice/dossiers/index.html.haml +++ b/app/views/backoffice/dossiers/index.html.haml @@ -12,4 +12,5 @@ %br %br - = render partial: 'backoffice/dossiers/state_description', locals: {dossiers_list_facade: @dossiers_list_facade} + - unless Features.opensimplif + = render partial: 'backoffice/dossiers/state_description', locals: {dossiers_list_facade: @dossiers_list_facade} diff --git a/app/views/users/dossiers/index.html.haml b/app/views/users/dossiers/index.html.haml index a692b6ea2..46774910d 100644 --- a/app/views/users/dossiers/index.html.haml +++ b/app/views/users/dossiers/index.html.haml @@ -8,4 +8,5 @@ %br %br - = render partial: 'state_description', locals: {dossiers_list_facade: @dossiers_list_facade} + - unless Features.opensimplif + = render partial: 'state_description', locals: {dossiers_list_facade: @dossiers_list_facade} From 028078216a56abc565b486cb241f6bfe952c2c9f Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 24 Oct 2016 15:18:32 +0200 Subject: [PATCH 2/6] Get all dossiers on one table for User and Gestionnaire (opensimplif) --- app/facades/dossiers_list_facades.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/facades/dossiers_list_facades.rb b/app/facades/dossiers_list_facades.rb index 39b98ba1a..eab744271 100644 --- a/app/facades/dossiers_list_facades.rb +++ b/app/facades/dossiers_list_facades.rb @@ -28,7 +28,11 @@ class DossiersListFacades end def dossiers_to_display - service.dossiers_to_display + if Features.opensimplif + @current_devise_profil.dossiers + else + service.dossiers_to_display + end end def preference_list_dossiers_filter From 740b3650aa4979b463beb6951fb710747dcc5bc3 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 24 Oct 2016 16:00:03 +0200 Subject: [PATCH 3/6] Restore select procedure for gestionnaire (opensimplif) --- app/facades/dossiers_list_facades.rb | 8 +- app/models/dossier.rb | 9 +++ .../dossiers_list_gestionnaire_service.rb | 9 ++- app/services/dossiers_list_user_service.rb | 9 ++- .../backoffice/dossiers/_onglets.html.haml | 73 ++++++++++--------- app/views/backoffice/dossiers/index.html.haml | 3 +- config/initializers/features.yml | 4 +- 7 files changed, 66 insertions(+), 49 deletions(-) diff --git a/app/facades/dossiers_list_facades.rb b/app/facades/dossiers_list_facades.rb index eab744271..50d2848d7 100644 --- a/app/facades/dossiers_list_facades.rb +++ b/app/facades/dossiers_list_facades.rb @@ -4,6 +4,7 @@ class DossiersListFacades def initialize current_devise_profil, liste, procedure = nil @current_devise_profil = current_devise_profil @liste = liste + @liste = 'all_state' if Features.opensimplif @procedure = procedure end @@ -28,11 +29,7 @@ class DossiersListFacades end def dossiers_to_display - if Features.opensimplif - @current_devise_profil.dossiers - else - service.dossiers_to_display - end + service.dossiers_to_display end def preference_list_dossiers_filter @@ -194,4 +191,5 @@ class DossiersListFacades def base_url liste @procedure.nil? ? backoffice_dossiers_path(liste: liste) : backoffice_dossiers_procedure_path(id: @procedure.id, liste: liste) end + end \ No newline at end of file diff --git a/app/models/dossier.rb b/app/models/dossier.rb index c952ad0f6..e7b9599d0 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -53,6 +53,7 @@ class Dossier < ActiveRecord::Base EN_INSTRUCTION = %w(submitted received) A_INSTRUIRE = %w(received) TERMINE = %w(closed refused without_continuation) + ALL_STATE = %w(draft initiated updated replied validated submitted received closed refused without_continuation) def retrieve_last_piece_justificative_by_type(type) pieces_justificatives.where(type_de_piece_justificative_id: type).last @@ -169,6 +170,10 @@ class Dossier < ActiveRecord::Base state end + def all_state? + ALL_STATE.include?(state) + end + def brouillon? BROUILLON.include?(state) end @@ -209,6 +214,10 @@ class Dossier < ActiveRecord::Base TERMINE.include?(state) end + def self.all_state order = 'ASC' + where(state: ALL_STATE, archived: false).order("updated_at #{order}") + end + def self.brouillon order = 'ASC' where(state: BROUILLON, archived: false).order("updated_at #{order}") end diff --git a/app/services/dossiers_list_gestionnaire_service.rb b/app/services/dossiers_list_gestionnaire_service.rb index 9dbb7c072..bc7923d08 100644 --- a/app/services/dossiers_list_gestionnaire_service.rb +++ b/app/services/dossiers_list_gestionnaire_service.rb @@ -11,11 +11,16 @@ class DossiersListGestionnaireService 'en_attente' => waiting_for_user, 'deposes' => deposes, 'a_instruire' => a_instruire, - 'termine' => termine}[@liste] + 'termine' => termine, + 'all_state' => all_state}[@liste] end def self.dossiers_liste_libelle - ['nouveaux', 'a_traiter', 'en_attente', 'deposes', 'a_instruire', 'termine'] + ['nouveaux', 'a_traiter', 'en_attente', 'deposes', 'a_instruire', 'termine', 'all_state'] + end + + def all_state + @all_state ||= filter_dossiers.all_state end def nouveaux diff --git a/app/services/dossiers_list_user_service.rb b/app/services/dossiers_list_user_service.rb index 53f7902b2..5869b39b9 100644 --- a/app/services/dossiers_list_user_service.rb +++ b/app/services/dossiers_list_user_service.rb @@ -10,11 +10,16 @@ class DossiersListUserService 'valides' => valides, 'en_instruction' => en_instruction, 'termine' => termine, - 'invite' => invite}[@liste] + 'invite' => invite, + 'all_state' => all_state}[@liste] end def self.dossiers_liste_libelle - ['brouillon', 'a_traiter', 'valides', 'en_instruction', 'termine', 'invite'] + ['brouillon', 'a_traiter', 'valides', 'en_instruction', 'termine', 'invite', 'all_state'] + end + + def all_state + @all_state ||= @current_devise_profil.dossiers.all_state end def brouillon diff --git a/app/views/backoffice/dossiers/_onglets.html.haml b/app/views/backoffice/dossiers/_onglets.html.haml index 9018c1144..c19dcf170 100644 --- a/app/views/backoffice/dossiers/_onglets.html.haml +++ b/app/views/backoffice/dossiers/_onglets.html.haml @@ -7,47 +7,48 @@ #onglets %ul.nav.nav-tabs - %li{ class: (@dossiers_list_facade.nouveaux_class)} - %a{:href => "#{url_for @dossiers_list_facade.nouveaux_url}", 'data-toggle' => :tooltip, title: 'Les nouveaux dossiers non ouverts.'} - %h5.text-info - = "Nouveaux " - .badge.progress-bar-info - =@dossiers_list_facade.nouveaux_total + -unless Features.opensimplif + %li{ class: (@dossiers_list_facade.nouveaux_class)} + %a{:href => "#{url_for @dossiers_list_facade.nouveaux_url}", 'data-toggle' => :tooltip, title: 'Les nouveaux dossiers non ouverts.'} + %h5.text-info + = "Nouveaux " + .badge.progress-bar-info + =@dossiers_list_facade.nouveaux_total - %li{ class: (@dossiers_list_facade.a_traiter_class) } - %a{:href => "#{url_for @dossiers_list_facade.a_traiter_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.'} - %h5.text-danger - = "Action requise" - .badge.progress-bar-danger - =@dossiers_list_facade.a_traiter_total + %li{ class: (@dossiers_list_facade.a_traiter_class) } + %a{:href => "#{url_for @dossiers_list_facade.a_traiter_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.'} + %h5.text-danger + = "Action requise" + .badge.progress-bar-danger + =@dossiers_list_facade.a_traiter_total - %li{ class: (@dossiers_list_facade.en_attente_class) } - %a{:href => "#{url_for @dossiers_list_facade.en_attente_url}", 'data-toggle' => :tooltip, title: 'Les dossiers en attentes d\'une action de la part de l\'usager.'} - %h5.text-default - ="Attente usager " - .badge.progress-bar-default - =@dossiers_list_facade.en_attente_total + %li{ class: (@dossiers_list_facade.en_attente_class) } + %a{:href => "#{url_for @dossiers_list_facade.en_attente_url}", 'data-toggle' => :tooltip, title: 'Les dossiers en attentes d\'une action de la part de l\'usager.'} + %h5.text-default + ="Attente usager " + .badge.progress-bar-default + =@dossiers_list_facade.en_attente_total - %li{ class: (@dossiers_list_facade.deposes_class) } - %a{:href => "#{url_for @dossiers_list_facade.deposes_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ont été validés et déposés par les usager qui attendent une réponse de bonne réception avant examen.'} - %h5.text-purple - ="À réceptionner" - .badge.progress-bar-purple - =@dossiers_list_facade.deposes_total + %li{ class: (@dossiers_list_facade.deposes_class) } + %a{:href => "#{url_for @dossiers_list_facade.deposes_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ont été validés et déposés par les usager qui attendent une réponse de bonne réception avant examen.'} + %h5.text-purple + ="À réceptionner" + .badge.progress-bar-purple + =@dossiers_list_facade.deposes_total - %li{ class: (@dossiers_list_facade.a_instruire_class) } - %a{:href => "#{url_for @dossiers_list_facade.a_instruire_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ont été notifiés comme bien réceptionnés et qui attendent un verdict final.'} - %h5.text-warning - = "À instruire" - .badge.progress-bar-warning - =@dossiers_list_facade.a_instruire_total + %li{ class: (@dossiers_list_facade.a_instruire_class) } + %a{:href => "#{url_for @dossiers_list_facade.a_instruire_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ont été notifiés comme bien réceptionnés et qui attendent un verdict final.'} + %h5.text-warning + = "À instruire" + .badge.progress-bar-warning + =@dossiers_list_facade.a_instruire_total - %li{ class: (@dossiers_list_facade.termine_class) } - %a{:href => "#{url_for @dossiers_list_facade.termine_url}",'data-toggle' => :tooltip, title: 'Tous les dossiers qui ont été traité avec un statut "Validé", "Refusé" ou "Sans suite "'} - %h5.text-success - = "Terminé" - .badge.progress-bar-success - =@dossiers_list_facade.termine_total + %li{ class: (@dossiers_list_facade.termine_class) } + %a{:href => "#{url_for @dossiers_list_facade.termine_url}",'data-toggle' => :tooltip, title: 'Tous les dossiers qui ont été traité avec un statut "Validé", "Refusé" ou "Sans suite "'} + %h5.text-success + = "Terminé" + .badge.progress-bar-success + =@dossiers_list_facade.termine_total %ul.nav.nav-tabs.navbar-right{style:'border-bottom: none;'} %li#search{ class: (@dossiers_list_facade.search_class) } diff --git a/app/views/backoffice/dossiers/index.html.haml b/app/views/backoffice/dossiers/index.html.haml index e38066977..7a9a68328 100644 --- a/app/views/backoffice/dossiers/index.html.haml +++ b/app/views/backoffice/dossiers/index.html.haml @@ -5,8 +5,7 @@ =link_to 'Tous mes dossiers en CSV', backoffice_download_dossiers_tps_path, {class: 'btn btn-success btn-sm', style: 'float: right; margin-right: 4%; margin-top: 7px'} %h1 Gestion des dossiers - -unless Features.opensimplif - = render partial: 'backoffice/dossiers/onglets' + = render partial: 'backoffice/dossiers/onglets' = smart_listing_render :dossiers diff --git a/config/initializers/features.yml b/config/initializers/features.yml index 00852d1d4..876c862b7 100644 --- a/config/initializers/features.yml +++ b/config/initializers/features.yml @@ -1,3 +1,3 @@ remote_storage: true -unified_login: false -opensimplif: false \ No newline at end of file +unified_login: true +opensimplif: true \ No newline at end of file From 7f5d5c6320f2322936b60ea74e4ee168952c73f9 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 24 Oct 2016 16:05:41 +0200 Subject: [PATCH 4/6] Fix test OpenSimplif --- spec/features/backoffice/onglets_link_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/features/backoffice/onglets_link_spec.rb b/spec/features/backoffice/onglets_link_spec.rb index e0d61d38c..3232d02c4 100644 --- a/spec/features/backoffice/onglets_link_spec.rb +++ b/spec/features/backoffice/onglets_link_spec.rb @@ -97,8 +97,7 @@ feature 'on click on tabs button' do end scenario "it hides the tabs" do - expect(page).to_not have_css('#filter_by_procedure') - expect(page).to_not have_css('#onglets') + expect(page).to_not have_content('Nouveaux') end end end From 7674eb23f0dd9960571a44e349c25d037de1a0ab Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 25 Oct 2016 12:02:51 +0200 Subject: [PATCH 5/6] Add informations on administrations view --- app/views/administrations/_list.html.haml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/views/administrations/_list.html.haml b/app/views/administrations/_list.html.haml index da0db82cf..346bb7551 100644 --- a/app/views/administrations/_list.html.haml +++ b/app/views/administrations/_list.html.haml @@ -2,22 +2,26 @@ %table.table %thead %th.col-md-4.col-lg-4= smart_listing.sortable 'Email', :email - %th.col-md-4.col-lg-4= smart_listing.sortable 'API Token', :api_token %th.col-md-4.col-lg-4= smart_listing.sortable 'Date de dernière connexion', :last_sign_in_at + %th.col-md-2.col-lg-2 Procédure active + %th.col-md-2.col-lg-2 Dossier en cours - @admins.each do |admin| %tr %td = admin.email - %td - = admin.api_token %td - unless admin.last_sign_in_at.nil? = time_ago_in_words(l(admin.last_sign_in_at, format: "%d/%m/%Y %H:%M UTC +02:00")) ( = admin.last_sign_in_at.to_date.strftime('%d/%m/%Y') ) - + %td + = admin.procedures.where(published: true).count + %td + - total_dossier = 0 + - admin.procedures.each do |procedure| total_dossier += procedure.dossiers.count end + = total_dossier = smart_listing.paginate = smart_listing.pagination_per_page_links From e6c28fc9b2a93d735e4757a35ab4b66c9bfa8c3c Mon Sep 17 00:00:00 2001 From: Xavier J Date: Tue, 25 Oct 2016 12:03:25 +0200 Subject: [PATCH 6/6] Add tps_v2 deploy function --- config/deploy.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 811373464..14abbcaa5 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -11,7 +11,7 @@ require 'mina/rbenv' # for rbenv support. (http://rbenv.org) # branch - Branch name to deploy. (needed by mina/git) ENV['to'] ||= "staging" -ENV['to'] = "staging" unless ["staging", "production", "opensimplif"].include?(ENV['to']) +ENV['to'] = "staging" unless ["staging", "production", "opensimplif", "tps_v2"].include?(ENV['to']) raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil? @@ -51,13 +51,23 @@ elsif ENV["to"] == "opensimplif" set :deploy_to, '/var/www/opensimplif' set :user, 'opensimplif' # Username in the server to SSH to. appname = 'opensimplif' +elsif ENV["to"] == "tps_v2" + if ENV['branch'].nil? + set :branch, 'tps_v2' + else + set :branch, ENV['branch'] + end + set :deploy_to, '/var/www/tps_v2' + set :user, 'tps_v2' # Username in the server to SSH to. + appname = 'tps_v2' end - set :rails_env, ENV["to"] if ENV["to"] == "opensimplif" set :rails_env, "production" +elsif ENV["to"] == "tps_v2" + set :rails_env, "production" end # For system-wide RVM install.