v0.10.5c - Made menuplan pdf better

This commit is contained in:
Neerholt 2020-08-18 15:27:58 +02:00
parent f6feb8a818
commit d2441250fb
8 changed files with 138 additions and 25 deletions

View File

@ -3,6 +3,7 @@
<component name="Encoding"> <component name="Encoding">
<file url="file://$PROJECT_DIR$/skolehjem/public/images/icons/backpack-hvid.svg" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/skolehjem/public/images/icons/backpack-hvid.svg" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/skolehjem/public/images/icons/eye-dark.svg" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/skolehjem/public/images/icons/eye-dark.svg" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/skolehjem/public/images/icons/food.svg" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/skolehjem/public/images/icons/print-hvid.svg" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/skolehjem/public/images/icons/print-hvid.svg" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/skolehjem/public/images/icons/users-hvid.svg" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/skolehjem/public/images/icons/users-hvid.svg" charset="UTF-8" />
</component> </component>

View File

@ -7,6 +7,7 @@ use App\ExternalLink;
use App\MenuPlan; use App\MenuPlan;
use App\News; use App\News;
use App\User; use App\User;
use Barryvdh\DomPDF\Facade as PDF;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
@ -207,35 +208,16 @@ class MenuPlanController extends Controller
*/ */
public function genPDF($Id){ public function genPDF($Id){
$menuPlan = MenuPlan::query()->where("id", "=", $Id)->first(); $menuPlan = MenuPlan::query()->where("id", "=", $Id)->first();
$pdf = \Illuminate\Support\Facades\App::make('dompdf.wrapper');
$data = '<html style="padding: 0; margin: 0; width: 100%; height: 100%;">'.
'<head style="padding: 0; margin: 0; width: 100%; height: 100%;">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>'.
'<style>h2 { font-size: 48px; color: #00788a; } p { font-size: 24px; }</style>'.
'<body style="padding: 0; margin: 0; width: 100%; height: 100%;">'.
'<div style="background-color: #00788A; width: 100%; padding: 1rem 1rem;">'.
'<h1 style="color: white; text-align: center">Erhverskollegiet - Odense</h1>'.
'<h1 style="font-size: 36px; text-align: center; color: white;">Menuplan</h1>'.
'<h1 style="font-size: 28px; text-align: center; color: white;">Uge '. $menuPlan->week. '</h1>'.
'</div>'.
'<div style="text-align: center">'.
'<h2 class="ql-align-center"><strong>Mandag:</strong></h2>'.
'<p class="ql-align-center">'.$menuPlan->monday.'</p><p class="ql-align-center"><br></p>'.
'<h2 class="ql-align-center"><strong>Tirsdag:</strong></h2>'. $var = 149;
'<p class="ql-align-center">'.$menuPlan->tuesday.'</p><p class="ql-align-center"><br></p>'.
'<h2 class="ql-align-center"><strong>Onsdag:</strong></h2>'. $menuPlan->monday = substr($menuPlan->monday, 0, $var);
'<p class="ql-align-center">'.$menuPlan->wednesday.'</p><p class="ql-align-center"><br></p>'. $menuPlan->tuesday = substr($menuPlan->tuesday, 0, $var);
$menuPlan->wednesday = substr($menuPlan->wednesday, 0, $var);
$menuPlan->thursday = substr($menuPlan->thursday, 0, $var);
'<h2 class="ql-align-center"><strong>Torsdag:</strong></h2>'. $pdf = PDF::loadView('pdf.menuplan', ["menuPlan" => $menuPlan]);
'<p class="ql-align-center">'.$menuPlan->thursday.'</p>';
'</div>'.
'</body>'.
'</html>';
$pdf->loadHTML($data, 'UTF-8');
$pdf->setPaper('A4', 'portrait'); $pdf->setPaper('A4', 'portrait');
return $pdf->stream("menuplan_uge_".$menuPlan->week.".pdf"); return $pdf->stream("menuplan_uge_".$menuPlan->week.".pdf");

View File

@ -233,6 +233,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class, 'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class, 'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class, 'View' => Illuminate\Support\Facades\View::class,
'PDF' => Barryvdh\DomPDF\Facade::class,
'Agent' => Jenssegers\Agent\Facades\Agent::class, 'Agent' => Jenssegers\Agent\Facades\Agent::class,
], ],

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -0,0 +1 @@
<svg height="512" fill="#0a0a0a0a" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><path d="m256 16c-132.336 0-240 107.664-240 240s107.664 240 240 240 240-107.664 240-240-107.664-240-240-240zm0 464c-123.516 0-224-100.484-224-224s100.484-224 224-224 224 100.484 224 224-100.484 224-224 224z"/><path d="m122.891 117.766-11.091-11.532c-4.852 4.68-9.524 9.625-13.875 14.711l12.156 10.407c4.019-4.704 8.333-9.274 12.81-13.586z"/><path d="m48.656 239.367 15.953 1.266a191.284 191.284 0 0 1 34.625-95.367l-13.062-9.25a207.42 207.42 0 0 0 -37.516 103.351z"/><path d="m368 98.633a34.634 34.634 0 0 0 -68.445-7.508c-1.351 6.08-2.436 12.219-3.552 18.35a148.5 148.5 0 0 0 -40-5.32v-40.155h-16.003v96a40.253 40.253 0 0 1 -8 24 39.8 39.8 0 0 1 -8.219 8.148c-9.914 7.313-15.57 19.532-15.117 32.727l7.328 183.414a15.075 15.075 0 0 1 -4.265 11.078 15.571 15.571 0 0 1 -21.852 0 15.1 15.1 0 0 1 -4.266-11.1l5.727-183.438c.453-13.148-5.2-25.367-15.125-32.68a39.8 39.8 0 0 1 -8.211-8.157 40.212 40.212 0 0 1 -8-23.992v-96h-16v89.492a151.493 151.493 0 0 0 26.447 227.933l-.822 26.317a31.195 31.195 0 1 0 62.352-.047l-.067-1.673a149.176 149.176 0 0 0 74.356-6.7l-.539 7.36a31.173 31.173 0 1 0 62.273 2.146v-50.32a151.349 151.349 0 0 0 0-205.016zm-196.948 263.411a135.468 135.468 0 0 1 -24.647-186.3 54.775 54.775 0 0 0 20.314 29.284c5.672 4.18 8.9 11.383 8.633 19.282zm136.508 19.61a130.071 130.071 0 0 1 -76.311 7.83l-6.6-165.2c-.265-7.875 2.961-15.078 8.625-19.258a55.646 55.646 0 0 0 11.526-11.426 56.3 56.3 0 0 0 11.2-33.6v-39.864a132.405 132.405 0 0 1 37.389 5.222 485.96 485.96 0 0 0 -5.389 71.033v83.609a8 8 0 0 0 8 8h18.422zm44.44 27.174a15.188 15.188 0 0 1 -15.172 15.172 15.171 15.171 0 0 1 -15.14-16.18l9.32-127.234a8 8 0 0 0 -7.977-8.586h-19.031v-75.609a469.614 469.614 0 0 1 11.18-101.8 18.631 18.631 0 0 1 36.82 4.042zm40-152.828a134.989 134.989 0 0 1 -24 76.9v-153.8a134.989 134.989 0 0 1 24 76.9z"/><path d="m176 64h16v88h-16z"/><path d="m208 64h16v88h-16z"/></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
fill="#080808" viewBox="0 0 511.988 511.988" style="enable-background:new 0 0 511.988 511.988;" xml:space="preserve">
<g>
<g>
<path d="M394.655,202.654H95.988c-17.643,0-32,14.357-32,32v21.333c0,76.117,42.048,145.152,109.717,180.16
c5.227,2.688,11.669,0.661,14.379-4.587c2.688-5.227,0.661-11.669-4.587-14.379c-60.544-31.317-98.176-93.077-98.176-161.195
v-21.333c0-5.888,4.779-10.667,10.667-10.667h298.667c5.888,0,10.667,4.779,10.667,10.667v21.333
c0,68.117-37.632,129.877-98.197,161.173c-5.248,2.709-7.275,9.152-4.587,14.379c1.899,3.669,5.632,5.781,9.493,5.781
c1.664,0,3.328-0.384,4.885-1.195c67.691-34.987,109.739-104,109.739-180.139v-21.333
C426.655,217.011,412.297,202.654,394.655,202.654z"/>
</g>
</g>
<g>
<g>
<path d="M489.865,422.558c-1.664-3.989-5.547-6.592-9.856-6.592H10.676c-4.309,0-8.192,2.603-9.856,6.592
c-1.664,3.989-0.747,8.576,2.304,11.627l23.915,23.936c14.123,14.101,32.853,21.867,52.8,21.867h330.965
c19.947,0,38.699-7.765,52.843-21.867l23.915-23.936C490.612,431.134,491.529,426.547,489.865,422.558z M448.543,443.038
c-10.069,10.069-23.488,15.616-37.717,15.616H79.839c-14.229,0-27.648-5.547-37.717-15.616l-5.717-5.717H454.26L448.543,443.038z"
/>
</g>
</g>
<g>
<g>
<path d="M491.359,253.022c-28.736-18.475-74.645,1.579-79.787,3.904c-5.355,2.453-7.744,8.768-5.291,14.144
c2.453,5.376,8.747,7.744,14.144,5.291c10.283-4.672,43.264-15.744,59.392-5.355c7.275,4.672,10.837,13.739,10.837,27.648
c0,42.709-86.144,68.523-119.403,74.88l-7.552,1.493c-5.781,1.131-9.536,6.741-8.405,12.523c1.003,5.077,5.461,8.597,10.453,8.597
c0.683,0,1.365-0.064,2.069-0.213l7.488-1.472c5.589-1.067,136.683-26.773,136.683-95.808
C511.988,277.193,505.034,261.854,491.359,253.022z"/>
</g>
</g>
<g>
<g>
<path d="M328.372,113.31c17.344-21.675,17.344-55.616,0-77.291c-3.691-4.608-10.368-5.376-14.997-1.664
c-4.608,3.691-5.355,10.389-1.664,14.997c10.987,13.717,10.987,36.907-0.021,50.667c-17.365,21.675-17.365,55.616,0,77.291
c2.112,2.645,5.205,4.011,8.341,4.011c2.325,0,4.693-0.768,6.656-2.347c4.608-3.691,5.355-10.411,1.664-14.997
C317.343,150.259,317.343,127.07,328.372,113.31z"/>
</g>
</g>
<g>
<g>
<path d="M264.287,113.31c17.365-21.675,17.365-55.616,0-77.291c-3.669-4.608-10.389-5.355-14.997-1.664
c-4.608,3.691-5.355,10.411-1.664,14.997c11.008,13.717,11.008,36.907-0.021,50.667c-17.344,21.675-17.344,55.616,0,77.291
c2.112,2.645,5.205,4.011,8.341,4.011c2.325,0,4.672-0.768,6.656-2.347c4.608-3.691,5.355-10.389,1.664-14.997
C253.279,150.259,253.279,127.07,264.287,113.31z"/>
</g>
</g>
<g>
<g>
<path d="M200.372,113.331c17.344-21.675,17.344-55.616,0-77.291c-3.669-4.608-10.368-5.376-14.997-1.664
c-4.587,3.669-5.333,10.389-1.664,14.976c10.987,13.717,10.987,36.907-0.021,50.667c-17.365,21.675-17.365,55.616,0,77.291
c2.112,2.645,5.205,4.011,8.341,4.011c2.325,0,4.693-0.768,6.656-2.325c4.608-3.691,5.355-10.411,1.664-14.997
C189.343,150.259,189.343,127.091,200.372,113.331z"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1 @@
<svg id="Capa_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><path d="m0 419.804c.031 2.915.047 4.52.078 7.435 118.246 114.241 306.719 113 423.44-3.721 116.722-116.721 117.962-305.194 3.722-423.44-2.915-.031-4.52-.047-7.435-.078z" fill="#98db7c"/><path d="m423.519 395.446c-113.259 113.258-294.062 117.765-412.723 13.562l-10.796 10.796c.031 2.915.047 4.52.078 7.435 118.246 114.241 306.719 113.001 423.441-3.721 62.559-62.559 91.939-145.728 88.152-227.65-3.355 72.57-32.736 144.161-88.152 199.578z" fill="#82d361"/><path d="m31.264 388.541c.001.001.002.002.003.003 98.66 98.659 258.618 98.659 357.277 0s98.659-258.618 0-357.277c-.001-.001-.002-.002-.003-.003z" fill="#ff4755"/><path d="m388.544 360.471c-93.936 93.936-243.44 98.429-342.698 13.487l-14.583 14.583c.001.001.002.002.003.003 98.66 98.659 258.618 98.659 357.277 0 52.901-52.901 77.421-123.426 73.591-192.675-3.312 59.899-27.832 118.844-73.59 164.602z" fill="#fc2b3a"/><g fill="#5b5b5b"><path d="m301.174 316.025c3.967 0 7.697-1.545 10.503-4.35s4.351-6.535 4.351-10.503-1.545-7.697-4.35-10.503c-.001-.001-.001-.001-.002-.002-2.112-2.112-18.071-14.15-26.615-5.607-2.565 2.566-4.802 7.501-.891 16.44 1.711 3.911 4.324 8 6.5 10.174 2.805 2.806 6.536 4.351 10.504 4.351z"/><path d="m223.897 321.451c-11.954 1.764-11.807 21.749-11.372 24.708 1.086 7.373 7.444 12.69 14.687 12.69 6.175 0 11.821-3.957 13.953-9.745 2.314-6.281-.4-13.067-3.54-18.562-4.842-8.471-10.137-9.614-13.728-9.091z"/><path d="m131.649 343.774c-1.388 3.716-1.244 7.752.403 11.361 2.474 5.419 8.113 8.909 14.077 8.683 5.938-.225 11.279-4.099 13.352-9.656 1.077-2.884 1.755-7.688 1.688-11.955-.153-9.757-4.238-13.318-7.637-14.586-11.322-4.228-20.838 13.354-21.883 16.153z"/><path d="m321.453 223.896c-1.762 11.956 17.421 17.581 20.375 18.016 8.018 1.176 15.681-4.52 16.863-12.53 1.181-8.016-4.526-15.682-12.53-16.861-2.96-.431-22.945-.581-24.708 11.375z"/><path d="m342.208 161.167c3.952.062 8.224-.294 11.955-1.688 7.577-2.827 11.558-11.516 8.722-19.109-2.828-7.578-11.515-11.557-19.109-8.724-2.884 1.076-6.959 3.712-10.139 6.559-7.271 6.508-7.284 11.927-6.015 15.326s4.829 7.483 14.586 7.636z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,39 @@
<html style="padding: 0; margin: 0; width: 100%; height: 100%;" lang="">
<head style="padding: 0; margin: 0; width: 100%; height: 100%;">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Title</title>
</head>
<style>
@page { margin: 0; }
body { margin: 0; }
h2 { font-size: 48px; color: #00788a; }
p { font-size: 24px; z-index: 1; }
img { z-index: 0; opacity: 0.7; }
</style>
<body style="padding: 0; width: 100%; height: 100%;">
<div style="background-color: #00788A; width: 100%; padding: 1rem 1rem;">
<h1 style="color: white; text-align: center">Erhverskollegiet - Odense</h1>
<h1 style="font-size: 36px; text-align: center; color: white;">Menuplan, Uge {{$menuPlan->week}}</h1>
</div>
<div style="text-align: center; margin: 0 16px;">
<h2 class="ql-align-center"><strong>Mandag:</strong></h2>
<p class="ql-align-center">{{$menuPlan->monday}}</p>
<p class="ql-align-center"><br></p>
<h2 class="ql-align-center"><strong>Tirsdag:</strong></h2>
<p class="ql-align-center">{{$menuPlan->tuesday}}</p>
<p class="ql-align-center"><br></p>
<h2 class="ql-align-center"><strong>Onsdag:</strong></h2>
<p class="ql-align-center">{{$menuPlan->wednesday}}</p>
<p class="ql-align-center"><br></p>
<h2 class="ql-align-center"><strong>Torsdag:</strong></h2>
<p class="ql-align-center">{{$menuPlan->thursday}}</p>
</div>
<img src="./images/icons/watermelon.svg" style="width: 8rem; position: absolute; right: 52px;" alt="watermelon">
<img src="./images/icons/coconut.svg" style="width: 6rem; position: absolute; left: 45px; top: 360px; transform: scaleX(-1);" alt="coconut">
<img src="./images/icons/dinner.svg" style="width: 6rem; position: absolute; right: 40px; top: 350px; transform: rotate(-20deg);" alt="plate">
<img src="./images/icons/food.svg" style="fill: black; width: 7rem; position: absolute; left: 32px; bottom: 150px; transform: rotate(30deg);" alt="plate">
</body>
</html>