From 56cbf3cc140eb534a4546cf2af2212840d603bbc Mon Sep 17 00:00:00 2001 From: daffahaidar Date: Fri, 26 Aug 2022 21:17:59 +0700 Subject: [PATCH] Daffa Haidar - Convert Student Data to PDF Stage 2 --- README.md | 1 + .../Student/StudentRegistrationController.php | 8 +- composer.json | 3 +- composer.lock | 161 +----------------- config/app.php | 2 - .../student_details_pdf.blade.php | 157 +++++++++++++++++ .../student_view.blade.php | 6 +- routes/web.php | 1 + 8 files changed, 175 insertions(+), 164 deletions(-) diff --git a/README.md b/README.md index 9a27c7b..ecdf75d 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ | **23 August 2022** | Completed Edit Student Data | | **24 August 2022** | Create Student Promotion Feature | | **25 August 2022** | Convert Student Data to PDF Stage 1 | +| **26 August 2022** | Convert Student Data to PDF Stage 2 | | **Next...** | coming soon... | ## Installation diff --git a/app/Http/Controllers/Backend/Student/StudentRegistrationController.php b/app/Http/Controllers/Backend/Student/StudentRegistrationController.php index 64dd272..c7baf6e 100644 --- a/app/Http/Controllers/Backend/Student/StudentRegistrationController.php +++ b/app/Http/Controllers/Backend/Student/StudentRegistrationController.php @@ -235,8 +235,10 @@ public function StudentRegistrationDetails($student_id) { $data['details'] = AssignStudent::with(['student', 'discount'])->where('student_id', $student_id)->first(); - $pdf = PDF::loadView('backend.student.student_registration.student_details_pdf', $data); - $pdf->SetProtection(['copy', 'print'], '', 'pass'); - return $pdf->stream('document.pdf'); + // $pdf = PDF::loadView('backend.student.student_registration.student_details_pdf', $data); + // $pdf->SetProtection(['copy', 'print'], '', 'pass'); + // return $pdf->stream('document.pdf'); + + return view('backend.student.student_registration.student_details_pdf', $data); } } diff --git a/composer.json b/composer.json index 6e49805..7a3169f 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,7 @@ "laravel/jetstream": "^2.8", "laravel/sanctum": "^2.14.1", "laravel/tinker": "^2.7", - "livewire/livewire": "^2.5", - "niklasravnsborg/laravel-pdf": "*" + "livewire/livewire": "^2.5" }, "require-dev": { "fakerphp/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index 52c7f5b..5413a92 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": "7587bcc534512b61deca29c6873515e7", + "content-hash": "c82581dedba21f7f6d99a05376102cdb", "packages": [ { "name": "bacon/bacon-qr-code", @@ -2195,62 +2195,6 @@ ], "time": "2022-07-24T11:55:47+00:00" }, - { - "name": "mpdf/mpdf", - "version": "v6.1.3", - "source": { - "type": "git", - "url": "https://github.com/mpdf/mpdf.git", - "reference": "7f138bf7508eac895ac2c13d2509b056ac7e7e97" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mpdf/mpdf/zipball/7f138bf7508eac895ac2c13d2509b056ac7e7e97", - "reference": "7f138bf7508eac895ac2c13d2509b056ac7e7e97", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=5.4.0", - "setasign/fpdi": "1.6.*" - }, - "require-dev": { - "phpunit/phpunit": "^4.7" - }, - "suggest": { - "ext-zlib": "Needed for compression of embedded resources, such as fonts" - }, - "type": "library", - "autoload": { - "classmap": [ - "mpdf.php", - "classes" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0" - ], - "authors": [ - { - "name": "Ian Back", - "role": "Developer" - } - ], - "description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support", - "homepage": "http://mpdf.github.io", - "keywords": [ - "pdf", - "php", - "utf-8" - ], - "support": { - "docs": "http://mpdf.github.io", - "issues": "https://github.com/mpdf/mpdf/issues", - "source": "https://github.com/mpdf/mpdf" - }, - "time": "2016-12-12T10:42:18+00:00" - }, { "name": "nesbot/carbon", "version": "2.61.0", @@ -2556,46 +2500,6 @@ }, "time": "2022-05-31T20:59:12+00:00" }, - { - "name": "niklasravnsborg/laravel-pdf", - "version": "v1.5.0", - "source": { - "type": "git", - "url": "https://github.com/niklasravnsborg/laravel-pdf.git", - "reference": "68a24e8ddc0b981f41b9b80dcae5ee3466a0a998" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/niklasravnsborg/laravel-pdf/zipball/68a24e8ddc0b981f41b9b80dcae5ee3466a0a998", - "reference": "68a24e8ddc0b981f41b9b80dcae5ee3466a0a998", - "shasum": "" - }, - "require": { - "mpdf/mpdf": "^6.1.3", - "php": ">=5.4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "niklasravnsborg\\LaravelPdf\\": "src/LaravelPdf" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Generate PDFs in Laravel with this mPDF wrapper.", - "keywords": [ - "laravel", - "mpdf", - "pdf" - ], - "support": { - "issues": "https://github.com/niklasravnsborg/laravel-pdf/issues", - "source": "https://github.com/niklasravnsborg/laravel-pdf/tree/master" - }, - "time": "2017-02-08T20:24:49+00:00" - }, { "name": "nunomaduro/termwind", "version": "v1.14.0", @@ -3532,59 +3436,6 @@ ], "time": "2022-08-05T17:58:37+00:00" }, - { - "name": "setasign/fpdi", - "version": "1.6.2", - "source": { - "type": "git", - "url": "https://github.com/Setasign/FPDI.git", - "reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6ad58897a6d97cc2d2cd2adaeda343b25a368ea", - "reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea", - "shasum": "" - }, - "suggest": { - "setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.", - "setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.", - "setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF." - }, - "type": "library", - "autoload": { - "classmap": [ - "filters/", - "fpdi.php", - "fpdf_tpl.php", - "fpdi_pdf_parser.php", - "pdf_context.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Slabon", - "email": "jan.slabon@setasign.com", - "homepage": "https://www.setasign.com" - } - ], - "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.", - "homepage": "https://www.setasign.com/fpdi", - "keywords": [ - "fpdf", - "fpdi", - "pdf" - ], - "support": { - "issues": "https://github.com/Setasign/FPDI/issues", - "source": "https://github.com/Setasign/FPDI/tree/master" - }, - "time": "2017-05-11T14:25:49+00:00" - }, { "name": "symfony/console", "version": "v6.1.3", @@ -8168,16 +8019,16 @@ }, { "name": "spatie/ignition", - "version": "1.3.1", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/spatie/ignition.git", - "reference": "997363fbcce809b1e55f571997d49017f9c623d9" + "reference": "dd3d456779108d7078baf4e43f8c2b937d9794a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/ignition/zipball/997363fbcce809b1e55f571997d49017f9c623d9", - "reference": "997363fbcce809b1e55f571997d49017f9c623d9", + "url": "https://api.github.com/repos/spatie/ignition/zipball/dd3d456779108d7078baf4e43f8c2b937d9794a1", + "reference": "dd3d456779108d7078baf4e43f8c2b937d9794a1", "shasum": "" }, "require": { @@ -8239,7 +8090,7 @@ "type": "github" } ], - "time": "2022-05-16T13:16:07+00:00" + "time": "2022-08-26T11:51:15+00:00" }, { "name": "spatie/laravel-ignition", diff --git a/config/app.php b/config/app.php index d35cc61..f66af84 100644 --- a/config/app.php +++ b/config/app.php @@ -181,7 +181,6 @@ Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, - niklasravnsborg\LaravelPdf\PdfServiceProvider::class, /* * Package Service Providers... @@ -213,7 +212,6 @@ 'aliases' => Facade::defaultAliases()->merge([ // 'ExampleClass' => App\Example\ExampleClass::class, - 'PDF' => niklasravnsborg\LaravelPdf\Facades\Pdf::class, ])->toArray(), ]; diff --git a/resources/views/backend/student/student_registration/student_details_pdf.blade.php b/resources/views/backend/student/student_registration/student_details_pdf.blade.php index e69de29..ac909f6 100644 --- a/resources/views/backend/student/student_registration/student_details_pdf.blade.php +++ b/resources/views/backend/student/student_registration/student_details_pdf.blade.php @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + +
+

