Ajout du bouton traité pour les gestionnaires
This commit is contained in:
parent
a57b9852b2
commit
d53c43a7b0
5 changed files with 37 additions and 1 deletions
|
@ -27,4 +27,15 @@ class Backoffice::DossiersController < ApplicationController
|
||||||
|
|
||||||
render 'show'
|
render 'show'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def process_end
|
||||||
|
params[:id] = params[:dossier_id]
|
||||||
|
|
||||||
|
show
|
||||||
|
|
||||||
|
@dossier.next_step! 'gestionnaire', 'process'
|
||||||
|
flash.notice = 'Dossier traité avec succès.'
|
||||||
|
|
||||||
|
render 'show'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,4 +48,8 @@
|
||||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :confirme, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
= form_tag(url_for({controller: 'backoffice/dossiers', action: :confirme, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
||||||
%button#action_button.btn.btn-success
|
%button#action_button.btn.btn-success
|
||||||
= 'Valider le dossier'
|
= 'Valider le dossier'
|
||||||
|
-elsif @dossier.deposited?
|
||||||
|
= form_tag(url_for({controller: 'backoffice/dossiers', action: :process_end, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
||||||
|
%button#action_button.btn.btn-success
|
||||||
|
= 'Traiter le dossier'
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ Rails.application.routes.draw do
|
||||||
get 'sign_in' => '/gestionnaires/sessions#new'
|
get 'sign_in' => '/gestionnaires/sessions#new'
|
||||||
resources :dossiers do
|
resources :dossiers do
|
||||||
post 'confirme' => 'dossiers#confirme'
|
post 'confirme' => 'dossiers#confirme'
|
||||||
|
post 'process' => 'dossiers#process_end'
|
||||||
end
|
end
|
||||||
resources :commentaires, only: [:create]
|
resources :commentaires, only: [:create]
|
||||||
end
|
end
|
||||||
|
|
|
@ -44,4 +44,20 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'POST #process_end' do
|
||||||
|
context 'le gestionnaire taite un dossier' do
|
||||||
|
before do
|
||||||
|
dossier.deposited!
|
||||||
|
sign_in gestionnaire
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'dossier change is state for processed' do
|
||||||
|
post :process_end, dossier_id: dossier_id
|
||||||
|
|
||||||
|
dossier.reload
|
||||||
|
expect(dossier.state).to eq('processed')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -111,8 +111,12 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
|
||||||
|
|
||||||
it { expect(rendered).to have_content('Déposé') }
|
it { expect(rendered).to have_content('Déposé') }
|
||||||
|
|
||||||
|
it 'button Traiter le dossier est present' do
|
||||||
|
expect(rendered).to have_css('#action_button')
|
||||||
|
expect(rendered).to have_content('Traiter le dossier')
|
||||||
|
end
|
||||||
|
|
||||||
it 'button Valider le dossier n\'est pas present' do
|
it 'button Valider le dossier n\'est pas present' do
|
||||||
expect(rendered).not_to have_css('#action_button')
|
|
||||||
expect(rendered).not_to have_content('Valider le dossier')
|
expect(rendered).not_to have_content('Valider le dossier')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue