feat: add PDF export functionality for reports using dompdf and integrate into ReportRelationManager

This commit is contained in:
Yoga Pangestu 2026-04-10 22:34:55 +07:00
parent ec7a9bdf30
commit ca5aa283d0
7 changed files with 999 additions and 2 deletions

View File

@ -0,0 +1,59 @@
<?php
namespace App\Filament\Resources\Manage\Cooperations\Actions\Report;
use App\Settings\GeneralSettings;
use Barryvdh\DomPDF\Facade\Pdf;
use Filament\Actions\Action;
use Filament\Tables\Table;
use Illuminate\Support\Facades\Blade;
class ExportAllReportsPdfAction extends Action
{
public static function getDefaultName(): ?string
{
return 'export_all_pdf';
}
protected function setUp(): void
{
parent::setUp();
$this->label('Unduh Semua')
->color('info')
->icon('heroicon-o-arrow-down-tray')
->action(function (Table $table) {
$settings = app(GeneralSettings::class);
$records = $table->getLivewire()->getFilteredTableQuery()->get();
$logoPath = $settings->site_icon ? storage_path('app/public/'.$settings->site_icon) : null;
$logoBase64 = null;
if ($logoPath && file_exists($logoPath)) {
$logoData = base64_encode(file_get_contents($logoPath));
$logoBase64 = 'data:image/'.pathinfo($logoPath, PATHINFO_EXTENSION).';base64,'.$logoData;
}
$records->each(function ($record) {
$image = $record->getFirstMedia('reports');
$record->imageBase64 = null;
if ($image) {
$imagePath = $image->getPath();
if (file_exists($imagePath)) {
$imageData = base64_encode(file_get_contents($imagePath));
$record->imageBase64 = 'data:image/'.pathinfo($imagePath, PATHINFO_EXTENSION).';base64,'.$imageData;
}
}
});
return response()->streamDownload(function () use ($records, $settings, $logoBase64) {
echo Pdf::loadHtml(
Blade::render('filament.manage.reports.print-all', [
'records' => $records,
'settings' => $settings,
'logoBase64' => $logoBase64,
])
)->output();
}, 'rekap-bukti-tayang.pdf');
});
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Filament\Resources\Manage\Cooperations\Actions\Report;
use App\Models\Report;
use App\Settings\GeneralSettings;
use Barryvdh\DomPDF\Facade\Pdf;
use Filament\Actions\Action;
use Illuminate\Support\Facades\Blade;
class ExportReportPdfAction extends Action
{
public static function getDefaultName(): ?string
{
return 'export_pdf';
}
protected function setUp(): void
{
parent::setUp();
$this->label('Unduh')
->color('success')
->icon('heroicon-o-arrow-down-tray')
->action(function (Report $record) {
$settings = app(GeneralSettings::class);
$logoPath = $settings->site_icon ? storage_path('app/public/'.$settings->site_icon) : null;
$logoBase64 = null;
if ($logoPath && file_exists($logoPath)) {
$logoData = base64_encode(file_get_contents($logoPath));
$logoBase64 = 'data:image/'.pathinfo($logoPath, PATHINFO_EXTENSION).';base64,'.$logoData;
}
$image = $record->getFirstMedia('reports');
$imageBase64 = null;
if ($image) {
$imagePath = $image->getPath();
if (file_exists($imagePath)) {
$imageData = base64_encode(file_get_contents($imagePath));
$imageBase64 = 'data:image/'.pathinfo($imagePath, PATHINFO_EXTENSION).';base64,'.$imageData;
}
}
return response()->streamDownload(function () use ($record, $settings, $logoBase64, $imageBase64) {
echo Pdf::loadHtml(
Blade::render('filament.manage.reports.print', [
'record' => $record,
'settings' => $settings,
'logoBase64' => $logoBase64,
'imageBase64' => $imageBase64,
])
)->output();
}, str($record->title)->slug().'.pdf');
});
}
}

View File

@ -5,12 +5,15 @@
use App\Enums\RoleEnum;
use App\Filament\Columns\RowIndexColumn;
use App\Filament\Resources\Manage\Cooperations\Actions\Report\AcceptAction;
use App\Filament\Resources\Manage\Cooperations\Actions\Report\ExportAllReportsPdfAction;
use App\Filament\Resources\Manage\Cooperations\Actions\Report\ExportReportPdfAction;
use App\Filament\Resources\Manage\Cooperations\Actions\Report\RejectAction;
use App\Filament\Resources\Manage\Cooperations\Actions\Report\SubmitReportAction;
use App\Filament\Support\CheerfulNotification;
use App\Models\Report;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Columns\SpatieMediaLibraryImageColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
@ -83,23 +86,30 @@ public function table(Table $table): Table
->label('Status')
->badge(),
SpatieMediaLibraryImageColumn::make('image')
->label('Gambar')
->collection('reports')
->imageHeight('240px'),
TextColumn::make('rejectionReasons.reason')
->label('Alasan Penolakan')
->searchable(),
])
->recordActions([
ExportReportPdfAction::make(),
AcceptAction::make(),
RejectAction::make(),
])
->headerActions([
ExportAllReportsPdfAction::make(),
SubmitReportAction::make(),
])
->toolbarActions([])
->emptyStateIcon(Heroicon::OutlinedInboxArrowDown)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('cooperation.report_empty_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('cooperation.report_empty'))
->defaultSort('created_at', 'desc')
->modifyQueryUsing(function (Builder $query): void {
$query->when(auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value), function (Builder $query): void {
$query->whereHas('mediaTaskAssignment.partnerMedia.company', function (Builder $q): void {

View File

@ -12,6 +12,7 @@
"php": "^8.2",
"achyutn/filament-log-viewer": "^1.7",
"asmit/filament-upload": "^1.1",
"barryvdh/laravel-dompdf": "^3.1",
"bezhansalleh/filament-shield": "^4.0",
"bilfeldt/laravel-route-statistics": "^4.2",
"filament/filament": "^4.0",

457
composer.lock generated
View File

@ -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": "56c24787e6cbc418cfa67149242373d2",
"content-hash": "116c8e60c2cac8f2a9bac2ede4d16dea",
"packages": [
{
"name": "achyutn/filament-log-viewer",
@ -355,6 +355,83 @@
},
"time": "2026-03-25T18:05:48+00:00"
},
{
"name": "barryvdh/laravel-dompdf",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-dompdf.git",
"reference": "ee3b72b19ccdf57d0243116ecb2b90261344dedc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/ee3b72b19ccdf57d0243116ecb2b90261344dedc",
"reference": "ee3b72b19ccdf57d0243116ecb2b90261344dedc",
"shasum": ""
},
"require": {
"dompdf/dompdf": "^3.0",
"illuminate/support": "^9|^10|^11|^12|^13.0",
"php": "^8.1"
},
"require-dev": {
"larastan/larastan": "^2.7|^3.0",
"orchestra/testbench": "^7|^8|^9.16|^10|^11.0",
"phpro/grumphp": "^2.5",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"PDF": "Barryvdh\\DomPDF\\Facade\\Pdf",
"Pdf": "Barryvdh\\DomPDF\\Facade\\Pdf"
},
"providers": [
"Barryvdh\\DomPDF\\ServiceProvider"
]
},
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"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/v3.1.2"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2026-02-21T08:51:10+00:00"
},
{
"name": "bezhansalleh/filament-plugin-essentials",
"version": "1.1.0",
@ -1725,6 +1802,161 @@
],
"time": "2024-02-05T11:56:58+00:00"
},
{
"name": "dompdf/dompdf",
"version": "v3.1.5",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "f11ead23a8a76d0ff9bbc6c7c8fd7e05ca328496"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/f11ead23a8a76d0ff9bbc6c7c8fd7e05ca328496",
"reference": "f11ead23a8a76d0ff9bbc6c7c8fd7e05ca328496",
"shasum": ""
},
"require": {
"dompdf/php-font-lib": "^1.0.0",
"dompdf/php-svg-lib": "^1.0.0",
"ext-dom": "*",
"ext-mbstring": "*",
"masterminds/html5": "^2.0",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"ext-gd": "*",
"ext-json": "*",
"ext-zip": "*",
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11",
"squizlabs/php_codesniffer": "^3.5",
"symfony/process": "^4.4 || ^5.4 || ^6.2 || ^7.0"
},
"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": "The Dompdf Community",
"homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md"
}
],
"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/v3.1.5"
},
"time": "2026-03-03T13:54:37+00:00"
},
{
"name": "dompdf/php-font-lib",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-font-lib.git",
"reference": "a6e9a688a2a80016ac080b97be73d3e10c444c9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/a6e9a688a2a80016ac080b97be73d3e10c444c9a",
"reference": "a6e9a688a2a80016ac080b97be73d3e10c444c9a",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11 || ^12"
},
"type": "library",
"autoload": {
"psr-4": {
"FontLib\\": "src/FontLib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "The FontLib Community",
"homepage": "https://github.com/dompdf/php-font-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/dompdf/php-font-lib",
"support": {
"issues": "https://github.com/dompdf/php-font-lib/issues",
"source": "https://github.com/dompdf/php-font-lib/tree/1.0.2"
},
"time": "2026-01-20T14:10:26+00:00"
},
{
"name": "dompdf/php-svg-lib",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-svg-lib.git",
"reference": "8259ffb930817e72b1ff1caef5d226501f3dfeb1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/8259ffb930817e72b1ff1caef5d226501f3dfeb1",
"reference": "8259ffb930817e72b1ff1caef5d226501f3dfeb1",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0",
"sabberworm/php-css-parser": "^8.4 || ^9.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11"
},
"type": "library",
"autoload": {
"psr-4": {
"Svg\\": "src/Svg"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "The SvgLib Community",
"homepage": "https://github.com/dompdf/php-svg-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/dompdf/php-svg-lib",
"support": {
"issues": "https://github.com/dompdf/php-svg-lib/issues",
"source": "https://github.com/dompdf/php-svg-lib/tree/1.0.2"
},
"time": "2026-01-02T16:01:13+00:00"
},
{
"name": "dragonmantank/cron-expression",
"version": "v3.6.0",
@ -7086,6 +7318,86 @@
],
"time": "2025-02-25T09:09:36+00:00"
},
{
"name": "sabberworm/php-css-parser",
"version": "v9.3.0",
"source": {
"type": "git",
"url": "https://github.com/MyIntervals/PHP-CSS-Parser.git",
"reference": "88dbd0f7f91abbfe4402d0a3071e9ff4d81ed949"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/88dbd0f7f91abbfe4402d0a3071e9ff4d81ed949",
"reference": "88dbd0f7f91abbfe4402d0a3071e9ff4d81ed949",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"php": "^7.2.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"thecodingmachine/safe": "^1.3 || ^2.5 || ^3.4"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "1.4.0",
"phpstan/extension-installer": "1.4.3",
"phpstan/phpstan": "1.12.32 || 2.1.32",
"phpstan/phpstan-phpunit": "1.4.2 || 2.0.8",
"phpstan/phpstan-strict-rules": "1.6.2 || 2.0.7",
"phpunit/phpunit": "8.5.52",
"rawr/phpunit-data-provider": "3.3.1",
"rector/rector": "1.2.10 || 2.2.8",
"rector/type-perfect": "1.0.0 || 2.1.0",
"squizlabs/php_codesniffer": "4.0.1",
"thecodingmachine/phpstan-safe-rule": "1.2.0 || 1.4.1"
},
"suggest": {
"ext-mbstring": "for parsing UTF-8 CSS"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.4.x-dev"
}
},
"autoload": {
"files": [
"src/Rule/Rule.php",
"src/RuleSet/RuleContainer.php"
],
"psr-4": {
"Sabberworm\\CSS\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Raphael Schweikert"
},
{
"name": "Oliver Klee",
"email": "github@oliverklee.de"
},
{
"name": "Jake Hotson",
"email": "jake.github@qzdesign.co.uk"
}
],
"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/MyIntervals/PHP-CSS-Parser/issues",
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v9.3.0"
},
"time": "2026-03-03T17:31:43+00:00"
},
{
"name": "scrivo/highlight.php",
"version": "v9.18.1.10",
@ -11060,6 +11372,149 @@
],
"time": "2026-02-15T10:53:20+00:00"
},
{
"name": "thecodingmachine/safe",
"version": "v3.4.0",
"source": {
"type": "git",
"url": "https://github.com/thecodingmachine/safe.git",
"reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thecodingmachine/safe/zipball/705683a25bacf0d4860c7dea4d7947bfd09eea19",
"reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19",
"shasum": ""
},
"require": {
"php": "^8.1"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/phpstan": "^2",
"phpunit/phpunit": "^10",
"squizlabs/php_codesniffer": "^3.2"
},
"type": "library",
"autoload": {
"files": [
"lib/special_cases.php",
"generated/apache.php",
"generated/apcu.php",
"generated/array.php",
"generated/bzip2.php",
"generated/calendar.php",
"generated/classobj.php",
"generated/com.php",
"generated/cubrid.php",
"generated/curl.php",
"generated/datetime.php",
"generated/dir.php",
"generated/eio.php",
"generated/errorfunc.php",
"generated/exec.php",
"generated/fileinfo.php",
"generated/filesystem.php",
"generated/filter.php",
"generated/fpm.php",
"generated/ftp.php",
"generated/funchand.php",
"generated/gettext.php",
"generated/gmp.php",
"generated/gnupg.php",
"generated/hash.php",
"generated/ibase.php",
"generated/ibmDb2.php",
"generated/iconv.php",
"generated/image.php",
"generated/imap.php",
"generated/info.php",
"generated/inotify.php",
"generated/json.php",
"generated/ldap.php",
"generated/libxml.php",
"generated/lzf.php",
"generated/mailparse.php",
"generated/mbstring.php",
"generated/misc.php",
"generated/mysql.php",
"generated/mysqli.php",
"generated/network.php",
"generated/oci8.php",
"generated/opcache.php",
"generated/openssl.php",
"generated/outcontrol.php",
"generated/pcntl.php",
"generated/pcre.php",
"generated/pgsql.php",
"generated/posix.php",
"generated/ps.php",
"generated/pspell.php",
"generated/readline.php",
"generated/rnp.php",
"generated/rpminfo.php",
"generated/rrd.php",
"generated/sem.php",
"generated/session.php",
"generated/shmop.php",
"generated/sockets.php",
"generated/sodium.php",
"generated/solr.php",
"generated/spl.php",
"generated/sqlsrv.php",
"generated/ssdeep.php",
"generated/ssh2.php",
"generated/stream.php",
"generated/strings.php",
"generated/swoole.php",
"generated/uodbc.php",
"generated/uopz.php",
"generated/url.php",
"generated/var.php",
"generated/xdiff.php",
"generated/xml.php",
"generated/xmlrpc.php",
"generated/yaml.php",
"generated/yaz.php",
"generated/zip.php",
"generated/zlib.php"
],
"classmap": [
"lib/DateTime.php",
"lib/DateTimeImmutable.php",
"lib/Exceptions/",
"generated/Exceptions/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHP core functions that throw exceptions instead of returning FALSE on error",
"support": {
"issues": "https://github.com/thecodingmachine/safe/issues",
"source": "https://github.com/thecodingmachine/safe/tree/v3.4.0"
},
"funding": [
{
"url": "https://github.com/OskarStark",
"type": "github"
},
{
"url": "https://github.com/shish",
"type": "github"
},
{
"url": "https://github.com/silasjoisten",
"type": "github"
},
{
"url": "https://github.com/staabm",
"type": "github"
}
],
"time": "2026-02-04T18:08:13+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
"version": "v2.4.0",

View File

@ -0,0 +1,180 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Rekapitulasi Bukti Tayang</title>
<style>
@page {
margin: 1cm;
size: landscape;
/* Gunakan landscape agar tabel lebih leluasa */
}
body {
font-family: 'Times New Roman', Times, serif;
color: #000;
font-size: 10pt;
line-height: 1.2;
}
.letterhead {
width: 100%;
border-bottom: 3px solid #000;
padding-bottom: 2px;
margin-bottom: 2px;
}
.letterhead-border-bottom {
border-bottom: 1px solid #000;
margin-bottom: 20px;
}
.institution-logo {
max-width: 60px;
}
.letterhead-content {
text-align: center;
}
.goverment-name {
font-size: 12pt;
text-transform: uppercase;
margin: 0;
}
.department-name {
font-size: 14pt;
font-weight: bold;
text-transform: uppercase;
margin: 0;
}
.institution-address {
font-size: 8pt;
font-style: italic;
margin: 0;
}
.document-title {
text-align: center;
font-size: 12pt;
font-weight: bold;
text-decoration: underline;
text-transform: uppercase;
margin: 20px 0;
}
.report-table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
}
.report-table th,
.report-table td {
border: 1px solid #000;
padding: 8px 5px;
vertical-align: top;
}
.report-table th {
background-color: #f2f2f2;
text-transform: uppercase;
font-size: 9pt;
}
.text-center {
text-align: center;
}
.text-nowrap {
white-space: nowrap;
}
.signature-section {
width: 100%;
margin-top: 30px;
}
.signature-box {
float: right;
width: 250px;
text-align: center;
}
</style>
</head>
<body>
<table class="letterhead">
<tr>
<td width="10%" align="center">
@if ($logoBase64)
<img src="{{ $logoBase64 }}" class="institution-logo">
@else
<div style="width: 50px; height: 50px; border: 1px dashed #ccc;">LOGO</div>
@endif
</td>
<td width="90%" class="letterhead-content">
<div class="goverment-name">{{ $settings->site_name }}</div>
<div class="department-name">DINAS KOMUNIKASI DAN INFORMATIKA</div>
<div class="institution-address">
{{ $settings->address }}<br>
Email: {{ $settings->site_email }} | Telp: {{ $settings->site_phone }}
</div>
</td>
</tr>
</table>
<div class="letterhead-border-bottom"></div>
<div class="document-title">Rekapitulasi Bukti Tayang </div>
<table class="report-table">
<thead>
<tr>
<th width="3%" class="text-center">No</th>
<th width="12%">Media</th>
<th width="30%">Judul Berita/Publikasi</th>
<th width="10%" class="text-center">Tanggal Tayang</th>
<th width="15%">Tautan (Link)</th>
<th width="15%" class="text-center">Gambar</th>
<th width="10%" class="text-center">Status</th>
</tr>
</thead>
<tbody>
@foreach ($records as $index => $record)
<tr>
<td class="text-center">{{ $index + 1 }}</td>
<td>{{ $record->mediaTaskAssignment?->partnerMedia?->name ?? '-' }}</td>
<td>{{ $record->title }}</td>
<td class="text-center text-nowrap">
{{ $record->publication_date?->translatedFormat('d F Y') ?? '-' }}</td>
<td style="word-break: break-all; font-size: 8pt;">{{ $record->link }}</td>
<td class="text-center">
@if ($record->imageBase64)
<img src="{{ $record->imageBase64 }}" style="max-width: 100px; max-height: 80px;">
@else
-
@endif
</td>
<td class="text-center">{{ $record->status->getLabel() }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="signature-section">
<div class="signature-box">
Purwakarta, {{ now()->translatedFormat('d F Y') }}<br>
Admin SIMEDKOM
<div style="margin-top: 60px; font-weight: bold; text-decoration: underline;">
SISTEM DINAS KOMINFO
</div>
<div style="font-size: 8pt;">Dokumen Sah Elektronik</div>
</div>
<div style="clear: both;"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,234 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Surat Bukti Tayang - {{ $record->title }}</title>
<style>
@page {
margin: 1.5cm;
}
body {
font-family: 'Times New Roman', Times, serif;
color: #000;
line-height: 1.4;
margin: 0;
padding: 0;
}
/* Letterhead Section */
.letterhead {
width: 100%;
border-bottom: 3px solid #000;
padding-bottom: 2px;
margin-bottom: 2px;
}
.letterhead-border-bottom {
border-bottom: 1px solid #000;
margin-bottom: 20px;
}
.institution-logo {
max-width: 80px;
max-height: 100px;
}
.letterhead-content {
text-align: center;
vertical-align: middle;
}
.government-name {
font-size: 14pt;
margin: 0;
text-transform: uppercase;
}
.department-name {
font-size: 16pt;
font-weight: bold;
margin: 0;
text-transform: uppercase;
}
.institution-address {
font-size: 10pt;
margin: 0;
font-style: italic;
}
/* Document Title Section */
.document-title {
text-align: center;
margin-top: 20px;
margin-bottom: 30px;
}
.document-title-text {
font-size: 14pt;
font-weight: bold;
text-decoration: underline;
margin-bottom: 5px;
text-transform: uppercase;
}
/* Body Content Section */
.document-body {
margin-top: 10px;
font-size: 12pt;
}
.label-column {
width: 180px;
}
.colon-separator {
width: 20px;
text-align: center;
}
.data-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
.data-table td {
padding: 5px 0;
vertical-align: top;
}
/* Signature Section */
.signature-section {
width: 100%;
margin-top: 40px;
}
.signature-box {
width: 300px;
text-align: center;
}
.signature-date {
margin-bottom: 60px;
}
.signature-name {
font-weight: bold;
text-decoration: underline;
}
.external-link {
color: blue;
text-decoration: none;
}
</style>
</head>
<body>
<!-- LETTERHEAD -->
<table class="letterhead">
<tr>
<td width="15%" align="center">
@if ($logoBase64)
<img src="{{ $logoBase64 }}" class="institution-logo">
@else
<div
style="width: 80px; height: 80px; border: 1px dashed #ccc; line-height: 80px; text-align: center;">
LOGO</div>
@endif
</td>
<td width="85%" class="letterhead-content">
<div class="government-name">{{ $settings->site_name }}</div>
<div class="department-name">DINAS KOMUNIKASI DAN INFORMATIKA</div>
<div class="institution-address">
{{ $settings->address ?? 'Alamat belum diatur dalam pengaturan.' }}<br>
Website: {{ parse_url(config('app.url'), PHP_URL_HOST) }} | Email: {{ $settings->site_email }} |
Telp: {{ $settings->site_phone }}
</div>
</td>
</tr>
</table>
<div class="letterhead-border-bottom"></div>
<!-- DOCUMENT HEADER -->
<div class="document-title">
<div class="document-title-text">Surat Bukti Tayang</div>
</div>
</div>
<div class="document-body">
<p style="text-align: justify;">Yang bertanda tangan di bawah ini, menerangkan bahwa laporan publikasi media
berikut telah diverifikasi
dalam sistem {{ $settings->site_name }}:</p>
<table class="data-table">
<tr>
<td class="label-column">Nama Media</td>
<td class="colon-separator">:</td>
<td style="font-weight: bold;">{{ $record->mediaTaskAssignment?->partnerMedia?->name ?? '-' }}</td>
</tr>
<tr>
<td class="label-column">Perusahaan</td>
<td class="colon-separator">:</td>
<td>{{ $record->mediaTaskAssignment?->partnerMedia?->company?->name ?? '-' }}</td>
</tr>
<tr>
<td class="label-column">Judul Publikasi</td>
<td class="colon-separator">:</td>
<td>"{{ $record->title }}"</td>
</tr>
<tr>
<td class="label-column">Tanggal Tayang</td>
<td class="colon-separator">:</td>
<td>{{ $record->publication_date?->translatedFormat('d F Y') ?? '-' }}</td>
</tr>
<tr>
<td class="label-column">Tautan Publikasi</td>
<td class="colon-separator">:</td>
<td><a href="{{ $record->link }}" class="external-link">{{ $record->link }}</a></td>
</tr>
<tr>
<td class="label-column">Status Verifikasi</td>
<td class="colon-separator">:</td>
<td>
<strong>
{{ $record->status->getLabel() }}
</strong>
</td>
</tr>
</table>
<p style="margin-top: 30px;">Demikian surat bukti tayang ini dibuat untuk dapat dipergunakan sebagaimana
mestinya.</p>
@if ($imageBase64)
<div style="margin-top: 20px; text-align: center;">
<p style="font-weight: bold; text-align: left;">Lampiran Bukti Tayang:</p>
<img src="{{ $imageBase64 }}" style="max-width: 100%; max-height: 400px; border: 1px solid #ccc;">
</div>
@endif
</div>
<table class="signature-section">
<tr>
<td width="60%"></td>
<td width="40%">
<div class="signature-box">
<div class="signature-date">
Purwakarta, {{ now()->translatedFormat('d F Y') }}<br>
Admin SIMEDKOM
</div>
<div>
<div class="signature-name">SISTEM DINAS KOMINFO</div>
<div style="font-size: 10pt;">Dokumen Sah Elektronik</div>
</div>
</div>
</td>
</tr>
</table>
</body>
</html>