update data pembading surveyor

This commit is contained in:
majid
2024-12-03 15:00:18 +07:00
parent 9502329fef
commit 280ed97a50
15 changed files with 1185 additions and 1034 deletions

View File

@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
use Modules\Lpj\Models\Permohonan; use Modules\Lpj\Models\Permohonan;
use Modules\Lpj\Models\Inspeksi; use Modules\Lpj\Models\Inspeksi;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
class PenilaiController extends Controller class PenilaiController extends Controller
{ {
@@ -22,7 +23,8 @@ class PenilaiController extends Controller
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*/ */
public function lampiran($id){ public function lampiran($id)
{
$permohonan = Permohonan::with('debiture.documents')->find($id); $permohonan = Permohonan::with('debiture.documents')->find($id);
$jaminanId = $permohonan->debiture->documents->first()->jenis_jaminan_id; $jaminanId = $permohonan->debiture->documents->first()->jenis_jaminan_id;
@@ -93,21 +95,26 @@ class PenilaiController extends Controller
} }
// Retrieve data from the database // Retrieve data from the database
$query = Permohonan::query()->where('status', '=', 'done'); $query = Permohonan::query();
// Apply search filter if provided // Apply search filter if provided
if ($request->has('search') && !empty($request->get('search'))) { if ($request->has('search') && !empty($request->get('search'))) {
$search = $request->get('search'); $search = $request->get('search');
$query->where(function ($q) use ($search) { $columns = ['nomor_registrasi', 'debiture.name', 'branch.name', 'user.name', 'tujuanPenilaian.name', 'jenisfasilitasKredit.name'];
$q->where('nomor_registrasi', 'LIKE', '%' . $search . '%');
$q->orWhereRelation('debiture', 'name', 'LIKE', '%' . $search . '%'); $query->where(function ($q) use ($search, $columns) {
$q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%'); foreach ($columns as $column) {
$q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%'); $q->orWhereRelation(explode('.', $column)[0], explode('.', $column)[1], 'LIKE', '%' . $search . '%');
$q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%'); }
$q->orWhereRelation('jenisfasilitasKredit', 'name', 'LIKE', '%' . $search . '%');
}); });
} }
// Apply whereHas to check penilai_id, role, and user_id specifically for 'penilai' role
$query->whereHas('penilaian.userPenilai', function ($q) {
$q->where('role', 'penilai') // Ensure the role is 'penilai'
->where('user_id', 12); // Ganti dengan Auth::user()->id jika dinamis
});
// Apply sorting if provided // Apply sorting if provided
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
$order = $request->get('sortOrder'); $order = $request->get('sortOrder');
@@ -122,7 +129,7 @@ class PenilaiController extends Controller
if ($request->has('page') && $request->has('size')) { if ($request->has('page') && $request->has('size')) {
$page = $request->get('page'); $page = $request->get('page');
$size = $request->get('size'); $size = $request->get('size');
$offset = ($page - 1) * $size; // Calculate the offset $offset = ($page - 1) * $size;
$query->skip($offset)->take($size); $query->skip($offset)->take($size);
} }
@@ -131,13 +138,20 @@ class PenilaiController extends Controller
$filteredRecords = $query->count(); $filteredRecords = $query->count();
// Get the data for the current page // Get the data for the current page
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'jenisfasilitasKredit'])->get(); $data = $query->with([
'user',
'debiture',
'branch',
'tujuanPenilaian',
'jenisfasilitasKredit',
'penilaian.userPenilai' // Ensure this relation is included
])->get();
// Calculate the page count // Calculate the page count
$pageCount = ceil($totalRecords / $request->get('size')); $pageCount = ceil($totalRecords / $request->get('size'));
// Calculate the current page number // Calculate the current page number
$currentPage = 0 + 1; $currentPage = $request->get('page', 1);
// Return the response data as a JSON object // Return the response data as a JSON object
return response()->json([ return response()->json([
@@ -150,4 +164,8 @@ class PenilaiController extends Controller
'data' => $data, 'data' => $data,
]); ]);
} }
} }

View File

