Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce margin for cancellation decision document to fit on one page + Rework student pfmp page #1374

Merged
merged 6 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions app/views/pfmps/_pfmp_student_table.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- schoolings.sort_by{ |schooling| schooling.classe.school_year.start_year}.reverse.each do |schooling|
%h2 Scolarités
- pfmps = schooling.pfmps
- classe = schooling.classe
- school_year = classe.school_year
Expand Down Expand Up @@ -31,18 +32,4 @@
%strong= number_to_currency(pfmp.amount)

- if classe.establishment.eql?(current_establishment)
.actions
.fr-btns-group.fr-btns-group--inline
= button_to "Ajouter une PFMP", new_school_year_class_schooling_pfmp_path(school_year, classe, schooling), class: 'fr-btn', method: :get
- if schooling.attributive_decision.attached?
= button_to "Télécharger la décision d'attribution", url_for(schooling.attributive_decision), class: 'fr-btn fr-btn--secondary', target: :download, method: :get
- if !schooling.cancellation_decision.attached? && !Rails.env.production?
= button_to "Retirer la décision d'attribution", confirm_cancellation_decision_school_year_class_schooling_path(school_year, classe, schooling), class: 'fr-btn fr-btn--danger', method: :get
= render partial: "shared/tooltip", locals: { message: "cancellation_decision", id: 1 }
- if schooling.abrogation_decision.attached?
= button_to "Télécharger la décision d'abrogation", url_for(schooling.abrogation_decision), class: 'fr-btn fr-btn--secondary', target: :download, method: :get
- if schooling.cancellation_decision.attached? && !Rails.env.production?
= button_to "Télécharger la décision de retrait", url_for(schooling.cancellation_decision), class: 'fr-btn fr-btn--secondary', target: :download, method: :get
- if [email protected]_schooling.nil? && @student.current_schooling.eql?(schooling) && !schooling.removed?
= button_to "Masquer l'élève de la classe", confirm_removal_school_year_class_schooling_path(school_year, classe, schooling), class: 'fr-btn fr-btn--danger', method: :get
= render partial: "shared/tooltip", locals: { message: "remove_student", id: 1 }
= render "pfmps/schooling_buttons", schooling: schooling, school_year: school_year, classe: classe, student: @student
41 changes: 41 additions & 0 deletions app/views/pfmps/_schooling_buttons.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.fr-grid-row.fr-grid-row--gutters
.fr-col-md-6
%h3.fr-h6 Actions
.fr-grid-row
.fr-col-10
%ul.fr-btns-group.fr-btns-group--sm
%li
.fr-grid-row
.fr-col-10
= button_to "Ajouter une PFMP", new_school_year_class_schooling_pfmp_path(school_year, classe, schooling), class: 'fr-btn', method: :get
- if !student.current_schooling.nil? && student.current_schooling.eql?(schooling) && !schooling.removed?
%li
.fr-grid-row.fr-grid-row--middle
.fr-col-10
= button_to "Masquer l'élève de la classe", confirm_removal_school_year_class_schooling_path(school_year, classe, schooling), class: 'fr-btn fr-btn--danger', method: :get
.fr-col-2
= render partial: "shared/tooltip", locals: { message: "remove_student", id: 1 }
- if !Rails.env.production? && schooling.attributive_decision.attached? && !schooling.cancellation_decision.attached?
%li
.fr-grid-row.fr-grid-row--middle
.fr-col-10
= button_to "Retirer la décision d'attribution", confirm_cancellation_decision_school_year_class_schooling_path(school_year, classe, schooling), class: 'fr-btn fr-btn--danger', method: :get
.fr-col-2
= render partial: "shared/tooltip", locals: { message: "cancellation_decision", id: 2 }

- if schooling.attributive_decision.attached? || schooling.abrogation_decision.attached? || schooling.cancellation_decision.attached?
.fr-col-md-6
%h3.fr-h6 Documents administratifs
%ul.fr-links-group
- if schooling.attributive_decision.attached?
%li
= link_to url_for(schooling.attributive_decision), class: 'fr-link fr-link--download', download: true do
Télécharger la décision d'attribution
- if schooling.abrogation_decision.attached?
%li
= link_to url_for(schooling.abrogation_decision), class: 'fr-link fr-link--download', download: true do
Télécharger la décision d'abrogation
- if schooling.cancellation_decision.attached?
%li
= link_to url_for(schooling.cancellation_decision), class: 'fr-link fr-link--download', download: true do
Télécharger la décision de retrait
5 changes: 5 additions & 0 deletions lib/attribute_decision/cancellation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
module AttributeDecision
# Generate "Décision de retrait"
class Cancellation < DocumentGenerator

private

def margin
34
end

def articles
composer.text("Décide :", style: :paragraph_title)
composer.text("Article 1 : Objet", style: :paragraph_title)
Expand Down
6 changes: 5 additions & 1 deletion lib/attribute_decision/document_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DocumentGenerator
attr_reader :composer, :schooling, :student, :school_year

def initialize(schooling)
@composer = HexaPDF::Composer.new(page_size: :A4, margin: 48)
@composer = HexaPDF::Composer.new(page_size: :A4, margin: margin)
@schooling = schooling
@student = schooling.student
@school_year = schooling.classe.school_year
Expand All @@ -25,6 +25,10 @@ def write

private

def margin
48
end

def render
setup_styles
header
Expand Down