update header printout standart

This commit is contained in:
majid
2024-12-27 09:00:27 +07:00
parent decca9be29
commit 66d0226d55
2 changed files with 42 additions and 42 deletions

View File

@@ -247,7 +247,7 @@ class PenilaiController extends Controller
}
if(!Auth::user()->hasRole('administrator')) {
if (!Auth::user()->hasRole('administrator')) {
$query->whereHas('penilaian.userPenilai', function ($q) {
$q
->where('role', 'penilai')
@@ -616,20 +616,20 @@ class PenilaiController extends Controller
$inputAddress = $forminspeksi['asset']['alamat']['sesuai'] ?? $forminspeksi['asset']['alamat']['tidak sesuai'];
$alamat = [
'address' => $inputAddress['address'] ?? null,
'village_code' => $this->getWilayahName($inputAddress['village_code'] ?? null, 'village'),
'district_code' => $this->getWilayahName($inputAddress['district_code'] ?? null, 'district'),
'city_code' => $this->getWilayahName($inputAddress['city_code'] ?? null, 'city'),
'province_code' => $this->getWilayahName($inputAddress['province_code'] ?? null, 'province')
];
$alamat = [
'address' => $inputAddress['address'] ?? null,
'village_code' => $this->getWilayahName($inputAddress['village_code'] ?? null, 'village'),
'district_code' => $this->getWilayahName($inputAddress['district_code'] ?? null, 'district'),
'city_code' => $this->getWilayahName($inputAddress['city_code'] ?? null, 'city'),
'province_code' => $this->getWilayahName($inputAddress['province_code'] ?? null, 'province')
];
$laporan = $lpj->type == 'sederhana' ? true : false;
$viewLaporan = null;
if($laporan){
$viewLaporan = 'penilai.components.print-out-sederhana';
}else{
if ($laporan) {
$viewLaporan = 'penilai.components.print-out-sederhana';
} else {
$viewLaporan = 'penilai.components.print-out-standard';
}
@@ -648,7 +648,7 @@ $alamat = [
'alamat',
'dataPembanding'
));
}else{
} else {
$pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
'permohonan',
'forminspeksi',
@@ -673,31 +673,32 @@ $alamat = [
}
function getWilayahName($code, $type) {
public function getWilayahName($code, $type)
{
try {
$wilayah = null;
if (!$code) {
return null;
}
switch($type) {
switch ($type) {
case 'province':
$wilayah = Province::where('code', $code)->first();
return $wilayah ? $wilayah->name : null;
case 'city':
$wilayah = City::where('code', $code)->first();
return $wilayah ? $wilayah->name : null;
case 'district':
$wilayah = District::where('code', $code)->first();
return $wilayah ? $wilayah->name : null;
case 'village':
$wilayah = Village::where('code', $code)->first();
return $wilayah ? $wilayah->name : null;
default:
return null;
}
@@ -705,6 +706,6 @@ $alamat = [
return null;
}
}
}