Add lien demarche to type de piece justificative

This commit is contained in:
Mathieu Magnin 2017-01-18 17:13:54 +01:00
parent 333ea9a610
commit 566fd8bc74
6 changed files with 33 additions and 12 deletions

View file

@ -22,7 +22,7 @@ class Admin::PiecesJustificativesController < AdminController
def update_params
params
.require(:procedure)
.permit(types_de_piece_justificative_attributes: [:libelle, :description, :id, :order_place])
.permit(types_de_piece_justificative_attributes: [:libelle, :description, :id, :order_place, :lien_demarche])
end
def move_up

View file

@ -6,6 +6,12 @@
.form-group
%h4 Description
=ff.text_area :description, class: 'form-control description', placeholder: 'Description'
.form-group
%h4
Lien du formulaire vierge
%small
(optionel)
=ff.url_field :lien_demarche, class: 'form-control', placeholder: 'Lien du document vierge'
.form-group
= ff.hidden_field :order_place, value: ff.index
@ -23,4 +29,3 @@
= f.submit('Ajouter la pièce', class: 'btn btn-success', id: 'add_piece_justificative')
- else
= link_to("", admin_procedure_piece_justificative_path(@procedure, ff.object.id), method: :delete, remote: true, id: "delete_type_de_piece_justificative_#{ff.object.id}", class: %w(form-control btn btn-danger fa fa-trash-o) )

View file

@ -1,15 +1,17 @@
-unless dossier.procedure.lien_demarche.blank?
%p
Récupérer le formulaire de demande ou CERFA vierge pour mon dossier :
= link_to "Télécharger", dossier.procedure.lien_demarche, target: '_blank', id: 'lien_cerfa'
%table.table
- if dossier.procedure.cerfa_flag
%tr
%th.col-lg-6
%th
Formulaire de demande ou CERFA (complété et numérisé)
%td
-unless dossier.procedure.lien_demarche.blank?
%em
Récupérer le formulaire de demande ou CERFA vierge pour mon dossier :
= link_to "Télécharger", "#{dossier.procedure.lien_demarche}", target: :blank, id: :lien_cerfa
-# %a{ id: 'lien_cerfa', href: "#{dossier.procedure.lien_demarche}", target: '_blank'} Télécharger
%td.col-lg-5
%td
-if dossier.cerfa_available?
%span.btn.btn-sm.btn-file.btn-success
Modifier
@ -19,9 +21,16 @@
- dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative|
%tr
%th.col-lg-6.piece-libelle
%th.piece-libelle
= type_de_piece_justificative.libelle
%td.col-lg-5
%td
- unless type_de_piece_justificative.lien_demarche.blank?
%em
Récupérer le formulaire vierge pour mon dossier :
= link_to "Télécharger", type_de_piece_justificative.lien_demarche, target: :blank
%td
-if type_de_piece_justificative.api_entreprise
%span.text-success{ id: "piece_justificative_#{type_de_piece_justificative.id}" } Nous l'avons récupéré pour vous.
-else

View file

@ -24,6 +24,7 @@
%br
%h3 Documents administratifs
//TODO a refactorer
.row
.col-lg-8

View file

@ -0,0 +1,5 @@
class AddLienToTypeDePieceJustificative < ActiveRecord::Migration[5.0]
def change
add_column :types_de_piece_justificative, :lien_demarche, :string, default: nil
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161227103823) do
ActiveRecord::Schema.define(version: 20170118144306) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -361,6 +361,7 @@ ActiveRecord::Schema.define(version: 20161227103823) do
t.datetime "updated_at", null: false
t.integer "procedure_id"
t.integer "order_place"
t.string "lien_demarche"
end
create_table "users", force: :cascade do |t|