Merge pull request #698 from sgmap/461_gestionnaire_action_button
461 gestionnaire action button
This commit is contained in:
commit
a93d05b3f7
8 changed files with 217 additions and 11 deletions
11
app/assets/javascripts/new_design/buttons.js
Normal file
11
app/assets/javascripts/new_design/buttons.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
$(document).on("click", "body", function () {
|
||||
$(".button.dropdown").removeClass("open");
|
||||
});
|
||||
|
||||
$(document).on("click", ".button.dropdown", function(event) {
|
||||
event.stopPropagation();
|
||||
var $target = $(event.target);
|
||||
if($target.hasClass("button", "dropdown")){
|
||||
$target.toggleClass("open");
|
||||
}
|
||||
});
|
9
app/assets/javascripts/new_design/state_button.js
Normal file
9
app/assets/javascripts/new_design/state_button.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
TPS.acceptDossier = function () {
|
||||
$(".motivation").show();
|
||||
$(".dropdown-items").hide();
|
||||
}
|
||||
|
||||
TPS.motivationCancel = function () {
|
||||
$(".motivation").hide();
|
||||
$(".dropdown-items").show();
|
||||
}
|
|
@ -61,6 +61,84 @@
|
|||
vertical-align: middle;
|
||||
margin-right: $default-spacer;
|
||||
}
|
||||
|
||||
&.dropdown {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "▾";
|
||||
margin-left: $default-spacer;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.open {
|
||||
.dropdown-content {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
border: 1px solid $border-grey;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 5 * $default-spacer;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.dropdown-items {
|
||||
li {
|
||||
display: flex;
|
||||
padding: 2 * $default-spacer;
|
||||
color: $grey;
|
||||
border-bottom: 1px solid $border-grey;
|
||||
font-size: 12px;
|
||||
min-width: 300px;
|
||||
cursor: pointer;
|
||||
|
||||
&.selected {
|
||||
cursor: default;
|
||||
|
||||
h4 {
|
||||
color: $blue;
|
||||
}
|
||||
}
|
||||
|
||||
&.selected,
|
||||
&:hover {
|
||||
background: $light-grey;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
a {
|
||||
display: flex;
|
||||
color: $grey;
|
||||
}
|
||||
|
||||
i {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
div {
|
||||
padding-left: $default-spacer;
|
||||
}
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 14px;
|
||||
color: $black;
|
||||
margin-bottom: $default-spacer;
|
||||
}
|
||||
}
|
||||
|
||||
.link {
|
||||
|
|
29
app/assets/stylesheets/new_design/motivation.scss
Normal file
29
app/assets/stylesheets/new_design/motivation.scss
Normal file
|
@ -0,0 +1,29 @@
|
|||
@import "colors";
|
||||
@import "constants";
|
||||
|
||||
.motivation {
|
||||
display: none;
|
||||
padding: $default-padding;
|
||||
color: $black;
|
||||
width: 450px;
|
||||
|
||||
h3 {
|
||||
font-size: 22px;
|
||||
margin-bottom: $default-spacer * 2;
|
||||
|
||||
i {
|
||||
vertical-align: sub;
|
||||
margin-right: $default-spacer;
|
||||
}
|
||||
}
|
||||
|
||||
textarea {
|
||||
margin-bottom: $default-spacer;
|
||||
}
|
||||
|
||||
.help {
|
||||
color: $grey;
|
||||
font-size: 11px;
|
||||
margin-bottom: $default-spacer * 2;
|
||||
}
|
||||
}
|
|
@ -99,9 +99,9 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
|
||||
dossier.received!
|
||||
current_gestionnaire.follow(dossier)
|
||||
flash.notice = 'Dossier considéré comme reçu.'
|
||||
flash.notice = 'Dossier passé en instruction.'
|
||||
|
||||
redirect_to backoffice_dossier_path(id: dossier.id)
|
||||
redirect_to_dossier(dossier)
|
||||
end
|
||||
|
||||
def process_dossier
|
||||
|
@ -143,7 +143,7 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
|
||||
NotificationMailer.send_notification(dossier, template, attestation_pdf).deliver_now!
|
||||
|
||||
redirect_to backoffice_dossier_path(id: dossier.id)
|
||||
redirect_to_dossier(dossier)
|
||||
end
|
||||
|
||||
def reload_smartlisting
|
||||
|
@ -180,13 +180,21 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
|||
create_dossier_facade params[:dossier_id]
|
||||
|
||||
@facade.dossier.replied!
|
||||
flash.notice = 'Dossier réouvert.'
|
||||
flash.notice = 'Dossier repassé en construction.'
|
||||
|
||||
redirect_to backoffice_dossiers_path
|
||||
redirect_to_dossier(@facade.dossier)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def redirect_to_dossier(dossier)
|
||||
if URI(request.referer).path == dossier_path(dossier.procedure, dossier)
|
||||
redirect_to dossier_path(dossier.procedure, dossier)
|
||||
else
|
||||
redirect_to backoffice_dossier_path(id: dossier.id)
|
||||
end
|
||||
end
|
||||
|
||||
def check_attestation_emailable(dossier)
|
||||
if dossier&.attestation&.emailable? == false
|
||||
human_size = number_to_human_size(dossier.attestation.pdf.size)
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
.backoffice-header
|
||||
.container
|
||||
%ul.breadcrumbs
|
||||
%li
|
||||
= link_to dossier.procedure.libelle, procedure_path(dossier.procedure)
|
||||
%li
|
||||
= "Dossier n° #{dossier.id}"
|
||||
.flex.justify-between
|
||||
%ul.breadcrumbs
|
||||
%li
|
||||
= link_to dossier.procedure.libelle, procedure_path(dossier.procedure)
|
||||
%li
|
||||
= "Dossier nº #{dossier.id}"
|
||||
%div
|
||||
= render partial: "state_button", locals: { dossier: dossier }
|
||||
= render partial: "new_gestionnaire/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) }
|
||||
%ul.tabs
|
||||
- notifications_summary = dossier.notifications_summary
|
||||
%li{ class: current_page?(dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
|
||||
|
|
67
app/views/new_gestionnaire/dossiers/_state_button.html.haml
Normal file
67
app/views/new_gestionnaire/dossiers/_state_button.html.haml
Normal file
|
@ -0,0 +1,67 @@
|
|||
- if dossier.en_construction? || dossier.en_instruction?
|
||||
%span.button.primary.dropdown
|
||||
= dossier.decorate.display_state
|
||||
.dropdown-content.fade-in-down
|
||||
%ul.dropdown-items
|
||||
- if dossier.en_construction?
|
||||
%li.selected
|
||||
%i.edit
|
||||
.description
|
||||
%h4 En construction
|
||||
Vous permettez à l'usager de modifier ses réponses au formulaire
|
||||
%li
|
||||
= link_to backoffice_dossier_receive_path(dossier), method: :post, data: { confirm: "Confirmer vous le passage en instruction de ce dossier ?" } do
|
||||
%i.in-progress
|
||||
.description
|
||||
%h4 Passer en instruction
|
||||
L'usager ne pourra plus modifier le formulaire
|
||||
|
||||
- if dossier.en_instruction?
|
||||
%li
|
||||
= link_to backoffice_dossier_reopen_path(dossier), method: :post, data: { confirm: "Confirmer vous la réouverture de ce dossier ?" } do
|
||||
%i.edit
|
||||
.description
|
||||
%h4 Repasser en construction
|
||||
Vous permettrez à l'usager de modifier ses réponses au formulaire
|
||||
%li.selected
|
||||
%i.in-progress
|
||||
.description
|
||||
%h4 En instruction
|
||||
L'usager ne peut modifer son dossier pendant l'instruction
|
||||
%li{ onclick: "TPS.acceptDossier();" }
|
||||
%i.accept
|
||||
.description
|
||||
%h4 Accepter
|
||||
L'usager sera notifié que son dossier a été accepté
|
||||
%li
|
||||
= link_to backoffice_dossier_process_dossier_path(dossier, process_action: "without_continuation"), method: :post, data: { confirm: "Confirmer vous le classement sans suite de ce dossier ?" } do
|
||||
%i.without-continuation
|
||||
.description
|
||||
%h4 Classer sans suite
|
||||
L'usager ne recevra aucune notification
|
||||
%li
|
||||
= link_to backoffice_dossier_process_dossier_path(dossier, process_action: "refuse"), method: :post, data: { confirm: "Confirmer vous le refus de ce dossier ?" } do
|
||||
%i.close
|
||||
.description
|
||||
%h4 Refuser
|
||||
L'usager sera notifié que son dossier a été refusé
|
||||
.motivation
|
||||
%h3
|
||||
%i.accept
|
||||
Accepter le dossier
|
||||
= "nº #{dossier.id}"
|
||||
|
||||
= form_tag(backoffice_dossier_process_dossier_url(dossier.id), method: :post, class: "form") do
|
||||
= text_area :dossier, :motivation, class: "motivation-text-area", placeholder: "Rédigez votre motivation ici (facultative)"
|
||||
%p.help
|
||||
L'acceptation du dossier envoie automatiquement une attestation à l'usager.
|
||||
.text-right
|
||||
%span.button{ onclick: "TPS.motivationCancel();" } Annuler
|
||||
= button_tag "Valider la décision", name: :process_action, value: "close", class: 'button primary', title: 'Accepter', data: { confirm: "Accepter ce dossier ?" }
|
||||
|
||||
- elsif dossier.closed?
|
||||
%span.label.closed Accepté
|
||||
- elsif dossier.refused?
|
||||
%span.label.refused Refusé
|
||||
- elsif dossier.without_continuation?
|
||||
%span.label.without-continuation Sans suite
|
|
@ -367,7 +367,7 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
expect(dossier.state).to eq('replied')
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to backoffice_dossiers_path }
|
||||
it { is_expected.to redirect_to backoffice_dossier_path(id: dossier_id) }
|
||||
end
|
||||
|
||||
describe 'POST #archive' do
|
||||
|
|
Loading…
Reference in a new issue