@@ -5,6 +5,7 @@ namespace Modules\Lpj\Http\Controllers;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
use Modules\Lpj\Exports\BasicDataSurveyorExport; use Modules\Lpj\Exports\BasicDataSurveyorExport;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
@@ -116,6 +117,7 @@ class SurveyorController extends Controller
]; ];
}); });
return view('lpj::surveyor.detail', compact( return view('lpj::surveyor.detail', compact(
'permohonan', 'permohonan',
'surveyor', 'surveyor',
@@ -377,7 +379,7 @@ private function deleteOfFile($filePath)
return $request->validate([ return $request->validate([
'permohonan_id' => 'required', 'permohonan_id' => 'required',
'jenis_jaminan_id' => 'required', 'jenis_jaminan_id' => 'required',
'pendamping' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', 'pendamping' => 'nullable|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', 'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
'name_objek.*' => 'required|string|max:255', 'name_objek.*' => 'required|string|max:255',
'foto_lingkungan.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', 'foto_lingkungan.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
@@ -548,41 +550,141 @@ private function deleteOfFile($filePath)
} }
public function storeDataPembanding(Request $request) private function formatDataPembanding($request)
{ {
$data = $request->all(); $dataPembanding = [];
if (!$data) { $pembandingCount = count($request->input('alamat_pembanding', []));
return response()->json(['success' => false, 'message' => 'Invalid data'], 400);
for ($i = 0; $i < $pembandingCount; $i++) {
$pembanding = $this->formatSinglePembanding($request, $i);
// Perbaikan penanganan foto pembanding
$fotoKey = "foto_objek_pembanding_{$i}"; // Sesuaikan dengan nama field di form
if ($request->hasFile($fotoKey)) {
$pembanding['foto_objek'] = $this->handleFileUpload(
$request->file($fotoKey),
'pembanding',
"pembanding_{$i}"
);
}
$dataPembanding[] = $pembanding;
}
return $dataPembanding;
}
private function handleFileUpload($file, $folder, $prefix)
{
if (!$file) {
return null;
} }
try {
// Buat nama file yang unik
$extension = $file->getClientOriginalExtension();
$fileName = $prefix . '_' . time() . '_' . uniqid() . '.' . $extension;
// Pastikan folder exists
$path = storage_path("app/public/{$folder}");
if (!File::exists($path)) {
File::makeDirectory($path, 0777, true);
}
// Simpan file
$file->storeAs("public/{$folder}", $fileName);
// Log untuk debugging
\Log::info("File berhasil disimpan: {$folder}/{$fileName}");
return $fileName;
} catch (\Exception $e) {
\Log::error("Error saat upload file: " . $e->getMessage());
throw $e;
}
}
private function formatSinglePembanding($request, $index)
{
$fields = [
'alamat', 'desa', 'kecamatan', 'kabupaten', 'provinsi',
'tahun', 'luas_tanah', 'luas_bangunan', 'tahun_bangunan',
'status_nara_sumber', 'harga', 'nama_nara_sumber',
'peruntukan', 'penawaran_transaksi', 'nomor_tlp',
'kordinat_lat', 'kordinat_lng', 'jenis_aset',
];
$pembanding = [];
foreach ($fields as $field) {
$inputName = "{$field}_pembanding";
$pembanding[$field] = $request->input($inputName)[$index] ?? null;
}
// Inisialisasi foto_objek sebagai null
$pembanding['foto_objek'] = null;
return $pembanding;
}
public function storeDataPembanding(Request $request)
{
try { try {
DB::beginTransaction(); DB::beginTransaction();
// $action = $request->input('type'); $validator = $request->validate([
// $rules = $this->getActionSpecificRules($data, $action, $request); 'permohonan_id' => 'required|exists:permohonan,id',
'type' => 'required|string',
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))->first(); 'jenis_jaminan_id' => 'required',
'foto_objek' => 'nullable|image|max:2048',
if (!$inspeksi) { 'foto_objek_pembanding_*' => 'nullable|image|max:2048',
Inspeksi::create([
'permohonan_id' => $request->input('permohonan_id'),
'data_pembanding' => json_encode($data),
'name' => $request->input('type'),
'jenis_jaminan_id' => $request->input('jenis_jaminan_id'),
]); ]);
} else {
$inspeksi->update(['data_pembanding' => json_encode($data)]); if ($validator->fails()) {
return response()->json([
'success' => false,
'message' => 'Validasi gagal',
'errors' => $validator->errors()
], 422);
} }
$objekPenilaian = $this->formatObjekPenilaian($request);
if ($request->hasFile('foto_objek')) {
$objekPenilaian['foto_objek'] = $this->handleFileUpload(
$request->file('foto_objek'),
'pembanding',
'objek_penilaian'
);
}
$formattedData = [
'permohonan_id' => $request->input('permohonan_id'),
'type' => $request->input('type'),
'jenis_jaminan_id' => $request->input('jenis_jaminan_id'),
'objek_penilaian' => $objekPenilaian,
'data_pembanding' => $this->formatDataPembanding($request)
];
$inspeksi = $this->saveInspeksi($formattedData);
DB::commit(); DB::commit();
return response()->json(['success' => true, 'message' => 'Data saved successfully', 'data' => json_encode($data)], 200); return response()->json([
} catch (Exception $e) { 'success' => true,
'message' => 'Data berhasil disimpan',
'data' => $formattedData
], 200);
} catch (\Exception $e) {
DB::rollBack(); DB::rollBack();
return response()->json(['success' => false, 'message' => 'Failed to save data: ' . $e->getMessage()], 500); return response()->json([
'success' => false,
'message' => 'Gagal menyimpan data: ' . $e->getMessage()
], 500);
} }
} }
/** /**
* Form inspeksi. * Form inspeksi.
*/ */
@@ -737,8 +839,9 @@ private function deleteOfFile($filePath)
public function dataPembanding($id, $jaminanId) public function dataPembanding($id, $jaminanId)
{ {
$permohonan = Permohonan::with( try {
[ // Ambil data permohonan dengan eager loading
$permohonan = Permohonan::with([
'user', 'user',
'debiture.province', 'debiture.province',
'debiture.city', 'debiture.city',
@@ -747,28 +850,65 @@ private function deleteOfFile($filePath)
'branch', 'branch',
'tujuanPenilaian', 'tujuanPenilaian',
'penilaian' 'penilaian'
], ])->findOrFail($id);
)->findOrFail($id);
$surveyor = $id; // Ambil data inspeksi
$inspeksi = Inspeksi::where([
'permohonan_id' => $id,
'jenis_jaminan_id' => $jaminanId
])->first();
// Inisialisasi variabel
$inspectionData = null;
$comparisons = null;
$fotoForm = null;
if ($inspeksi) {
$inspectionData = json_decode($inspeksi->data_form, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \Exception('Error decoding inspection data: ' . json_last_error_msg());
}
if ($inspeksi->data_pembanding) {
$comparisons = json_decode($inspeksi->data_pembanding, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \Exception('Error decoding comparison data: ' . json_last_error_msg());
}
}
$fotoForm = json_decode($inspeksi->foto_form, true);
}
// Ambil data pendukung
$data = $this->getCommonData();
$branches = Branch::all(); $branches = Branch::all();
$provinces = Province::all(); $provinces = Province::all();
$data = $this->getCommonData(); return view('lpj::surveyor.components.data-pembanding', compact(
'permohonan',
'id',
'branches',
'provinces',
'inspectionData',
'comparisons',
'data',
'jaminanId',
'fotoForm'
));
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first(); } catch (\Exception $e) {
$forminspeksi = null; return redirect()
if ($inpeksi) { ->back()
$forminspeksi = $inpeksi; ->with('error', 'Terjadi kesalahan saat memuat data: ' . $e->getMessage());
// $forminspeksi = json_decode($inpeksi->data_form, true);
} }
// return response()->json($forminspeksi);
return view('lpj::surveyor.components.data-pembanding', compact('permohonan', 'surveyor', 'branches', 'provinces', 'forminspeksi', 'data'));
} }
private function getHeader(string $type): array private function getHeader(string $type): array
{ {
return self::HEADERS[$type] ?? []; return self::HEADERS[$type] ?? [];
@@ -1407,23 +1547,23 @@ private function deleteOfFile($filePath)
$data = $request->all(); $data = $request->all();
$result = []; $result = [];
foreach ($data['nama_bagunan'] as $index => $bangunan) { // foreach ($data['nama_bangunan'] as $index => $bangunan) {
$bangunanData = [ // $bangunanData = [
'bangunan' => $bangunan, // 'bangunan' => $bangunan,
'kategori' => [] // 'kategori' => []
]; // ];
foreach ($data['spek_kategori_bangunan'] as $kategoriIndex => $kategori) { // foreach ($data['spek_kategori_bangunan'] as $kategoriIndex => $kategori) {
if (isset($data['spek_bangunan'][$kategori])) { // if (isset($data['spek_bangunan'][$kategori])) {
$bangunanData['kategori'][] = [ // $bangunanData['kategori'][] = [
'kategori' => $kategori, // 'kategori' => $kategori,
'spesifikasi' => $data['spek_bangunan'][$kategori] // 'spesifikasi' => $data['spek_bangunan'][$kategori]
]; // ];
} // }
} // }
$result[] = $bangunanData; // $result[] = $bangunanData;
} // }
return [ return [
'bangunan' => [ 'bangunan' => [
@@ -1459,7 +1599,10 @@ private function deleteOfFile($filePath)
'gol_mas_sekitar' => $data['gol_mas_sekitar'] ?? null, 'gol_mas_sekitar' => $data['gol_mas_sekitar'] ?? null,
'tingkat_keramaian' => $data['tingkat_keramaian'] ?? null, 'tingkat_keramaian' => $data['tingkat_keramaian'] ?? null,
'terletak_diarea' => $data['terletak_diarea'] ?? null, 'terletak_diarea' => $data['terletak_diarea'] ?? null,
'disekitar_lokasi' => $data['disekitar_lokasi'] ?? null, 'disekitar_lokasi' => $data['disekitar_lokasi'] === 'yes' ? [
'kondisi' => $data['kondisi_bagunan_disekitar_lokasi'] ?? null,
'sifat' => $data['sifat_bagunan_disekitar_lokasi'] ?? null,
] : $data['disekitar_lokasi'],
'kondisi_bangunan_sekitar' => $data['kondisi_bangunan_sekitar'] ?? null, 'kondisi_bangunan_sekitar' => $data['kondisi_bangunan_sekitar'] ?? null,
'sifat_bangunan_sekitar' => $data['sifat_bangunan_sekitar'] ?? null, 'sifat_bangunan_sekitar' => $data['sifat_bangunan_sekitar'] ?? null,
'dekat_makam' => $data['dekat_makam'] ?? null, 'dekat_makam' => $data['dekat_makam'] ?? null,
@@ -1917,7 +2060,6 @@ private function deleteOfFile($filePath)
'luas_unit', 'luas_unit',
true true
), ),
'jenis_unit' => $data['jenis_unit'] ?? null,
'kondisi_unit' => $data['kondisi_unit'] ?? null, 'kondisi_unit' => $data['kondisi_unit'] ?? null,
'posisi_unit' => $data['posisi_unit'] ?? null, 'posisi_unit' => $data['posisi_unit'] ?? null,
'lantai' => $data['lantai'] ?? null, 'lantai' => $data['lantai'] ?? null,

View File

@@ -104,7 +104,7 @@ class FormSurveyorRequest extends FormRequest
'kondisi_bangunan' => 'nullable', 'kondisi_bangunan' => 'nullable',
'sifat_bangunan' => 'required|array', 'sifat_bangunan' => 'required|array',
'sifat_bangunan_input' => 'nullable|array', 'sifat_bangunan_input' => 'nullable|array',
'nama_bagunan' => 'required', 'nama_bagunan' => 'required|nullable',
'spek_kategori_bangunan.*' => 'required', 'spek_kategori_bangunan.*' => 'required',
'spek_bangunan.*' => 'required', 'spek_bangunan.*' => 'required',
'sarana_pelengkap' => 'required', 'sarana_pelengkap' => 'required',
@@ -122,7 +122,6 @@ class FormSurveyorRequest extends FormRequest
'luas_unit' => 'required', 'luas_unit' => 'required',
'luas_unit_sesuai' => 'nullable', 'luas_unit_sesuai' => 'nullable',
'luas_unit_tidak_sesuai' => 'nullable', 'luas_unit_tidak_sesuai' => 'nullable',
'jenis_unit' => 'required|array',
'kondisi_unit' => 'required|array', 'kondisi_unit' => 'required|array',
'posisi_unit' => 'required|array', 'posisi_unit' => 'required|array',
'lantai' => 'required|array', 'lantai' => 'required|array',
@@ -150,8 +149,8 @@ class FormSurveyorRequest extends FormRequest
'tingkat_keramaian' => 'nullable', 'tingkat_keramaian' => 'nullable',
'terletak_diarea' => 'nullable', 'terletak_diarea' => 'nullable',
'disekitar_lokasi' => 'nullable', 'disekitar_lokasi' => 'nullable',
'kondisi_bangunan_sekitar' => 'nullable', 'kondisi_bagunan_disekitar_lokasi' => 'nullable',
'sifat_bangunan_sekitar' => 'nullable', 'sifat_bagunan_disekitar_lokasi' => 'nullable',
'dekat_makam' => 'nullable', 'dekat_makam' => 'nullable',
'jarak_makam' => 'nullable', 'jarak_makam' => 'nullable',
'nama_makam' => 'nullable', 'nama_makam' => 'nullable',

View File

@@ -14,7 +14,7 @@ class Inspeksi extends Model
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
*/ */
protected $fillable = ['data_form', 'foto_form', 'denah_form','permohonan_id', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_by', 'updated_by', 'deleted_by','jenis_jaminan_id']; protected $fillable = ['data_form', 'foto_form', 'denah_form','permohonan_id', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_by', 'updated_by', 'deleted_by','jenis_jaminan_id','data_pembanding'];
public function permohonan() public function permohonan()
{ {

View File

@@ -23,4 +23,8 @@ class Regions extends Model
public function teams(){ public function teams(){
return $this->hasMany(Teams::class, 'regions_id', 'id'); return $this->hasMany(Teams::class, 'regions_id', 'id');
} }
public function penilaiTeam(){
return $this->hasMany(PenilaianTeam::class, 'team_id', 'id');
}
} }

View File

@@ -51,13 +51,12 @@
@php @php
$sortedTeamsActivity = $teamsActivity->sortBy(function ($item) { $sortedTeamsActivity = $teamsActivity->sortBy(function ($item) {
return $item->team->penilaianTeam return $item->team->regions->penilaiTeam
->filter(function ($penilaianTeam) use ($item) { ->filter(function ($penilaiTeam) use ($item) {
return $penilaianTeam->user_id == $item->user->id; return $penilaiTeam->user_id == $item->user->id;
}) })
->count(); ->count();
}); });
@endphp @endphp
@foreach ($sortedTeamsActivity as $index => $item) @foreach ($sortedTeamsActivity as $index => $item)
@@ -75,9 +74,9 @@
<th class="min-w-[150px]"> <th class="min-w-[150px]">
<span class="text-base text-gray-900 font-normal"> <span class="text-base text-gray-900 font-normal">
@php @php
$totalTasks = $item->team->penilaianTeam $totalTasks = $item->team->regions->penilaiTeam
->filter(function ($penilaianTeam) use ($item) { ->filter(function ($penilaiTeam) use ($item) {
return $penilaianTeam->user_id == $item->user->id; return $penilaiTeam->user_id == $item->user->id;
}) })
->count(); ->count();
@endphp @endphp
@@ -208,7 +207,7 @@
tanggal_kunjungan: { tanggal_kunjungan: {
title: 'Tgl Kunjungan', title: 'Tgl Kunjungan',
render: (item, data) => render: (item, data) =>
`${formatDateFromISO(data.tanggal_kunjungan) || ''}`, `${formatDateFromISO(data.waktu_penilaian) || ''}`,
}, },
progress: { progress: {
title: 'Progress', title: 'Progress',
@@ -222,6 +221,7 @@
return `${mulai.getDate()}-${mulai.getMonth() + 1}-${mulai.getFullYear()} - ${selesai.getDate()}-${selesai.getMonth() + 1}-${selesai.getFullYear()}` return `${mulai.getDate()}-${mulai.getMonth() + 1}-${mulai.getFullYear()} - ${selesai.getDate()}-${selesai.getMonth() + 1}-${selesai.getFullYear()}`
}, },
}, },
paparan: { paparan: {
title: 'Paparan', title: 'Paparan',
render: (item, data) => `${data.paparan || ''}`, render: (item, data) => `${data.paparan || ''}`,

View File

@@ -26,24 +26,29 @@
<input type="radio" <input type="radio"
onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])" onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])"
class="radio" name="luas_tanah_bagunan" value="sesuai" class="radio" name="luas_tanah_bagunan" value="sesuai"
{{ old('luas_tanah_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan'] ?? '') == 'sesuai' ? 'checked' : '' }}> {{ old('luas_tanah_bagunan', isset($forminspeksi['bangunan']['luas_tanah_bagunan']['sesuai'])) ? 'checked' : '' }}>
<span class="ml-2">Sesuai</span> <span class="ml-2">Sesuai</span>
</label> </label>
<label class="form-label flex items-center gap-2.5 text-nowrap"> <label class="form-label flex items-center gap-2.5 text-nowrap">
<input type="radio" class="radio" name="luas_tanah_bagunan" <input type="radio" class="radio" name="luas_tanah_bagunan"
onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])" onclick="toggleFieldVisibility('luas_tanah_bagunan', 'luas_tanah_bagunan_tidak_sesuai', ['tidak sesuai'])"
value="tidak sesuai" value="tidak sesuai"
{{ old('luas_tanah_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan'] ?? '') == 'tidak sesuai' ? 'checked' : '' }}> {{ old('luas_tanah_bagunan', isset($forminspeksi['bangunan']['luas_tanah_bagunan']['tidak sesuai'])) ? 'checked' : '' }}>
<span class="ml-2">Tidak Sesuai</span> <span class="ml-2">Tidak Sesuai</span>
</label> </label>
<div id="luas_tanah_bagunan_tidak_sesuai" class="flex items-baseline gap-2" <div id="luas_tanah_bagunan_tidak_sesuai" class="flex items-baseline gap-2"
style="{{ old('luas_tanah_bagunan_bagunan', $forminspeksi['bangunan']['luas_tanah_bagunan_bagunan'] ?? '') == 'tidak sesuai' ? '' : 'display: none;' }}"> style="{{ isset($forminspeksi['bangunan']['luas_tanah_bagunan']['tidak_sesuai']) ? '' : 'display: none;' }}">
<input type="text"id="analisa_bangunan_tidak_sesuai" name="luas_tanah_bagunan_tidak_sesuai" class="input w-full" <input type="text" id="analisa_bangunan_tidak_sesuai"
name="luas_tanah_bagunan_tidak_sesuai" class="input w-full"
placeholder="Masukan Luas Bangunan Tidak Sesuai..." placeholder="Masukan Luas Bangunan Tidak Sesuai..."
value="{{ old('luas_tanah_bagunan_tidak_sesuai', $forminspeksi['bangunan']['luas_tanah_bagunan_tidak_sesuai'] ?? '') }}"> value="{{ old('luas_tanah_bagunan_tidak_sesuai', $forminspeksi['bangunan']['luas_tanah_bagunan']['tidak_sesuai'] ?? '') }}">
<button type="button" class="btn btn-md btn-primary" onclick="updateAnalisa('analisa_bangunan')">Save</button> <button type="button" class="btn btn-md btn-primary"
onclick="updateAnalisa('analisa_bangunan')">
Save
</button>
</div> </div>
</div> </div>
<em id="error-luas_tanah_bagunan" class="alert text-danger text-sm"></em> <em id="error-luas_tanah_bagunan" class="alert text-danger text-sm"></em>
</div> </div>
@@ -62,8 +67,7 @@
<input class="checkbox" name="jenis_bangunan[]" type="checkbox" <input class="checkbox" name="jenis_bangunan[]" type="checkbox"
value="{{ $item->name }}" value="{{ $item->name }}"
{{ old('jenis_bangunan') == $item->name || isset($forminspeksi['bangunan']['jenis_bangunan']) == $item->name ? 'checked' : '' }} {{ old('jenis_bangunan') == $item->name || isset($forminspeksi['bangunan']['jenis_bangunan']) == $item->name ? 'checked' : '' }}
onclick="toggleCheckboxVisibility('jenis_bangunan', 'jenis_bangunan_lainnya', ['lainnya'])" onclick="toggleCheckboxVisibility('jenis_bangunan', 'jenis_bangunan_lainnya', ['lainnya'])" />
/>
{{ $item->name }} {{ $item->name }}
</label> </label>
@if (strcasecmp($item->name, 'Lainnya') == 0) @if (strcasecmp($item->name, 'Lainnya') == 0)
@@ -196,16 +200,28 @@
<div class="flex flex-col items-start gap-4"> <div class="flex flex-col items-start gap-4">
@if (isset($saranaPelengkap)) @if (isset($saranaPelengkap))
@foreach ($saranaPelengkap as $item) @foreach ($saranaPelengkap as $item)
@php
$isChecked = false;
$inputValue = '';
if (isset($forminspeksi['bangunan']['sarana_pelengkap'])) {
foreach ($forminspeksi['bangunan']['sarana_pelengkap'] as $key => $value) {
if ($key === $item->name) {
$isChecked = true;
$inputValue = $value;
break;
}
}
}
@endphp
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56 gap-2.5" style="width: 500px"> <label class="form-label max-w-56 gap-2.5" style="width: 500px">
<input class="checkbox" name="sarana_pelengkap[]" type="checkbox" <input class="checkbox" name="sarana_pelengkap[]" type="checkbox"
value="{{ $item->name }}" value="{{ $item->name }}" {{ $isChecked ? 'checked' : '' }} />
{{ in_array($item->name, old('sarana_pelengkap', $forminspeksi['bangunan']['sarana_pelengkap'] ?? [])) ? 'checked' : '' }} />
{{ $item->name }} {{ $item->name }}
</label> </label>
<input type="text" name="sarana_pelengkap_input[]" class="input w-full" <input type="text" name="sarana_pelengkap_input[]" class="input w-full"
id="bentukTanahInput" placeholder="Masukkan {{ $item->name }}..." placeholder="Masukkan {{ $item->name }}..." value="{{ $inputValue }}">
value="{{ old('sarana_pelengkap_input.' . $loop->index, $forminspeksi['bangunan']['sarana_pelengkap_input'][$loop->index] ?? '') }}">
</div> </div>
@endforeach @endforeach
@endif @endif
@@ -213,6 +229,7 @@
<em id="error-sarana_pelengkap" class="alert text-danger text-sm"></em> <em id="error-sarana_pelengkap" class="alert text-danger text-sm"></em>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -57,7 +57,14 @@
<div class="card-group flex items-center flex-wrap sm:flex-nowrap justify-between py-4 gap-2.5"> <div class="card-group flex items-center flex-wrap sm:flex-nowrap justify-between py-4 gap-2.5">
<div class="flex items-center gap-3.5"> <div class="flex items-center gap-3.5">
<div class="relative size-[50px] shrink-0"> <div class="relative size-[50px] shrink-0">
<!-- SVG code remains the same --> <svg class="w-full h-full stroke-brand-clarity fill-light" fill="none" height="48"
viewBox="0 0 44 48" width="44" xmlns="http://www.w3.org/2000/svg">
<path d="M16 2.4641C19.7128 0.320509 24.2872 0.320508 28 2.4641L37.6506 8.0359C41.3634 10.1795 43.6506 14.141 43.6506 18.4282V29.5718C43.6506 33.859 41.3634 37.8205 37.6506 39.9641L28 45.5359C24.2872 47.6795 19.7128 47.6795 16 45.5359L6.34937 39.9641C2.63655 37.8205 0.349365 33.859 0.349365 29.5718V18.4282C0.349365 14.141 2.63655 10.1795 6.34937 8.0359L16 2.4641Z" fill=""></path>
<path d="M16.25 2.89711C19.8081 0.842838 24.1919 0.842837 27.75 2.89711L37.4006 8.46891C40.9587 10.5232 43.1506 14.3196 43.1506 18.4282V29.5718C43.1506 33.6804 40.9587 37.4768 37.4006 39.5311L27.75 45.1029C24.1919 47.1572 19.8081 47.1572 16.25 45.1029L6.59937 39.5311C3.04125 37.4768 0.849365 33.6803 0.849365 29.5718V18.4282C0.849365 14.3196 3.04125 10.5232 6.59937 8.46891L16.25 2.89711Z" stroke=""></path>
</svg>
<div class="absolute leading-none left-2/4 top-2/4 -translate-y-2/4 -translate-x-2/4">
<i class="ki-filled ki-additem text-2xl text-brand"></i>
</div>
</div> </div>
</div> </div>
<div class="flex items-center gap-2.5"> <div class="flex items-center gap-2.5">

