fix(survyor/penilai): perbaikan view print-resume, lampiran, foto-lampiran, foto, header, main dan controller penilai dan surveyor
This commit is contained in:
@@ -96,6 +96,7 @@ class PenilaianController extends Controller
|
||||
}
|
||||
|
||||
} else {
|
||||
$teams_ids[] = $validatedData['teams_id'];
|
||||
$user_ids[] = $validatedData['surveyor_id'];
|
||||
|
||||
}
|
||||
@@ -136,13 +137,14 @@ class PenilaianController extends Controller
|
||||
$user_ids[] = $validatedData['penilai_surveyor_id'];
|
||||
}
|
||||
} else {
|
||||
$teams_ids[] = $validatedData['teams_id'];
|
||||
$user_ids[] = $validatedData['penilai_id'];
|
||||
}
|
||||
|
||||
$roles[] = 'penilai';
|
||||
}
|
||||
|
||||
// dd($teams_ids, $user_ids);
|
||||
// dd($validatedData['penilai_region_id'],$validatedData['teams_id']);
|
||||
foreach ($teams_ids as $key => $teams_id) {
|
||||
PenilaianTeam::create([
|
||||
'penilaian_id' => $validatedData['penilaian_id'],
|
||||
@@ -153,13 +155,11 @@ class PenilaianController extends Controller
|
||||
}
|
||||
|
||||
if ($validatedData['surveyor_id'] === 'pilih_dari_region' || $validatedData['penilai_id'] === 'pilih_dari_region' || $validatedData['penilai_surveyor_id'] === 'pilih_dari_region') {
|
||||
$status = $permohonan->status;
|
||||
}else {
|
||||
$status = 'reassign';
|
||||
} else {
|
||||
$status = 'assign';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$permohonan->update([
|
||||
'status' => $status,
|
||||
]);
|
||||
@@ -344,7 +344,7 @@ class PenilaianController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
$query->whereIn('status', ['registered', 'registrasi-final']);
|
||||
$query->whereIn('status', ['registered', 'registrasi-final', 'reassign']);
|
||||
|
||||
// Filter berdasarkan role
|
||||
if (Auth::user()->roles[0]->name !== 'administrator') {
|
||||
|
||||
@@ -500,45 +500,67 @@ class SurveyorController extends Controller
|
||||
$formatFotoData = [];
|
||||
$nomor_registrasi = $request->nomor_registrasi;
|
||||
|
||||
// Generate a unique timestamp for this batch
|
||||
$batchTimestamp = time();
|
||||
|
||||
foreach ($files as $index => $file) {
|
||||
$timestamp = time();
|
||||
$originalName = $file->getClientOriginalName();
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
|
||||
// Validasi nama file
|
||||
if (empty($originalName)) {
|
||||
$originalName = "file_{$timestamp}";
|
||||
$originalName = "file_{$batchTimestamp}";
|
||||
}
|
||||
$uniqueFileName = "{$timestamp}.{$extension}";
|
||||
|
||||
// Use batchTimestamp and index to ensure uniqueness
|
||||
$uniqueFileName = "{$batchTimestamp}_{$index}.{$extension}";
|
||||
|
||||
// Simpan file
|
||||
$nomor_registrasi = $request->nomor_registrasi;
|
||||
$path = $file->storeAs("surveyor/{$paramName}/{$nomor_registrasi}", $uniqueFileName, 'public');
|
||||
|
||||
$fotoData = [
|
||||
'name' => pathinfo($originalName, PATHINFO_FILENAME),
|
||||
'path' => $path,
|
||||
'category' => 'lainnya',
|
||||
'sub' => null,
|
||||
'description' => null,
|
||||
'created_by' => Auth::user()->name,
|
||||
'created_at' => now()->toDateTimeString(),
|
||||
];
|
||||
// Check if this file already exists in formatFotojson
|
||||
$fileExists = false;
|
||||
if (isset($formatFotojson[$paramName]) && is_array($formatFotojson[$paramName])) {
|
||||
foreach ($formatFotojson[$paramName] as $existingFile) {
|
||||
// Check if the original file name matches
|
||||
if (isset($existingFile['name']) &&
|
||||
$existingFile['name'] === pathinfo($originalName, PATHINFO_FILENAME)) {
|
||||
$fileExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$formatFotoData[] = $fotoData;
|
||||
// Only add if this file doesn't already exist
|
||||
if (!$fileExists) {
|
||||
$fotoData = [
|
||||
'name' => pathinfo($originalName, PATHINFO_FILENAME),
|
||||
'path' => $path,
|
||||
'category' => 'lainnya',
|
||||
'sub' => null,
|
||||
'description' => null,
|
||||
'created_by' => Auth::user()->name,
|
||||
'created_at' => now()->toDateTimeString(),
|
||||
];
|
||||
|
||||
$formatFotoData[] = $fotoData;
|
||||
}
|
||||
}
|
||||
|
||||
// Struktur JSON yang konsisten
|
||||
if (!isset($formatFotojson[$paramName])) {
|
||||
$formatFotojson[$paramName] = $formatFotoData;
|
||||
} else {
|
||||
$formatFotojson[$paramName] = array_merge(
|
||||
$formatFotojson[$paramName] ?? [],
|
||||
$formatFotoData
|
||||
);
|
||||
// Only update if we have new photos to add
|
||||
if (!empty($formatFotoData)) {
|
||||
// Struktur JSON yang konsisten
|
||||
if (!isset($formatFotojson[$paramName])) {
|
||||
$formatFotojson[$paramName] = $formatFotoData;
|
||||
} else {
|
||||
$formatFotojson[$paramName] = array_merge(
|
||||
$formatFotojson[$paramName] ?? [],
|
||||
$formatFotoData
|
||||
);
|
||||
}
|
||||
|
||||
return $formatFotoData;
|
||||
}
|
||||
|
||||
|
||||
return $formatFotoData;
|
||||
}
|
||||
|
||||
return [];
|
||||
@@ -699,80 +721,6 @@ class SurveyorController extends Controller
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hapusLantai(Request $request)
|
||||
{
|
||||
$permohonanId = $request->permohonan_id;
|
||||
$dokumentId = $request->dokument_id;
|
||||
|
||||
// Normalisasi path foto
|
||||
$cleanRequestPath = str_replace(['storage/', 'surveyor/'], '', $request->foto_path);
|
||||
|
||||
$inspeksi = Inspeksi::firstOrNew(
|
||||
['permohonan_id' => $permohonanId, 'dokument_id' => $dokumentId]
|
||||
);
|
||||
$fotoLantaiUnit = json_decode($inspeksi->foto_form, true);
|
||||
|
||||
// Konversi lantai ke string untuk konsistensi
|
||||
$lantai = (string)$request->lantai;
|
||||
|
||||
// Cek apakah lantai ada di array
|
||||
$pat = null;
|
||||
if (isset($fotoLantaiUnit['foto_lantai_unit'][$lantai])) {
|
||||
// Filter foto, hapus foto yang sesuai
|
||||
$fotoLantaiUnit['foto_lantai_unit'][$lantai] = array_filter(
|
||||
$fotoLantaiUnit['foto_lantai_unit'][$lantai],
|
||||
function ($foto) use ($cleanRequestPath) {
|
||||
// Normalisasi path foto yang tersimpan
|
||||
$storedPath = str_replace(['storage/', 'surveyor/'], '', $foto['path']);
|
||||
|
||||
// Jika path cocok, hapus file dari storage
|
||||
if ($storedPath === $cleanRequestPath) {
|
||||
// Hapus file dari storage dengan berbagai kemungkinan path
|
||||
$possiblePaths = [
|
||||
'storage/surveyor/lantai_unit/' . $cleanRequestPath,
|
||||
'storage/surveyor/' . $cleanRequestPath,
|
||||
'storage/' . $cleanRequestPath,
|
||||
$cleanRequestPath
|
||||
];
|
||||
|
||||
foreach ($possiblePaths as $path) {
|
||||
if (Storage::disk('public')->exists($path)) {
|
||||
Storage::disk('public')->delete($path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false; // Hapus dari array
|
||||
}
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
// Reset index array
|
||||
$fotoLantaiUnit['foto_lantai_unit'][$lantai] = array_values($fotoLantaiUnit['foto_lantai_unit'][$lantai]);
|
||||
|
||||
// Hapus lantai jika tidak ada foto
|
||||
if (empty($fotoLantaiUnit['foto_lantai_unit'][$lantai])) {
|
||||
unset($fotoLantaiUnit['foto_lantai_unit'][$lantai]);
|
||||
}
|
||||
|
||||
// Update inspeksi
|
||||
$inspeksi->foto_form = json_encode($fotoLantaiUnit);
|
||||
$inspeksi->save();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'foto_lantai_unit' => $pat
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'gagal menghapus'
|
||||
], 404);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function generateUniqueFileName($file, $prefix = '')
|
||||
{
|
||||
@@ -797,7 +745,7 @@ class SurveyorController extends Controller
|
||||
'permohonan_id' => 'required',
|
||||
'dokument_id' => 'required',
|
||||
'nomor_registrasi' => 'required',
|
||||
'foto_rute.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||
'upload_foto.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg,webp,bmp,tiff,heic,heif|max:'. $maxSize,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -577,11 +577,11 @@ class FormSurveyorRequest extends FormRequest
|
||||
'alamat_sesuai' => 'required',
|
||||
'alamat_tidak_sesuai' => 'nullable|string',
|
||||
'pihak_bank' => 'nullable|string',
|
||||
|
||||
'hub_cadeb' => 'required',
|
||||
'nomor_nib' => 'nullable|string',
|
||||
'hub_cadeb' => 'nullable|string',
|
||||
'hub_cadeb_sesuai' => 'nullable|string',
|
||||
'hub_cadeb_tidak_sesuai' => 'nullable|string',
|
||||
'hub_cadeb_penghuni' => 'required',
|
||||
'hub_cadeb_penghuni' => 'nullable',
|
||||
'hub_cadeb_penghuni_sesuai' => 'nullable|string',
|
||||
'hub_penghuni_tidak_sesuai' => 'nullable|string',
|
||||
|
||||
|
||||
@@ -13,70 +13,101 @@
|
||||
@foreach ($groupedPhotos as $category => $photos)
|
||||
<div class="mt-5">
|
||||
<h2 class="text-gray-800 font-bold text-xl mb-3">{{ $category ?? 'Tanpa Kategori' }}</h2>
|
||||
<div class="grid gap-5">
|
||||
@php
|
||||
$groupedBySubcategory = $photos->groupBy('sub');
|
||||
@endphp
|
||||
<div class="card border rounded-lg shadow-lg p-4">
|
||||
<!-- Carousel Container -->
|
||||
<div class="relative w-full overflow-hidden">
|
||||
<div class="flex transition-transform duration-500 ease-in-out" id="carousel-{{ $category }}">
|
||||
<span class="absolute top-0 right-2 text-white">
|
||||
<i class="ki-filled ki-maximize"></i>
|
||||
</span>
|
||||
@foreach ($photos as $index => $item)
|
||||
<div class="min-w-full flex flex-col items-center hover:cursor-pointer"
|
||||
onclick="openPreview('{{ asset('storage/' . $item['path']) }}', '{{ $item['name'] }}', '{{ $item['description'] }}')">
|
||||
|
||||
@if ($groupedBySubcategory->isEmpty())
|
||||
|
||||
@foreach ($photos as $index => $item)
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="grid gap-5">
|
||||
<h3 class="text-gray-600 font-semibold text-lg">
|
||||
{{ $item['name'] ?? 'Foto - ' . ($index + 1) }}
|
||||
</h3>
|
||||
<div class="flex items-center">
|
||||
<div class="w-full overflow-hidden rounded-md" style="height: 500px;">
|
||||
@if (isset($item['path']))
|
||||
<img src="{{ asset('storage/' . $item['path']) }}" alt="Gambar {{ $index + 1 }}"
|
||||
class="w-full h-auto object-cover rounded-md">
|
||||
<img src="{{ asset('storage/' . $item['path']) }}"
|
||||
alt="Gambar {{ $index + 1 }}" class="w-full h-full object-cover">
|
||||
@else
|
||||
<p class="text-gray-500">Gambar tidak tersedia</p>
|
||||
@endif
|
||||
</div>
|
||||
<p class="text-gray-500 text-sm">{{ $item['description'] ?? '-' }}</p>
|
||||
<h3 class="text-gray-600 font-semibold text-lg mt-3">
|
||||
{{ $item['name'] ?? 'Foto - ' . ($index + 1) }}
|
||||
</h3>
|
||||
<p class="text-gray-500 text-sm mt-1">{{ $item['description'] ?? '-' }}</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<!-- Jika ada subkategori, tampilkan berdasarkan subkategori -->
|
||||
@foreach ($groupedBySubcategory as $subcategory => $subPhotos)
|
||||
<div class="mb-4">
|
||||
<!-- Judul Subkategori -->
|
||||
<h4 class="text-gray-700 font-semibold text-lg mb-2">
|
||||
@if ($subcategory)
|
||||
{{ $subcategory }}
|
||||
@endif
|
||||
</h4>
|
||||
<div class="grid gap-5">
|
||||
@foreach ($subPhotos as $index => $item)
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="grid gap-5">
|
||||
<h3 class="text-gray-600 font-semibold text-lg">
|
||||
{{ $item['name'] ?? 'Foto - ' . ($index + 1) }}
|
||||
</h3>
|
||||
<div class="flex items-center">
|
||||
@if (isset($item['path']))
|
||||
<img src="{{ asset('storage/' . $item['path']) }}" alt="Gambar {{ $index + 1 }}"
|
||||
class="w-full h-auto object-cover rounded-md">
|
||||
@else
|
||||
<p class="text-gray-500">Gambar tidak tersedia</p>
|
||||
@endif
|
||||
</div>
|
||||
<p class="text-gray-500 text-sm">{{ $item['description'] ?? '-' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<!-- Navigation Buttons -->
|
||||
<button
|
||||
class="absolute top-1/2 left-0 transform -translate-y-1/2 bg-gray-800 text-white rounded-full p-2 focus:outline-none"
|
||||
onclick="prevSlide('{{ $category }}')">
|
||||
<i class="ki-outline ki-left-square"></i>
|
||||
</button>
|
||||
<button
|
||||
class="absolute top-1/2 right-0 transform -translate-y-1/2 bg-gray-800 text-white rounded-full p-2 focus:outline-none"
|
||||
onclick="nextSlide('{{ $category }}')">
|
||||
<i class="ki-outline ki-right-square"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@endisset
|
||||
|
||||
<script>
|
||||
let currentIndex = {};
|
||||
|
||||
function nextSlide(category) {
|
||||
if (!currentIndex[category]) currentIndex[category] = 0;
|
||||
|
||||
const carousel = document.getElementById(`carousel-${category}`);
|
||||
const totalSlides = carousel.children.length;
|
||||
|
||||
currentIndex[category] = (currentIndex[category] + 1) % totalSlides;
|
||||
carousel.style.transform = `translateX(-${currentIndex[category] * 100}%)`;
|
||||
}
|
||||
|
||||
function prevSlide(category) {
|
||||
if (!currentIndex[category]) currentIndex[category] = 0;
|
||||
|
||||
const carousel = document.getElementById(`carousel-${category}`);
|
||||
const totalSlides = carousel.children.length;
|
||||
|
||||
currentIndex[category] = (currentIndex[category] - 1 + totalSlides) % totalSlides;
|
||||
carousel.style.transform = `translateX(-${currentIndex[category] * 100}%)`;
|
||||
}
|
||||
|
||||
function openPreview(imagePath, name, description) {
|
||||
const previewModal = document.createElement('div');
|
||||
previewModal.className = 'fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50';
|
||||
previewModal.innerHTML = `
|
||||
<div class="relative">
|
||||
<h3 class="text-white font-semibold text-lg mt-3 text-center">${name}</h3>
|
||||
<img src="${imagePath}" class="max-w-full max-h-screen object-contain">
|
||||
<button class="absolute top-2 right-2 bg-red-500 text-white rounded-full p-2"
|
||||
onclick="closePreview(this)">×</button>
|
||||
|
||||
<p class="text-white text-sm mt-1">${description}</p>
|
||||
</div>
|
||||
`;
|
||||
document.body.appendChild(previewModal);
|
||||
}
|
||||
|
||||
|
||||
function closePreview(button) {
|
||||
const modal = button.closest('div.fixed');
|
||||
if (modal) {
|
||||
modal.remove();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@php
|
||||
$fotoTypes = ['foto_gistaru', 'foto_bhumi', 'foto_argis_region', 'foto_tempat'];
|
||||
if (($key = array_search('foto_tempat', $fotoTypes)) !== false) {
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Luas Tanah</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Luas Bangunan</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Nilai Pasar Wajar</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Nilai Likuidasi {{ isset($item['likuidasi']) ? '('. $item['likuidasi'] . ' %)' : '-' }}</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">{{ $item['sertifikat'] ?? '' }}
|
||||
@@ -242,8 +242,7 @@
|
||||
{{ isset($item['luas_bangunan']) ? $item['luas_bangunan'] . ' m²' : '-' }}</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">
|
||||
{{ isset($item['nilai']) ? formatRupiah($item['nilai']) : '-' }}</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">
|
||||
{{ isset($item['total_likuidasi']) ? formatRupiah($item['total_likuidasi']) : '-' }}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
@@ -265,7 +264,7 @@
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Luas Tanah</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Luas Bangunan</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Nilai Pasar Wajar</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Nilai Likuidasi {{ isset($item['likuidasi']) ? '('. $item['likuidasi'] . ' %)' : '-' }}</td>
|
||||
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -277,8 +276,7 @@
|
||||
{{ isset($item['luas_bangunan']) ? $item['luas_bangunan'] . ' m²' : '-' }}</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">
|
||||
{{ isset($item['nilai']) ? formatRupiah($item['nilai']) : '-' }}</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">
|
||||
{{ isset($item['total_likuidasi']) ? formatRupiah($item['total_likuidasi']) : '-' }}</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
@@ -301,7 +299,7 @@
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Luas Tanah</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Luas Bangunan</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Nilai Pasar Wajar</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">Nilai Likuidasi {{ isset($item['likuidasi']) ? '('. $item['likuidasi'] . ' %)' : '' }}</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">
|
||||
@@ -312,8 +310,7 @@
|
||||
{{ isset($item['luas_bangunan']) ? $item['luas_bangunan'] . ' m²' : '-' }}</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">
|
||||
{{ isset($item['nilai']) ? formatRupiah($item['nilai']) : '-' }}</td>
|
||||
<td style="border: 1px solid #000; padding: 4px; text-align: center">
|
||||
{{ isset($item['total_likuidasi']) ? formatRupiah($item['total_likuidasi']) : '-' }}</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
@endforeach
|
||||
|
||||
@@ -194,14 +194,13 @@
|
||||
<th class="text-center">Luas Tanah</th>
|
||||
<th class="text-center">Luas Bangunan</th>
|
||||
<th class="text-center">Nilai Pasar Wajar</th>
|
||||
<th class="text-center">Nilai Likuidasi(%)</th>
|
||||
<th class="text-center">Total Nilai Likuidasi</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (!empty($resumeData['fisik']))
|
||||
@foreach ($resumeData['fisik'] as $item)
|
||||
@if (!empty($resumeData['sesuai_imb']))
|
||||
@foreach ($resumeData['sesuai_imb'] as $item)
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
<input type="text" name="fisik_sertifikat[]"
|
||||
@@ -217,18 +216,9 @@
|
||||
<td class="text-center">
|
||||
<input type="text" name="fisik_nilai[]"
|
||||
class="input currency-format nilai-pasar"
|
||||
value="{{ $item['nilai'] }}" onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="likuidasi[]" class="input likuidasi"
|
||||
value="{{ $item['likuidasi'] ?? 0 }}"
|
||||
onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="total_nilai_likuidasi[]"
|
||||
class="input currency-format total-likuidasi"
|
||||
value="{{ $item['total_likuidasi'] ?? 0 }}" readonly>
|
||||
value="{{ $item['nilai'] }}" >
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
@@ -277,16 +267,9 @@
|
||||
<td class="text-center">
|
||||
<input type="text" name="fisik_nilai[]"
|
||||
class="input currency-format nilai-pasar"
|
||||
onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="likuidasi[]" class="input likuidasi"
|
||||
onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="total_nilai_likuidasi[]"
|
||||
class="input currency-format total-likuidasi" readonly>
|
||||
>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
@@ -306,8 +289,7 @@
|
||||
<th class="text-center">Luas Tanah</th>
|
||||
<th class="text-center">Luas Bangunan</th>
|
||||
<th class="text-center">Nilai Pasar Wajar</th>
|
||||
<th class="text-center">Nilai Likuidasi (%)</th>
|
||||
<th class="text-center">Total Nilai Likuidasi</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
</thead>
|
||||
@@ -330,18 +312,9 @@
|
||||
<td class="text-center">
|
||||
<input type="text" name="sesuai_nilai[]"
|
||||
class="input currency-format nilai-pasar"
|
||||
value="{{ $item['nilai'] }}" onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="sesuai_likuidasi[]"
|
||||
class="input likuidasi" value="{{ $item['likuidasi'] ?? '' }}"
|
||||
onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="sesuai_total_likuidasi[]"
|
||||
class="input currency-format total-likuidasi"
|
||||
value="{{ $item['total_likuidasi'] ?? 0 }}">
|
||||
value="{{ $item['nilai'] }}" >
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
@@ -360,17 +333,9 @@
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="sesuai_nilai[]" class="input currency-format"
|
||||
onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="sesuai_likuidasi[]" class="input likuidasi"
|
||||
value="{{ $item['likuidasi'] ?? 0 }}" onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="sesuai_total_likuidasi[]"
|
||||
class="input currency-format total-likudasi"
|
||||
value="{{ $item['total_likuidasi'] ?? 0 }}">
|
||||
>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
@@ -398,8 +363,7 @@
|
||||
<th class="text-center">Luas Tanah</th>
|
||||
<th class="text-center">Luas Bangunan</th>
|
||||
<th class="text-center">Nilai Pasar Wajar</th>
|
||||
<th class="text-center">Nilai Likuidasi (%)</th>
|
||||
<th class="text-center">Total Nilai Likuidasi</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
</thead>
|
||||
@@ -421,18 +385,9 @@
|
||||
<td class="text-center">
|
||||
<input type="text" name="tambahan_nilai[]"
|
||||
class="input currency-format nilai-pasar"
|
||||
value="{{ $item['nilai'] }}" onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="tambahan_nilai_likuidasi[]"
|
||||
class="input likuidasi " value="{{ $item['likuidasi'] ?? 0 }}"
|
||||
onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="tambahan_total_likuidasi[]"
|
||||
class="input currency-format total-likuidasi"
|
||||
value="{{ $item['total_likuidasi'] ?? 0 }}">
|
||||
value="{{ $item['nilai'] }}" >
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
@@ -441,7 +396,7 @@
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
<div id="kesimpulans" class="grid gap-5 w-full"></div>
|
||||
<div id="kesimpulan" class="grid gap-5 w-full"></div>
|
||||
<div>
|
||||
<button type="button" class="btn btn-primary btn-sm mt-5" onclick="tambahKesimpulanNilai()">
|
||||
<i class="ki-outline ki-plus"></i>
|
||||
@@ -519,7 +474,7 @@
|
||||
let counter = 3;
|
||||
|
||||
function tambahKesimpulanNilai() {
|
||||
const kesimpulan = document.getElementById('kesimpulans');
|
||||
const kesimpulan = document.getElementById('kesimpulan');
|
||||
|
||||
kesimpulan.innerHTML += `
|
||||
<div class="grid gap-5 w-full mt-5" id="kesimpulan-${counter}">
|
||||
@@ -541,8 +496,7 @@
|
||||
<th class="text-center">Luas Tanah</th>
|
||||
<th class="text-center">Luas Bangunan</th>
|
||||
<th class="text-center">Nilai Pasar Wajar</th>
|
||||
<th class="text-center">Nilai Likuidasi (%)</th>
|
||||
<th class="text-center">Total Nilai Likuidasi</th>
|
||||
|
||||
<th class="text-center">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -564,15 +518,8 @@
|
||||
<input type="text" name="tambahan_nilai[]"
|
||||
class="input currency-format nilai-pasar">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="tambahan_nilai_likuidasi[]"
|
||||
class="input likuidasi"
|
||||
onkeyup="calculateTotal(this)">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="tambahan_total_likuidasi[]"
|
||||
class="input currency-format total-likuidasi" >
|
||||
</td>
|
||||
|
||||
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-danger" onclick="deleteRow(this)">Delete</button>
|
||||
</td>
|
||||
@@ -617,7 +564,7 @@
|
||||
|
||||
const formElement = document.querySelector('form');
|
||||
const jsonData = formToJson(formElement);
|
||||
console.log('Data dalam format JSON:', JSON.stringify(formElement, null, 2));
|
||||
console.log('Data dalam format JSON:', JSON.stringify(jsonData, null, 2));
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search); // Mengambil query parameters dari URL
|
||||
const permohonanId = urlParams.get('permohonanId');
|
||||
@@ -714,10 +661,7 @@
|
||||
sertifikat: row.querySelector('input[name="fisik_sertifikat[]"]')?.value || "",
|
||||
luas_tanah: row.querySelector('input[name="fisik_luas_tanah[]"]')?.value || "",
|
||||
luas_bangunan: row.querySelector('input[name="fisik_luas_bangunan[]"]')?.value || "",
|
||||
nilai: cleanCurrencyValue(row.querySelector('input[name="fisik_nilai[]"]')?.value || ""),
|
||||
likuidasi: row.querySelector('input[name="likuidasi[]"]')?.value || "",
|
||||
total_likuidasi: cleanCurrencyValue(row.querySelector(
|
||||
'input[name="total_nilai_likuidasi[]"]')?.value || "")
|
||||
nilai: cleanCurrencyValue(row.querySelector('input[name="fisik_nilai[]"]')?.value || "")
|
||||
};
|
||||
if (fisikData.sertifikat) {
|
||||
jsonData.fisik.push(fisikData);
|
||||
@@ -730,10 +674,7 @@
|
||||
sertifikat: row.querySelector('input[name="sesuai_sertifikat[]"]')?.value || "",
|
||||
luas_tanah: row.querySelector('input[name="sesuai_luas_tanah[]"]')?.value || "",
|
||||
luas_bangunan: row.querySelector('input[name="sesuai_luas_bangunan[]"]')?.value || "",
|
||||
nilai: cleanCurrencyValue(row.querySelector('input[name="sesuai_nilai[]"]')?.value || ""),
|
||||
likuidasi: row.querySelector('input[name="sesuai_likuidasi[]"]')?.value || "",
|
||||
total_likuidasi: cleanCurrencyValue(row.querySelector(
|
||||
'input[name="sesuai_total_likuidasi[]"]')?.value || "")
|
||||
nilai: cleanCurrencyValue(row.querySelector('input[name="sesuai_nilai[]"]')?.value || "")
|
||||
};
|
||||
if (imbData.sertifikat) {
|
||||
jsonData.sesuai_imb.push(imbData);
|
||||
@@ -747,10 +688,7 @@
|
||||
sertifikat: row.querySelector('input[name="tambahan_sertifikat[]"]')?.value || "",
|
||||
luas_tanah: row.querySelector('input[name="tambahan_luas_tanah[]"]')?.value || "",
|
||||
luas_bangunan: row.querySelector('input[name="tambahan_luas_bangunan[]"]')?.value || "",
|
||||
nilai: cleanCurrencyValue(row.querySelector('input[name="tambahan_nilai[]"]')?.value || ""),
|
||||
likuidasi: row.querySelector('input[name="tambahan_nilai_likuidasi[]"]')?.value || "",
|
||||
total_likuidasi: cleanCurrencyValue(row.querySelector(
|
||||
'input[name="tambahan_total_likuidasi[]"]')?.value || "")
|
||||
nilai: cleanCurrencyValue(row.querySelector('input[name="tambahan_nilai[]"]')?.value || "")
|
||||
};
|
||||
console.log(imbData);
|
||||
if (imbData.sertifikat) {
|
||||
@@ -784,37 +722,6 @@
|
||||
|
||||
|
||||
|
||||
function calculateTotal(element) {
|
||||
|
||||
|
||||
const row = element.closest('tr');
|
||||
|
||||
const nilaiPasarInput = row.querySelector('.nilai-pasar');
|
||||
let likuidasiInput = row.querySelector('.likuidasi');
|
||||
|
||||
const totalLikuidasiInput = row.querySelector('.total-likuidasi');
|
||||
|
||||
const cleanNilaiPasar = cleanCurrencyValue(nilaiPasarInput.value);
|
||||
let cleanLikuidasi = cleanCurrencyValue(likuidasiInput.value);
|
||||
|
||||
// Batasi likuidasi maksimal hingga 100
|
||||
cleanLikuidasi = Math.min(parseFloat(cleanLikuidasi) || 0, 100);
|
||||
|
||||
// Format nilai likuidasi dengan simbol %
|
||||
likuidasiInput.value = cleanLikuidasi;
|
||||
|
||||
// Konversi ke angka untuk perhitungan
|
||||
const nilaiPasar = parseFloat(cleanNilaiPasar) || 0;
|
||||
const likuidasi = cleanLikuidasi / 100; // Konversi persentase ke desimal
|
||||
|
||||
// Hitung total likuidasi
|
||||
const totalLikuidasi = nilaiPasar * likuidasi;
|
||||
|
||||
// Tampilkan hasil dengan format yang benar
|
||||
totalLikuidasiInput.value = formatCurrency(totalLikuidasi.toString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -38,14 +38,14 @@
|
||||
<div class="card-body ">
|
||||
<div class="w-full grid gap-5 ">
|
||||
<!-- Preview Container -->
|
||||
<div class="preview-container-{{ $index }}">
|
||||
<div class="preview-container-{{ $index }}" class="flex items-center">
|
||||
@if (isset($denah['foto_denah']))
|
||||
@php
|
||||
$fileExtension = pathinfo($denah['foto_denah'], PATHINFO_EXTENSION);
|
||||
@endphp
|
||||
|
||||
@if (in_array($fileExtension, ['jpg', 'jpeg', 'png']))
|
||||
<img src="{{ asset('storage/' . $denah['foto_denah']) }}" style="max-width: 30rem;">
|
||||
<img src="{{ asset('storage/' . $denah['foto_denah']) }}" class="max-w-full max-h-screen object-contain">
|
||||
@elseif($fileExtension === 'pdf')
|
||||
<embed src="{{ asset('storage/' . $denah['foto_denah']) }}" type="application/pdf"
|
||||
width="100%" height="500px">
|
||||
|
||||
@@ -283,11 +283,11 @@
|
||||
console.error(`Dropzone element not found: ${selector}`);
|
||||
return null;
|
||||
}
|
||||
const processedFiles = new Set();
|
||||
|
||||
myDropzone = new Dropzone(selector, {
|
||||
url: "{{ route('surveyor.storeFoto') }}",
|
||||
paramName: paramName,
|
||||
maxFilesize: 30,
|
||||
acceptedFiles: 'image/*',
|
||||
uploadMultiple: false,
|
||||
parallelUploads: 1,
|
||||
@@ -304,14 +304,40 @@
|
||||
param_name: paramName,
|
||||
nomor_registrasi: '{{ $permohonan->nomor_registrasi ?? '' }}',
|
||||
},
|
||||
accept: function(file, done) {
|
||||
// Generate a unique identifier for the file
|
||||
const fileId = file.name + '_' + file.size;
|
||||
|
||||
addedfiles: function(files) {
|
||||
uploadQueue += files.length;
|
||||
uploadBatch = Array.from(files);
|
||||
if (files.length > 0) showLoadingOverlay();
|
||||
// If file is already being processed, reject it
|
||||
if (processedFiles.has(fileId)) {
|
||||
done('File sudah dalam antrian upload.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Add file to processed set
|
||||
processedFiles.add(fileId);
|
||||
done();
|
||||
},
|
||||
|
||||
addedfiles: function(files) {
|
||||
const validFiles = Array.from(files).filter(file => {
|
||||
// Generate a unique ID for this file
|
||||
const fileId = file.name + '_' + file.size;
|
||||
|
||||
// Only count files that haven't been rejected
|
||||
return !file.rejected;
|
||||
});
|
||||
|
||||
uploadQueue += validFiles.length;
|
||||
uploadBatch = validFiles;
|
||||
|
||||
if (validFiles.length > 0) showLoadingOverlay();
|
||||
},
|
||||
error: function(file, response) {
|
||||
// Remove file from processed list on error
|
||||
const fileId = file.name + '_' + file.size;
|
||||
processedFiles.delete(fileId);
|
||||
|
||||
handleUploadComplete(file, false, response.message);
|
||||
},
|
||||
success: function(file, response) {
|
||||
@@ -333,7 +359,14 @@
|
||||
},
|
||||
|
||||
init: function() {
|
||||
// var myDropzone = this;
|
||||
const dz = this;
|
||||
|
||||
// Clear processed files when all uploads complete
|
||||
this.on("queuecomplete", function() {
|
||||
processedFiles.clear();
|
||||
});
|
||||
|
||||
// Load existing photos
|
||||
loadExistingPhotos(this, paramName);
|
||||
}
|
||||
|
||||
|
||||
@@ -280,6 +280,14 @@
|
||||
<div class="card-body w-full">
|
||||
@include('lpj::component.detail-jaminan', ['status' => true])
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label class="form-label font-medium max-w-56">Nomor NIB</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input type="text" name="nomor_nib" class="input w-full" value="{{ isset($forminspeksi['asset']['nomor_nib']) ? $forminspeksi['asset']['nomor_nib'] : '' }}"
|
||||
placeholder="Masukkan Nomor NIB">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" mx-auto rounded-lg overflow-hidden">
|
||||
<div class="py-4 ">
|
||||
<h1 class="text-md font-medium text-gray-900">Hubungan cadeb/debitur dengan Pemilik Jaminan</h1>
|
||||
|
||||
@@ -424,9 +424,11 @@
|
||||
<table>
|
||||
@if (@isset($dokumen))
|
||||
@foreach ($dokumen->detail as $detail)
|
||||
<tr>
|
||||
@if (isset($detail->dokumen_jaminan))
|
||||
@if (isset($detail->dokumen_jaminan))
|
||||
<tr>
|
||||
<td width="25%"><strong>{{ $detail->name ?? '' }}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@if (isset($detail->dokumen_jaminan))
|
||||
@php
|
||||
@@ -449,27 +451,28 @@
|
||||
@endforeach
|
||||
@endif
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
</tr>
|
||||
@endif
|
||||
|
||||
<tr>
|
||||
@if (isset($detail->details))
|
||||
@if (json_decode($detail->details))
|
||||
@foreach (json_decode($detail->details) as $key => $value)
|
||||
@if (!is_null($value) && $value !== '')
|
||||
<td style=" padding: 2px;">{{ ucwords(str_replace('_', ' ', $key)) ?? '' }}
|
||||
@if (isset($detail->details))
|
||||
@if (json_decode($detail->details))
|
||||
@foreach (json_decode($detail->details) as $key => $value)
|
||||
@if (!is_null($value) && $value !== '')
|
||||
<tr>
|
||||
<td style="padding: 2px;">
|
||||
{{ ucwords(str_replace('_', ' ', $key)) ?? '' }}
|
||||
</td>
|
||||
|
||||
<td style=" padding: 2px;">{{ $value }}
|
||||
<td style="padding: 2px;">
|
||||
{{ $value }}
|
||||
@if ($key == 'luas_bangunan' || $key == 'luas_tanah')
|
||||
<sup>m2</sup>
|
||||
@endif
|
||||
</td>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user