diff --git a/Gemfile b/Gemfile
index 5e7fb07..39b8e6d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -35,7 +35,8 @@ gem 'jbuilder', '~> 2.5'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
-
+gem 'wicked_pdf'
+gem 'wkhtmltopdf-binary'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
diff --git a/app/controllers/invoices_controller.rb b/app/controllers/invoices_controller.rb
index 688327d..67e9b8c 100644
--- a/app/controllers/invoices_controller.rb
+++ b/app/controllers/invoices_controller.rb
@@ -5,6 +5,14 @@ class InvoicesController < ApplicationController
def show
@invoice = Invoice.find(params[:id])
+ respond_to do |format|
+ format.html
+ format.pdf do
+ render pdf: "Faktura_VAT_#{@invoice.id}", # Excluding ".pdf" extension.
+ disposition: 'attachment',
+ exe_path: ''
+ end
+ end
end
def new
diff --git a/app/views/invoices/_show.html.erb b/app/views/invoices/_show.html.erb
index 2b705c1..13fbd89 100644
--- a/app/views/invoices/_show.html.erb
+++ b/app/views/invoices/_show.html.erb
@@ -180,6 +180,30 @@
+
+
+
+
+
+ | Sprzedający: |
+
+ | Osoba upowazniona do wystawienia faktury VAT |
+
+
+
+
+
+
+ | Kupujący: |
+
+ | Osoba upowazniona do odbioru faktury VAT |
+
+
+
+
+
diff --git a/app/views/invoices/show.html.erb b/app/views/invoices/show.html.erb
index 941e44a..afd1c0a 100644
--- a/app/views/invoices/show.html.erb
+++ b/app/views/invoices/show.html.erb
@@ -3,6 +3,7 @@
Faktura: <%= @invoice.number %>
<%= link_to raw(" " + I18n.t('back')), invoices_path, title: I18n.t('back'), class: "text-primary" %>
+ <%= link_to 'PDF', invoice_path(@invoice, format: :pdf) %>