fix(suveyor/penilai/so): perbaikan print out, form survey dan laporan dan paparan
This commit is contained in:
@@ -75,7 +75,7 @@ class LaporanController extends Controller
|
||||
}
|
||||
|
||||
// Retrieve data from the database
|
||||
$query = Permohonan::query()->whereIn('status',['proses-laporan','done'])->whereNotNull('approval_so_at')->whereNotNull('approval_eo_at')->where(function ($q) {
|
||||
$query = Permohonan::query()->whereIn('status',['proses-laporan','done', 'paparan', 'proses-paparan'])->whereNotNull('approval_so_at')->whereNotNull('approval_eo_at')->where(function ($q) {
|
||||
$q->whereIn('nilai_plafond_id', [1,4])
|
||||
->whereNotNull('approval_dd_at')
|
||||
->orWhereIn('nilai_plafond_id', [2,3]);
|
||||
|
||||
@@ -496,7 +496,7 @@ class PenilaiController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
$query->whereRaw('LOWER(status) IN (?, ?, ?, ?, ?, ?)', ['assign','survey-completed', 'proses-laporan', 'paparan', 'proses-paparan','paparan']);
|
||||
$query->whereRaw('LOWER(status) IN (?, ?, ?, ?, ?, ?,?)', ['assign','survey-completed', 'proses-laporan', 'paparan', 'proses-paparan','paparan', 'revisi-laporan']);
|
||||
|
||||
if (!Auth::user()->hasRole('administrator')) {
|
||||
$query->whereHas('penilaian.userPenilai', function ($q) {
|
||||
@@ -775,20 +775,23 @@ class PenilaiController extends Controller
|
||||
public function storeResume(Request $request)
|
||||
{
|
||||
try {
|
||||
|
||||
// dd($request->all());
|
||||
$validatedData = $request->validate([
|
||||
'permohonan_id' => 'required',
|
||||
'document_id' => 'required',
|
||||
'dokument_id' => 'required',
|
||||
'inspeksi_id' => 'required',
|
||||
'resume' => 'required|array',
|
||||
'fakta_positif' => 'nullable|array',
|
||||
'fakta_negatif' => 'nullable|array',
|
||||
'type' => 'required',
|
||||
'action' => 'required',
|
||||
'keterangan' => 'nullable|array'
|
||||
]);
|
||||
|
||||
// Simpan atau update data
|
||||
|
||||
Penilai::updateOrCreate(
|
||||
[
|
||||
'permohonan_id' => $validatedData['permohonan_id'],
|
||||
'dokument_id' => $validatedData['document_id'],
|
||||
'dokument_id' => $validatedData['dokument_id'],
|
||||
'inspeksi_id' => $validatedData['inspeksi_id'],
|
||||
],
|
||||
[
|
||||
@@ -796,10 +799,51 @@ class PenilaiController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
$inspeksi = Inspeksi::where('permohonan_id', $validatedData['permohonan_id'])
|
||||
->where('dokument_id', $validatedData['dokument_id'])
|
||||
->first();
|
||||
if ($inspeksi) {
|
||||
// Get existing data_form
|
||||
$existingData = json_decode($inspeksi->data_form, true) ?: [];
|
||||
|
||||
// Structure the fakta data correctly
|
||||
$existingFaktaData = $existingData['fakta'] ?? [];
|
||||
|
||||
// Gabungkan data baru dengan data yang sudah ada
|
||||
$updatedFaktaData = array_merge($existingFaktaData, [
|
||||
'fakta_positif' => $validatedData['fakta_positif'] ?? $existingFaktaData['fakta_positif'] ?? null,
|
||||
'fakta_negatif' => $validatedData['fakta_negatif'] ?? $existingFaktaData['fakta_negatif'] ?? null,
|
||||
'keterangan' => $validatedData['keterangan'] ?? $existingFaktaData['keterangan'] ?? null,
|
||||
]);
|
||||
$existingData['fakta'] = $updatedFaktaData;
|
||||
|
||||
$inspeksi->update([
|
||||
'data_form' => json_encode($existingData),
|
||||
]);
|
||||
} else {
|
||||
// If inspeksi
|
||||
$newData = [
|
||||
'fakta' => [
|
||||
'fakta_positif' => $validatedData['fakta_positif'] ?? null,
|
||||
'fakta_negatif' => $validatedData['fakta_negatif'] ?? null,
|
||||
'keterangan' => $validatedData['keterangan'] ?? null,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
|
||||
Inspeksi::create([
|
||||
'permohonan_id' => $validatedData['permohonan_id'],
|
||||
'dokument_id' => $validatedData['dokument_id'],
|
||||
'data_form' => json_encode($newData),
|
||||
'name' => $validatedData['type']
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Berhasil saved resume'
|
||||
'message' => 'Berhasil saved resume',
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
@@ -1332,8 +1376,6 @@ class PenilaiController extends Controller
|
||||
|
||||
$validationRules = [
|
||||
'resume' => [
|
||||
'fakta.fakta_positif',
|
||||
'fakta.fakta_negatif',
|
||||
'fisik'
|
||||
],
|
||||
];
|
||||
@@ -1498,5 +1540,20 @@ class PenilaiController extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function revisiSurveyor(Request $request, $id)
|
||||
{
|
||||
$permohonan = Permohonan::findOrFail($id);
|
||||
$permohonan->update([
|
||||
'status' => 'revisi-survey',
|
||||
'keterangan' => $request->message,
|
||||
'submitted_at' => now()
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Berhasil Revisi Ke surveyor',
|
||||
], 200);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ use Modules\Lpj\Models\StatusPermohonan;
|
||||
use Modules\Lpj\Models\Teams;
|
||||
use Modules\Lpj\Models\Inspeksi;
|
||||
use Modules\Lpj\Models\Penilai;
|
||||
use Modules\Lpj\Models\Regions;
|
||||
use Modules\Location\Models\Province;
|
||||
use Modules\Location\Models\City;
|
||||
use Modules\Location\Models\District;
|
||||
@@ -26,6 +27,7 @@ use Modules\Lpj\Http\Controllers\SurveyorController;
|
||||
use Modules\Lpj\Http\Controllers\PenilaiController;
|
||||
use Modules\Lpj\Http\Requests\FormSurveyorRequest;
|
||||
|
||||
|
||||
class PenilaianController extends Controller
|
||||
{
|
||||
public $user;
|
||||
@@ -404,6 +406,8 @@ class PenilaianController extends Controller
|
||||
'paparan' => 'Paparan'
|
||||
];
|
||||
|
||||
$regions = Regions::all();
|
||||
|
||||
$header = $headers[$type] ?? 'Pelaporan';
|
||||
|
||||
switch ($header) {
|
||||
@@ -412,7 +416,7 @@ class PenilaianController extends Controller
|
||||
case 'Paparan':
|
||||
return view('lpj::penilaian.paparan-so', compact('header'));
|
||||
default:
|
||||
return view('lpj::penilaian.otorisator.index', compact('header'));
|
||||
return view('lpj::penilaian.otorisator.index', compact('header', 'regions'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -634,6 +638,7 @@ class PenilaianController extends Controller
|
||||
// Pencarian berdasarkan parameter search
|
||||
if ($request->has('search') && !empty($request->get('search'))) {
|
||||
$search = $request->get('search');
|
||||
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('nomor_registrasi', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%');
|
||||
@@ -641,6 +646,7 @@ class PenilaianController extends Controller
|
||||
$q->orWhereRelation('debiture', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('region', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('status', 'LIKE', '%' . $search . '%');
|
||||
});
|
||||
}
|
||||
@@ -661,11 +667,27 @@ class PenilaianController extends Controller
|
||||
}
|
||||
|
||||
// Filter berdasarkan region user yang login
|
||||
if ($status == 'proses-laporan') {
|
||||
$requestedRegion = $request->get('search');
|
||||
|
||||
if ($requestedRegion) {
|
||||
$query->whereHas('region', function ($q) use ($requestedRegion) {
|
||||
$q->where('name', $requestedRegion);
|
||||
});
|
||||
} else {
|
||||
$query->whereHas('region.teams.teamsUsers', function ($q) {
|
||||
$q->where('user_id', Auth::id());
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (Auth::user()->hasRole('senior-officer')) {
|
||||
$query->whereHas('region.teams.teamsUsers', function ($q) {
|
||||
$q->where('user_id', Auth::id());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Sorting berdasarkan sortField dan sortOrder
|
||||
|
||||
@@ -82,13 +82,17 @@ use Modules\Lpj\Http\Requests\FormSurveyorRequest;
|
||||
use Modules\Lpj\Emails\SendJadwalKunjunganEmail;
|
||||
use App\Helpers\Lpj;
|
||||
use Modules\Lpj\Models\Authorization;
|
||||
use Modules\Lpj\Services\SurveyorValidateService;
|
||||
|
||||
class SurveyorController extends Controller
|
||||
{
|
||||
public $user;
|
||||
public $validateService;
|
||||
|
||||
|
||||
|
||||
public function __construct(SurveyorValidateService $validateService)
|
||||
{
|
||||
$this->validateService = $validateService;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
@@ -156,11 +160,12 @@ class SurveyorController extends Controller
|
||||
/**
|
||||
* Store form inspeksi.
|
||||
*/
|
||||
public function store(FormSurveyorRequest $request)
|
||||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
// Validate request data
|
||||
$validatedData = $request->validated();
|
||||
$validatedData = $request->all();
|
||||
|
||||
|
||||
// Get action specific rules and process data
|
||||
$processedData = $this->getActionSpecificRules(
|
||||
@@ -237,6 +242,9 @@ class SurveyorController extends Controller
|
||||
$rules = [];
|
||||
$hasAssetDescriptionRules = false;
|
||||
$hasFactaData = false;
|
||||
|
||||
|
||||
|
||||
$pisah = array_filter(
|
||||
explode(',', $action),
|
||||
function ($act) use ($allowedActions) {
|
||||
@@ -244,22 +252,29 @@ class SurveyorController extends Controller
|
||||
}
|
||||
);
|
||||
|
||||
// dd($pisah);
|
||||
|
||||
foreach ($pisah as $act) {
|
||||
$act = trim($act);
|
||||
$act = trim($act); // Bersihkan spasi
|
||||
if (isset($allowedActions[$act])) {
|
||||
$method = $allowedActions[$act];
|
||||
|
||||
$actionRules = $this->$method($data, $request);
|
||||
$rules = array_merge($rules, $actionRules);
|
||||
|
||||
// Cek apakah act memerlukan asset description rules
|
||||
if (in_array($act, ['apartemen-kantor', 'tanah', 'bangunan', 'rap'])) {
|
||||
$hasAssetDescriptionRules = true;
|
||||
}
|
||||
|
||||
// Cek apakah act memerlukan fakta data
|
||||
if (in_array($act, ['rap'])) {
|
||||
$hasFactaData = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($hasAssetDescriptionRules) {
|
||||
$rules = array_merge($rules, $this->getAssetData($data));
|
||||
}
|
||||
@@ -503,38 +518,41 @@ class SurveyorController extends Controller
|
||||
// Generate a unique timestamp for this batch
|
||||
$batchTimestamp = time();
|
||||
|
||||
// Create a lookup map of existing file names for faster checking
|
||||
$existingFileNames = [];
|
||||
if (isset($formatFotojson[$paramName]) && is_array($formatFotojson[$paramName])) {
|
||||
foreach ($formatFotojson[$paramName] as $existingFile) {
|
||||
if (isset($existingFile['name'])) {
|
||||
$existingFileNames[$existingFile['name']] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($files as $index => $file) {
|
||||
$originalName = $file->getClientOriginalName();
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
$fileNameWithoutExt = pathinfo($originalName, PATHINFO_FILENAME);
|
||||
|
||||
// Validasi nama file
|
||||
if (empty($originalName)) {
|
||||
$originalName = "file_{$batchTimestamp}";
|
||||
if (empty($fileNameWithoutExt)) {
|
||||
$fileNameWithoutExt = "file_{$batchTimestamp}_{$index}";
|
||||
}
|
||||
|
||||
// Use batchTimestamp and index to ensure uniqueness
|
||||
// Check if this file name already exists in formatFotojson
|
||||
if (isset($existingFileNames[$fileNameWithoutExt])) {
|
||||
// File already exists, skip it
|
||||
continue;
|
||||
}
|
||||
|
||||
// Use batchTimestamp and index to ensure uniqueness in storage
|
||||
$uniqueFileName = "{$batchTimestamp}_{$index}.{$extension}";
|
||||
|
||||
// Simpan file
|
||||
$path = $file->storeAs("surveyor/{$paramName}/{$nomor_registrasi}", $uniqueFileName, 'public');
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only add if this file doesn't already exist
|
||||
if (!$fileExists) {
|
||||
// Add file data
|
||||
$fotoData = [
|
||||
'name' => pathinfo($originalName, PATHINFO_FILENAME),
|
||||
'name' => $fileNameWithoutExt,
|
||||
'path' => $path,
|
||||
'category' => 'lainnya',
|
||||
'sub' => null,
|
||||
@@ -544,7 +562,9 @@ class SurveyorController extends Controller
|
||||
];
|
||||
|
||||
$formatFotoData[] = $fotoData;
|
||||
}
|
||||
|
||||
// Add to the lookup map to prevent duplicates within the same batch
|
||||
$existingFileNames[$fileNameWithoutExt] = true;
|
||||
}
|
||||
|
||||
// Only update if we have new photos to add
|
||||
@@ -756,6 +776,7 @@ class SurveyorController extends Controller
|
||||
$buttonStatusCheck = $this->checkButtonStatus($id);
|
||||
$buttonStatus = json_decode($buttonStatusCheck->getContent(), true);
|
||||
|
||||
|
||||
// Check if button should be disabled
|
||||
if ($buttonStatus['buttonDisable']) {
|
||||
return response()->json([
|
||||
@@ -764,19 +785,57 @@ class SurveyorController extends Controller
|
||||
], 422);
|
||||
}
|
||||
|
||||
$inspeksiRecords = Inspeksi::with(['dokument.jenisJaminan'])
|
||||
->where('permohonan_id', $id)
|
||||
->get();
|
||||
|
||||
|
||||
$validateConfig = [
|
||||
'tanah' => 'validateTanah',
|
||||
'bangunan' => 'validateBangunan',
|
||||
'lingkungan' => 'validateLingkungan',
|
||||
'fakta' => 'validateFactData',
|
||||
'rap' => 'validateRapData',
|
||||
];
|
||||
|
||||
// Ambil data inspeksi
|
||||
$inspeksiRecords = Inspeksi::with(['dokument.jenisJaminan'])
|
||||
->where('permohonan_id', $id)
|
||||
->get();
|
||||
|
||||
foreach ($inspeksiRecords as $inspeksi) {
|
||||
$cekname = $inspeksi->name;
|
||||
|
||||
// Pecah nama menjadi array
|
||||
$names = array_map('trim', explode(',', $cekname));
|
||||
$dataForm = json_decode($inspeksi->data_form, true);
|
||||
|
||||
foreach ($names as $name) {
|
||||
// Validasi hanya untuk nama yang ada dalam konfigurasi
|
||||
if (array_key_exists($name, $validateConfig)) {
|
||||
$validateMethod = $validateConfig[$name];
|
||||
$invalidFields = $this->validateService->{$validateMethod}($dataForm);
|
||||
|
||||
// Jika validasi gagal, kembalikan respons error
|
||||
if ($invalidFields) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => ucfirst($name) . ' tidak valid: ' . implode(', ', $invalidFields),
|
||||
], 422);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If validation passes, update permohonan status
|
||||
$permohonan = Permohonan::findOrFail($id);
|
||||
|
||||
|
||||
|
||||
$permohonan->update([
|
||||
'status' => 'survey-completed',
|
||||
'submitted_at' => now()
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Form surveyor berhasil disubmit'
|
||||
@@ -1384,7 +1443,8 @@ class SurveyorController extends Controller
|
||||
'type' => $request->input('type'),
|
||||
'dokument_id' => $request->input('dokument_id'),
|
||||
'objek_penilaian' => $objekPenilaian,
|
||||
'data_pembanding' => $this->formatDataPembanding($request)
|
||||
'data_pembanding' => $this->formatDataPembanding($request),
|
||||
'keterangan' => $request->input('keterangan')
|
||||
];
|
||||
|
||||
|
||||
@@ -1974,7 +2034,7 @@ class SurveyorController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
$query->whereRaw('LOWER(status) IN (?, ?, ?, ?, ?, ? ,?,?)', ['assign', 'survey', 'proses-survey', 'request-reschedule', 'reschedule', 'rejected-reschedule', 'approved-reschedule', 'revisi-laporan' ]);
|
||||
$query->whereRaw('LOWER(status) IN (?, ?, ?, ?, ?, ? ,?,?)', ['assign', 'survey', 'proses-survey', 'request-reschedule', 'reschedule', 'rejected-reschedule', 'approved-reschedule', 'revisi-survey' ]);
|
||||
|
||||
|
||||
if (!Auth::user()->hasRole('administrator')) {
|
||||
@@ -2295,7 +2355,7 @@ class SurveyorController extends Controller
|
||||
'province_code' => $data['province_code'] ?? null,
|
||||
];
|
||||
|
||||
$alamatKey = ($data['alamat_sesuai'] === 'sesuai') ? 'sesuai' : 'tidak sesuai';
|
||||
$alamatKey = ($data['alamat_sesuai'] ?? null) === 'sesuai' ? 'sesuai' : 'tidak sesuai';
|
||||
$alamat = [];
|
||||
|
||||
// Masukkan key baru yang sesuai
|
||||
@@ -2304,21 +2364,27 @@ class SurveyorController extends Controller
|
||||
'asset' => [
|
||||
'debitur_perwakilan' => $data['debitur_perwakilan'] ?? [],
|
||||
'jenis_asset' => [
|
||||
$data['jenis_asset'] => ($data['jenis_asset'] === 'sesuai')
|
||||
? $data['jenis_asset_name']
|
||||
$data['jenis_asset'] ?? null => ($data['jenis_asset'] ?? null) === 'sesuai'
|
||||
? ($data['jenis_asset_name'] ?? null)
|
||||
: ($data['jenis_asset_tidak_sesuai'] ?? null)
|
||||
],
|
||||
'alamat' => $alamat,
|
||||
'hub_cadeb' => [
|
||||
$data['hub_cadeb'] => ($data['hub_cadeb'] == 'sesuai') ? $data['hub_cadeb_sesuai'] : $data['hub_cadeb_tidak_sesuai']
|
||||
$data['hub_cadeb'] ?? null => ($data['hub_cadeb'] ?? null) === 'sesuai'
|
||||
? ($data['hub_cadeb_sesuai'] ?? null)
|
||||
: ($data['hub_cadeb_tidak_sesuai'] ?? null)
|
||||
],
|
||||
'hub_cadeb_penghuni' => [
|
||||
$data['hub_cadeb_penghuni'] => ($data['hub_cadeb_penghuni'] == 'sesuai') ? $data['hub_cadeb_penghuni_sesuai'] : $data['hub_penghuni_tidak_sesuai']
|
||||
$data['hub_cadeb_penghuni'] ?? null => ($data['hub_cadeb_penghuni'] ?? null) === 'sesuai'
|
||||
? ($data['hub_cadeb_penghuni_sesuai'] ?? null)
|
||||
: ($data['hub_penghuni_tidak_sesuai'] ?? null)
|
||||
],
|
||||
|
||||
'pihak_bank' => $data['pihak_bank'] ?? null,
|
||||
|
||||
'kordinat_lng' => $data['kordinat_lng'] ?? null,
|
||||
'kordinat_lat' => $data['kordinat_lat'] ?? null,
|
||||
'nomor_nib' => $data['nomor_nib'] ?? null
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -2326,17 +2392,23 @@ class SurveyorController extends Controller
|
||||
private function getTanahData(array $data): array
|
||||
{
|
||||
//luas tanah key
|
||||
$luas_tanah_key = ($data['luas_tanah'] === 'sesuai') ? 'sesuai' : 'tidak sesuai';
|
||||
// Luas tanah key
|
||||
$luas_tanah_key = ($data['luas_tanah'] ?? null) === 'sesuai' ? 'sesuai' : 'tidak sesuai';
|
||||
$luas_tanah = [];
|
||||
$hasil_tanah = $luas_tanah_key === 'sesuai' ? $data['luas_tanah_sesuai'] : $data['luas_tanah_tidak_sesuai'];
|
||||
$hasil_tanah = $luas_tanah_key === 'sesuai'
|
||||
? ($data['luas_tanah_sesuai'] ?? null)
|
||||
: ($data['luas_tanah_tidak_sesuai'] ?? null);
|
||||
$luas_tanah[$luas_tanah_key] = $hasil_tanah;
|
||||
|
||||
// hadap mata angin
|
||||
$hadap_mata_angin_key = ($data['hadap_mata_angin'] === 'sesuai') ? 'sesuai' : 'tidak sesuai';
|
||||
// Hadap mata angin key
|
||||
$hadap_mata_angin_key = ($data['hadap_mata_angin'] ?? null) === 'sesuai' ? 'sesuai' : 'tidak sesuai';
|
||||
$hadap_mata_angin = [];
|
||||
$hasil_hadap_mata_angin = $hadap_mata_angin_key === 'sesuai' ? $data['hadap_mata_angin_sesuai'] : $data['hadap_mata_angin_tidak_sesuai'];
|
||||
$hasil_hadap_mata_angin = $hadap_mata_angin_key === 'sesuai'
|
||||
? ($data['hadap_mata_angin_sesuai'] ?? null)
|
||||
: ($data['hadap_mata_angin_tidak_sesuai'] ?? null);
|
||||
$hadap_mata_angin[$hadap_mata_angin_key] = $hasil_hadap_mata_angin;
|
||||
|
||||
|
||||
return [
|
||||
'tanah' => [
|
||||
'luas_tanah' => $luas_tanah,
|
||||
@@ -2415,14 +2487,17 @@ class SurveyorController extends Controller
|
||||
|
||||
|
||||
|
||||
$luas_tanah_bagunan_key = ($data['luas_tanah_bagunan'] === 'sesuai') ? 'sesuai' : 'tidak sesuai';
|
||||
$luas_tanah_bagunan_key = ($data['luas_tanah_bagunan'] ?? null) === 'sesuai' ? 'sesuai' : 'tidak sesuai';
|
||||
$luas_tanah_bagunan = [];
|
||||
|
||||
$hasil_tanah_bagunan = $luas_tanah_bagunan_key === 'sesuai' ? $data['luas_bangunan_sesuai'] : $data['luas_tanah_bagunan_tidak_sesuai'];
|
||||
$hasil_tanah_bagunan = $luas_tanah_bagunan_key === 'sesuai'
|
||||
? ($data['luas_bangunan_sesuai'] ?? null)
|
||||
: ($data['luas_tanah_bagunan_tidak_sesuai'] ?? null);
|
||||
|
||||
// Masukkan key baru yang sesuai
|
||||
$luas_tanah_bagunan[$luas_tanah_bagunan_key] = $hasil_tanah_bagunan;
|
||||
|
||||
|
||||
return [
|
||||
'bangunan' => [
|
||||
'luas_tanah_bagunan' => $luas_tanah_bagunan,
|
||||
@@ -2461,10 +2536,11 @@ class SurveyorController extends Controller
|
||||
false,
|
||||
'lainnya'
|
||||
),
|
||||
'disekitar_lokasi' => $data['disekitar_lokasi'] === 'yes' ? [
|
||||
'disekitar_lokasi' => ($data['disekitar_lokasi'] ?? null) === 'yes' ? [
|
||||
'kondisi' => $data['kondisi_bagunan_disekitar_lokasi'] ?? null,
|
||||
'sifat' => $data['sifat_bagunan_disekitar_lokasi'] ?? null,
|
||||
] : $data['disekitar_lokasi'],
|
||||
] : ($data['disekitar_lokasi'] ?? null),
|
||||
|
||||
'kondisi_bagunan_disekitar_lokasi' => $data['kondisi_bagunan_disekitar_lokasi'] ?? null,
|
||||
'sifat_bagunan_disekitar_lokasi' => $data['sifat_bagunan_disekitar_lokasi'] ?? null,
|
||||
'dekat_makam' => $data['dekat_makam'] ?? null,
|
||||
|
||||
392
app/Services/SurveyorValidateService.php
Normal file
392
app/Services/SurveyorValidateService.php
Normal file
@@ -0,0 +1,392 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Services;
|
||||
|
||||
class SurveyorValidateService
|
||||
{
|
||||
/**
|
||||
* Validasi data asset
|
||||
*
|
||||
* @param array $assetData
|
||||
* @return string
|
||||
*/
|
||||
public function validateAsset(array $assetData): array
|
||||
{
|
||||
$invalidFields = [];
|
||||
|
||||
// Validasi data `debitur_perwakilan`
|
||||
if (empty($assetData['asset']['debitur_perwakilan'])) {
|
||||
$invalidFields[] = 'debitur perwakilan';
|
||||
}
|
||||
|
||||
// Validasi data `jenis_asset`
|
||||
$jenisAsset = $assetData['asset']['jenis_asset'] ?? [];
|
||||
foreach ($jenisAsset as $key => $value) {
|
||||
if (empty($key) || empty($value)) {
|
||||
$invalidFields[] = "jenis_asset[$key]";
|
||||
}
|
||||
}
|
||||
|
||||
// Validasi data `alamat`
|
||||
$alamat = $assetData['asset']['alamat'] ?? [];
|
||||
foreach ($alamat as $key => $alamatData) {
|
||||
if (empty($key)) {
|
||||
$invalidFields[] = "alamat[$key]";
|
||||
}
|
||||
|
||||
foreach ($alamatData as $field => $value) {
|
||||
if (empty($value)) {
|
||||
$invalidFields[] = "alamat[$key][$field]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validasi data `hub_cadeb`
|
||||
$hubCadeb = $assetData['asset']['hub_cadeb'] ?? [];
|
||||
foreach ($hubCadeb as $key => $value) {
|
||||
if (empty($key) || empty($value)) {
|
||||
$invalidFields[] = "Hubungan cadeb/debitur dengan Pemilik Jaminan";
|
||||
}
|
||||
}
|
||||
|
||||
// Validasi data `hub_cadeb_penghuni`
|
||||
$hubCadebPenghuni = $assetData['asset']['hub_cadeb_penghuni'] ?? [];
|
||||
foreach ($hubCadebPenghuni as $key => $value) {
|
||||
if (empty($key) || empty($value)) {
|
||||
$invalidFields[] = "Hubungan Cadeb/Debitur dengan Penghuni Jaminan";
|
||||
}
|
||||
}
|
||||
|
||||
// Validasi data tambahan lainnya
|
||||
$fieldsToValidate = [
|
||||
'pihak_bank',
|
||||
'kordinat_lng',
|
||||
'kordinat_lat',
|
||||
'nomor_nib',
|
||||
];
|
||||
|
||||
foreach ($fieldsToValidate as $field) {
|
||||
if (empty($assetData['asset'][$field])) {
|
||||
$invalidFields[] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
// validasi signature
|
||||
|
||||
$signature = [
|
||||
'penilai',
|
||||
'cabang',
|
||||
'debitur',
|
||||
];
|
||||
foreach ($signature as $value) {
|
||||
if (empty($assetData['signature'][$value])) {
|
||||
$invalidFields[] = 'Tanda tangan' . $value . ' tidak ada';
|
||||
}
|
||||
}
|
||||
|
||||
// Kembalikan daftar field yang tidak valid
|
||||
return $invalidFields;
|
||||
}
|
||||
|
||||
|
||||
public function validateTanah(array $data): array
|
||||
{
|
||||
$invalidFields = [];
|
||||
|
||||
if (empty($data['tanah']['luas_tanah'])) {
|
||||
$invalidFields[] = 'luas tanah';
|
||||
}
|
||||
|
||||
if (empty($data['tanah']['hadap_mata_angin'])) {
|
||||
$invalidFields[] = 'hadap mata angin';
|
||||
}
|
||||
|
||||
// Validasi bentuk tanah
|
||||
if (empty($data['tanah']['bentuk_tanah'])) {
|
||||
$invalidFields[] = 'bentuk tanah';
|
||||
}
|
||||
|
||||
// Validasi kontur tanah
|
||||
if (empty($data['tanah']['kontur_tanah'])) {
|
||||
$invalidFields[] = 'kontur tanah';
|
||||
}
|
||||
|
||||
// Validasi ketinggian tanah
|
||||
if (empty($data['tanah']['ketinggian_jalan']) && empty($data['tanah']['ketinggian_lebih_tinggi']) && empty($data['tanah']['ketinggian_lebih_rendah'])) {
|
||||
$invalidFields[] = 'ketinggian tanah';
|
||||
}
|
||||
|
||||
// Validasi kontur jalan
|
||||
if (empty($data['tanah']['kontur_jalan'])) {
|
||||
$invalidFields[] = 'kontur jalan';
|
||||
}
|
||||
|
||||
// Validasi posisi kavling
|
||||
if (empty($data['tanah']['posisi_kavling'])) {
|
||||
$invalidFields[] = 'posisi kavling';
|
||||
}
|
||||
|
||||
// Validasi tusuk sate
|
||||
if (!isset($data['tanah']['tusuk_sate'])) {
|
||||
$invalidFields[] = 'tusuk sate';
|
||||
}
|
||||
|
||||
// Validasi lockland
|
||||
if (!isset($data['tanah']['lockland'])) {
|
||||
$invalidFields[] = 'lockland';
|
||||
}
|
||||
|
||||
// Validasi kondisi fisik tanah
|
||||
if (empty($data['tanah']['kondisi_fisik_tanah'])) {
|
||||
$invalidFields[] = 'kondisi fisik tanah';
|
||||
}
|
||||
|
||||
return $invalidFields;
|
||||
}
|
||||
|
||||
|
||||
public function validateBangunan(array $data): array
|
||||
{
|
||||
$invalidFields = [];
|
||||
|
||||
// Validasi luas tanah banguna
|
||||
|
||||
if (empty($data['bangunan']['luas_tanah_bagunan'])) {
|
||||
$invalidFields[] = 'luas bangunan';
|
||||
}
|
||||
|
||||
|
||||
// Validasi jenis bangunan
|
||||
if (empty($data['bangunan']['jenis_bangunan'])) {
|
||||
$invalidFields[] = 'jenis bangunan';
|
||||
}
|
||||
|
||||
// Validasi kondisi bangunan
|
||||
if (empty($data['bangunan']['kondisi_bangunan'])) {
|
||||
$invalidFields[] = 'kondisi bangunan';
|
||||
}
|
||||
|
||||
// Validasi sifat bangunan
|
||||
if (empty($data['bangunan']['sifat_bangunan'])) {
|
||||
$invalidFields[] = 'sifat bangunan';
|
||||
}
|
||||
|
||||
// Validasi sifat bangunan input
|
||||
if (empty($data['bangunan']['sifat_bangunan_input'])) {
|
||||
$invalidFields[] = 'sifat bangunan input';
|
||||
}
|
||||
|
||||
// Validasi sarana pelengkap
|
||||
if (empty($data['bangunan']['sarana_pelengkap'])) {
|
||||
$invalidFields[] = 'sarana pelengkap';
|
||||
}
|
||||
|
||||
// Validasi sarana pelengkap input
|
||||
if (empty($data['bangunan']['sarana_pelengkap_input'])) {
|
||||
$invalidFields[] = 'sarana pelengkap input';
|
||||
}
|
||||
|
||||
return $invalidFields;
|
||||
}
|
||||
|
||||
public function validateLingkungan(array $data): array
|
||||
{
|
||||
$invalidFields = [];
|
||||
|
||||
// Validasi jarak jalan utama
|
||||
if (empty($data['lingkungan']['jarak_jalan_utama'])) {
|
||||
$invalidFields[] = 'jarak jalan utama';
|
||||
}
|
||||
|
||||
// Validasi jalan lingkungan
|
||||
if (empty($data['lingkungan']['jalan_linkungan'])) {
|
||||
$invalidFields[] = 'jalan lingkungan';
|
||||
}
|
||||
|
||||
// Validasi jarak CBD point
|
||||
if (empty($data['lingkungan']['jarak_cbd_point'])) {
|
||||
$invalidFields[] = 'jarak CBD point';
|
||||
}
|
||||
|
||||
// Validasi nama CBD point
|
||||
if (empty($data['lingkungan']['nama_cbd_point'])) {
|
||||
$invalidFields[] = 'nama CBD point';
|
||||
}
|
||||
|
||||
// Validasi lebar perkerasan jalan
|
||||
if (empty($data['lingkungan']['lebar_perkerasan_jalan'])) {
|
||||
$invalidFields[] = 'lebar perkerasan jalan';
|
||||
}
|
||||
|
||||
// Validasi perkerasan jalan
|
||||
if (empty($data['lingkungan']['perkerasan_jalan'])) {
|
||||
$invalidFields[] = 'perkerasan jalan';
|
||||
}
|
||||
|
||||
// Validasi lalu lintas
|
||||
if (empty($data['lingkungan']['lalu_lintas'])) {
|
||||
$invalidFields[] = 'lalu lintas';
|
||||
}
|
||||
|
||||
// Validasi golongan masyarakat sekitar
|
||||
if (empty($data['lingkungan']['gol_mas_sekitar'])) {
|
||||
$invalidFields[] = 'golongan masyarakat sekitar';
|
||||
}
|
||||
|
||||
// Validasi tingkat keramaian
|
||||
if (empty($data['lingkungan']['tingkat_keramaian'])) {
|
||||
$invalidFields[] = 'tingkat keramaian';
|
||||
}
|
||||
|
||||
// Validasi terletak di area
|
||||
if (empty($data['lingkungan']['terletak_diarea'])) {
|
||||
$invalidFields[] = 'terletak di area';
|
||||
}
|
||||
|
||||
// Validasi lokasi sekitar
|
||||
if (isset($data['lingkungan']['disekitar_lokasi']) && $data['lingkungan']['disekitar_lokasi'] === 'yes') {
|
||||
if (empty($data['lingkungan']['kondisi_bagunan_disekitar_lokasi'])) {
|
||||
$invalidFields[] = 'kondisi bangunan di sekitar lokasi';
|
||||
}
|
||||
|
||||
if (empty($data['lingkungan']['sifat_bagunan_disekitar_lokasi'])) {
|
||||
$invalidFields[] = 'sifat bangunan di sekitar lokasi';
|
||||
}
|
||||
}
|
||||
|
||||
// Validasi dekat makam
|
||||
if (isset($data['lingkungan']['dekat_makam']) && $data['lingkungan']['dekat_makam'] === 'yes') {
|
||||
if (empty($data['lingkungan']['jarak_makam'])) {
|
||||
$invalidFields[] = 'jarak makam';
|
||||
}
|
||||
|
||||
if (empty($data['lingkungan']['nama_makam'])) {
|
||||
$invalidFields[] = 'nama makam';
|
||||
}
|
||||
}
|
||||
|
||||
// Validasi dekat TPS
|
||||
if (isset($data['lingkungan']['dekat_tps']) && $data['lingkungan']['dekat_tps'] === 'yes') {
|
||||
if (empty($data['lingkungan']['jarak_tps'])) {
|
||||
$invalidFields[] = 'jarak TPS';
|
||||
}
|
||||
|
||||
if (empty($data['lingkungan']['nama_tps'])) {
|
||||
$invalidFields[] = 'nama TPS';
|
||||
}
|
||||
}
|
||||
|
||||
// Validasi fasilitas dekat object
|
||||
if (empty($data['lingkungan']['fasilitas_dekat_object'])) {
|
||||
$invalidFields[] = 'fasilitas dekat object';
|
||||
}
|
||||
|
||||
// Validasi fasilitas dekat object input
|
||||
if (empty($data['lingkungan']['fasilitas_dekat_object_input'])) {
|
||||
$invalidFields[] = 'fasilitas dekat object input';
|
||||
}
|
||||
|
||||
return $invalidFields;
|
||||
}
|
||||
|
||||
|
||||
public function validateFactData(array $data): array
|
||||
{
|
||||
$invalidFields = [];
|
||||
|
||||
// Validasi fakta_positif dan fakta_negatif
|
||||
if (empty($data['fakta']['fakta_positif'])) {
|
||||
$invalidFields[] = 'fakta_positif harus diisi';
|
||||
}
|
||||
if (empty($data['fakta']['fakta_negatif'])) {
|
||||
$invalidFields[] = 'fakta_negatif harus diisi';
|
||||
}
|
||||
|
||||
// Validasi rute_menuju
|
||||
if (empty($data['fakta']['rute_menuju'])) {
|
||||
$invalidFields[] = 'rute_menuju harus diisi';
|
||||
}
|
||||
|
||||
// Validasi batas_batas dan batas_batas_input
|
||||
if (empty($data['fakta']['batas_batas']) && empty($data['fakta']['batas_batas_input'])) {
|
||||
$invalidFields[] = 'Batas batas';
|
||||
}
|
||||
|
||||
// Validasi kondisi_lingkungan
|
||||
if (empty($data['fakta']['kondisi_lingkungan'])) {
|
||||
$invalidFields[] = 'kondisi_lingkungan harus diisi';
|
||||
}
|
||||
|
||||
return $invalidFields;
|
||||
}
|
||||
|
||||
|
||||
public function validateRapData(array $data): array
|
||||
{
|
||||
$invalidFields = [];
|
||||
|
||||
// Validasi pengalaman_developer
|
||||
if (empty($data['pengalaman_developer'])) {
|
||||
$invalidFields[] = 'Pengalaman developer harus diisi';
|
||||
}
|
||||
|
||||
// Validasi kondisi_perumahan
|
||||
if (empty($data['kondisi_perumahan'])) {
|
||||
$invalidFields[] = 'Kondisi perumahan harus diisi';
|
||||
}
|
||||
|
||||
// Validasi progres_pembangunan
|
||||
if (empty($data['progres_pembangunan'])) {
|
||||
$invalidFields[] = 'Progres pembangunan harus diisi';
|
||||
}
|
||||
|
||||
// Validasi partisi
|
||||
if (isset($data['partisi'])) {
|
||||
foreach ($data['partisi'] as $name => $values) {
|
||||
if (empty($values['value'])) {
|
||||
$invalidFields[] = "Partisi '{$name}' harus memiliki nilai";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validasi jumlah_unit
|
||||
if (empty($data['jumlah_unit'])) {
|
||||
$invalidFields[] = 'Jumlah unit harus diisi';
|
||||
}
|
||||
|
||||
// Validasi batas_batas_perumahan
|
||||
if (empty($data['batas_batas_perumahan'])) {
|
||||
$invalidFields[] = 'Batas batas perumahan harus diisi';
|
||||
}
|
||||
|
||||
// Validasi fasus_fasum
|
||||
if (empty($data['fasus_fasum'])) {
|
||||
$invalidFields[] = 'Fasus fasum harus diisi';
|
||||
}
|
||||
|
||||
// Validasi harga_unit
|
||||
if (empty($data['harga_unit'])) {
|
||||
$invalidFields[] = 'Harga unit harus diisi';
|
||||
}
|
||||
|
||||
// Validasi target_market
|
||||
if (empty($data['target_market'])) {
|
||||
$invalidFields[] = 'Target market harus diisi';
|
||||
}
|
||||
|
||||
// Validasi kerjasama_dengan_bank
|
||||
if (empty($data['kerjasama_dengan_bank'])) {
|
||||
$invalidFields[] = 'Kerjasama dengan bank harus diisi';
|
||||
}
|
||||
|
||||
// Validasi rute_menuju_lokasi
|
||||
if (empty($data['rute_menuju_lokasi'])) {
|
||||
$invalidFields[] = 'Rute menuju lokasi harus diisi';
|
||||
}
|
||||
|
||||
return $invalidFields;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -662,8 +662,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tambah mb-10" id="tambah-npw" style="margin-bottom: 20px;">
|
||||
<button type="button" class="btn btn-primary">
|
||||
<div class="tambah mb-10" style="margin-bottom: 20px;">
|
||||
<button type="button" id="tambah-npw" class="btn btn-primary">
|
||||
<i class="ki-filled ki-plus"></i>
|
||||
Tambah NPW </button>
|
||||
</div>
|
||||
@@ -1000,88 +1000,100 @@
|
||||
}
|
||||
|
||||
function calculateTotal() {
|
||||
const parseInput = (value) => parseFloat(value.replace(/[^0-9]/g, '')) || 0;
|
||||
const parseInput = (value) => {
|
||||
if (!value) return 0;
|
||||
return parseFloat(value.replace(/[^0-9]/g, '')) || 0;
|
||||
};
|
||||
|
||||
// Bagian Likuidasi
|
||||
let persentaseLikuidasiInput = document.getElementById('likuidasi');
|
||||
let persentaseLikuidasi = parseInput(persentaseLikuidasiInput.value);
|
||||
persentaseLikuidasiInput.value = formatPercentage(persentaseLikuidasiInput.value);
|
||||
// Function to format currency
|
||||
function formatCurrency(value) {
|
||||
// Ensure we have a valid number to format
|
||||
const num = parseFloat(value.replace(/[^0-9]/g, '')) || 0;
|
||||
return num.toLocaleString('id-ID');
|
||||
}
|
||||
|
||||
let totalNilaiPasarLikuidasi = document.querySelector('input[name="likuidasi_nilai_1"]');
|
||||
let totalLikuidasi = document.querySelector('input[name="likuidasi_nilai_2"]');
|
||||
|
||||
// Bagian Asuransi
|
||||
let luasBangunanAsuransi = parseInput(document.getElementById('asuransi_luas_bangunan').value);
|
||||
let hargaPerMeterAsuransi = parseInput(document.querySelector('input[name="asuransi_nilai_1"]').value);
|
||||
let totalNilaiAsuransi = document.querySelector('input[name="asuransi_nilai_2"]');
|
||||
|
||||
// Perhitungan Asuransi
|
||||
const hasilAsuransi = luasBangunanAsuransi * hargaPerMeterAsuransi;
|
||||
// Function to format percentage
|
||||
function formatPercentage(value) {
|
||||
if (!value) return '';
|
||||
const num = parseFloat(value.replace(/[^0-9.]/g, '')) || 0;
|
||||
return num.toString();
|
||||
}
|
||||
|
||||
// Calculate total nilai pasar wajar
|
||||
let totalNilaiPasarWajar = 0;
|
||||
|
||||
// Perhitungan untuk input yang sudah ada
|
||||
const jenisAsetData = @json($jenisAset);
|
||||
// Get all kategori unik elements dynamically
|
||||
const kategoriItems = document.querySelectorAll('[id^="luas_"]');
|
||||
|
||||
// Menentukan input yang akan dihitung berdasarkan jenis aset
|
||||
let standardInputs = [];
|
||||
kategoriItems.forEach(item => {
|
||||
const kategori = item.id.replace('luas_', '');
|
||||
const luasInput = document.getElementById(`luas_${kategori}`);
|
||||
const nilaiInput = document.querySelector(`input[name="nilai_${kategori}_1"]`);
|
||||
const outputElement = document.querySelector(`input[name="nilai_${kategori}_2"]`);
|
||||
|
||||
if (jenisAsetData.toUpperCase() === 'RUKO/RUKAN') {
|
||||
standardInputs = [{
|
||||
luas: 'luas_bangunan',
|
||||
nilai: 'nilai_bangunan_1',
|
||||
output: 'nilai_bangunan_2'
|
||||
}];
|
||||
} else {
|
||||
standardInputs = [{
|
||||
luas: 'luas_tanah',
|
||||
nilai: 'nilai_tanah_1',
|
||||
output: 'nilai_tanah_2'
|
||||
},
|
||||
{
|
||||
luas: 'luas_bangunan',
|
||||
nilai: 'nilai_bangunan_1',
|
||||
output: 'nilai_bangunan_2'
|
||||
if (luasInput && nilaiInput && outputElement) {
|
||||
const luas = parseInput(luasInput.value);
|
||||
const nilai = parseInput(nilaiInput.value);
|
||||
const hasil = luas * nilai;
|
||||
|
||||
outputElement.value = formatCurrency(hasil.toString());
|
||||
totalNilaiPasarWajar += hasil;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
standardInputs.forEach(input => {
|
||||
let luas = parseInput(document.getElementById(input.luas).value);
|
||||
let hargaPerMeter = parseInput(document.querySelector(`input[name="${input.nilai}"]`).value);
|
||||
let totalNilai = luas * hargaPerMeter;
|
||||
|
||||
document.querySelector(`input[name="${input.output}"]`).value = formatCurrency(totalNilai
|
||||
.toString());
|
||||
totalNilaiPasarWajar += totalNilai;
|
||||
});
|
||||
|
||||
// Tambahkan perhitungan untuk NPW tambahan
|
||||
const npwRows = document.querySelectorAll('.npw-row');
|
||||
npwRows.forEach(row => {
|
||||
let luasNPW = parseInput(row.querySelector('input[id^="luas_npw_"]').value);
|
||||
let nilaiNPW = parseInput(row.querySelector('input[id^="nilai_npw_"][id$="_1"]').value);
|
||||
let totalNilaiNPW = luasNPW * nilaiNPW;
|
||||
const luasInput = row.querySelector('input[id^="luas_npw_"]');
|
||||
const nilaiInput = row.querySelector('input[id^="nilai_npw_"][id$="_1"]');
|
||||
const outputElement = row.querySelector('input[id^="nilai_npw_"][id$="_2"]');
|
||||
|
||||
row.querySelector('input[id^="nilai_npw_"][id$="_2"]').value = formatCurrency(totalNilaiNPW
|
||||
.toString());
|
||||
totalNilaiPasarWajar += totalNilaiNPW;
|
||||
if (luasInput && nilaiInput && outputElement) {
|
||||
const luas = parseInput(luasInput.value);
|
||||
const nilai = parseInput(nilaiInput.value);
|
||||
const hasil = luas * nilai;
|
||||
|
||||
outputElement.value = formatCurrency(hasil.toString());
|
||||
totalNilaiPasarWajar += hasil;
|
||||
}
|
||||
});
|
||||
|
||||
// Update total nilai pasar wajar
|
||||
document.getElementById('total_nilai_pasar_wajar').value = formatCurrency(totalNilaiPasarWajar.toString());
|
||||
const totalElement = document.getElementById('total_nilai_pasar_wajar');
|
||||
if (totalElement) {
|
||||
totalElement.value = formatCurrency(totalNilaiPasarWajar.toString());
|
||||
}
|
||||
|
||||
// Bagian Likuidasi
|
||||
const persentaseLikuidasiInput = document.getElementById('likuidasi');
|
||||
if (persentaseLikuidasiInput) {
|
||||
let persentaseLikuidasi = parseInput(persentaseLikuidasiInput.value);
|
||||
persentaseLikuidasiInput.value = formatPercentage(persentaseLikuidasiInput.value);
|
||||
|
||||
const totalNilaiPasarLikuidasi = document.querySelector('input[name="likuidasi_nilai_1"]');
|
||||
const totalLikuidasi = document.querySelector('input[name="likuidasi_nilai_2"]');
|
||||
|
||||
if (totalNilaiPasarLikuidasi && totalLikuidasi) {
|
||||
totalNilaiPasarLikuidasi.value = formatCurrency(totalNilaiPasarWajar.toString());
|
||||
|
||||
// Perhitungan Likuidasi
|
||||
const hasilLikuidasi = (persentaseLikuidasi / 100) * totalNilaiPasarWajar;
|
||||
|
||||
// Tampilkan nilai likuidasi dan asuransi
|
||||
totalNilaiPasarLikuidasi.value = formatCurrency(totalNilaiPasarWajar.toString());
|
||||
totalNilaiAsuransi.value = formatCurrency(hasilAsuransi.toString());
|
||||
|
||||
// Total likuidasi (total nilai pasar wajar + nilai likuidasi)
|
||||
// const totalPasarWajarDenganLikuidasi = totalNilaiPasarWajar + hasilLikuidasi;
|
||||
totalLikuidasi.value = formatCurrency(hasilLikuidasi.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// Bagian Asuransi (jika ada)
|
||||
const luasBangunanAsuransi = document.getElementById('asuransi_luas_bangunan');
|
||||
const hargaPerMeterAsuransi = document.querySelector('input[name="asuransi_nilai_1"]');
|
||||
const totalNilaiAsuransi = document.querySelector('input[name="asuransi_nilai_2"]');
|
||||
|
||||
if (luasBangunanAsuransi && hargaPerMeterAsuransi && totalNilaiAsuransi) {
|
||||
const luas = parseInput(luasBangunanAsuransi.value);
|
||||
const nilai = parseInput(hargaPerMeterAsuransi.value);
|
||||
const hasilAsuransi = luas * nilai;
|
||||
|
||||
totalNilaiAsuransi.value = formatCurrency(hasilAsuransi.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -116,14 +116,14 @@
|
||||
<td>Tusuk Sate</td>
|
||||
<td>:</td>
|
||||
<td>
|
||||
{{ $forminspeksi['tanah']['tusuk_sate'] == 'yes' ? 'Ya' : 'Tidak' }}
|
||||
{{ isset($forminspeksi['tanah']['tusuk_sate']) && $forminspeksi['tanah']['tusuk_sate'] == 'yes' ? 'Ya' : 'Tidak' }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Lockland</td>
|
||||
<td>:</td>
|
||||
<td>
|
||||
{{ $forminspeksi['tanah']['lockland'] == 'yes' ? 'Ya' : 'Tidak' }}
|
||||
{{ isset($forminspeksi['tanah']['lockland']) && $forminspeksi['tanah']['lockland'] == 'yes' ? 'Ya' : 'Tidak' }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -178,8 +178,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@isset($resumeData['fakta']['fakta_positif'])
|
||||
@foreach ($resumeData['fakta']['fakta_positif'] as $key => $item)
|
||||
@isset($forminspeksi['fakta']['fakta_positif'])
|
||||
@foreach ($forminspeksi['fakta']['fakta_positif'] as $key => $item)
|
||||
<tr>
|
||||
<td>{!! nl2br(e($item)) !!}</td>
|
||||
</tr>
|
||||
@@ -195,8 +195,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@isset($resumeData['fakta']['fakta_negatif'])
|
||||
@foreach ($resumeData['fakta']['fakta_negatif'] as $key => $item)
|
||||
@isset($forminspeksi['fakta']['fakta_negatif'])
|
||||
@foreach ($forminspeksi['fakta']['fakta_negatif'] as $key => $item)
|
||||
<tr>
|
||||
<td>{!! nl2br(e($item)) !!}</td>
|
||||
</tr>
|
||||
@@ -323,9 +323,14 @@
|
||||
<h6 style="text-transform: uppercase; margin: 0; ">lain lain</h2>
|
||||
</td>
|
||||
</tr>
|
||||
@isset($forminspeksi['fakta']['keterangan'])
|
||||
@foreach ($forminspeksi['fakta']['keterangan'] as $key => $item)
|
||||
<tr>
|
||||
<td>{!! nl2br(e($resumeData['keterangan'] ?? '')) !!}</td>
|
||||
<td>{!! nl2br(e($item)) !!}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endisset
|
||||
|
||||
</table>
|
||||
|
||||
<table style="width: 100%">
|
||||
|
||||
@@ -21,9 +21,30 @@
|
||||
}
|
||||
</style>
|
||||
@include('lpj::assetsku.includenya')
|
||||
@php
|
||||
$paparan = $permohonan->status === 'proses-paparan' ? 'Paparan' : 'Pelaporan';
|
||||
@endphp
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto ">
|
||||
|
||||
<form id="formResume" method="POST" class="w-full grid gap-5">
|
||||
@csrf
|
||||
|
||||
@foreach ($permohonan->documents as $dokumen)
|
||||
@if ($dokumen->jenisJaminan)
|
||||
@php
|
||||
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
|
||||
$jenisAset = $dokumen->jenisJaminan->name;
|
||||
@endphp
|
||||
@if (isset($formKategori) && $formKategori)
|
||||
@php
|
||||
$kategoriArray = is_array($formKategori) ? $formKategori : [$formKategori];
|
||||
$kategoriUnik = array_unique($kategoriArray);
|
||||
@endphp
|
||||
<input type="hidden" name="action" value="{{ implode(',', $kategoriUnik) }}">
|
||||
<input type="hidden" name="type" value="{{ implode(',', $kategoriUnik) }}">
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
<div class="card">
|
||||
<div class="card-header bg-agi-50">
|
||||
<h3 class="card-title uppercase">
|
||||
@@ -36,7 +57,7 @@
|
||||
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'senior-officer', 'EO Appraisal', 'DD Appraisal']) &&
|
||||
Route::currentRouteName('otorisator.show'))
|
||||
<a href="{{ route('otorisator.show', ['id' => $permohonan->id, 'type' => 'Pelaporan']) }}"
|
||||
<a href="{{ route('otorisator.show', ['id' => $permohonan->id, 'type' => $paparan]) }}"
|
||||
class="btn btn-xs btn-info">
|
||||
<i class="ki-filled ki-exit-left"></i> Back
|
||||
</a>
|
||||
@@ -119,10 +140,10 @@
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Faktor Positif</label>
|
||||
<div id="fakta-positif-container" class="flex flex-wrap items-baseline w-full">
|
||||
@if (!empty($resumeData['fakta']['fakta_positif']))
|
||||
@foreach ($resumeData['fakta']['fakta_positif'] as $index => $positif)
|
||||
@if (!empty($forminspeksi['fakta']['fakta_positif']))
|
||||
@foreach ($forminspeksi['fakta']['fakta_positif'] as $index => $positif)
|
||||
<div class="fakta_positif flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea class="textarea mt-2" name="fakta_positif[]" rows="3">{{ old("fakta_positif.$index", $positif) }}</textarea>
|
||||
<textarea class="textarea mt-2" name="fakta_positif[]" rows="10">{{ old("fakta_positif.$index", $positif) }}</textarea>
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
||||
style="display: none;">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
@@ -131,7 +152,7 @@
|
||||
@endforeach
|
||||
@else
|
||||
<div class="fakta_positif flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea class="textarea mt-2" name="fakta_positif[]" rows="3">{{ old('fakta_positif.0', '') }}</textarea>
|
||||
<textarea class="textarea mt-2" name="fakta_positif[]" rows="10">{{ old('fakta_positif.0', '') }}</textarea>
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button" style="display: none;">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</button>
|
||||
@@ -147,10 +168,10 @@
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Faktor Negatif</label>
|
||||
<div id="fakta-negatif-container" class="flex flex-wrap items-baseline w-full">
|
||||
@if (!empty($resumeData['fakta']['fakta_negatif']))
|
||||
@foreach ($resumeData['fakta']['fakta_negatif'] as $index => $negatif)
|
||||
@if (!empty($forminspeksi['fakta']['fakta_negatif']))
|
||||
@foreach ($forminspeksi['fakta']['fakta_negatif'] as $index => $negatif)
|
||||
<div class="fakta_negatif flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="3">{{ old("fakta_negatif.$index", $negatif) }}</textarea>
|
||||
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="10">{{ old("fakta_negatif.$index", $negatif) }}</textarea>
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
||||
style="display: none;">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
@@ -159,7 +180,7 @@
|
||||
@endforeach
|
||||
@else
|
||||
<div class="fakta_negatif flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="3">{{ old('fakta_negatif.0', $resumeData['fakta']['fakta_negatif'][0] ?? '') }}</textarea>
|
||||
<textarea class="textarea mt-2" name="fakta_negatif[]" rows="10">{{ old('fakta_negatif.0', $forminspeksi['fakta']['fakta_negatif'][0] ?? '') }}</textarea>
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button" style="display: none;">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</button>
|
||||
@@ -266,8 +287,7 @@
|
||||
class="input number-format" value="{{ $luas_bangunan }}"></td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="fisik_nilai[]"
|
||||
class="input currency-format nilai-pasar"
|
||||
>
|
||||
class="input currency-format nilai-pasar">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@@ -332,8 +352,8 @@
|
||||
class="input number-format">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<input type="text" name="sesuai_nilai[]" class="input currency-format"
|
||||
>
|
||||
<input type="text" name="sesuai_nilai[]"
|
||||
class="input currency-format">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@@ -397,7 +417,7 @@
|
||||
@endforeach
|
||||
@endif
|
||||
<div id="kesimpulan" class="grid gap-5 w-full"></div>
|
||||
<div>
|
||||
<div class="">
|
||||
<button type="button" class="btn btn-primary btn-sm mt-5" onclick="tambahKesimpulanNilai()">
|
||||
<i class="ki-outline ki-plus"></i>
|
||||
Kesimpulan Nilai
|
||||
@@ -410,8 +430,33 @@
|
||||
|
||||
<label class="form-label lg:form-label max-w-56 ">Catatan yang Perlu Diperhatikan
|
||||
</label>
|
||||
<div class="input-group w-full flex gap-2">
|
||||
<textarea name="keterangan" class="textarea mt-2" placeholder="Masukkan catatan penting" rows="3">{{ old('keterangan', $resumeData['keterangan'] ?? '') }}</textarea>
|
||||
<div class="w-full">
|
||||
<div id="keterangan-container" class="flex items-baseline flex-wrap gap-2.5 w-full">
|
||||
@if (!empty($forminspeksi['fakta']['keterangan']) && is_array($forminspeksi['fakta']['keterangan']))
|
||||
@foreach ($forminspeksi['fakta']['keterangan'] as $index => $item)
|
||||
<div class="keterangan flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea name="keterangan[]" class="textarea mt-2" placeholder="Masukkan catatan penting" rows="10">{{ old("keterangan.$index", $item) }}</textarea>
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
||||
style="display: none;">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<div class="keterangan flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea name="keterangan[]" class="textarea mt-2" placeholder="Masukkan catatan penting" rows="10"></textarea>
|
||||
<button class="btn btn-danger btn-sm remove-btn" type="button"
|
||||
style="display: none;">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</button>
|
||||
<em id="error-keterangan" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<button type="button" onclick="addClonableItem('keterangan-container', 'keterangan')"
|
||||
class="btn btn-primary btn-sm mt-5 ">
|
||||
<i class="ki-outline ki-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5" style="margin-top: 20px">
|
||||
@@ -444,9 +489,12 @@
|
||||
</div>
|
||||
|
||||
<div class="flex card-footer justify-end gap-5">
|
||||
|
||||
<button type="button" class="btn btn-primary" onclick="saveResume()">
|
||||
<i class="ki-filled ki-save-2"></i>
|
||||
Save</button>
|
||||
|
||||
|
||||
@if (Auth::user()->hasAnyRole(['senior-officer', 'EO Appraisal', 'DD Appraisal', 'administrator']))
|
||||
<a class="btn btn-info"
|
||||
href="{{ route('penilai.lampiran') }}?permohonanId={{ request('permohonanId') }}&documentId={{ request('documentId') }}&inspeksiId={{ request('inspeksiId') }}&jaminanId={{ request('jaminanId') }}&statusLpj=1">
|
||||
@@ -570,6 +618,23 @@
|
||||
const permohonanId = urlParams.get('permohonanId');
|
||||
const documentId = urlParams.get('documentId');
|
||||
const inspeksiId = urlParams.get('inspeksiId');
|
||||
const faktaPositif = Array.from(document.querySelectorAll('[name="fakta_positif[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
|
||||
const faktaNegatif = Array.from(document.querySelectorAll('[name="fakta_negatif[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
const keterangan = Array.from(document.querySelectorAll('[name="keterangan[]"]'))
|
||||
.map(textarea => textarea.value.trim())
|
||||
.filter(value => value !== '');
|
||||
|
||||
const action = Array.from(document.querySelectorAll('input[name="action"]'))
|
||||
.map(input => input.value)
|
||||
.join(',') || "";
|
||||
const type = Array.from(document.querySelectorAll('input[name="type"]'))
|
||||
.map(input => input.value)
|
||||
.join(',') || "";
|
||||
|
||||
const requestUrl =
|
||||
`{{ route('penilai.storeResume') }}`;
|
||||
@@ -580,9 +645,15 @@
|
||||
type: 'POST',
|
||||
data: JSON.stringify({
|
||||
permohonan_id: permohonanId,
|
||||
document_id: documentId,
|
||||
dokument_id: documentId,
|
||||
inspeksi_id: inspeksiId,
|
||||
resume: jsonData,
|
||||
fakta_positif: faktaPositif,
|
||||
fakta_negatif: faktaNegatif,
|
||||
action: action,
|
||||
type: type,
|
||||
keterangan: keterangan
|
||||
|
||||
}),
|
||||
contentType: 'application/json',
|
||||
|
||||
@@ -634,26 +705,13 @@
|
||||
const formData = new FormData(formElement);
|
||||
const jsonData = {
|
||||
tanggal_resume: "",
|
||||
fakta: {
|
||||
fakta_positif: [],
|
||||
fakta_negatif: []
|
||||
},
|
||||
fisik: [],
|
||||
sesuai_imb: [],
|
||||
tambahan: [],
|
||||
keterangan: ""
|
||||
tambahan: []
|
||||
};
|
||||
|
||||
|
||||
// Ambil fakta positif
|
||||
document.querySelectorAll('textarea[name="fakta_positif[]"]').forEach(textarea => {
|
||||
jsonData.fakta.fakta_positif.push(textarea.value);
|
||||
});
|
||||
|
||||
// Ambil fakta negatif
|
||||
document.querySelectorAll('textarea[name="fakta_negatif[]"]').forEach(textarea => {
|
||||
jsonData.fakta.fakta_negatif.push(textarea.value);
|
||||
});
|
||||
|
||||
// Ambil data fisik
|
||||
document.querySelectorAll('table tbody tr').forEach(row => {
|
||||
@@ -696,10 +754,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Ambil keterangan
|
||||
const keterangan = formElement.querySelector('textarea[name="keterangan"]')?.value || "";
|
||||
jsonData.keterangan = keterangan;
|
||||
|
||||
const tanggal_resume = formElement.querySelector('input[name="tanggal_resume"]')?.value || "";
|
||||
jsonData.tanggal_resume = tanggal_resume;
|
||||
|
||||
@@ -719,9 +773,4 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
actions: {
|
||||
title: 'Action',
|
||||
render: (item, data) => {
|
||||
if (data.status === 'survey-completed' || data.status === 'proses-laporan' || data.status === 'paparan' || data.status === 'proses-paparan' || data.status === 'paparan') {
|
||||
if (data.status === 'survey-completed' || data.status === 'proses-laporan' || data.status === 'paparan' || data.status === 'proses-paparan' || data.status === 'paparan' || data.status == 'revisi-laporan') {
|
||||
return `
|
||||
<div class="flex flex-nowrap justify-center gap-1.5">
|
||||
<a class="btn btn-sm btn-outline btn-info" href="penilai/${data.id}/show">
|
||||
|
||||
@@ -188,6 +188,21 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($permohonan->status == 'revisi-laporan')
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Catatan Revisi
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<p class="flex w-full text-gray-600 font-medium text-sm">
|
||||
{{ $permohonan->keterangan ?? '' }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@php
|
||||
$inspeksiId = null;
|
||||
@@ -316,7 +331,6 @@
|
||||
PRINT OUT
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@@ -324,7 +338,14 @@
|
||||
<a class="btn btn-success" onclick="savePenilai()">
|
||||
REPORT
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="revisiSurveyor('{{ $permohonan->id }}', '{{$permohonan->debiture->name }}', '{{$permohonan->nomor_registrasi }}')">
|
||||
REVISI
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -626,6 +647,55 @@
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function revisiSurveyor(dataId, debitur, noreg) {
|
||||
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: `Untuk melakukan Revisi nomor registrasi ${noreg} atas nama debiture ${debitur} !`,
|
||||
icon: 'warning',
|
||||
input: 'textarea',
|
||||
inputLabel: 'Keterangan',
|
||||
inputPlaceholder: 'Masukkan keterangan...',
|
||||
inputAttributes: {
|
||||
'aria-label': 'Masukkan keterangan'
|
||||
},
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Lanjutkan!',
|
||||
cancelButtonText: 'Batal',
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const userMessage = result.value || '';
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
});
|
||||
$.ajax({
|
||||
url: `/penilai/revisi-surveyor/${dataId}`,
|
||||
type: 'PUT',
|
||||
data: {
|
||||
message: userMessage
|
||||
},
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!', response.message , 'success').then(
|
||||
() => {
|
||||
window.location.href =
|
||||
'{{ route('penilai.index') }}';
|
||||
});
|
||||
console.log(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Gagal!', 'Terjadi kesalahan saat melakukan Revisi.',
|
||||
'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@include('lpj::surveyor.js.utils')
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
@section('content')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card border border-agi-100 pb-2.5">
|
||||
<div class="min-w-full card-grid" data-datatable="false" data-datatable-page-size="10"
|
||||
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="10"
|
||||
data-datatable-state-save="false" id="permohonan-table"
|
||||
data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header]) }}">
|
||||
<div class="flex-wrap py-5 card-header bg-agi-50">
|
||||
@@ -20,6 +19,22 @@
|
||||
<input placeholder="Search Penilaian" id="search" type="text" value="">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@if ($header == 'Pelaporan')
|
||||
<div class="flex">
|
||||
<select class="select select-sm w-28" id="region">
|
||||
<option value="">
|
||||
Pilih Region
|
||||
</option>
|
||||
@foreach ($regions as $region)
|
||||
<option value="{{ $region->name }}">
|
||||
{{ $region->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="flex flex-wrap gap-2.5">
|
||||
<div class="h-[24px] border border-r-gray-200"></div>
|
||||
<a class="btn btn-sm btn-light" href="{{ route('permohonan.export') }}"> Export to Excel </a>
|
||||
@@ -29,7 +44,7 @@
|
||||
|
||||
<div class="card-body">
|
||||
<div class="scrollable-x-auto">
|
||||
<table class="table text-sm font-medium text-gray-700 align-middle table-auto table-border"
|
||||
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm"
|
||||
data-datatable-table="true">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -112,7 +127,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -290,6 +304,12 @@
|
||||
dataTable.search(searchValue, true);
|
||||
|
||||
});
|
||||
|
||||
const regionSelect = document.getElementById('region');
|
||||
regionSelect.addEventListener('change', function() {
|
||||
const selectedRegion = this.value;
|
||||
dataTable.search(selectedRegion, true);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
@@ -325,7 +345,9 @@
|
||||
message: userMessage // Kirim pesan sebagai bagian dari data
|
||||
},
|
||||
success: (response) => {
|
||||
Swal.fire('Berhasil!', 'Data berhasil diotorisasi. Menunggu Approval EO dan atau DD', 'success').then(() => {
|
||||
Swal.fire('Berhasil!',
|
||||
'Data berhasil diotorisasi. Menunggu Approval EO dan atau DD',
|
||||
'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
console.log(response);
|
||||
|
||||
@@ -160,10 +160,24 @@
|
||||
|
||||
@elseif($dataHeader == 'paparan')
|
||||
@if($permohonan->penilai->file_paparan)
|
||||
<span class="btn btn-success"
|
||||
<span class="btn btn-success btn-outline"
|
||||
onclick="viewPDF('{{ Storage::url($permohonan->penilai->file_paparan) }}')"><i
|
||||
class="ki-filled ki-eye mr-2"></i>Lihat Data Paparan</span>
|
||||
@endif
|
||||
|
||||
@if($permohonan->penilai->kertas_kerja)
|
||||
<span class="btn btn-warning btn-outline"
|
||||
onclick="viewPDF('{{ Storage::url($permohonan->penilai->kertas_kerja) }}')"><i
|
||||
class="ki-filled ki-eye mr-2"></i>Lihat Kertas Kerja</span>
|
||||
@endif
|
||||
|
||||
|
||||
<a class="btn btn-success"
|
||||
href="{{ route('otorisator.view-laporan') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}&statusLpj={{ true }}">
|
||||
Lihat Laporan
|
||||
</a>
|
||||
|
||||
|
||||
@if(Auth::user()->hasAnyRole(['administrator','senior-officer']) && $authorization->approve_so==null)
|
||||
<button onclick="otorisatorData({{ $authorization->id }},'SO')" type="button" class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
@section('content')
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card border border-agi-100 pb-2.5">
|
||||
|
||||
<div class="min-w-full card-grid" data-datatable="false" data-datatable-page-size="10"
|
||||
data-datatable-state-save="false" id="permohonan-table"
|
||||
data-api-url="{{ route('otorisator.datatables', ['otorisator' => $header]) }}">
|
||||
@@ -108,7 +108,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
$dokumentName = null;
|
||||
@endphp
|
||||
|
||||
<form id="dataPembandingForm" method="POST" enctype="multipart/form-data">
|
||||
<form id="dataPembandingForm" method="POST" enctype="multipart/form-data" class="grid gap-5">
|
||||
@csrf
|
||||
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
|
||||
<input type="hidden" name="type" value="tanah">
|
||||
<input type="hidden" name="dokument_id" value="{{ request('dokument') }}">
|
||||
<input type="hidden" name="nomor_registrasi" value="{{ $permohonan->nomor_registrasi }}">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@foreach ($permohonan->documents as $dokumen)
|
||||
@if ($dokumen->jenisJaminan)
|
||||
@php
|
||||
@@ -38,6 +39,26 @@
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body ">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5" style="margin: 20px">
|
||||
<label class="form-label lg:form-label max-w-56 ">Catatan yang Perlu Diperhatikan
|
||||
</label>
|
||||
<div class="w-full">
|
||||
<div id="keterangan-container" class="flex items-baseline flex-wrap gap-2.5 w-full">
|
||||
<div class="keterangan flex items-center gap-2 mt-2 textarea-group w-full">
|
||||
<textarea name="keterangan" class="textarea mt-2" placeholder="Masukkan catatan penting" rows="10">{{ $comparisons['keterangan'] ?? old('keterangan') }}</textarea>
|
||||
<em id="error-keterangan" class="alert text-danger text-sm"></em>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="flex justify-end gap-2">
|
||||
<button type="button" onclick="submitData()" class="btn btn-primary">
|
||||
@@ -46,7 +67,6 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -285,6 +285,9 @@
|
||||
}
|
||||
const processedFiles = new Set();
|
||||
|
||||
// Track files that are already on the server
|
||||
const existingFiles = new Set();
|
||||
|
||||
myDropzone = new Dropzone(selector, {
|
||||
url: "{{ route('surveyor.storeFoto') }}",
|
||||
paramName: paramName,
|
||||
@@ -304,8 +307,9 @@
|
||||
param_name: paramName,
|
||||
nomor_registrasi: '{{ $permohonan->nomor_registrasi ?? '' }}',
|
||||
},
|
||||
|
||||
accept: function(file, done) {
|
||||
// Generate a unique identifier for the file
|
||||
// Generate a unique identifier for the file - use hash or content-based ID if possible
|
||||
const fileId = file.name + '_' + file.size;
|
||||
|
||||
// If file is already being processed, reject it
|
||||
@@ -314,6 +318,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if file already exists on server
|
||||
if (existingFiles.has(file.name)) {
|
||||
done('File dengan nama ini sudah ada.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Add file to processed set
|
||||
processedFiles.add(fileId);
|
||||
done();
|
||||
@@ -321,9 +331,6 @@
|
||||
|
||||
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;
|
||||
});
|
||||
@@ -333,13 +340,19 @@
|
||||
|
||||
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);
|
||||
// Format error message
|
||||
let errorMsg = typeof response === 'string' ? response :
|
||||
(response.message || 'Gagal mengupload file');
|
||||
|
||||
handleUploadComplete(file, false, errorMsg);
|
||||
},
|
||||
|
||||
success: function(file, response) {
|
||||
if (response.success) {
|
||||
const fileData = {
|
||||
@@ -351,6 +364,9 @@
|
||||
param_name: paramName
|
||||
};
|
||||
|
||||
// Add file to existing files set to prevent duplicates
|
||||
existingFiles.add(file.name);
|
||||
|
||||
addEditAndDeleteButtons(file, fileData);
|
||||
handleUploadComplete(file, true);
|
||||
} else {
|
||||
@@ -367,9 +383,8 @@
|
||||
});
|
||||
|
||||
// Load existing photos
|
||||
loadExistingPhotos(this, paramName);
|
||||
loadExistingPhotos(this, paramName, existingFiles);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return myDropzone;
|
||||
@@ -379,7 +394,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function loadExistingPhotos(dropzone, paramName) {
|
||||
function loadExistingPhotos(dropzone, paramName, existingFilesSet) {
|
||||
showLoadingOverlay();
|
||||
|
||||
$.ajax({
|
||||
@@ -402,6 +417,9 @@
|
||||
originalPath: foto.path
|
||||
};
|
||||
|
||||
// Add to existing files set to prevent duplicates
|
||||
existingFilesSet.add(foto.name);
|
||||
|
||||
dropzone.emit("addedfile", mockFile);
|
||||
dropzone.emit("thumbnail", mockFile, foto.path);
|
||||
dropzone.emit("complete", mockFile);
|
||||
@@ -489,7 +507,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function hideLoadingOverlay() {
|
||||
const overlay = document.querySelector('.loading-overlay');
|
||||
if (overlay) overlay.style.display = 'none';
|
||||
@@ -514,7 +531,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Inisialisasi Dropzone untuk elemen awal dengan pengecekan
|
||||
function safeInitDropzone(selector, paramName) {
|
||||
setTimeout(() => {
|
||||
@@ -527,7 +543,6 @@
|
||||
|
||||
// Inisialisasi dropzone untuk elemen awal
|
||||
safeInitDropzone('#upload-dropzone', 'upload_foto');
|
||||
|
||||
});
|
||||
|
||||
let fotoObjekJaminan = @json($fotoObjekJaminan);
|
||||
|
||||
@@ -138,7 +138,6 @@
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if (isset($inspectionData['bangunan']))
|
||||
<tr>
|
||||
<td class="px-4 py-2">Luas Bangunan (m²)</td>
|
||||
<td class="px-4 py-2">
|
||||
@@ -149,7 +148,7 @@
|
||||
<input type="text" name="luas_bangunan_pembanding[]" class="input ">
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
<!-- Informasi Harga -->
|
||||
|
||||
@@ -124,12 +124,12 @@
|
||||
<td>
|
||||
<label>
|
||||
<input type="radio" name="tusuk_sate" value="yes"
|
||||
{{ $forminspeksi['tanah']['tusuk_sate'] == 'yes' ? 'checked' : '' }}>
|
||||
{{ isset($forminspeksi['tanah']['tusuk_sate']) && $forminspeksi['tanah']['tusuk_sate'] == 'yes' ? 'Ya' : 'Tidak' }}
|
||||
Ya
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="tusuk_sate" value="no"
|
||||
{{ $forminspeksi['tanah']['tusuk_sate'] == 'no' ? 'checked' : '' }}>
|
||||
{{isset($forminspeksi['tanah']['tusuk_sate']) && $forminspeksi['tanah']['tusuk_sate'] == 'no' ? 'checked' : '' }}>
|
||||
Tidak
|
||||
</label>
|
||||
</td>
|
||||
@@ -139,12 +139,12 @@
|
||||
<td>
|
||||
<label>
|
||||
<input type="radio" name="lockland" value="yes"
|
||||
{{ $forminspeksi['tanah']['lockland'] == 'yes' ? 'checked' : '' }}>
|
||||
{{ isset($forminspeksi['tanah']['lockland']) && $forminspeksi['tanah']['lockland'] == 'yes' ? 'checked' : '' }}>
|
||||
Ya
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="lockland" value="no"
|
||||
{{ $forminspeksi['tanah']['lockland'] == 'no' ? 'checked' : '' }}>
|
||||
{{ isset($forminspeksi['tanah']['lockland']) && $forminspeksi['tanah']['lockland'] == 'no' ? 'checked' : '' }}>
|
||||
Tidak
|
||||
</label>
|
||||
</td>
|
||||
|
||||
@@ -22,6 +22,21 @@
|
||||
|
||||
@include('lpj::component.detail-jaminan',['backLink'=>'surveyor.index'])
|
||||
|
||||
@if ($permohonan->status == 'revisi-survey')
|
||||
<div class="card border border-agi-100 min-w-full">
|
||||
<div class="card-header bg-agi-50" id="basic_settings">
|
||||
<div class="card-title flex flex-row gap-1.5">
|
||||
Catatan Revisi
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>{{ $permohonan->keterangan ?? '' }}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
<div class="card border border-agi-100 min-w-full">
|
||||
<div class="card-header bg-agi-50" id="basic_settings">
|
||||
<div class="card-title flex flex-row gap-1.5">
|
||||
|
||||
@@ -410,12 +410,10 @@
|
||||
render: (item, data) => {
|
||||
let tooltip = '';
|
||||
|
||||
if (data.status === 'revisi-laporan') {
|
||||
if (data.status === 'revisi-laporan' || data.status === 'revisi-survey') {
|
||||
tooltip = data.keterangan || '';
|
||||
} else if (data.status === 'reschedule') {
|
||||
tooltip = data.penilaian?.reschedule_note || '';
|
||||
} else {
|
||||
tooltip = '';
|
||||
}
|
||||
|
||||
return `
|
||||
|
||||
@@ -616,6 +616,7 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::post('storeMemo', [PenilaiController::class, 'storeMemo'])->name('storeMemo');
|
||||
Route::post('storeRap', [PenilaiController::class, 'storeRap'])->name('storeRap');
|
||||
Route::post('storeLpjSederhanadanStandard', [PenilaiController::class, 'storeLpjSederhanadanStandard'])->name('storeLpjSederhanadanStandard');
|
||||
Route::put('revisi-surveyor/{id}', [PenilaiController::class, 'revisiSurveyor'])->name('revisiSurveyor');
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user