- Ajust TPS for OpenSimplif
- Create /simplifcations routes for OpenSimplifController
This commit is contained in:
parent
29c7c8f498
commit
23df8a2348
18 changed files with 231 additions and 47 deletions
|
@ -18,7 +18,7 @@ class Backoffice::PreferenceListDossierController < Backoffice::DossiersListCont
|
|||
procedure_id: params_procedure_id
|
||||
)
|
||||
|
||||
render partial: 'backoffice/dossiers/pref_list', formats: :js
|
||||
render partial: path, formats: :js
|
||||
end
|
||||
|
||||
def reload_pref_list
|
||||
|
@ -30,11 +30,15 @@ class Backoffice::PreferenceListDossierController < Backoffice::DossiersListCont
|
|||
def delete
|
||||
PreferenceListDossier.delete(params[:pref_id])
|
||||
|
||||
render partial: 'backoffice/dossiers/pref_list', formats: :js
|
||||
render partial: path, formats: :js
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def path
|
||||
Features.opensimplif ? 'opensimplif/pref_list' : 'backoffice/dossiers/pref_list'
|
||||
end
|
||||
|
||||
def params_procedure_id
|
||||
@procedure_id ||= params[:procedure_id]
|
||||
end
|
||||
|
|
61
app/controllers/opensimplif_controller.rb
Normal file
61
app/controllers/opensimplif_controller.rb
Normal file
|
@ -0,0 +1,61 @@
|
|||
class OpensimplifController < Backoffice::Dossiers::ProcedureController
|
||||
def index
|
||||
if params[:id].nil?
|
||||
procedure = current_gestionnaire.procedures.order('libelle ASC').first
|
||||
|
||||
if procedure.nil?
|
||||
return redirect_to simplifications_nothing_path
|
||||
else
|
||||
return redirect_to simplification_path(id: procedure.id)
|
||||
end
|
||||
end
|
||||
|
||||
smartlisting_dossier
|
||||
end
|
||||
|
||||
def nothing
|
||||
|
||||
end
|
||||
|
||||
def reload_smartlisting
|
||||
smartlisting_dossier
|
||||
|
||||
render 'opensimplif/index', formats: :js
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def smartlisting_dossier dossiers_list=nil, liste='all_state'
|
||||
dossiers_list_facade liste
|
||||
|
||||
mes_dossiers_list = current_user.dossiers
|
||||
follow_dossiers_list = dossiers_list_facade.service.suivi
|
||||
all_state_dossiers_list = dossiers_list_facade.service.all_state
|
||||
|
||||
if param_page.nil?
|
||||
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
|
||||
end
|
||||
|
||||
smart_listing_create :mes_dossiers,
|
||||
mes_dossiers_list,
|
||||
partial: "backoffice/dossiers/list",
|
||||
array: true,
|
||||
default_sort: dossiers_list_facade.service.default_sort
|
||||
|
||||
smart_listing_create :follow_dossiers,
|
||||
follow_dossiers_list,
|
||||
partial: "backoffice/dossiers/list",
|
||||
array: true,
|
||||
default_sort: dossiers_list_facade.service.default_sort
|
||||
|
||||
smart_listing_create :all_state_dossiers,
|
||||
all_state_dossiers_list,
|
||||
partial: "backoffice/dossiers/list",
|
||||
array: true,
|
||||
default_sort: dossiers_list_facade.service.default_sort
|
||||
end
|
||||
|
||||
def dossiers_list_facade liste='all_state'
|
||||
@facade_data_view ||= DossiersListFacades.new current_gestionnaire, liste, retrieve_procedure
|
||||
end
|
||||
end
|
|
@ -2,6 +2,12 @@ class RootController < ApplicationController
|
|||
def index
|
||||
route = Rails.application.routes.recognize_path(request.referrer)
|
||||
|
||||
if Features.opensimplif
|
||||
unless !user_signed_in? && !administrateur_signed_in? && !gestionnaire_signed_in?
|
||||
return redirect_to simplifications_path
|
||||
end
|
||||
end
|
||||
|
||||
if user_signed_in? && !route[:controller].match('users').nil?
|
||||
return redirect_to users_dossiers_path
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ class Users::SessionsController < Sessions::SessionsController
|
|||
current_user.update_attributes(loged_in_with_france_connect: '')
|
||||
end
|
||||
|
||||
check_opensimplif if Features.opensimplif
|
||||
|
||||
if user_signed_in?
|
||||
redirect_to after_sign_in_path_for(:user)
|
||||
elsif gestionnaire_signed_in?
|
||||
|
@ -72,6 +74,18 @@ class Users::SessionsController < Sessions::SessionsController
|
|||
|
||||
private
|
||||
|
||||
def check_opensimplif
|
||||
return if (user_signed_in? && gestionnaire_signed_in?) || administrateur_signed_in?
|
||||
|
||||
if gestionnaire_signed_in?
|
||||
User.create email: params[:user][:email], password: params[:user][:password]
|
||||
try_to_authenticate User
|
||||
elsif user_signed_in?
|
||||
Gestionnaire.create email: params[:user][:email], password: params[:user][:password]
|
||||
try_to_authenticate Gestionnaire
|
||||
end
|
||||
end
|
||||
|
||||
def error_procedure
|
||||
flash.alert = t('errors.messages.procedure_not_found')
|
||||
redirect_to url_for root_path
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
- if smart_listing.name.to_s == 'follow_dossiers'
|
||||
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
|
||||
%i.fa.fa-bell
|
||||
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
|
||||
État
|
||||
- unless Features.opensimplif
|
||||
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
|
||||
État
|
||||
|
||||
- @facade_data_view.preference_list_dossiers_filter.each do |preference|
|
||||
- unless preference.libelle == 'Statut' || preference.libelle == 'État'
|
||||
|
@ -32,8 +33,9 @@
|
|||
- else
|
||||
.badge.progress-bar-warning
|
||||
= total_notif
|
||||
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
|
||||
= dossier.decorate.display_state
|
||||
- unless Features.opensimplif
|
||||
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.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
|
||||
|
@ -60,7 +62,7 @@
|
|||
= dossier.total_follow
|
||||
|
||||
= smart_listing.paginate
|
||||
- if smart_listing.name.to_s == 'follow_dossiers'
|
||||
- if smart_listing.name.to_s == 'follow_dossiers' && smart_listing.collection.count > 0
|
||||
= smart_listing.pagination_per_page_links
|
||||
%br
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<%= smart_listing_update :search %>
|
||||
|
||||
filters_init();
|
||||
filters_init();
|
||||
link_init();
|
|
@ -34,17 +34,17 @@
|
|||
- else
|
||||
.row
|
||||
%div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label= champ.libelle
|
||||
- if Features.opensimplif
|
||||
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments
|
||||
- if gestionnaire_signed_in?
|
||||
= link_to "", "data-href" => backoffice_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" do
|
||||
%i.fa.fa-comment-o
|
||||
- else
|
||||
= link_to "", "data-href" => users_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" do
|
||||
%i.fa.fa-commenting-o
|
||||
- else
|
||||
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off
|
||||
= "-"
|
||||
-#- if Features.opensimplif
|
||||
-# %div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments
|
||||
-# - if gestionnaire_signed_in?
|
||||
-# = link_to "", "data-href" => backoffice_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" do
|
||||
-# %i.fa.fa-comment-o
|
||||
-# - else
|
||||
-# = link_to "", "data-href" => users_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" do
|
||||
-# %i.fa.fa-commenting-o
|
||||
-#- else
|
||||
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off
|
||||
= "-"
|
||||
%div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info{ id: "champ-#{champ.id}-value" }
|
||||
- unless champ.decorate.value.blank?
|
||||
= champ.decorate.value.html_safe
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
|
||||
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect? && !Features.opensimplif
|
||||
#switch_menu.dropdown.dropup
|
||||
%button.btn.btn-default.dropdown-toggle{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false}
|
||||
%i.fa.fa-toggle-on
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
%div.dossiers-en-cours
|
||||
.count= @facade_data_view.total_dossier_follow
|
||||
.text= "SUIVIS"
|
||||
%div.nouveaux-dossiers
|
||||
.count= @facade_data_view.total_new_dossier
|
||||
.text= "NOUVEAUX"
|
||||
- unless Features.opensimplif
|
||||
%div.nouveaux-dossiers
|
||||
.count= @facade_data_view.total_new_dossier
|
||||
.text= "NOUVEAUX"
|
||||
%div.nouvelles-notifications
|
||||
.count= @facade_data_view.dossiers_with_unread_notifications.count
|
||||
.text= "MODIFIÉS"
|
||||
|
@ -21,11 +22,14 @@
|
|||
%div.split-hr-left
|
||||
#procedure_list
|
||||
- @facade_data_view.gestionnaire_procedures_name_and_id_list.each do |procedure|
|
||||
= link_to backoffice_dossiers_procedure_path(procedure[:id]), {title: procedure[:libelle]} do
|
||||
|
||||
- url_path = Features.opensimplif ? simplification_path(procedure[:id]) : backoffice_dossiers_procedure_path(procedure[:id])
|
||||
|
||||
= link_to url_path, {title: procedure[:libelle]} do
|
||||
%div.procedure_list_element{ class: ('active' if procedure[:id] == @facade_data_view.procedure.id rescue '') }
|
||||
= truncate(procedure[:libelle], length: 50)
|
||||
- total_new = @facade_data_view.new_dossier_number procedure[:id]
|
||||
- if total_new > 0
|
||||
- if total_new > 0 && !Features.opensimplif
|
||||
.badge.progress-bar-success{title:'Nouveaux dossiers'}
|
||||
= total_new
|
||||
-if procedure[:unread_notifications] > 0
|
||||
|
|
|
@ -2,32 +2,34 @@
|
|||
%div.infos
|
||||
#dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
|
||||
|
||||
%div#action-block
|
||||
- if gestionnaire_signed_in?
|
||||
- if !@facade.dossier.read_only?
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
|
||||
%button.action{'data-toggle' => :tooltip, title: 'En cliquant ici, vous figez le dossier et autorisez le dépôt du dossier pour instruction.'}
|
||||
= 'Déclarer complet'.upcase
|
||||
- elsif @facade.dossier.submitted?
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :receive, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
|
||||
%button.action
|
||||
= 'Accuser réception'.upcase
|
||||
- elsif @facade.dossier.received?
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do
|
||||
%button.action.close-dossier
|
||||
%i.fa.fa-check
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :without_continuation, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Classer sans suite') do
|
||||
%button.action.forget-dossier
|
||||
%i.fa.fa-circle-o
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do
|
||||
%button.action.refuse-dossier
|
||||
%i.fa.fa-times
|
||||
- unless Features.opensimplif
|
||||
%div#action-block
|
||||
- if gestionnaire_signed_in?
|
||||
- if !@facade.dossier.read_only?
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
|
||||
%button.action{'data-toggle' => :tooltip, title: 'En cliquant ici, vous figez le dossier et autorisez le dépôt du dossier pour instruction.'}
|
||||
= 'Déclarer complet'.upcase
|
||||
- elsif @facade.dossier.submitted?
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :receive, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
|
||||
%button.action
|
||||
= 'Accuser réception'.upcase
|
||||
- elsif @facade.dossier.received?
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do
|
||||
%button.action.close-dossier
|
||||
%i.fa.fa-check
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :without_continuation, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Classer sans suite') do
|
||||
%button.action.forget-dossier
|
||||
%i.fa.fa-circle-o
|
||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do
|
||||
%button.action.refuse-dossier
|
||||
%i.fa.fa-times
|
||||
|
||||
%div#menu-block
|
||||
|
||||
%div#infos-block
|
||||
%div.split-hr-left
|
||||
%div.dossier-state= @facade.dossier.display_state
|
||||
- unless Features.opensimplif
|
||||
%div.split-hr-left
|
||||
%div.dossier-state= @facade.dossier.display_state
|
||||
%div.split-hr-left
|
||||
%div.notifications
|
||||
- if @facade.dossier.notifications.empty?
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
= render partial: 'layouts/left_panels/left_panel_backoffice_dossierscontroller_index'
|
|
@ -0,0 +1 @@
|
|||
= render partial: 'layouts/navbars/navbar_backoffice_dossiers_procedurecontroller_index'
|
14
app/views/opensimplif/_pref_list.js.erb
Normal file
14
app/views/opensimplif/_pref_list.js.erb
Normal file
|
@ -0,0 +1,14 @@
|
|||
$.ajax({
|
||||
method: 'get',
|
||||
url: '/simplifications/reload_smartlisting?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();
|
||||
});
|
43
app/views/opensimplif/index.html.haml
Normal file
43
app/views/opensimplif/index.html.haml
Normal file
|
@ -0,0 +1,43 @@
|
|||
#backoffice_index
|
||||
#pref_list_menu
|
||||
= render partial: 'backoffice/dossiers/pref_list'
|
||||
|
||||
.default_data_block.default_visible
|
||||
%div.row.show-block#new_dossiers
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
||||
%div.carret-right
|
||||
%div.carret-down
|
||||
Mes simplifications
|
||||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
||||
=current_user.dossiers.count
|
||||
SIMPLIFICATIONS
|
||||
%div.body
|
||||
= smart_listing_render :mes_dossiers
|
||||
|
||||
.default_data_block.default_visible
|
||||
%div.row.show-block#new_dossiers
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
||||
%div.carret-right
|
||||
%div.carret-down
|
||||
Les simplifications que je suivis
|
||||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
||||
=@facade_data_view.suivi_total
|
||||
simplifications
|
||||
%div.body
|
||||
= smart_listing_render :follow_dossiers
|
||||
|
||||
|
||||
.default_data_block
|
||||
%div.row.show-block#new_dossiers
|
||||
%div.header
|
||||
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
||||
%div.carret-right
|
||||
%div.carret-down
|
||||
Les autres
|
||||
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
||||
=@facade_data_view.all_state_total
|
||||
simplifications
|
||||
%div.body
|
||||
= smart_listing_render :all_state_dossiers
|
6
app/views/opensimplif/index.js.erb
Normal file
6
app/views/opensimplif/index.js.erb
Normal file
|
@ -0,0 +1,6 @@
|
|||
<%= smart_listing_update :mes_dossiers, {force: true} %>
|
||||
<%= smart_listing_update :follow_dossiers, {force: true} %>
|
||||
<%= smart_listing_update :all_state_dossiers, {force: true} %>
|
||||
|
||||
filters_init();
|
||||
link_init();
|
6
app/views/opensimplif/nothing.html.haml
Normal file
6
app/views/opensimplif/nothing.html.haml
Normal file
|
@ -0,0 +1,6 @@
|
|||
.center
|
||||
%h3.text-danger
|
||||
Vous n'avez aucun droit de lecture sur cette plateforme.
|
||||
|
||||
%h4
|
||||
Merci de prendre contact avec votre reponsable simplification afin de remedier à ce problème.
|
|
@ -43,6 +43,13 @@ Rails.application.routes.draw do
|
|||
get 'admin' => 'admin#index'
|
||||
get 'backoffice' => 'backoffice#index'
|
||||
|
||||
if Features.opensimplif
|
||||
get 'simplifications' => 'opensimplif#index'
|
||||
get 'simplifications/reload_smartlisting' => 'opensimplif#reload_smartlisting'
|
||||
get 'simplifications/nothing' => 'opensimplif#nothing'
|
||||
get 'simplifications/:id' => 'opensimplif#index', as: :simplification
|
||||
end
|
||||
|
||||
resources :administrations
|
||||
|
||||
namespace :france_connect do
|
||||
|
|
|
@ -58,6 +58,18 @@ describe RootController, type: :controller do
|
|||
it { expect(response.body).to have_css('#landing') }
|
||||
end
|
||||
|
||||
context 'when opensimplif features is true' do
|
||||
let(:gestionnaire) { create(:gestionnaire) }
|
||||
|
||||
before do
|
||||
sign_in gestionnaire
|
||||
|
||||
allow_any_instance_of(Features).to receive(:opensimplif).and_return(true)
|
||||
end
|
||||
|
||||
it { expect(subject).to redirect_to(simplifications_path) }
|
||||
end
|
||||
|
||||
context "unified login" do
|
||||
render_views
|
||||
|
||||
|
|
Loading…
Reference in a new issue