From fccf5e97f17b8d81304e0c200cb9ee39ef91d65c Mon Sep 17 00:00:00 2001 From: EwelinaLasowy Date: Fri, 4 Feb 2022 08:42:18 +0100 Subject: [PATCH] #40 - wip --- .../Controllers/GeneratePdfController.php | 18 ++ composer.json | 1 + composer.lock | 289 +++++++++++++++++- config/app.php | 1 + .../views/vacation-request-pdf.blade.php | 93 ++++++ routes/web.php | 3 + 6 files changed, 403 insertions(+), 2 deletions(-) create mode 100644 app/Infrastructure/Http/Controllers/GeneratePdfController.php create mode 100644 resources/views/vacation-request-pdf.blade.php diff --git a/app/Infrastructure/Http/Controllers/GeneratePdfController.php b/app/Infrastructure/Http/Controllers/GeneratePdfController.php new file mode 100644 index 0000000..6ce8e16 --- /dev/null +++ b/app/Infrastructure/Http/Controllers/GeneratePdfController.php @@ -0,0 +1,18 @@ +stream(); + } +} diff --git a/composer.json b/composer.json index f2962a5..ebd3f96 100644 --- a/composer.json +++ b/composer.json @@ -8,6 +8,7 @@ "php": "^8.1", "ext-pdo": "*", "azuyalabs/yasumi": "^2.4", + "barryvdh/laravel-dompdf": "^1.0", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "inertiajs/inertia-laravel": "^0.5.1", diff --git a/composer.lock b/composer.lock index 066cfc9..a7e5000 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bf5f7d8f40ecadea64ae8564a3df3110", + "content-hash": "c2f475e65f84bdff45169e4443d9ef4f", "packages": [ { "name": "asm89/stack-cors", @@ -135,6 +135,82 @@ ], "time": "2022-01-30T07:43:17+00:00" }, + { + "name": "barryvdh/laravel-dompdf", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-dompdf.git", + "reference": "e3f429e97087b2ef19b83e5ed313f080f2477685" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/e3f429e97087b2ef19b83e5ed313f080f2477685", + "reference": "e3f429e97087b2ef19b83e5ed313f080f2477685", + "shasum": "" + }, + "require": { + "dompdf/dompdf": "^1", + "illuminate/support": "^6|^7|^8|^9", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "nunomaduro/larastan": "^1|^2", + "orchestra/testbench": "^4|^5|^6|^7", + "phpro/grumphp": "^1", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Barryvdh\\DomPDF\\ServiceProvider" + ], + "aliases": { + "PDF": "Barryvdh\\DomPDF\\Facade\\Pdf" + } + } + }, + "autoload": { + "psr-4": { + "Barryvdh\\DomPDF\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "A DOMPDF Wrapper for Laravel", + "keywords": [ + "dompdf", + "laravel", + "pdf" + ], + "support": { + "issues": "https://github.com/barryvdh/laravel-dompdf/issues", + "source": "https://github.com/barryvdh/laravel-dompdf/tree/v1.0.0" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2022-01-29T08:02:59+00:00" + }, { "name": "brick/math", "version": "0.9.3", @@ -437,6 +513,73 @@ ], "time": "2022-01-12T08:27:12+00:00" }, + { + "name": "dompdf/dompdf", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/dompdf/dompdf.git", + "reference": "de4aad040737a89fae2129cdeb0f79c45513128d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/de4aad040737a89fae2129cdeb0f79c45513128d", + "reference": "de4aad040737a89fae2129cdeb0f79c45513128d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "phenx/php-font-lib": "^0.5.2", + "phenx/php-svg-lib": "^0.3.3", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.3", + "phpunit/phpunit": "^7.5 || ^8 || ^9", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggest": { + "ext-gd": "Needed to process images", + "ext-gmagick": "Improves image processing performance", + "ext-imagick": "Improves image processing performance", + "ext-zlib": "Needed for pdf stream compression" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dompdf\\": "src/" + }, + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + }, + { + "name": "Brian Sweeney", + "email": "eclecticgeek@gmail.com" + }, + { + "name": "Gabriel Bull", + "email": "me@gabrielbull.com" + } + ], + "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", + "homepage": "https://github.com/dompdf/dompdf", + "support": { + "issues": "https://github.com/dompdf/dompdf/issues", + "source": "https://github.com/dompdf/dompdf/tree/v1.1.1" + }, + "time": "2021-11-24T00:45:04+00:00" + }, { "name": "dragonmantank/cron-expression", "version": "v3.3.1", @@ -2846,6 +2989,95 @@ ], "time": "2021-07-19T03:43:32+00:00" }, + { + "name": "phenx/php-font-lib", + "version": "0.5.4", + "source": { + "type": "git", + "url": "https://github.com/dompdf/php-font-lib.git", + "reference": "dd448ad1ce34c63d09baccd05415e361300c35b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/dd448ad1ce34c63d09baccd05415e361300c35b4", + "reference": "dd448ad1ce34c63d09baccd05415e361300c35b4", + "shasum": "" + }, + "require": { + "ext-mbstring": "*" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3 || ^4 || ^5" + }, + "type": "library", + "autoload": { + "psr-4": { + "FontLib\\": "src/FontLib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse, export and make subsets of different types of font files.", + "homepage": "https://github.com/PhenX/php-font-lib", + "support": { + "issues": "https://github.com/dompdf/php-font-lib/issues", + "source": "https://github.com/dompdf/php-font-lib/tree/0.5.4" + }, + "time": "2021-12-17T19:44:54+00:00" + }, + { + "name": "phenx/php-svg-lib", + "version": "0.3.4", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-svg-lib.git", + "reference": "f627771eb854aa7f45f80add0f23c6c4d67ea0f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/f627771eb854aa7f45f80add0f23c6c4d67ea0f2", + "reference": "f627771eb854aa7f45f80add0f23c6c4d67ea0f2", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "sabberworm/php-css-parser": "^8.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Svg\\": "src/Svg" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse and export to PDF SVG files.", + "homepage": "https://github.com/PhenX/php-svg-lib", + "support": { + "issues": "https://github.com/PhenX/php-svg-lib/issues", + "source": "https://github.com/PhenX/php-svg-lib/tree/0.3.4" + }, + "time": "2021-10-18T02:13:32+00:00" + }, { "name": "phpoption/phpoption", "version": "1.8.1", @@ -3572,6 +3804,59 @@ ], "time": "2021-09-25T23:10:38+00:00" }, + { + "name": "sabberworm/php-css-parser", + "version": "8.4.0", + "source": { + "type": "git", + "url": "https://github.com/sabberworm/PHP-CSS-Parser.git", + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/e41d2140031d533348b2192a83f02d8dd8a71d30", + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=5.6.20" + }, + "require-dev": { + "codacy/coverage": "^1.4", + "phpunit/phpunit": "^4.8.36" + }, + "suggest": { + "ext-mbstring": "for parsing UTF-8 CSS" + }, + "type": "library", + "autoload": { + "psr-4": { + "Sabberworm\\CSS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Raphael Schweikert" + } + ], + "description": "Parser for CSS Files written in PHP", + "homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser", + "keywords": [ + "css", + "parser", + "stylesheet" + ], + "support": { + "issues": "https://github.com/sabberworm/PHP-CSS-Parser/issues", + "source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.4.0" + }, + "time": "2021-12-11T13:40:54+00:00" + }, { "name": "swiftmailer/swiftmailer", "version": "v6.3.0", @@ -10027,5 +10312,5 @@ "ext-pdo": "*" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/config/app.php b/config/app.php index cbd96cb..a5d12a9 100644 --- a/config/app.php +++ b/config/app.php @@ -43,5 +43,6 @@ return [ Toby\Architecture\Providers\RouteServiceProvider::class, Toby\Architecture\Providers\TelescopeServiceProvider::class, Toby\Architecture\Providers\ObserverServiceProvider::class, + Barryvdh\DomPDF\ServiceProvider::class, ], ]; diff --git a/resources/views/vacation-request-pdf.blade.php b/resources/views/vacation-request-pdf.blade.php new file mode 100644 index 0000000..6b88d47 --- /dev/null +++ b/resources/views/vacation-request-pdf.blade.php @@ -0,0 +1,93 @@ + + + + + Wniosek urlopowy + + + +
+ +
+ + + + + + + + + + + + + + + + +
Jan KowalskiLegnica, 02.02.2022
imię i nazwisko
tester oprogramowania
stanowisko
+
+ +
+

Wniosek o urlop

+

Proszę o udzielenie urlopu wypoczynkowego w okresie od dnia 03.02.2022 do dnia 10.02.2022 + włącznie tj. 5 dni roboczych za rok 2022.

+
+ + + + + + + + + + + + +
Super PrzełożonyJan Kowalski
podpis przełożonegopodpis pracownika
+
+ + diff --git a/routes/web.php b/routes/web.php index db18237..fa03c4b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,6 +3,7 @@ declare(strict_types=1); use Illuminate\Support\Facades\Route; +use Toby\Infrastructure\Http\Controllers\GeneratePdfController; use Toby\Infrastructure\Http\Controllers\GoogleController; use Toby\Infrastructure\Http\Controllers\HolidayController; use Toby\Infrastructure\Http\Controllers\LogoutController; @@ -44,6 +45,8 @@ Route::middleware("auth")->group(function (): void { Route::post("year-periods/{yearPeriod}/select", SelectYearPeriodController::class) ->name("year-periods.select"); + + Route::get("/generate-pdf", [GeneratePdfController::class, "generatePDF"]); }); Route::middleware("guest")->group(function (): void {