diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index 48a5066..ec27c82 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -153,7 +153,13 @@ class SurveyorController extends Controller public function store(Request $request) { - dd($request); + try { + + return response()->json(['status' => 200, 'message' => 'Data berhasil disimpan']); + } catch (Exception $e) { + + return response()->json(['status' => 500, 'message' => 'Data gagal disimpan: ' . $e->getMessage()], 500); + } // $validatedData = $request->validated(); @@ -523,8 +529,9 @@ class SurveyorController extends Controller $query->whereRaw('LOWER(status) = ?', ['assign']); - $query->whereHas('region.teams.teamsUsers.user', function ($q) { - $q->where('id', Auth::user()->id); + $query->whereHas('penilaian.userPenilai', function ($q) { + $q->where('user_id', Auth::user()->id); + $q->where('role', 'surveyor'); }); @@ -549,7 +556,7 @@ class SurveyorController extends Controller } $filteredRecords = $query->count(); - $data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'penilaian', 'jenisFasilitasKredit'])->get(); + $data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'jenisFasilitasKredit'])->get(); $pageCount = ceil($totalRecords / $size); @@ -788,6 +795,7 @@ class SurveyorController extends Controller $header = $dataMap[$type] ?? ''; $model = $modelClass::findOrFail($id); + $spekKategoriBagunan= null; if ($type == 'spek-bangunan') { $spekKategoriBagunan = SpekKategoritBangunan::all(); diff --git a/app/Models/PenilaianTeam.php b/app/Models/PenilaianTeam.php index 808d0de..8df88ef 100644 --- a/app/Models/PenilaianTeam.php +++ b/app/Models/PenilaianTeam.php @@ -29,7 +29,7 @@ class PenilaianTeam extends Model public function penilaian(){ - return $this->hasMany(Penilaian::class, 'penilaian_id', 'id'); + return $this->belongsTo(Penilaian::class, 'penilaian_id', 'id'); } protected static function newFactory(): PenilaianTeamFactory diff --git a/resources/views/surveyor/components/bangunan.blade.php b/resources/views/surveyor/components/bangunan.blade.php index c293814..7c66d7d 100644 --- a/resources/views/surveyor/components/bangunan.blade.php +++ b/resources/views/surveyor/components/bangunan.blade.php @@ -1,188 +1,211 @@ - {{-- @if ($analisaType == 'tanah_bangunan') --}}
-
-

Analisa Bangunan

-
-
-
- -
-
- - +
+

Analisa Bangunan

+
+
+
+ +
+
+ + +
+ + @error('luas_tanah_bagunan') + {{ $message }} + @enderror
- - @error('luas_tanah_bagunan') - {{ $message }} - @enderror
-
- -
- -
-
- @if (isset($jenisBangunan)) - @foreach ($jenisBangunan as $item) - - @endforeach - @endif - -
- - @error('jenis_bangunan') - {{ $message }} - @enderror -
-
- - -
- -
- -
- @if (isset($kondisiBangunan)) - @foreach ($kondisiBangunan as $item) - - @endforeach - @endif - -
- - - @error('kondisi_bangunan') - {{ $message }} - @enderror -
-
- - -
- -
- - -
- @if (isset($sifatBangunan)) - @foreach ($sifatBangunan as $item) -
- - -
- @endforeach - @endif -
- - @error('sifat_bangunan') - {{ $message }} - @enderror -
-
- - -
+
- -
-
- -
- @if (@isset($spekKategoriBagunan)) - @foreach ($spekKategoriBagunan as $item) + +
+
+ @if (isset($jenisBangunan)) + @foreach ($jenisBangunan as $item) + + @if (strcasecmp($item->name, 'lainnya') == 0) +
+ + +
+ @endif + @endforeach + @endif +
+ @error('jenis_bangunan') + {{ $message }} + @enderror +
+
-
- -
-
- @foreach ($spekBangunan as $spek) - @if ($spek->spek_kategori_bangunan_id == $item->id) - - @endif - @endforeach -
+ +
+ +
- @error('name') - {{ $message }} - @enderror +
+ @if (isset($kondisiBangunan)) + @foreach ($kondisiBangunan as $item) + + @if (strcasecmp($item->name, 'lainnya') == 0) +
+ + +
+ @endif + @endforeach + @endif + +
+ + + @error('kondisi_bangunan') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + +
+ @if (isset($sifatBangunan)) + @foreach ($sifatBangunan as $item) +
+ + +
+ @endforeach + @endif +
+ + @error('sifat_bangunan') + {{ $message }} + @enderror +
+
+ + +
+
+ +
+
+ +
+ @if (@isset($spekKategoriBagunan)) + @foreach ($spekKategoriBagunan as $item) +
+ +
+
+ @foreach ($spekBangunan as $spek) + @if ($spek->spek_kategori_bangunan_id == $item->id) + + @endif + @endforeach +
+ + @error('name') + {{ $message }} + @enderror +
-
- @endforeach - @endif + @endforeach + @endif +
+
-
-
-
- -
-
- - - - -
- -
- - -
- @if (isset($saranaPelengkap)) - @foreach ($saranaPelengkap as $item) -
- - -
- @endforeach - @endif +
+
+
- @error('sarana_pelengkap') - {{ $message }} - @enderror + + + +
+ +
+ + +
+ @if (isset($saranaPelengkap)) + @foreach ($saranaPelengkap as $item) +
+ + +
+ @endforeach + @endif +
+ + @error('sarana_pelengkap') + {{ $message }} + @enderror +
-
{{-- @endif --}} @push('scripts') diff --git a/resources/views/surveyor/components/inspeksi.blade.php b/resources/views/surveyor/components/inspeksi.blade.php index 7951638..0389306 100644 --- a/resources/views/surveyor/components/inspeksi.blade.php +++ b/resources/views/surveyor/components/inspeksi.blade.php @@ -5,681 +5,690 @@ @endsection --}} @section('content') -
+
+
-
-
-

