Dossier: add method to allow gestionnaire to reopen dossier
This commit is contained in:
parent
43e6f15c5f
commit
870d3719e1
4 changed files with 28 additions and 0 deletions
|
@ -159,6 +159,15 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
|
||||||
redirect_to backoffice_dossiers_path
|
redirect_to backoffice_dossiers_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reopen
|
||||||
|
create_dossier_facade params[:dossier_id]
|
||||||
|
|
||||||
|
@facade.dossier.initiated!
|
||||||
|
flash.notice = 'Dossier réouvert.'
|
||||||
|
|
||||||
|
redirect_to backoffice_dossiers_path
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_dossier_facade dossier_id
|
def create_dossier_facade dossier_id
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
= 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
|
= 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
|
%button.action.refuse-dossier
|
||||||
%i.fa.fa-times
|
%i.fa.fa-times
|
||||||
|
= link_to 'Reouvrir', backoffice_dossier_reopen_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
||||||
|
|
||||||
- unless @facade.dossier.archived?
|
- unless @facade.dossier.archived?
|
||||||
= link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
= link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
|
||||||
|
|
|
@ -163,6 +163,7 @@ Rails.application.routes.draw do
|
||||||
post 'without_continuation' => 'dossiers#without_continuation'
|
post 'without_continuation' => 'dossiers#without_continuation'
|
||||||
post 'close' => 'dossiers#close'
|
post 'close' => 'dossiers#close'
|
||||||
post 'archive' => 'dossiers#archive'
|
post 'archive' => 'dossiers#archive'
|
||||||
|
post 'reopen' => 'dossiers#reopen'
|
||||||
|
|
||||||
put 'follow' => 'dossiers#follow'
|
put 'follow' => 'dossiers#follow'
|
||||||
resources :commentaires, only: [:index]
|
resources :commentaires, only: [:index]
|
||||||
|
|
|
@ -357,6 +357,23 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'POST #reopen' do
|
||||||
|
before do
|
||||||
|
dossier.received!
|
||||||
|
sign_in gestionnaire
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { post :reopen, params: {dossier_id: dossier_id} }
|
||||||
|
|
||||||
|
it 'change state to initiated' do
|
||||||
|
subject
|
||||||
|
|
||||||
|
dossier.reload
|
||||||
|
expect(dossier.state).to eq('initiated')
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to redirect_to backoffice_dossiers_path }
|
||||||
|
end
|
||||||
|
|
||||||
describe 'POST #archive' do
|
describe 'POST #archive' do
|
||||||
before do
|
before do
|
||||||
|
|
Loading…
Add table
Reference in a new issue