diff --git a/app/views/contracts/_amendment_page.html.erb b/app/views/contracts/_amendment_page.html.erb
new file mode 100644
index 0000000..427dc9a
--- /dev/null
+++ b/app/views/contracts/_amendment_page.html.erb
@@ -0,0 +1,19 @@
+<% if preview %>
+
PREVIEW ONLY
+<% end %>
+
+<%= t '.heading' %>
+
+
+ <%= description_list_pair "#{t('.description_labels.amendment_clause')}:", releasable.contract_template.amendment_clause %>
+ <%= description_list_pair "#{t('.description_labels.amendment_signer_name')}:", releasable.amendment_signer_name %>
+
+ - <%= t('.description_labels.amendment_signature') %>:
+ -
+ <% if preview %>
+ <%= image_tag dummy_signature %>
+ <% elsif releasable.amendment_signature.attached? %>
+ <%= image_tag releasable.amendment_signature.variant(auto_orient: true, resize: "200x200") %>
+ <% end %>
+
+
\ No newline at end of file
diff --git a/app/views/contracts/pdf.html.erb b/app/views/contracts/pdf.html.erb
index dd01e5f..edeab19 100644
--- a/app/views/contracts/pdf.html.erb
+++ b/app/views/contracts/pdf.html.erb
@@ -26,6 +26,12 @@
<%= render "contracts/signature_page", releasable: releasable, contract_template: contract_template, preview: preview %>
+<% if releasable.respond_to?(:amendment_signed?) && releasable.amendment_signed? %>
+
+ <%= render "contracts/amendment_page", releasable: releasable, preview: preview %>
+
+<%end %>
+
<% if releasable.respond_to?(:approved?) && releasable.approved? %>
<%= render "contracts/for_office_use_only", releasable: releasable, preview: preview %>
diff --git a/app/views/location_releases/_location_release.html.erb b/app/views/location_releases/_location_release.html.erb
index 82fa7a9..a829689 100644
--- a/app/views/location_releases/_location_release.html.erb
+++ b/app/views/location_releases/_location_release.html.erb
@@ -35,8 +35,10 @@
- <% else %>
-
+ <% elsif location_release.amendment_signable? %>
+
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index b2693cb..12d6f36 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -323,6 +323,12 @@ en:
update:
notice: The release template has been updated
contracts:
+ amendment_page:
+ description_labels:
+ amendment_clause: Amendment Clause
+ amendment_signature: Amendment Signature
+ amendment_signer_name: Amendment Signer Name
+ heading: Amendment
for_office_use_only:
description_labels:
date_issued: Date Issued
@@ -783,6 +789,7 @@ en:
review: Review
sign_amendment: Sign Amendment
messages:
+ amendment_not_signed_tooltip: Amendment not yet signed
amendment_signed_tooltip: Amendment Signed
approved_tooltip: Approved by %{user} on %{timestamp}
no_photos: Needs Photo
diff --git a/config/locales/es.yml b/config/locales/es.yml
index af10d76..9d2f19b 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -148,6 +148,12 @@ es:
update:
notice: The release template has been updated (ES)
contracts:
+ amendment_page:
+ description_labels:
+ amendment_clause: Amendment Clause (ES)
+ amendment_signature: Amendment Signature (ES)
+ amendment_signer_name: Amendment Signer Name (ES)
+ heading: Amendment (ES)
for_office_use_only:
description_labels:
date_issued: Date Issued (ES)
@@ -343,6 +349,7 @@ es:
actions:
sign_amendment: Sign Amendment (ES)
messages:
+ amendment_not_signed_tooltip: Amendment not yet signed (ES)
amendment_signed_tooltip: Amendment Signed (ES)
material_releases:
form:
diff --git a/spec/features/user_managing_location_releases_spec.rb b/spec/features/user_managing_location_releases_spec.rb
index 1afa908..98b8e66 100644
--- a/spec/features/user_managing_location_releases_spec.rb
+++ b/spec/features/user_managing_location_releases_spec.rb
@@ -301,7 +301,7 @@ feature "User managing location releases" do
end
end
- scenario "viewing the contract PDF" do
+ scenario "viewing the contract PDF when amendment is not yet signed" do
location_release = create(:location_release_with_contract_template_and_photo,
:native,
project: project,
@@ -313,16 +313,13 @@ feature "User managing location releases" do
content: "Note 1",
user: build(:user, email: "jane.doe@test.com"),
email: "jane.doe@test.com",
- created_at: DateTime.new(2020, 2, 21, 12, 0, 0),
- ),
+ created_at: DateTime.new(2020, 2, 21, 12, 0, 0),),
build(:note,
content: "Note 2",
user: build(:user, email: "john.doe@test.com"),
email: "john.doe@test.com",
- created_at: DateTime.new(2020, 2, 20, 11, 0, 0),
- ),
- ]
- )
+ created_at: DateTime.new(2020, 2, 20, 11, 0, 0),),
+ ])
sign_in(current_user)
visit project_location_releases_path(project)
@@ -331,6 +328,8 @@ feature "User managing location releases" do
expect(content_type).to eq("application/pdf")
expect(content_disposition).to include("inline")
expect(pdf_filename).to include("benny-s-burritos")
+
+ expect(pdf_body).not_to have_content amendment_page_heading
expect(pdf_body).to have_content("Benny's Burritos")
expect(pdf_body).to have_content("NOTES")
expect(pdf_body).to have_content("Note 1")
@@ -347,6 +346,34 @@ feature "User managing location releases" do
expect(pdf_body).to have_content("06:00 - 20:00")
end
+ scenario "viewing the contract PDF when amendment is signed" do
+ contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
+ location_release = create(:location_release,
+ :amendment_signed,
+ :native,
+ contract_template: contract_template,
+ project: project,
+ name: "Test Loc")
+
+ sign_in(current_user)
+ visit project_location_releases_path(project)
+ click_link *view_release_pdf_link_for(location_release)
+
+ expect(content_type).to eq("application/pdf")
+ expect(content_disposition).to include("inline")
+ expect(pdf_filename).to include("test-loc")
+
+ expect(pdf_body).to have_content("Test Loc")
+
+ expect(pdf_body).to have_content amendment_page_heading
+ expect(pdf_body).to have_content amendment_clause_label
+ expect(pdf_body).to have_content amendment_signer_name_label
+ expect(pdf_body).to have_content amendment_signature_label
+
+ expect(pdf_body).to have_content contract_template.amendment_clause.to_plain_text
+ expect(pdf_body).to have_content location_release.amendment_signer_name
+ end
+
context "when the user is account manager" do
let(:current_user) { create(:user, :account_manager) }
@@ -686,4 +713,20 @@ feature "User managing location releases" do
def copy_url_button
t 'public.amendments.new.copy_url'
end
+
+ def amendment_page_heading
+ t 'contracts.amendment_page.heading'
+ end
+
+ def amendment_signer_name_label
+ t 'contracts.amendment_page.description_labels.amendment_signer_name'
+ end
+
+ def amendment_clause_label
+ t 'contracts.amendment_page.description_labels.amendment_clause'
+ end
+
+ def amendment_signature_label
+ t 'contracts.amendment_page.description_labels.amendment_signature'
+ end
end