File diff suppressed because it is too large Load Diff

View File

@@ -142,7 +142,8 @@
<div class="w-full grid gap-5"> <div class="w-full grid gap-5">
<img id="foto_denah-preview" <img id="foto_denah-preview"
src="{{ isset($formDenah['foto_denah']) ? asset('storage/' . old('foto_denah', $formDenah['foto_denah'])) : '' }}" src="{{ isset($formDenah['foto_denah']) ? asset('storage/' . old('foto_denah', $formDenah['foto_denah'])) : '' }}"
alt="Gambar foto_denah" style="{{ isset($formDenah['foto_denah']) ? 'width: 30rem;' : 'display: none;' }}"> alt="Gambar foto_denah"
style="{{ isset($formDenah['foto_denah']) ? 'width: 30rem;' : 'display: none;' }}">
@@ -150,9 +151,7 @@
<input type="file" <input type="file"
value="{{ old('foto_denah', isset($formDenah['foto_denah']) ? $formDenah['foto_denah'] : '') }}" value="{{ old('foto_denah', isset($formDenah['foto_denah']) ? $formDenah['foto_denah'] : '') }}"
name="foto_denah" class="file-input file-input-bordered w-full " name="foto_denah" class="file-input file-input-bordered w-full "
accept="image/*" accept="image/*" onchange="previewImage(this, 'foto_denah-preview')">
onchange="previewImage(this, 'foto_denah-preview')"
>
</div> </div>
</div> </div>
</div> </div>
@@ -185,16 +184,19 @@
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px"> <div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
<button type="button" class="btn btn-success" id="saveButton" onclick="submitDenah()"> <button type="button" class="btn btn-success" id="saveButton" onclick="submitDenah()">
<span id="saveButtonText">Save</span> <span id="saveButtonText">Save</span>
<div class="spinner-border spinner-border-sm text-light" role="status" style="display: none;"
id="saveButtonSpinner">
<span class="visually-hidden">Loading...</span>
</div>
</button> </button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
<div class="bg-white p-4 rounded-lg">
<div class="loader"></div>
<p class="mt-2 text-center">Sedang memproses...</p>
</div>
</div>
@endsection @endsection
@@ -213,15 +215,13 @@
} }
function submitDenah() { function submitDenah() {
const loadingOverlay = document.getElementById('loadingOverlay');
loadingOverlay.classList.remove('hidden');
loadingOverlay.classList.add('flex');
const formElement = $('#formDenah')[0]; const formElement = $('#formDenah')[0];
const formData = new FormData(formElement); const formData = new FormData(formElement);
// Disable the button and show the spinner
$('#saveButton').prop('disabled', true);
$('#saveButtonText').hide();
$('#saveButtonSpinner').show();
$.ajax({ $.ajax({
url: '{{ route('surveyor.storeDenah') }}', url: '{{ route('surveyor.storeDenah') }}',
type: 'POST', type: 'POST',
@@ -233,9 +233,24 @@
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
Swal.fire({
title: 'Berhasil!',
text: response.message,
icon: 'success',
confirmButtonText: 'OK'
}).then((response) => {
if (response.isConfirmed) {
window.location.href = window.location.href =
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=denah'; '{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
toastrSuccessBuild(response.message); }
});
} else {
Swal.fire({
title: 'Error!',
text: response.message || 'Terjadi kesalahan',
icon: 'error',
confirmButtonText: 'OK'
});
} }
console.log(response); console.log(response);
}, },
@@ -255,13 +270,32 @@
}, },
complete: function() { complete: function() {
// Re-enable the button and hide the spinner loadingOverlay.classList.add('hidden');
$('#saveButton').prop('disabled', false); loadingOverlay.classList.remove('flex');
$('#saveButtonText').show();
$('#saveButtonSpinner').hide();
} }
}); });
} }
</script> </script>
@endpush @endpush
<style>
.loader {
border: 4px solid #f3f3f3;
border-radius: 50%;
border-top: 4px solid #3498db;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>

View File

@@ -76,19 +76,32 @@
<label class="form-label max-w-56">Batas batas</label> <label class="form-label max-w-56">Batas batas</label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<div class="grid grid-cols-1 gap-4 items-center w-full"> <div class="grid grid-cols-1 gap-4 items-center w-full">
@if (isset($arahMataAngin)) @if (isset($arahMataAngin))
@foreach ($arahMataAngin as $item) @foreach ($arahMataAngin as $item)
@php
$isChecked = false;
$inputValue = '';
if (isset($forminspeksi['fakta']['batas_batas'])) {
foreach ($forminspeksi['fakta']['batas_batas'] as $key => $value) {
if ($key === $item->name) {
$isChecked = true;
$inputValue = $value;
break;
}
}
}
@endphp
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56 gap-2.5" style="width: 500px"> <label class="form-label max-w-56 gap-2.5" style="width: 500px">
<input class="checkbox" name="batas_batas[]" type="checkbox" <input class="checkbox" name="batas_batas[]" type="checkbox"
value="{{ $item->name }}" value="{{ $item->name }}"
{{ in_array($item->name, old('batas_batas', $forminspeksi['fakta']['batas_batas'] ?? [])) ? 'checked' : '' }} /> {{ $isChecked ? 'checked' : '' }} />
{{ $item->name }} {{ $item->name }}
</label> </label>
<input type="text" name="batas_batas_input[]" class="input w-full" <input type="text" name="batas_batas_input[]" class="input w-full"
id="bentukTanahInput" placeholder="Masukkan Batas {{ $item->name }}..." placeholder="Masukkan Batas {{ $item->name }}..."
value="{{ old('batas_batas_input.' . $loop->index, $forminspeksi['fakta']['batas_batas_input'][$loop->index] ?? '') }}"> value="{{ $inputValue }}">
</div> </div>
@endforeach @endforeach
@endif @endif
@@ -98,6 +111,7 @@
</div> </div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Kondisi lain terkait lingkungan</label> <label class="form-label max-w-56">Kondisi lain terkait lingkungan</label>
<div class="flex flex-wrap items-baseline w-full" id="kondisi-lingkungan-container"> <div class="flex flex-wrap items-baseline w-full" id="kondisi-lingkungan-container">

View File

@@ -585,8 +585,12 @@
</div> </div>
</form> </form>
</div>
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
<div class="bg-white p-4 rounded-lg">
<div class="loader"></div>
<p class="mt-2 text-center">Sedang memproses...</p>
</div>
</div> </div>
<!-- Modal Kamera --> <!-- Modal Kamera -->
@@ -598,17 +602,16 @@
@push('scripts') @push('scripts')
<script> <script>
function submitFoto() { function submitFoto() {
const loadingOverlay = document.getElementById('loadingOverlay');
loadingOverlay.classList.remove('hidden');
loadingOverlay.classList.add('flex');
const formElement = $('#formFoto')[0]; const formElement = $('#formFoto')[0];
const formData = new FormData(formElement); const formData = new FormData(formElement);
// for (const [key, value] of formData.entries()) { // for (const [key, value] of formData.entries()) {
// console.log(`Key: ${key}, Value: ${value}`); // console.log(`Key: ${key}, Value: ${value}`);
// } // }
// Disable the button and show the spinner
$('#saveButtonFoto').prop('disabled', true);
$('#saveButtonFotoText').hide();
$('#saveButtonSpinner').show();
$.ajax({ $.ajax({
url: '{{ route('surveyor.storeFoto') }}', url: '{{ route('surveyor.storeFoto') }}',
type: 'POST', type: 'POST',
@@ -621,9 +624,24 @@
}, },
success: function(response) { success: function(response) {
if (response.success) { if (response.success) {
// window.location.href = Swal.fire({
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=foto'; title: 'Berhasil!',
toastrSuccessBuild(response.message); text: response.message,
icon: 'success',
confirmButtonText: 'OK'
}).then((response) => {
if (response.isConfirmed) {
window.location.href =
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
}
});
} else {
Swal.fire({
title: 'Error!',
text: response.message || 'Terjadi kesalahan',
icon: 'error',
confirmButtonText: 'OK'
});
} }
console.log(response); console.log(response);
@@ -645,9 +663,8 @@
}, },
complete: function() { complete: function() {
// Re-enable the button and hide the spinner // Re-enable the button and hide the spinner
$('#saveButtonFoto').prop('disabled', false); loadingOverlay.classList.add('hidden');
$('#saveButtonFotoText').show(); loadingOverlay.classList.remove('flex');
$('#saveButtonSpinner').hide();
} }
}); });
} }
@@ -655,6 +672,28 @@
@include('lpj::surveyor.js.camera-editor') @include('lpj::surveyor.js.camera-editor')
@endpush @endpush
<style>
.loader {
border: 4px solid #f3f3f3;
border-radius: 50%;
border-top: 4px solid #3498db;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>

View File

@@ -37,12 +37,20 @@
<span id="saveButtonText">Save</span> <span id="saveButtonText">Save</span>
<div class="spinner-border spinner-border-sm text-light" role="status" style="display: none;" <div class="spinner-border spinner-border-sm text-light" role="status" style="display: none;"
id="saveButtonSpinner"> id="saveButtonSpinner">
<span class="visually-hidden">Loading...</span>
</div> </div>
</button> </button>
</div> </div>
</form> </form>
</div> </div>
<!-- Loading Overlay -->
<div id="loadingOverlay" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
<div class="bg-white p-4 rounded-lg">
<div class="loader"></div>
<p class="mt-2 text-center">Sedang memproses...</p>
</div>
</div>
@endsection @endsection
@push('scripts') @push('scripts')
<script type="text/javascript"> <script type="text/javascript">
@@ -118,14 +126,14 @@
function submitData() { function submitData() {
const loadingOverlay = document.getElementById('loadingOverlay');
loadingOverlay.classList.remove('hidden');
loadingOverlay.classList.add('flex');
const formElement = $('#formInspeksi')[0]; const formElement = $('#formInspeksi')[0];
const formData = new FormData(formElement); const formData = new FormData(formElement);
// Disable the button and show the spinner
$('#saveButton').prop('disabled', true);
$('#saveButtonText').hide();
$('#saveButtonSpinner').show();
$.ajax({ $.ajax({
url: '{{ route('surveyor.store') }}', url: '{{ route('surveyor.store') }}',
type: 'POST', type: 'POST',
@@ -136,12 +144,26 @@
'X-CSRF-TOKEN': '{{ csrf_token() }}' 'X-CSRF-TOKEN': '{{ csrf_token() }}'
}, },
success: function(response) { success: function(response) {
// if (response.success) { if (response.success) {
// toastrSuccessBuild(response.message) Swal.fire({
// window.location.href = title: 'Berhasil!',
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi'; text: response.message,
// } icon: 'success',
confirmButtonText: 'OK'
}).then((response) => {
if (response.isConfirmed) {
window.location.href =
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
}
});
} else {
Swal.fire({
title: 'Error!',
text: response.message || 'Terjadi kesalahan',
icon: 'error',
confirmButtonText: 'OK'
});
}
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
@@ -160,9 +182,8 @@
}, },
complete: function() { complete: function() {
// Re-enable the button and hide the spinner // Re-enable the button and hide the spinner
$('#saveButton').prop('disabled', false); loadingOverlay.classList.add('hidden');
$('#saveButtonText').show(); loadingOverlay.classList.remove('flex');
$('#saveButtonSpinner').hide();
} }
}); });
} }
@@ -239,10 +260,9 @@
success: function(response) { success: function(response) {
console.log(response); console.log(response);
if (response.success) { if (response.success) {
if (response.jenis_asset) {
window.location.href = window.location.href =
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=inspeksi'; '{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
}
toastrSuccessBuild(response.message); toastrSuccessBuild(response.message);
} }
}, },
@@ -260,3 +280,34 @@
} }
</script> </script>
@endpush @endpush
<style>
.loader {
border: 4px solid #f3f3f3;
border-radius: 50%;
border-top: 4px solid #3498db;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.scrollable-x-auto {
overflow-x: auto;
max-width: 100%;
}
.table {
min-width: 100%;
}
</style>

