diff --git a/app/controllers/tools_controller.rb b/app/controllers/tools_controller.rb
new file mode 100644
index 00000000..82dab3ea
--- /dev/null
+++ b/app/controllers/tools_controller.rb
@@ -0,0 +1,18 @@
+class ToolsController < ApplicationController
+ def index; end
+
+ def combine_pdf
+ uploaded_pdf = params[:pdf_file]
+
+ if uploaded_pdf.present?
+ templated_pdf = Invoices::TemplatedPDF.new(uploaded_pdf.read).read
+
+ send_data templated_pdf,
+ filename: uploaded_pdf.original_filename,
+ type: 'application/pdf',
+ disposition: 'attachment'
+ else
+ redirect_to tools_path, alert: 'Bitte wähle eine PDF-Datei aus.'
+ end
+ end
+end
diff --git a/app/models/invoices/swiss_qr_bill_qr_code.rb b/app/models/invoices/swiss_qr_bill_qr_code.rb
index 06b7d1e1..0d019af8 100644
--- a/app/models/invoices/swiss_qr_bill_qr_code.rb
+++ b/app/models/invoices/swiss_qr_bill_qr_code.rb
@@ -12,7 +12,8 @@ def self.generate_img_data_for(invoice)
module_px_size: 10,
resize_exactly_to: false,
resize_gte_to: false,
- size: 1024
+ size: 1024,
+ level: :m
)
swiss_cross = ChunkyPNG::Image.from_file('app/assets/images/swiss_cross.png')
diff --git a/app/views/tools/index.html.erb b/app/views/tools/index.html.erb
new file mode 100644
index 00000000..96c70351
--- /dev/null
+++ b/app/views/tools/index.html.erb
@@ -0,0 +1,12 @@
+<%= define_page_title(t('.title')) %>
+
+
<%= t('.apply_pdf_template.title') %>
+
+<%= form_with url: combine_pdf_tools_path, method: :post, multipart: true, local: true do |form| %>
+
+ <%= form.label :pdf_file, t('.apply_pdf_template.select_pdf_file') %>
+ <%= form.file_field :pdf_file, accept: 'application/pdf', required: true, class: 'form-control' %>
+
+
+ <%= form.submit t('.apply_pdf_template.submit'), class: 'btn btn-primary', data: { disable_with: false } %>
+<% end %>
diff --git a/config/bottom_navigation.rb b/config/bottom_navigation.rb
index 68a6eba1..04bc1a25 100644
--- a/config/bottom_navigation.rb
+++ b/config/bottom_navigation.rb
@@ -1,5 +1,7 @@
SimpleNavigation::Configuration.run do |navigation|
navigation.items do |bottom|
+ bottom.item :tools, t('application.navigation.tools'), tools_path, highlights_on: %r{\A/tools(/.*)?\z}
+
bottom.item :preferences, t('application.navigation.preferences'),
employee_hourly_rates_path(current_employee),
html: { class: 'sub_nav preferences' } do |sub_nav|
diff --git a/config/locales/application.de.yml b/config/locales/application.de.yml
index fcf83a0e..8f3056ea 100644
--- a/config/locales/application.de.yml
+++ b/config/locales/application.de.yml
@@ -16,3 +16,4 @@ de:
customer_report: Kunde
customers_report: Kunden
other_preferences: Sonstiges
+ tools: Werkzeuge
diff --git a/config/locales/views/tools.de.yml b/config/locales/views/tools.de.yml
new file mode 100644
index 00000000..9a3c69f0
--- /dev/null
+++ b/config/locales/views/tools.de.yml
@@ -0,0 +1,8 @@
+de:
+ tools:
+ index:
+ title: Werkzeuge
+ apply_pdf_template:
+ title: "PDF mit Briefpapier kombinieren"
+ select_pdf_file: "PDF-Datei auswählen:"
+ submit: "PDF kombinieren und herunterladen"
diff --git a/config/routes.rb b/config/routes.rb
index b7e7f5c7..a5e9147a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -96,6 +96,11 @@
resources :debtors_reports, only: [:new, :create]
resources :versions, only: [:index]
resources :settings, only: [:index, :update]
+ resources :tools, only: [:index] do
+ collection do
+ post :combine_pdf
+ end
+ end
mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development?
end