- Data Jaminan -

- -
- @php - $jenisJaminanData = null; - - @endphp - -
- @foreach ($permohonan->debiture->documents as $dokumen) - @php - $jenisJaminanData = $dokumen->jenisJaminan->name ?? ''; - @endphp - -
- - -
- @endforeach +
+

+ Data Jaminan +

+
-
- - - - {{--
-
--}} -
- @if (isset($analisa->id)) - - @method('PUT') - @endif - @csrf - - - - @php - $analisaType = 'unknown'; - $data = [ - 'tanah' => 'Tanah', - 'unit_rumah' => 'Rumah Tinggal / Ruko (Unit) / Apartemen (Unit) / Gudang', - 'tanah_bangunan' => 'Kawasan Industrial / Komersil / Residensial - Perumahan', - 'unit_gedung' => 'Gedung Apartement / Kantor / Condotel (Strata Title)', - 'tanah_bangunan' => 'Mall', - ]; - - if (isset($analisa->id)) { - $analisaType = $analisa->type; - } else { - foreach ($data as $key => $value) { - if ( - isset($jenisJaminanData) && - trim(strtolower($jenisJaminanData)) === trim(strtolower($value)) - ) { - $analisaType = $key; - break; - } - } - } - if ($analisaType === 'tanah') { - $analisaType = 'tanah_bangunan'; - } - - if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') { - $analisaType = 'unit'; - } + $jenisJaminanData = null; @endphp - - +
+ @foreach ($permohonan->debiture->documents as $dokumen) + @php + $jenisJaminanData = $dokumen->jenisJaminan->name ?? ''; + @endphp - @if ($analisaType == 'tanah_bangunan') - @include('lpj::surveyor.components.tanah') - @elseif($analisaType == 'unit') - @include('lpj::surveyor.components.apartemen-kantor') - @elseif($analisaType == 'alat-berat') - @include('lpj::surveyor.components.alat-berat') - @elseif($analisaType == 'mesin') - @include('lpj::surveyor.components.mesin') - @elseif($analisaType == 'kapal') - @include('lpj::surveyor.components.kapal') - @elseif($analisaType == 'kendaraan') - @include('lpj::surveyor.components.kendaraan') - @elseif($analisaType == 'pesawat') - @include('lpj::surveyor.components.pesawat') - @endif - - @if ($analisaType == 'tanah_bangunan') - @include('lpj::surveyor.components.bangunan') - @endif - - @if ($analisaType != 'mesin' && $analisaType != 'kapal' && $analisaType != 'kendaraan' && $analisaType != 'pesawat') - @include('lpj::surveyor.components.lingkungan') - @endif - - {{-- analisa fakta --}} -
-
-
-

Analisis Fakta