View File

@@ -169,25 +169,38 @@
<span class="ml-2">Telah ada bangunan</span> <span class="ml-2">Telah ada bangunan</span>
</label> </label>
<div class="flex w-full items-center gap-4"> <div class="flex w-full items-center gap-4">
<div id="disekitar_lokasi_sesuai" class="grid grid-cols-2 gap-4 mt-5 mb-5" <div id="disekitar_lokasi_sesuai" class="grid grid-cols-2 gap-4 mt-5 mb-5"
style="display: none;"> style="{{ old('disekitar_lokasi', $forminspeksi['lingkungan']['disekitar_lokasi'] ?? '') == 'ya' ? '' : 'display: none;' }}">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<label for="" class="text-sm text-gray-700">Kondisi bangunan</label> <label for="" class="text-sm text-gray-700">Kondisi bangunan</label>
@php
$kondisi = ['Cukup', 'Baik', 'Kurang'];
@endphp
<select class="select" name="kondisi_bagunan_disekitar_lokasi" id=""> <select class="select" name="kondisi_bagunan_disekitar_lokasi" id="">
<option value="">pilih kondisi</option> <option value="">pilih kondisi</option>
<option value="Cukup">Cukup</option> @foreach ($kondisi as $item)
<option value="Baik">Baik</option> <option value="{{ $item }}"
<option value="Kurang">Kurang</option> {{ old('kondisi_bagunan_disekitar_lokasi', $forminspeksi['lingkungan']['disekitar_lokasi'] ?? '') == $item ? 'selected' : '' }}>
{{ $item }}
</option>
@endforeach
</select> </select>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<label for="" class="text-sm text-gray-700">Sifat bangunan</label> <label for="" class="text-sm text-gray-700">Sifat bangunan</label>
@php
$sifat = ['Permanen', 'Semi Permanen', 'Tidak Permanen'];
@endphp
<select class="select" name="sifat_bagunan_disekitar_lokasi" id=""> <select class="select" name="sifat_bagunan_disekitar_lokasi" id="">
<option value="">pilih sifat bagunan</option> <option value="">pilih sifat bagunan</option>
<option value="Permanen">Permanen</option> @foreach ($sifat as $item)
<option value="Semi Permanen">Semi Permanen</option> <option value="{{ $item }}"
<option value="Tidak Permanen">Tidak Permanen</option> {{ old('sifat_bagunan_disekitar_lokasi', $forminspeksi['lingkungan']['disekitar_lokasi'] ?? '') == $item ? 'selected' : '' }}>
{{ $item }}
</option>
@endforeach
</select> </select>
</div> </div>

