prbaikan output foto di laporan dan penilai dan surveyor by region

This commit is contained in:
majid
2024-12-30 09:28:06 +07:00
parent fa0a864a10
commit f60a4c558e
6 changed files with 343 additions and 298 deletions

View File

@@ -7,6 +7,7 @@
use Modules\Lpj\Models\PenawaranTender;
use Modules\Lpj\Models\Penilaian;
use Modules\Lpj\Models\JenisDokumen;
use Modules\Lpj\Models\TeamsUsers;
use Modules\Usermanagement\Models\User;
function formatTanggalIndonesia($date, $time = false)
@@ -107,8 +108,7 @@
}
// generate last penawaran.code
function onLastnumberCodePenawaran()
: string
function onLastnumberCodePenawaran(): string
{
// ambil code terakhir
$maxCode = PenawaranTender::max('code');
@@ -119,12 +119,10 @@
// nomor di set 0001
$noUrutAkhirString = sprintf("%04s", 1);
if($penawaran)
{
if ($penawaran) {
$isNum = substr($maxCode, 2); // memastikan string ke 3 s/d 8 adalan numiric
$isNP = substr($maxCode, 0, 2);
if((8 == strlen($maxCode)) && ("NP"==$isNP) && (isNumeric($isNum)))
{
if ((8 == strlen($maxCode)) && ("NP" == $isNP) && (isNumeric($isNum))) {
$code_penawaran_last = substr($maxCode, -4);
$year_penawaran_last = Carbon::parse($penawaran->created_at)->year;
$year_now = Carbon::now()->year;
@@ -158,13 +156,11 @@
$year_now = Carbon::now()->year;
// nomor di set 001
$noUrutAkhirString = sprintf("%03s", 1);
if($penawaran)
{
if ($penawaran) {
$no_spk_penawaran_last = substr($maxCode, -3);
$year_penawaran_last = substr($maxCode, 0, 4);
if($year_now == $year_penawaran_last)
{
if ($year_now == $year_penawaran_last) {
$noUrutAkhirString = sprintf("%03s", abs($no_spk_penawaran_last + 1));
}
// jika ternyata tahun tdk sama (kurang dari tahun sekarang), maka nomor di set 001
@@ -220,7 +216,8 @@
}
function penyebut($nilai) {
function penyebut($nilai)
{
$nilai = abs($nilai);
$huruf = array("", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas");
$temp = "";
@@ -248,7 +245,8 @@
return $temp;
}
function terbilang($nilai) {
function terbilang($nilai)
{
if ($nilai < 0) {
$hasil = "minus ". trim(penyebut($nilai));
} else {
@@ -312,7 +310,8 @@
return $maxSizeInKB;
}
function getUser($userId){
function getUser($userId)
{
return User::find($userId);
}
@@ -329,3 +328,13 @@
// Concatenate components to create the custom code
return $year . $month . $day . $randomNumber;
}
function checkRegionUserName($userId)
{
$region = TeamsUsers::where('user_id', $userId)->first();
if ($region) {
return $region->team->regions->name;
} else {
return null;
}
}

View File

@@ -75,7 +75,7 @@
@endforeach
@endif
@if (isset($formFoto['foto_lingkungan']['foto_lingkungan']))
{{-- @if (isset($formFoto['foto_lingkungan']['foto_lingkungan']))
@foreach ($formFoto['foto_lingkungan']['foto_lingkungan'][0] as $index => $item)
<div class="border photo-item">
<h2 class="text-gray-600 font-semibold text-xl">
@@ -91,7 +91,7 @@
@endif
</div>
@endforeach
@endif
@endif --}}
@if (isset($formFoto['foto_basement']))
<div class="border photo-item">

View File

@@ -263,7 +263,7 @@
@endphp
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
<img src="{{ asset('storage/' . $imagePath) }}" alt="{{ $type }}"
<img src="{{ Storage::url($imagePath) }}" alt="{{ $type }}"
class="photo-image">
@endif
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>

View File

@@ -1067,7 +1067,7 @@
@endphp
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
<img src="{{ asset('storage/' . $imagePath) }}" alt="{{ $type }}"
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $type }}"
class="photo-image">
@endif
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>

View File

@@ -1422,6 +1422,42 @@
<div class="page-break"></div>
<div class="section">
<div class="judul">
<h6 class="border">
PETA
</h6>
</div>
<div>
@php
$fotoTypes = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat'];
if (($key = array_search('foto_tempat', $fotoTypes)) !== false) {
unset($fotoTypes[$key]);
array_unshift($fotoTypes, 'foto_tempat');
}
@endphp
@if (isset($forminspeksi))
@forelse ($fotoTypes as $type)
<div class="border photo-item">
@php
$imagePath = $forminspeksi[$type] ?? null;
@endphp
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
<img src="{{ storage_path('app/public/' . $imagePath) }}" alt="{{ $type }}"
class="photo-image">
@endif
<p class="mt-2 text-sm">{{ Str::title(str_replace('_', ' ', $type)) }}</p>
</div>
@empty
<p>Tidak ada tipe foto yang tersedia</p>
@endforelse
@endif
</div>
</div>
<div class="section">
<div class="judul">
<h6 class="border">

View File

@@ -116,7 +116,7 @@
{{ $surveyor->userPenilaiTeam->name }}
</p>
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $permohonan->region->name }}
<p class="flex w-full text-gray-600 font-medium text-sm">{{ checkRegionUserName($surveyor->userPenilaiTeam->id) }}
</p>
</div>
<label class="form-label max-w-56">
@@ -129,7 +129,7 @@
</p>
<p class="flex w-full text-gray-600 font-medium text-sm">
{{ $permohonan->region->name }}
{{ checkRegionUserName($penilai->userPenilaiTeam->id) }}
</p>
</div>
</div>