Your Brand

+
+

Your ERP

+

School Address

+

School Phones

+

School Email

+
+

Your ERP

+

School Address

+

School Phones

+

School Email

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
No.Detail SiswaData Siswa
1Nama Siswa{{ $details['student']['name'] }}
2ID Siswa{{ $details['student']['id_no'] }}
3Kode Siswa{{ $details['student']['code'] }}
4Roll{{ $details->roll }}
5Jenis Kelamin{{ $details['student']['gender'] }}
6Agama{{ $details['student']['religion'] }}
7Tangga Lahir{{ $details['student']['birth'] }}
8Nama Ayah{{ $details['student']['father'] }}
9Nama Ibu{{ $details['student']['mother'] }}
10Telepon Siswa{{ $details['student']['mobile'] }}
11Alamat Siswa{{ $details['student']['address'] }}
12Kelas{{ $details['student_class']['name'] }}
13Tahun Angkatan{{ $details['student_year']['name'] }}
14Jurusan{{ $details['group']['name'] }}
15Shift Siswa{{ $details['shift']['name'] }}
16Potongan BiayaRp. {{ $details['discount']['discount'] }}
+
+ Dicetak Tanggal: {{ date('d M Y') }} + + + + diff --git a/resources/views/backend/student/student_registration/student_view.blade.php b/resources/views/backend/student/student_registration/student_view.blade.php index a18cc96..16b69b2 100644 --- a/resources/views/backend/student/student_registration/student_view.blade.php +++ b/resources/views/backend/student/student_registration/student_view.blade.php @@ -110,7 +110,8 @@ class="btn btn-rounded btn-success mb-5"> Tambahkan Siswa class="btn btn-info"> - @@ -159,7 +160,8 @@ class="fa fa-solid fa-file-pdf"> class="btn btn-info"> - diff --git a/routes/web.php b/routes/web.php index 0d33b59..f04c8f4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -150,4 +150,5 @@ Route::post('/registration/update/{student_id}', [StudentRegistrationController::class, 'StudentRegistrationUpdate'])->name('update.student.registration'); Route::get('/registration/promotion/{student_id}', [StudentRegistrationController::class, 'StudentRegistrationPromotion'])->name('student.registration.promotion'); Route::post('/registration/update/promotion/{student_id}', [StudentRegistrationController::class, 'StudentUpdatePromotion'])->name('promotion.student.registration'); + Route::get('/registration/details/{student_id}', [StudentRegistrationController::class, 'StudentRegistrationDetails'])->name('student.registration.details'); });