update service preview laporan and foto jaminan
This commit is contained in:
@@ -69,6 +69,7 @@ use Modules\Lpj\Jobs\SendJadwalKunjunganEmailJob;
|
|||||||
use App\Helpers\Lpj;
|
use App\Helpers\Lpj;
|
||||||
use Modules\Lpj\Models\Penilai;
|
use Modules\Lpj\Models\Penilai;
|
||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
|
|
||||||
class PreviewLaporanService
|
class PreviewLaporanService
|
||||||
{
|
{
|
||||||
public function previewLaporan($permohonan_id, $dokumen_id, $jaminan_id, $back)
|
public function previewLaporan($permohonan_id, $dokumen_id, $jaminan_id, $back)
|
||||||
@@ -78,7 +79,12 @@ class PreviewLaporanService
|
|||||||
$dokumen_id,
|
$dokumen_id,
|
||||||
$jaminan_id
|
$jaminan_id
|
||||||
);
|
);
|
||||||
|
// $tipeLaporanResponse = $this->checkPrintOutLaporan($permohonan_id, $document_id);
|
||||||
|
// $tipeLaporan = $tipeLaporanResponse->getData();
|
||||||
|
|
||||||
|
// if (!$tipeLaporan->status) {
|
||||||
|
// return redirect()->back()->with('error', 'Laporan tidak valid');
|
||||||
|
// }
|
||||||
$basicData = $this->getCommonData();
|
$basicData = $this->getCommonData();
|
||||||
|
|
||||||
$inspeksi = Inspeksi::where('permohonan_id', $permohonan_id)->where('dokument_id', $dokumen_id)->first();
|
$inspeksi = Inspeksi::where('permohonan_id', $permohonan_id)->where('dokument_id', $dokumen_id)->first();
|
||||||
@@ -90,20 +96,20 @@ class PreviewLaporanService
|
|||||||
$lpjData = null;
|
$lpjData = null;
|
||||||
$formFoto = null;
|
$formFoto = null;
|
||||||
|
|
||||||
if ($inspeksi) {
|
// if ($inspeksi) {
|
||||||
$forminspeksi = json_decode($inspeksi->data_form, true);
|
$forminspeksi = json_decode($inspeksi?->data_form, true) ?? null;
|
||||||
$formFoto = json_decode($inspeksi->foto_form, true);
|
$formFoto = json_decode($inspeksi?->foto_form, true) ?? null;
|
||||||
// $denahForm = json_decode($data->denah_form, true);
|
// $denahForm = json_decode($data->denah_form, true);
|
||||||
$dataPembanding = json_decode($inspeksi->data_pembanding, true);
|
$dataPembanding = json_decode($inspeksi?->data_pembanding, true) ?? null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($lpj) {
|
// if ($lpj) {
|
||||||
$lpjData = json_decode($lpj->lpj, true);
|
$lpjData = json_decode($lpj?->lpj, true) ?? null;
|
||||||
$memo = json_decode($lpj->memo, true);
|
$memo = json_decode($lpj?->memo, true) ?? null;
|
||||||
$resumeData = json_decode($lpj->resume, true);
|
$resumeData = json_decode($lpj?->resume, true) ?? null;
|
||||||
$rap = json_decode($lpj->rap, true);
|
$rap = json_decode($lpj?->rap, true);
|
||||||
$report = json_decode($lpj->call_report, true);
|
$report = json_decode($lpj?->call_report, true) ?? null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
$inputAddress = $forminspeksi['asset']['alamat']['sesuai'] ?? $forminspeksi['asset']['alamat']['tidak sesuai'] ?? [];
|
$inputAddress = $forminspeksi['asset']['alamat']['sesuai'] ?? $forminspeksi['asset']['alamat']['tidak sesuai'] ?? [];
|
||||||
|
|
||||||
@@ -118,7 +124,7 @@ class PreviewLaporanService
|
|||||||
$statusLpj = 0;
|
$statusLpj = 0;
|
||||||
|
|
||||||
// $viewLaporan = $this->getViewLaporan($tipeLaporan);
|
// $viewLaporan = $this->getViewLaporan($tipeLaporan);
|
||||||
return view('lpj::component.show-laporan-inspeksi', compact('permohonan', 'basicData', 'forminspeksi', 'alamat', 'lpjData', 'memo', 'resumeData', 'rap', 'report', 'lpj', 'formFoto', 'nomorLaporan', 'tanggalLaporan', 'dataPembanding', 'inspeksi', 'statusLpj', 'permohonan_id', 'back'));
|
return view('lpj::component.show-laporan-inspeksi', compact('permohonan', 'basicData', 'forminspeksi', 'alamat', 'lpjData', 'memo', 'resumeData', 'rap', 'report', 'lpj', 'formFoto', 'nomorLaporan', 'tanggalLaporan', 'dataPembanding', 'inspeksi', 'statusLpj', 'permohonan_id', 'back', ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printOutLaporan($permohonan_id, $document_id, $jaminan_id)
|
public function printOutLaporan($permohonan_id, $document_id, $jaminan_id)
|
||||||
@@ -230,7 +236,7 @@ class PreviewLaporanService
|
|||||||
return $viewMap[$tipe] ?? 'penilai.components.print-resume';
|
return $viewMap[$tipe] ?? 'penilai.components.print-resume';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkPrintOutLaporan($permohonan_id, $dokumen_id)
|
public function checkPrintOutLaporan($permohonan_id, $dokumen_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -98,41 +98,83 @@
|
|||||||
<table width="100%" border="0"
|
<table width="100%" border="0"
|
||||||
style="align-content: center; text-align: center; margin-bottom: 20px">
|
style="align-content: center; text-align: center; margin-bottom: 20px">
|
||||||
@foreach ($chunkedPhotos as $item)
|
@foreach ($chunkedPhotos as $item)
|
||||||
@php
|
@php
|
||||||
$filePath = $statusLpj == 1 ? storage_path('app/public/' . $item['path']) : asset('storage/' . $item['path']);
|
$filePath =
|
||||||
$filePath = asset('storage/' . $item['path']);
|
$statusLpj == 1
|
||||||
|
? storage_path('app/public/' . $item['path'])
|
||||||
|
: asset('storage/' . $item['path']);
|
||||||
|
|
||||||
$extension = strtolower(pathinfo($item['path'], PATHINFO_EXTENSION));
|
$extension = strtolower(pathinfo($item['path'], PATHINFO_EXTENSION));
|
||||||
$isImage = in_array($extension, ['jpg', 'jpeg', 'png', 'gif']);
|
$isImage = in_array($extension, [
|
||||||
|
'jpg',
|
||||||
|
'jpeg',
|
||||||
|
'png',
|
||||||
|
'gif',
|
||||||
|
'bmp',
|
||||||
|
'svg',
|
||||||
|
'webp',
|
||||||
|
'tiff',
|
||||||
|
]);
|
||||||
$isPdf = $extension === 'pdf';
|
$isPdf = $extension === 'pdf';
|
||||||
@endphp
|
@endphp
|
||||||
<tr>
|
@if ($statusLpj == 1)
|
||||||
<td style="width: 100%; padding: 10px; align-content: center; text-align: center" class="photo-item border " >
|
@if ($isImage && $filePath)
|
||||||
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
<tr>
|
||||||
@isset($subcategory)
|
<td style="width: 100%; padding: 10px; align-content: center; text-align: center"
|
||||||
@if (trim($subcategory) !== '')
|
class="photo-item border">
|
||||||
{{ $subcategory }} -
|
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||||
|
@isset($subcategory)
|
||||||
|
@if (trim($subcategory) !== '')
|
||||||
|
{{ $subcategory }} -
|
||||||
|
@endif
|
||||||
|
@endisset
|
||||||
|
{{ $item['name'] ?? '' }}
|
||||||
|
</p>
|
||||||
|
<img src="{{ $filePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||||
|
style="align-content: center; text-align: center; max-width: 100%; height: auto;">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@elseif ($statusLpj != 1)
|
||||||
|
<tr>
|
||||||
|
<td style="width: 100%; padding: 10px; align-content: center; text-align: center"
|
||||||
|
class="photo-item border ">
|
||||||
|
|
||||||
|
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||||
|
@isset($subcategory)
|
||||||
|
@if (trim($subcategory) !== '')
|
||||||
|
{{ $subcategory }} -
|
||||||
|
@endif
|
||||||
|
@endisset
|
||||||
|
|
||||||
|
{{ $item['name'] ?? '' }}
|
||||||
|
|
||||||
|
</p>
|
||||||
|
@if ($statusLpj || file_exists(public_path('storage/' . $item['path'])))
|
||||||
|
@if ($isImage)
|
||||||
|
<img src="{{ $filePath }}" alt="{{ $item['path'] }}"
|
||||||
|
class="photo-image"
|
||||||
|
style="align-content: center; text-align: center;">
|
||||||
|
@elseif ($isPdf)
|
||||||
|
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||||
|
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||||
|
⬇️ Unduh File PDF
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||||
|
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||||
|
⬇️ Unduh File
|
||||||
|
</a>
|
||||||
@endif
|
@endif
|
||||||
@endisset
|
|
||||||
{{ $item['name'] ?? '' }}
|
|
||||||
</p>
|
|
||||||
@if ($statusLpj || file_exists(public_path('storage/' . $item['path'])))
|
|
||||||
@if ($isImage)
|
|
||||||
<img src="{{ $filePath }}" alt="{{ $item['path'] }}" class="photo-image" style="align-content: center; text-align: center;">
|
|
||||||
@elseif ($isPdf)
|
|
||||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}" style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
|
||||||
⬇️ Unduh File PDF
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}" style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
|
||||||
⬇️ Unduh File
|
|
||||||
</a>
|
|
||||||
@endif
|
@endif
|
||||||
@endif
|
|
||||||
@isset($item['description'])
|
@isset($item['description'])
|
||||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||||
@endisset
|
@endisset
|
||||||
</td>
|
|
||||||
</tr>
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
@if (count($chunkedPhotos) < 2)
|
@if (count($chunkedPhotos) < 2)
|
||||||
<tr style="width: 100%;"></tr>
|
<tr style="width: 100%;"></tr>
|
||||||
@@ -151,41 +193,79 @@
|
|||||||
<table width="100%" border="0"
|
<table width="100%" border="0"
|
||||||
style="align-content: center; text-align: center; margin-bottom: 20px">
|
style="align-content: center; text-align: center; margin-bottom: 20px">
|
||||||
@foreach ($chunkedPhotos as $item)
|
@foreach ($chunkedPhotos as $item)
|
||||||
@php
|
@php
|
||||||
$filePath = $statusLpj == 1 ? storage_path('app/public/' . $item['path']) : asset('storage/' . $item['path']);
|
$filePath =
|
||||||
|
$statusLpj == 1
|
||||||
|
? storage_path('app/public/' . $item['path'])
|
||||||
|
: asset('storage/' . $item['path']);
|
||||||
|
|
||||||
$extension = strtolower(pathinfo($item['path'], PATHINFO_EXTENSION));
|
$extension = strtolower(pathinfo($item['path'], PATHINFO_EXTENSION));
|
||||||
|
$isImage = in_array($extension, [
|
||||||
|
'jpg',
|
||||||
|
'jpeg',
|
||||||
|
'png',
|
||||||
|
'gif',
|
||||||
|
'bmp',
|
||||||
|
'svg',
|
||||||
|
'webp',
|
||||||
|
'tiff',
|
||||||
|
]);
|
||||||
$isPdf = $extension === 'pdf';
|
$isPdf = $extension === 'pdf';
|
||||||
@endphp
|
@endphp
|
||||||
<tr>
|
@if ($statusLpj == 1)
|
||||||
<td style="width: 100%; padding: 10px;" class="photo-item border">
|
@if ($isImage && $filePath)
|
||||||
<p style="font-weight: medium; font-size: 10px">Lainnya -
|
<tr>
|
||||||
@isset($subcategory)
|
<td style="width: 100%; padding: 10px; align-content: center; text-align: center"
|
||||||
@if (trim($subcategory) !== '')
|
class="photo-item border">
|
||||||
{{ $subcategory }} -
|
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||||
|
@isset($subcategory)
|
||||||
|
@if (trim($subcategory) !== '')
|
||||||
|
{{ $subcategory }} -
|
||||||
|
@endif
|
||||||
|
@endisset
|
||||||
|
{{ $item['name'] ?? '' }}
|
||||||
|
</p>
|
||||||
|
<img src="{{ $filePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||||
|
style="align-content: center; text-align: center; max-width: 100%; height: auto;">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@elseif ($statusLpj != 1)
|
||||||
|
<tr>
|
||||||
|
<td style="width: 100%; padding: 10px;" class="photo-item border">
|
||||||
|
<p style="font-weight: medium; font-size: 10px">Lainnya -
|
||||||
|
@isset($subcategory)
|
||||||
|
@if (trim($subcategory) !== '')
|
||||||
|
{{ $subcategory }} -
|
||||||
|
@endif
|
||||||
|
@endisset
|
||||||
|
{{ $item['name'] ?? '' }}
|
||||||
|
</p>
|
||||||
|
@if ($statusLpj || file_exists(public_path('storage/' . $item['path'])))
|
||||||
|
@if ($isImage)
|
||||||
|
<img src="{{ $filePath }}" alt="{{ $item['path'] }}"
|
||||||
|
class="photo-image" style="text-align: center;">
|
||||||
|
@elseif ($isPdf)
|
||||||
|
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||||
|
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||||
|
⬇️ Unduh File PDF
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||||
|
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||||
|
⬇️ Unduh File
|
||||||
|
</a>
|
||||||
@endif
|
@endif
|
||||||
@endisset
|
|
||||||
{{ $item['name'] ?? '' }}
|
|
||||||
</p>
|
|
||||||
@if ($statusLpj || file_exists(public_path('storage/' . $item['path'])))
|
|
||||||
@if ($isImage)
|
|
||||||
<img src="{{ $filePath }}" alt="{{ $item['path'] }}" class="photo-image" style="text-align: center;">
|
|
||||||
@elseif ($isPdf)
|
|
||||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}" style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
|
||||||
⬇️ Unduh File PDF
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}" style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
|
||||||
⬇️ Unduh File
|
|
||||||
</a>
|
|
||||||
@endif
|
@endif
|
||||||
@endif
|
|
||||||
@isset($item['description'])
|
@isset($item['description'])
|
||||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||||
@endisset
|
@endisset
|
||||||
</td>
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
</tr>
|
|
||||||
@if (count($chunkedPhotos) < 2)
|
@if (count($chunkedPhotos) < 2)
|
||||||
<tr style="width: 100%;"></tr>
|
<tr style="width: 100%;"></tr>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
Reference in New Issue
Block a user