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 Modules\Lpj\Models\Penilai;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
|
||||
class PreviewLaporanService
|
||||
{
|
||||
public function previewLaporan($permohonan_id, $dokumen_id, $jaminan_id, $back)
|
||||
@@ -78,7 +79,12 @@ class PreviewLaporanService
|
||||
$dokumen_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();
|
||||
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $permohonan_id)->where('dokument_id', $dokumen_id)->first();
|
||||
@@ -90,20 +96,20 @@ class PreviewLaporanService
|
||||
$lpjData = null;
|
||||
$formFoto = null;
|
||||
|
||||
if ($inspeksi) {
|
||||
$forminspeksi = json_decode($inspeksi->data_form, true);
|
||||
$formFoto = json_decode($inspeksi->foto_form, true);
|
||||
// if ($inspeksi) {
|
||||
$forminspeksi = json_decode($inspeksi?->data_form, true) ?? null;
|
||||
$formFoto = json_decode($inspeksi?->foto_form, true) ?? null;
|
||||
// $denahForm = json_decode($data->denah_form, true);
|
||||
$dataPembanding = json_decode($inspeksi->data_pembanding, true);
|
||||
}
|
||||
$dataPembanding = json_decode($inspeksi?->data_pembanding, true) ?? null;
|
||||
// }
|
||||
|
||||
if ($lpj) {
|
||||
$lpjData = json_decode($lpj->lpj, true);
|
||||
$memo = json_decode($lpj->memo, true);
|
||||
$resumeData = json_decode($lpj->resume, true);
|
||||
$rap = json_decode($lpj->rap, true);
|
||||
$report = json_decode($lpj->call_report, true);
|
||||
}
|
||||
// if ($lpj) {
|
||||
$lpjData = json_decode($lpj?->lpj, true) ?? null;
|
||||
$memo = json_decode($lpj?->memo, true) ?? null;
|
||||
$resumeData = json_decode($lpj?->resume, true) ?? null;
|
||||
$rap = json_decode($lpj?->rap, true);
|
||||
$report = json_decode($lpj?->call_report, true) ?? null;
|
||||
// }
|
||||
|
||||
$inputAddress = $forminspeksi['asset']['alamat']['sesuai'] ?? $forminspeksi['asset']['alamat']['tidak sesuai'] ?? [];
|
||||
|
||||
@@ -118,7 +124,7 @@ class PreviewLaporanService
|
||||
$statusLpj = 0;
|
||||
|
||||
// $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)
|
||||
|
||||
@@ -99,14 +99,29 @@
|
||||
style="align-content: center; text-align: center; margin-bottom: 20px">
|
||||
@foreach ($chunkedPhotos as $item)
|
||||
@php
|
||||
$filePath = $statusLpj == 1 ? storage_path('app/public/' . $item['path']) : asset('storage/' . $item['path']);
|
||||
$filePath = asset('storage/' . $item['path']);
|
||||
$filePath =
|
||||
$statusLpj == 1
|
||||
? storage_path('app/public/' . $item['path'])
|
||||
: asset('storage/' . $item['path']);
|
||||
|
||||
$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';
|
||||
@endphp
|
||||
@if ($statusLpj == 1)
|
||||
@if ($isImage && $filePath)
|
||||
<tr>
|
||||
<td style="width: 100%; padding: 10px; align-content: center; text-align: center" class="photo-item border " >
|
||||
<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) !== '')
|
||||
@@ -115,24 +130,51 @@
|
||||
@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;">
|
||||
<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;">
|
||||
<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;">
|
||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||
⬇️ Unduh File
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
@if (count($chunkedPhotos) < 2)
|
||||
<tr style="width: 100%;"></tr>
|
||||
@@ -152,11 +194,43 @@
|
||||
style="align-content: center; text-align: center; margin-bottom: 20px">
|
||||
@foreach ($chunkedPhotos as $item)
|
||||
@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));
|
||||
$isImage = in_array($extension, [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
'gif',
|
||||
'bmp',
|
||||
'svg',
|
||||
'webp',
|
||||
'tiff',
|
||||
]);
|
||||
$isPdf = $extension === 'pdf';
|
||||
@endphp
|
||||
@if ($statusLpj == 1)
|
||||
@if ($isImage && $filePath)
|
||||
<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>
|
||||
<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 -
|
||||
@@ -169,23 +243,29 @@
|
||||
</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;">
|
||||
<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;">
|
||||
<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;">
|
||||
<a href="{{ $filePath }}" download="{{ basename($filePath) }}"
|
||||
style="font-size:12px; color:#1a73e8; text-decoration: underline;">
|
||||
⬇️ Unduh File
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@isset($item['description'])
|
||||
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||
@endisset
|
||||
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
@if (count($chunkedPhotos) < 2)
|
||||
<tr style="width: 100%;"></tr>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user