-
-
-
- -
- - - @error('fakta_positif') - {{ $message }} - @enderror +
+ + --}} -
- - - + + {{--
+
--}} +
+ @if (isset($analisa->id)) + + @method('PUT') + @endif + @csrf + + + + + @php + $analisaType = 'unknown'; + $data = [ + 'tanah' => 'Tanah', + 'unit_rumah' => 'Rumah Tinggal / Ruko (Unit) / Apartemen (Unit) / Gudang', + 'tanah_bangunan' => 'Kawasan Industrial / Komersil / Residensial - Perumahan', + 'unit_gedung' => 'Gedung Apartement / Kantor / Condotel (Strata Title)', + 'tanah_bangunan' => 'Mall', + ]; + + if (isset($analisa->id)) { + $analisaType = $analisa->type; + } else { + foreach ($data as $key => $value) { + if ( + isset($jenisJaminanData) && + trim(strtolower($jenisJaminanData)) === trim(strtolower($value)) + ) { + $analisaType = $key; + break; + } + } + } + if ($analisaType === 'tanah') { + $analisaType = 'tanah_bangunan'; + } + + if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') { + $analisaType = 'unit'; + } + + @endphp + + + + + @if ($analisaType == 'tanah_bangunan') + @include('lpj::surveyor.components.tanah') + @elseif($analisaType == 'unit') + @include('lpj::surveyor.components.apartemen-kantor') + @elseif($analisaType == 'alat-berat') + @include('lpj::surveyor.components.alat-berat') + @elseif($analisaType == 'mesin') + @include('lpj::surveyor.components.mesin') + @elseif($analisaType == 'kapal') + @include('lpj::surveyor.components.kapal') + @elseif($analisaType == 'kendaraan') + @include('lpj::surveyor.components.kendaraan') + @elseif($analisaType == 'pesawat') + @include('lpj::surveyor.components.pesawat') + @endif + + @if ($analisaType == 'tanah_bangunan') + @include('lpj::surveyor.components.bangunan') + @endif + + @if ($analisaType != 'mesin' && $analisaType != 'kapal' && $analisaType != 'kendaraan' && $analisaType != 'pesawat') + @include('lpj::surveyor.components.lingkungan') + @endif + + {{-- analisa fakta --}} +
+
+
+

Analisis Fakta

+
+
+
+ +
+ + + @error('fakta_positif') + {{ $message }} + @enderror +
+ + +
+ +
+ +
+ + @error('fakta_negatif') + {{ $message }} + @enderror +
+ +
+ + @if ($analisaType != 'mesin' && $analisaType != 'kapal' && $analisaType != 'kendaraan' && $analisaType != 'pesawat') +
+ +
+ + @error('rute_menuju') + {{ $message }} + @enderror +
+
+ +
+ +
+
+ @php + $inputBatas = []; + $inputBatas = [ + ['label' => 'Utara', 'index' => 0], + ['label' => 'Timur', 'index' => 1], + ['label' => 'Selatan', 'index' => 2], + ['label' => 'Barat', 'index' => 3], + ]; + @endphp + @if ($inputBatas > 0) + @foreach ($inputBatas as $item) +
+ + +
+ @endforeach + @endif +
+ + @error('batas_batas') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + + + @error('kondisi_linkungan') + {{ $message }} + @enderror +
+ + +
+ + +
+ +
+ + @error('kondisi_lain_bangunan') + {{ $message }} + @enderror +
+ +
+ +
+ +
+ + @error('informasi_dokument') + {{ $message }} + @enderror +
+ +
+ @endif +
+
+
+ + + + @if ($analisaType != 'mesin' && $analisaType != 'kapal' && $analisaType != 'kendaraan' && $analisaType != 'pesawat') +
+
+ + +
+

Informasi Dinas Tata Ruang

+
+ + +
+ +
+ +
+ + @error('peruntukan') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('kdb') + {{ $message }} + @enderror +
+
+ + +
+ +
+ + @error('kdh') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('gsb') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('maxLantai') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('klb') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('gss') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('pelebaran_jalan') + {{ $message }} + @enderror +
+
+ +
+ +
+ + @error('nama_petugas') + {{ $message }} + @enderror +
+
+ + +
+ + +
+
+ +
+ + + + Bhumi + +
+
+ + @if (isset($link_url_region->regions->url)) +
+ + +
+ @endif +
+ + +
+ + +
+ +
+
+ + + +
+
+ +
+ @if (old('foto_tempat', isset($analisa->analisaFakta) ? $analisa->analisaFakta->foto_tempat : '')) + Gambar Tempat + @endif +
+ + + + + @error('foto_tempat') + {{ $message }} + @enderror + + + +
+ +
+ + +
+
+

Catatan yang Perlu Diperhatikan +

+ +
+
+
+
+ @endif + +
+ +
+
+ {{--
+
--}} +
+ + + + + @endsection @push('scripts') - + + + - // Isi input dengan data URL gambar - inputRute.value = dataURL; + + - - - - - -@endpush + alert("Data gagal disimpan."); + } + }); + } + + +@endpush \ No newline at end of file diff --git a/resources/views/surveyor/components/lingkungan.blade.php b/resources/views/surveyor/components/lingkungan.blade.php index a8c105b..3af8fee 100644 --- a/resources/views/surveyor/components/lingkungan.blade.php +++ b/resources/views/surveyor/components/lingkungan.blade.php @@ -3,12 +3,12 @@
-
+

Analisis Lingkungan

-
+