fix(print-out): perbaikan print out foto dan sederhana dan standard
This commit is contained in:
@@ -19,10 +19,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.photo-item {
|
.photo-item {
|
||||||
width: 48%;
|
|
||||||
margin-right: 2%;
|
|
||||||
float: left;
|
|
||||||
padding: 5px;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
page-break-inside: avoid;
|
page-break-inside: avoid;
|
||||||
}
|
}
|
||||||
@@ -38,7 +35,6 @@
|
|||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
background-color: #f0f0f0;
|
background-color: #f0f0f0;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
page-break-inside: avoid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clearfix */
|
/* Clearfix */
|
||||||
@@ -90,7 +86,7 @@
|
|||||||
}
|
}
|
||||||
$groupedPhotos = collect($photos)->groupBy('category');
|
$groupedPhotos = collect($photos)->groupBy('category');
|
||||||
|
|
||||||
$mainPhotos = $groupedPhotos->filter(fn($_, $key) => $key !== 'lainnya');
|
$mainPhotos = $groupedPhotos->filter(fn($_, $key) => strtolower($key) !== 'lainnya');
|
||||||
$otherPhotos = $groupedPhotos->get('lainnya', collect());
|
$otherPhotos = $groupedPhotos->get('lainnya', collect());
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@@ -98,91 +94,148 @@
|
|||||||
<p class="text-gray-500">Tidak ada foto yang tersedia.</p>
|
<p class="text-gray-500">Tidak ada foto yang tersedia.</p>
|
||||||
@else
|
@else
|
||||||
@foreach ($mainPhotos as $category => $photos)
|
@foreach ($mainPhotos as $category => $photos)
|
||||||
<div class="photo-container">
|
@php
|
||||||
<h2>{{ $category }}</h2>
|
$groupedBySubcategory = $photos->groupBy('sub');
|
||||||
@php
|
@endphp
|
||||||
$groupedBySubcategory = $photos->groupBy('sub');
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if ($groupedBySubcategory->isEmpty())
|
@foreach ($groupedBySubcategory as $subcategory => $subPhotos)
|
||||||
<p class="text-gray-500">Tidak ada subkategori yang tersedia.</p>
|
@if (count($subPhotos) > 0)
|
||||||
@else
|
<table width="100%" border="0" style="align-content: center; text-align: center">
|
||||||
@foreach ($groupedBySubcategory as $subcategory => $subPhotos)
|
<tr>
|
||||||
@isset($subcategory)
|
@if (count($subPhotos) === 1)
|
||||||
<h6 style="font-size:10px">
|
|
||||||
{{ $subcategory ?: '' }}
|
|
||||||
</h6>
|
|
||||||
@endisset
|
|
||||||
|
|
||||||
<div class="photo-row clearfix">
|
|
||||||
@foreach ($subPhotos as $index => $item)
|
|
||||||
@php
|
@php
|
||||||
|
$item = $subPhotos->first();
|
||||||
$imagePath = storage_path('app/public/' . $item['path']);
|
$imagePath = storage_path('app/public/' . $item['path']);
|
||||||
@endphp
|
@endphp
|
||||||
<div class="photo-item border">
|
<td style="width: 100%; vertical-align: top; text-align: center" colspan="2"
|
||||||
<p style="text-align: center" >{{ $item['name'] }}</p>
|
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($imagePath))
|
@if ($statusLpj || file_exists($imagePath))
|
||||||
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image">
|
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||||
@else
|
style="width: 100%; max-width: 300px;">
|
||||||
<p class="text-gray-400">Foto tidak ditemukan.</p>
|
|
||||||
@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
|
||||||
</div>
|
</td>
|
||||||
|
@else
|
||||||
|
@foreach ($subPhotos as $index => $item)
|
||||||
|
@php
|
||||||
|
$imagePath = storage_path('app/public/' . $item['path']);
|
||||||
|
@endphp
|
||||||
|
<td style="width: 50%; vertical-align: top; text-align: center"
|
||||||
|
class="photo-item border">
|
||||||
|
<p style="font-weight: medium; font-size: 10px">{{ $category }} -
|
||||||
|
|
||||||
@if (($index + 1) % 2 == 0 && !$loop->last)
|
@isset($subcategory)
|
||||||
</div>
|
@if (trim($subcategory) !== '')
|
||||||
<div class="photo-row clearfix">
|
{{ $subcategory }} -
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endisset
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@if (!$otherPhotos->isEmpty())
|
{{ $item['name'] ?? '' }}
|
||||||
<div class="photo-container">
|
</p>
|
||||||
<h2 class="text-gray-800 font-bold text-lg">Lainnya</h2>
|
@if ($statusLpj || file_exists($imagePath))
|
||||||
|
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||||
@php
|
style="width: 100%; max-width: 300px;">
|
||||||
$groupedBySubcategory = $otherPhotos->groupBy('sub');
|
@endif
|
||||||
@endphp
|
@isset($item['description'])
|
||||||
|
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||||
@if ($groupedBySubcategory->isEmpty())
|
@endisset
|
||||||
<p class="text-gray-500">Tidak ada subkategori yang tersedia.</p>
|
</td>
|
||||||
@else
|
@if (($index + 1) % 2 == 0)
|
||||||
@foreach ($groupedBySubcategory as $subcategory => $subPhotos)
|
</tr>
|
||||||
@isset($subcategory)
|
<tr>
|
||||||
<h6 style="font-size:10px">
|
|
||||||
{{ $subcategory ?: '' }}
|
|
||||||
</h6>
|
|
||||||
@endisset
|
|
||||||
|
|
||||||
<div class="photo-row clearfix">
|
|
||||||
@foreach ($subPhotos as $index => $item)
|
|
||||||
@php
|
|
||||||
$imagePath = storage_path('app/public/' . $item['path']);
|
|
||||||
@endphp
|
|
||||||
<div class="photo-item border">
|
|
||||||
<h6 style="text-align: center" >{{ $item['name'] }}</h6>
|
|
||||||
@if ($statusLpj || file_exists($imagePath))
|
|
||||||
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image">
|
|
||||||
@else
|
|
||||||
<p class="text-gray-400">Foto tidak ditemukan.</p>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (($index + 1) % 2 == 0 && !$loop->last)
|
|
||||||
</div>
|
|
||||||
<div class="photo-row clearfix">
|
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
@if (count($subPhotos) % 2 != 0)
|
||||||
|
<td style="width: 50%;"></td>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
</div>
|
|
||||||
|
<div class="page-break"></div>
|
||||||
|
|
||||||
|
@if (!$otherPhotos->isEmpty())
|
||||||
|
@foreach ($otherPhotos->groupBy('sub') as $subcategory => $subPhotos)
|
||||||
|
@if (count($subPhotos) > 0)
|
||||||
|
<table width="100%" border="0" style="align-content: center; text-align: center">
|
||||||
|
<tr>
|
||||||
|
@if (count($subPhotos) === 1)
|
||||||
|
@php
|
||||||
|
$item = $subPhotos->first();
|
||||||
|
$imagePath = storage_path('app/public/' . $item['path']);
|
||||||
|
@endphp
|
||||||
|
<td style="width: 100%; vertical-align: top; text-align: center" colspan="2"
|
||||||
|
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($imagePath))
|
||||||
|
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||||
|
style="width: 100%; max-width: 300px;">
|
||||||
|
@endif
|
||||||
|
@isset($item['description'])
|
||||||
|
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||||
|
@endisset
|
||||||
|
</td>
|
||||||
|
@else
|
||||||
|
@foreach ($subPhotos as $index => $item)
|
||||||
|
@php
|
||||||
|
$imagePath = storage_path('app/public/' . $item['path']);
|
||||||
|
@endphp
|
||||||
|
<td style="width: 50%; vertical-align: top; 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($imagePath))
|
||||||
|
<img src="{{ $imagePath }}" alt="{{ $item['path'] }}" class="photo-image"
|
||||||
|
style="width: 100%; max-width: 300px;">
|
||||||
|
@endif
|
||||||
|
@isset($item['description'])
|
||||||
|
<p style="font-size:9px">{{ $item['description'] }}</p>
|
||||||
|
@endisset
|
||||||
|
</td>
|
||||||
|
@if (($index + 1) % 2 == 0)
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@if (count($subPhotos) % 2 != 0)
|
||||||
|
<td style="width: 50%;"></td>
|
||||||
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
@endisset
|
@endisset
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style="vertical-align: top">
|
||||||
<table style="width: 100%; border-collapse: collapse;">
|
<table style="width: 100%; border-collapse: collapse;">
|
||||||
<tr>
|
<tr>
|
||||||
<td style=" padding: 2px; vertical-align: top;">Fasilitas Kredit</td>
|
<td style=" padding: 2px; vertical-align: top;">Fasilitas Kredit</td>
|
||||||
@@ -1175,35 +1175,57 @@
|
|||||||
unset($fotoTypes[$key]);
|
unset($fotoTypes[$key]);
|
||||||
array_unshift($fotoTypes, 'foto_tempat');
|
array_unshift($fotoTypes, 'foto_tempat');
|
||||||
}
|
}
|
||||||
|
// Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid
|
||||||
|
$validPhotoTypes = array_filter($fotoTypes, function ($type) use ($forminspeksi) {
|
||||||
|
return isset($forminspeksi[$type]) && file_exists(storage_path('app/public/' . $forminspeksi[$type]));
|
||||||
|
});
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@if (isset($forminspeksi))
|
<table width="100%" border="0">
|
||||||
@php $counter = 0; @endphp
|
<tr>
|
||||||
@foreach ($fotoTypes as $type)
|
@if (count($validPhotoTypes) === 1)
|
||||||
@php
|
@php
|
||||||
$imagePath = $forminspeksi[$type] ?? null;
|
$type = reset($validPhotoTypes);
|
||||||
@endphp
|
$imagePath = $forminspeksi[$type] ?? null;
|
||||||
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
|
@endphp
|
||||||
@if ($counter % 2 == 0)
|
<td style="width: 100%; vertical-align: top; text-align: center" colspan="2" class="photo-item border">
|
||||||
<div class="photo-row clearfix"
|
<p style="margin: 0; font-size: 10px; text-align: center;">
|
||||||
>
|
|
||||||
@endif
|
|
||||||
<div class="photo-item border"
|
|
||||||
>
|
|
||||||
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $type }}"
|
|
||||||
class="photo-image">
|
|
||||||
<p style="margin: 0; font-size: 14px;">
|
|
||||||
{{ Str::title(str_replace('_', ' ', $type)) }}
|
{{ Str::title(str_replace('_', ' ', $type)) }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
@if ($imagePath)
|
||||||
@if ($counter % 2 == 1 || $loop->last)
|
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imagePath }}"
|
||||||
</div>
|
class="photo-image" style="width: 100%; max-width: 300px;">
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@else
|
||||||
|
@foreach ($fotoTypes as $index => $type)
|
||||||
|
@php
|
||||||
|
$imagePath = $forminspeksi[$type] ?? null;
|
||||||
|
@endphp
|
||||||
|
@isset($imagePath)
|
||||||
|
<td style="width: 50%; vertical-align: top; text-align: center" class="photo-item border">
|
||||||
|
<p style="margin: 0; font-size: 10px; text-align: center;">
|
||||||
|
{{ Str::title(str_replace('_', ' ', $type)) }}
|
||||||
|
</p>
|
||||||
|
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
|
||||||
|
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imagePath }}"
|
||||||
|
class="photo-image" style="width: 100%; max-width: 300px;">
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@endisset
|
||||||
|
@if (($index + 1) % 2 == 0)
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@if (count($fotoTypes) % 2 != 0)
|
||||||
|
<td style="width: 50%;"></td>
|
||||||
@endif
|
@endif
|
||||||
@php $counter++; @endphp
|
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
</tr>
|
||||||
@endif
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -1214,7 +1236,7 @@
|
|||||||
FOTO JAMINAN
|
FOTO JAMINAN
|
||||||
</h6>
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
@include('lpj::penilai.components.foto-jaminan')
|
@include('lpj::penilai.components.foto')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -643,42 +643,66 @@
|
|||||||
unset($fotoTypes[$key]);
|
unset($fotoTypes[$key]);
|
||||||
array_unshift($fotoTypes, 'foto_tempat');
|
array_unshift($fotoTypes, 'foto_tempat');
|
||||||
}
|
}
|
||||||
|
// Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid
|
||||||
|
$validPhotoTypes = array_filter($fotoTypes, function ($type) use ($forminspeksi) {
|
||||||
|
return isset($forminspeksi[$type]) && file_exists(storage_path('app/public/' . $forminspeksi[$type]));
|
||||||
|
});
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@if (isset($forminspeksi))
|
<table width="100%" border="0">
|
||||||
@php $counter = 0; @endphp
|
<tr>
|
||||||
@foreach ($fotoTypes as $type)
|
@if (count($validPhotoTypes) === 1)
|
||||||
@php
|
@php
|
||||||
$imagePath = $forminspeksi[$type] ?? null;
|
$type = reset($validPhotoTypes); // Ambil elemen pertama
|
||||||
@endphp
|
$imagePath = $forminspeksi[$type] ?? null;
|
||||||
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
|
@endphp
|
||||||
@if ($counter % 2 == 0)
|
<td style="width: 100%; vertical-align: top; text-align: center" colspan="2" class="photo-item border">
|
||||||
<div class="photo-row clearfix">
|
<p style="margin: 0; font-size: 10px; text-align: center;">
|
||||||
@endif
|
|
||||||
<div class="photo-item border">
|
|
||||||
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $type }}"
|
|
||||||
class="photo-image">
|
|
||||||
<p style="margin: 0; font-size: 14px;">
|
|
||||||
{{ Str::title(str_replace('_', ' ', $type)) }}
|
{{ Str::title(str_replace('_', ' ', $type)) }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
@if ($imagePath)
|
||||||
@if ($counter % 2 == 1 || $loop->last)
|
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imagePath }}"
|
||||||
|
class="photo-image" style="width: 100%; max-width: 300px;">
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@else
|
||||||
|
@foreach ($fotoTypes as $index => $type)
|
||||||
|
@php
|
||||||
|
$imagePath = $forminspeksi[$type] ?? null;
|
||||||
|
@endphp
|
||||||
|
@isset($imagePath)
|
||||||
|
<td style="width: 50%; vertical-align: top; text-align: center" class="photo-item border">
|
||||||
|
<p style="margin: 0; font-size: 10px; text-align: center;">
|
||||||
|
{{ Str::title(str_replace('_', ' ', $type)) }}
|
||||||
|
</p>
|
||||||
|
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
|
||||||
|
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $imagePath }}"
|
||||||
|
class="photo-image" style="width: 100%; max-width: 300px;">
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@endisset
|
||||||
|
@if (($index + 1) % 2 == 0)
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@if (count($fotoTypes) % 2 != 0)
|
||||||
|
<td style="width: 50%;"></td>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
@php $counter++; @endphp
|
<div class="page-break"></div>
|
||||||
@endif
|
<table style="width: 100%; ">
|
||||||
@endforeach
|
<tr>
|
||||||
@endif
|
<td style="border: 1px solid #000; text-align: center;">
|
||||||
</div>
|
FOTO JAMINAN
|
||||||
<div class="page-break"></div>
|
</td>
|
||||||
<table style="width: 100%; ">
|
</tr>
|
||||||
<tr>
|
</table>
|
||||||
<td style="border: 1px solid #000; text-align: center;">
|
@include('lpj::penilai.components.foto')
|
||||||
FOTO JAMINAN
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
@include('lpj::penilai.components.foto-jaminan')
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user