diff --git a/Dockerfile b/Dockerfile
index 19542f88..2b4c2ed6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -53,7 +53,7 @@ RUN DATABASE_PASSWORD=required-to-run-but-not-used \
bundle exec rails assets:precompile
# Cleanup to save space in the production image
-RUN rm -rf node_modules log/* tmp/* /tmp && \
+RUN rm -rf log/* tmp/* /tmp && \
rm -rf /usr/local/bundle/cache && \
rm -rf .env && \
find /usr/local/bundle/gems -name "*.c" -delete && \
@@ -86,6 +86,18 @@ RUN apk add --no-cache libpq
COPY --from=builder /app /app
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
+# Set up puppeteer (for PDF generation)
+# https://pptr.dev/troubleshooting#running-on-alpine
+RUN apk add --no-cache \
+ chromium \
+ nss \
+ freetype \
+ harfbuzz \
+ ca-certificates \
+ ttf-freefont \
+ nodejs
+ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
+
# SSH access specific to Azure
# Install OpenSSH and set the password for root to "Docker!".
RUN apk add --no-cache openssh && echo "root:Docker!" | chpasswd
diff --git a/app/assets/builds/certificates.css b/app/assets/builds/certificates.css
new file mode 100644
index 00000000..4e93a0ce
--- /dev/null
+++ b/app/assets/builds/certificates.css
@@ -0,0 +1,65 @@
+body {
+ margin: 0;
+ padding: 0;
+}
+
+.container {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ margin: 0;
+ padding: 0;
+ width: 100%;
+}
+
+.content {
+ position: absolute;
+ top: 350px;
+ left: 100px;
+ width: 100%;
+}
+
+.header-image {
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 100%;
+}
+
+.heading {
+ font-size: 82px;
+ font-family: Helvetica;
+ color: #063961;
+}
+
+.text {
+ font-size: 18px;
+ font-family: Helvetica;
+ color: #231f20;
+}
+
+.content-npq {
+ position: absolute;
+ top: 350px;
+ left: 85px;
+ width: 100%;
+}
+
+.text-npq {
+ font-size: 32px;
+ font-family: Arial;
+ color: #231f20;
+}
+
+.heading-npq {
+ font-size: 48px;
+ font-family: Arial;
+ color: #231f20;
+}
+
+.name-heading-npq {
+ max-width: 70%;
+ text-align: left;
+ font-size: clamp(16px, 4vw, 40px);
+ white-space: nowrap;
+}
diff --git a/app/assets/stylesheets/certificates.scss b/app/assets/stylesheets/certificates.scss
index 2dc9626d..78dfbd43 100644
--- a/app/assets/stylesheets/certificates.scss
+++ b/app/assets/stylesheets/certificates.scss
@@ -32,3 +32,25 @@ body {
font-family: Helvetica;
color: #231f20;
}
+.content-npq {
+ position: absolute;
+ top: 350px;
+ left: 85px;
+ width: 100%;
+}
+.text-npq {
+ font-size: 32px;
+ font-family: Arial;
+ color: #231f20;
+}
+.heading-npq {
+ font-size: 48px;
+ font-family: Arial;
+ color: #231f20;
+}
+.name-heading-npq {
+ max-width: 70%;
+ text-align: left;
+ font-size: clamp(16px, 4vw, 40px);
+ white-space: nowrap;
+}
diff --git a/app/components/induction_summary_component.rb b/app/components/induction_summary_component.rb
index 79bffbef..0735bae6 100644
--- a/app/components/induction_summary_component.rb
+++ b/app/components/induction_summary_component.rb
@@ -71,7 +71,7 @@ def rows
}
]
- if details.respond_to?(:certificate_url) && details.certificate_url.present?
+ if details.status == "Pass"
@rows << {
key: {
text: "Certificate"
diff --git a/app/controllers/qualifications/certificates_controller.rb b/app/controllers/qualifications/certificates_controller.rb
index a7f5d65f..0f47de72 100644
--- a/app/controllers/qualifications/certificates_controller.rb
+++ b/app/controllers/qualifications/certificates_controller.rb
@@ -13,7 +13,7 @@ def show
formats: [:html],
locals: { teacher: @teacher, qualification: @qualification },
layout: "layouts/certificate")
- grover = Grover.new(html, format: 'A4', display_url: request.base_url)
+ grover = Grover.new(html, format: 'A4', display_url: ENV["HOSTING_DOMAIN"])
pdf = grover.to_pdf
send_data pdf, filename: "#{@teacher.name}_#{@qualification.type.downcase}_certificate.pdf",
type: 'application/pdf', disposition: 'attachment'
diff --git a/app/views/qualifications/certificates/_eyts.html.erb b/app/views/qualifications/certificates/_eyts.html.erb
index 4345063f..f88930fc 100644
--- a/app/views/qualifications/certificates/_eyts.html.erb
+++ b/app/views/qualifications/certificates/_eyts.html.erb
@@ -1,7 +1,7 @@
-
Early years
Teacher Status
+
Early Years
Teacher Status
This is to certify that: <%= teacher.name %>
Teacher Reference Number: <%= teacher.trn %>
diff --git a/app/views/qualifications/certificates/_induction.html.erb b/app/views/qualifications/certificates/_induction.html.erb
index 65eb7675..c59eac0b 100644
--- a/app/views/qualifications/certificates/_induction.html.erb
+++ b/app/views/qualifications/certificates/_induction.html.erb
@@ -11,9 +11,9 @@
institution. The holder of this certificate is a qualified teacher and has obtained the required
qualifications and completed the necessary training for the profession of school teacher in England.
-
Date Induction Completed: <%= qualification.awarded_at.to_fs(:long_uk) %>
+
Date Induction Completed: <%= qualification.details.periods.first.end_date.to_date.to_fs(:long_uk) %>
Congratulations and best wishes for your future career.
-
Any potential employer can independently confirm your teacher status online at:
https://teacherservices.education.gov.uk
+
Any potential employer can independently confirm your teacher status online at:
https://www.gov.uk/guidance/check-a-teachers-record
\ No newline at end of file
diff --git a/app/views/qualifications/certificates/_npq.html.erb b/app/views/qualifications/certificates/_npq.html.erb
index a098eb41..2f0e1d36 100644
--- a/app/views/qualifications/certificates/_npq.html.erb
+++ b/app/views/qualifications/certificates/_npq.html.erb
@@ -2,7 +2,7 @@