View File

@@ -42,7 +42,7 @@
style="{{ old('luas_tanah', isset($forminspeksi['tanah']['luas_tanah']['tidak sesuai'])) ? '' : 'display: none;' }}"> style="{{ old('luas_tanah', isset($forminspeksi['tanah']['luas_tanah']['tidak sesuai'])) ? '' : 'display: none;' }}">
<input id="analisa_tanah_tidak_sesuai" type="text" name="luas_tanah_tidak_sesuai" <input id="analisa_tanah_tidak_sesuai" type="text" name="luas_tanah_tidak_sesuai"
class="input w-full" placeholder="Masukan Luas Tanah" class="input w-full" placeholder="Masukan Luas Tanah"
value="{{ old('luas_tanah_tidak_sesuai', $forminspeksi['tanah']['luas_tanah_tidak_sesuai'] ?? '') }}"> value="{{ old('luas_tanah_tidak_sesuai', $forminspeksi['tanah']['luas_tanah']['tidak sesuai'] ?? '') }}">
<button type="button" class="btn btn-md btn-primary" <button type="button" class="btn btn-md btn-primary"
onclick="updateAnalisa('analisa_tanah')">Save</button> onclick="updateAnalisa('analisa_tanah')">Save</button>
</div> </div>
@@ -85,6 +85,7 @@
</label> </label>
<!-- Select dropdown untuk "Tidak Sesuai" --> <!-- Select dropdown untuk "Tidak Sesuai" -->
<div id="hadap_mata_angin_tidak_sesuai" class="flex items-baseline gap-2" <div id="hadap_mata_angin_tidak_sesuai" class="flex items-baseline gap-2"
style="{{ old('hadap_mata_angin', isset($forminspeksi['tanah']['hadap_mata_angin']['tidak sesuai'])) ? '' : 'display: none;' }}"> style="{{ old('hadap_mata_angin', isset($forminspeksi['tanah']['hadap_mata_angin']['tidak sesuai'])) ? '' : 'display: none;' }}">
<select class="input w-full <select class="input w-full
@@ -94,7 +95,7 @@
@if (isset($arahMataAngin)) @if (isset($arahMataAngin))
@foreach ($arahMataAngin as $item) @foreach ($arahMataAngin as $item)
<option value="{{ $item->name }}" <option value="{{ $item->name }}"
{{ old('hadap_mata_angin_tidak_sesuai', $forminspeksi['tanah']['hadap_mata_angin_tidak_sesuai'] ?? '') == $item->name ? 'selected' : '' }}> {{ old('hadap_mata_angin_tidak_sesuai', $forminspeksi['tanah']['hadap_mata_angin']['tidak sesuai'] ?? '') == $item->name ? 'selected' : '' }}>
{{ $item->name }} {{ $item->name }}
</option> </option>
@endforeach @endforeach
@@ -233,14 +234,14 @@
<label class="form-label flex items-center gap-2.5 text-nowrap"> <label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="posisi_kavling[]" type="checkbox" <input class="checkbox" name="posisi_kavling[]" type="checkbox"
value="{{ $item->name }}" value="{{ $item->name }}"
{{ in_array($item->name, old('posisi_kavling', $forminspeksi['tanah']['posisi_kavling'] ?? [])) ? 'checked' : '' }} {{ in_array($item->name, old('posisi_kavling', $forminspeksi['tanah']['posisi_kavling']['posisi_kavling'] ?? [])) ? 'checked' : '' }}
onclick="toggleCheckboxVisibility('posisi_kavling', 'posisi_kavling_lainnya', ['Lainnya'])" /> onclick="toggleCheckboxVisibility('posisi_kavling', 'posisi_kavling_lainnya', ['Lainnya'])" />
{{ $item->name }} {{ $item->name }}
</label> </label>
@if (strcasecmp($item->name, 'Lainnya') == 0) @if (strcasecmp($item->name, 'Lainnya') == 0)
<input id="posisi_kavling_lainnya" type="text" style="display: none;" <input id="posisi_kavling_lainnya" type="text" style="display: none;"
name="posisi_kavling_lainnya" class="input w-full mt-2" name="posisi_kavling_lainnya" class="input w-full mt-2"
placeholder="Masukkan Posisi Kavling lainnya..." /> placeholder="Masukkan Posisi Kavling lainnya..." value="{{ old('posisi_kavling_lainnya', $forminspeksi['tanah']['posisi_kavling']['lainnya'] ?? '') }}" />
@endif @endif
</div> </div>
@endforeach @endforeach