perbaikan report rap dan dan penambahan no nib di pritn out sederhana
This commit is contained in:
@@ -304,7 +304,7 @@ class PenilaiController extends Controller
|
||||
$forminspeksi = json_decode($inspeksi->data_form, true);
|
||||
}
|
||||
|
||||
return view('lpj::penilai.components.paparan', compact('permohonan', 'formFoto', 'penilai', 'forminspeksi','inspeksi'));
|
||||
return view('lpj::penilai.components.paparan', compact('permohonan', 'formFoto', 'penilai', 'forminspeksi', 'inspeksi'));
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ class PenilaiController extends Controller
|
||||
$rap = json_decode($resume->rap, true);
|
||||
}
|
||||
|
||||
return view('lpj::penilai.components.rap-penilai', compact('permohonan', 'rap', 'provinces', 'forminspeksi', 'noLpRAP','basicData'));
|
||||
return view('lpj::penilai.components.rap-penilai', compact('permohonan', 'rap', 'provinces', 'forminspeksi', 'noLpRAP', 'basicData'));
|
||||
}
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ class PenilaiController extends Controller
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
} else {
|
||||
$query->orderBy('updated_at','DESC');
|
||||
$query->orderBy('updated_at', 'DESC');
|
||||
}
|
||||
|
||||
// Get the total count of records
|
||||
@@ -600,7 +600,21 @@ class PenilaiController extends Controller
|
||||
|
||||
$penilai = Penilai::where('permohonan_id', $id)->get();
|
||||
|
||||
$rap = $penilai->some(function ($item) {
|
||||
return strtolower($item->type_penilai) === 'rap';
|
||||
});
|
||||
$allComplete = $penilai->every(function ($item) {
|
||||
|
||||
if ($item->type_penilai === 'rap') {
|
||||
return !empty($item->type_penilai) && (
|
||||
!empty($item->memo) ||
|
||||
!empty($item->resume) ||
|
||||
!empty($item->lpj) ||
|
||||
!empty($item->rap)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return !empty($item->type_penilai) && (
|
||||
!empty($item->memo) ||
|
||||
!empty($item->resume) ||
|
||||
@@ -625,8 +639,7 @@ class PenilaiController extends Controller
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Berhasil Megirim reported ke so',
|
||||
'data' => $penilai,
|
||||
'message' => 'Berhasil Megirim reported ke so'
|
||||
], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
@@ -799,10 +812,11 @@ class PenilaiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function storeRap(Request $request){
|
||||
public function storeRap(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$formRequest = new FormSurveyorRequest();
|
||||
$formRequest = new FormSurveyorRequest();
|
||||
$formRequest->setContainer(app());
|
||||
$formRequest->initialize(
|
||||
$request->all(),
|
||||
@@ -817,7 +831,7 @@ class PenilaiController extends Controller
|
||||
$validated = $formRequest->validateResolved();
|
||||
$result = $this->surveyorController->store($formRequest);
|
||||
|
||||
$data =[
|
||||
$data = [
|
||||
'kepada' => $request->input('kepada'),
|
||||
'dari' => $request->input('dari'),
|
||||
'nomor_rap' => $request->input('nomor_rap'),
|
||||
@@ -926,7 +940,7 @@ class PenilaiController extends Controller
|
||||
'tanggalLaporan',
|
||||
'rap'
|
||||
));
|
||||
// return $pdf;
|
||||
// return $pdf;
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
return $pdf->stream();
|
||||
} else {
|
||||
@@ -1076,278 +1090,278 @@ class PenilaiController extends Controller
|
||||
|
||||
|
||||
public function generateNoLaporan($permohonan, $documentId, $type)
|
||||
{
|
||||
$typeMapping = ['lpj' => 'LPJ', 'memo' => 'MAK', 'rap' => 'RAP'];
|
||||
{
|
||||
$typeMapping = ['lpj' => 'LPJ', 'memo' => 'MAK', 'rap' => 'RAP'];
|
||||
|
||||
// Cek apakah data sudah ada
|
||||
$laporan = Laporan::where([
|
||||
'permohonan_id' => $permohonan->id,
|
||||
'dokumen_jaminan_id' => $documentId,
|
||||
])->first();
|
||||
|
||||
if ($laporan) {
|
||||
|
||||
$nomorArray = explode('/', $laporan->nomor_laporan);
|
||||
$nomorArray[2] = $typeMapping[$type] ?? 'RES';
|
||||
$laporan->update([
|
||||
'nomor_laporan' => implode('/', $nomorArray)
|
||||
]);
|
||||
} else {
|
||||
|
||||
$laporan = Laporan::create([
|
||||
// Cek apakah data sudah ada
|
||||
$laporan = Laporan::where([
|
||||
'permohonan_id' => $permohonan->id,
|
||||
'dokumen_jaminan_id' => $documentId,
|
||||
'nomor_laporan' => implode('/', [
|
||||
$permohonan->debiture->branch->code,
|
||||
generateLpjUniqueCode(3),
|
||||
$typeMapping[$type] ?? 'RSM',
|
||||
$permohonan->nomor_registrasi,
|
||||
onRomawi(date('m')),
|
||||
substr(date('Y'), -2)
|
||||
])
|
||||
])->first();
|
||||
|
||||
if ($laporan) {
|
||||
|
||||
$nomorArray = explode('/', $laporan->nomor_laporan);
|
||||
$nomorArray[2] = $typeMapping[$type] ?? 'RES';
|
||||
$laporan->update([
|
||||
'nomor_laporan' => implode('/', $nomorArray)
|
||||
]);
|
||||
} else {
|
||||
|
||||
$laporan = Laporan::create([
|
||||
'permohonan_id' => $permohonan->id,
|
||||
'dokumen_jaminan_id' => $documentId,
|
||||
'nomor_laporan' => implode('/', [
|
||||
$permohonan->debiture->branch->code,
|
||||
generateLpjUniqueCode(3),
|
||||
$typeMapping[$type] ?? 'RSM',
|
||||
$permohonan->nomor_registrasi,
|
||||
onRomawi(date('m')),
|
||||
substr(date('Y'), -2)
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
return $laporan->nomor_laporan;
|
||||
}
|
||||
|
||||
|
||||
public function checkDataMemo($type, $statusLpj)
|
||||
{
|
||||
// Ambil data JSON dari statusLpj
|
||||
$data = json_decode($statusLpj->memo, true) ?? [];
|
||||
|
||||
$validationRules = [
|
||||
'memo' => [
|
||||
'kepada',
|
||||
'dari',
|
||||
'nomor_memo',
|
||||
'tanggal',
|
||||
'perihal',
|
||||
'jenis_asset_tidak_sesuai',
|
||||
'lokasi.lokasi',
|
||||
'lokasi.address',
|
||||
'lokasi.province_code',
|
||||
'lokasi.city_code',
|
||||
'lokasi.district_code',
|
||||
'lokasi.village_code',
|
||||
'lokasi.penilai',
|
||||
'terlampir',
|
||||
'hasil_survey',
|
||||
'kesimpulan_saran',
|
||||
],
|
||||
];
|
||||
|
||||
// Validasi data JSON
|
||||
if (isset($validationRules[$type])) {
|
||||
$missingFields = [];
|
||||
|
||||
foreach ($validationRules[$type] as $field) {
|
||||
$keys = explode('.', $field);
|
||||
$value = $data;
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if (!isset($value[$key])) {
|
||||
$missingFields[] = $field;
|
||||
break;
|
||||
}
|
||||
$value = $value[$key];
|
||||
}
|
||||
}
|
||||
|
||||
// Jika ada field yang kosong, kembalikan error
|
||||
if (!empty($missingFields)) {
|
||||
return response()->json([
|
||||
'status' => null,
|
||||
'message' => "Silahkan lengkapi data memo terlebih dahulu.",
|
||||
'missing_fields' => $missingFields,
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
// Jika data valid
|
||||
return response()->json([
|
||||
'status' => $type,
|
||||
'message' => "Data memo valid.",
|
||||
]);
|
||||
}
|
||||
|
||||
return $laporan->nomor_laporan;
|
||||
}
|
||||
|
||||
|
||||
public function checkDataMemo($type, $statusLpj)
|
||||
{
|
||||
// Ambil data JSON dari statusLpj
|
||||
$data = json_decode($statusLpj->memo, true) ?? [];
|
||||
|
||||
$validationRules = [
|
||||
'memo' => [
|
||||
'kepada',
|
||||
'dari',
|
||||
'nomor_memo',
|
||||
'tanggal',
|
||||
'perihal',
|
||||
'jenis_asset_tidak_sesuai',
|
||||
'lokasi.lokasi',
|
||||
'lokasi.address',
|
||||
'lokasi.province_code',
|
||||
'lokasi.city_code',
|
||||
'lokasi.district_code',
|
||||
'lokasi.village_code',
|
||||
'lokasi.penilai',
|
||||
'terlampir',
|
||||
'hasil_survey',
|
||||
'kesimpulan_saran',
|
||||
],
|
||||
];
|
||||
public function checkDataResume($type, $statusLpj)
|
||||
{
|
||||
// Ambil data JSON dari statusLpj
|
||||
$data = json_decode($statusLpj->resume, true) ?? [];
|
||||
|
||||
// Validasi data JSON
|
||||
if (isset($validationRules[$type])) {
|
||||
$missingFields = [];
|
||||
$validationRules = [
|
||||
'resume' => [
|
||||
'fakta.fakta_positif',
|
||||
'fakta.fakta_negatif',
|
||||
'fisik',
|
||||
'sesuai_imb',
|
||||
'keterangan'
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($validationRules[$type] as $field) {
|
||||
$keys = explode('.', $field);
|
||||
$value = $data;
|
||||
// Validasi data JSON
|
||||
if (isset($validationRules[$type])) {
|
||||
$missingFields = [];
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if (!isset($value[$key])) {
|
||||
$missingFields[] = $field;
|
||||
break;
|
||||
foreach ($validationRules[$type] as $field) {
|
||||
$keys = explode('.', $field);
|
||||
$value = $data;
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if (!isset($value[$key])) {
|
||||
$missingFields[] = $field;
|
||||
break;
|
||||
}
|
||||
$value = $value[$key];
|
||||
}
|
||||
$value = $value[$key];
|
||||
|
||||
// Validasi khusus untuk array fisik dan sesuai_imb
|
||||
if ($field === 'fisik' || $field === 'sesuai_imb') {
|
||||
if (empty($value) || !is_array($value)) {
|
||||
$missingFields[] = $field;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validasi struktur data di dalam array
|
||||
foreach ($value as $item) {
|
||||
$requiredKeys = ['sertifikat', 'luas_tanah', 'luas_bangunan', 'nilai'];
|
||||
foreach ($requiredKeys as $requiredKey) {
|
||||
if (!isset($item[$requiredKey])) {
|
||||
$missingFields[] = $field . '.' . $requiredKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Jika ada field yang kosong, kembalikan error
|
||||
if (!empty($missingFields)) {
|
||||
return response()->json([
|
||||
'status' => null,
|
||||
'message' => "Silahkan lengkapi data resume terlebih dahulu.",
|
||||
'missing_fields' => $missingFields,
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
// Jika ada field yang kosong, kembalikan error
|
||||
if (!empty($missingFields)) {
|
||||
return response()->json([
|
||||
'status' => null,
|
||||
'message' => "Silahkan lengkapi data memo terlebih dahulu.",
|
||||
'missing_fields' => $missingFields,
|
||||
], 400);
|
||||
}
|
||||
// Jika data valid
|
||||
return response()->json([
|
||||
'status' => $type,
|
||||
'message' => "Data resume valid.",
|
||||
]);
|
||||
}
|
||||
|
||||
// Jika data valid
|
||||
return response()->json([
|
||||
'status' => $type,
|
||||
'message' => "Data memo valid.",
|
||||
]);
|
||||
}
|
||||
public function checkDataLpj($type, $statusLpj)
|
||||
{
|
||||
// Ambil data JSON dari statusLpj
|
||||
$data = json_decode($statusLpj->lpj, true) ?? [];
|
||||
|
||||
$validationRules = [
|
||||
'lpj' => [
|
||||
'luas_tanah',
|
||||
'nilai_tanah_1',
|
||||
'nilai_tanah_2',
|
||||
'luas_bangunan',
|
||||
'nilai_bangunan_1',
|
||||
'nilai_bangunan_2',
|
||||
'total_nilai_pasar_wajar',
|
||||
'likuidasi',
|
||||
'likuidasi_nilai_1',
|
||||
'likuidasi_nilai_2',
|
||||
'asuransi_luas_bangunan',
|
||||
'asuransi_nilai_1',
|
||||
'asuransi_nilai_2',
|
||||
'npw_tambahan'
|
||||
],
|
||||
];
|
||||
|
||||
// Validasi data JSON
|
||||
if (isset($validationRules[$type])) {
|
||||
$missingFields = [];
|
||||
|
||||
|
||||
public function checkDataResume($type, $statusLpj)
|
||||
{
|
||||
// Ambil data JSON dari statusLpj
|
||||
$data = json_decode($statusLpj->resume, true) ?? [];
|
||||
|
||||
$validationRules = [
|
||||
'resume' => [
|
||||
'fakta.fakta_positif',
|
||||
'fakta.fakta_negatif',
|
||||
'fisik',
|
||||
'sesuai_imb',
|
||||
'keterangan'
|
||||
],
|
||||
];
|
||||
|
||||
// Validasi data JSON
|
||||
if (isset($validationRules[$type])) {
|
||||
$missingFields = [];
|
||||
|
||||
foreach ($validationRules[$type] as $field) {
|
||||
$keys = explode('.', $field);
|
||||
$value = $data;
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if (!isset($value[$key])) {
|
||||
$missingFields[] = $field;
|
||||
break;
|
||||
foreach ($validationRules[$type] as $field) {
|
||||
// Penanganan khusus untuk field yang boleh null
|
||||
if (in_array($field, ['sarana_pelengkap_penilai', 'nilai_sarana_pelengkap_1', 'nilai_sarana_pelengkap_2'])) {
|
||||
continue;
|
||||
}
|
||||
$value = $value[$key];
|
||||
}
|
||||
|
||||
// Validasi khusus untuk array fisik dan sesuai_imb
|
||||
if ($field === 'fisik' || $field === 'sesuai_imb') {
|
||||
if (empty($value) || !is_array($value)) {
|
||||
if (!isset($data[$field])) {
|
||||
$missingFields[] = $field;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validasi struktur data di dalam array
|
||||
foreach ($value as $item) {
|
||||
$requiredKeys = ['sertifikat', 'luas_tanah', 'luas_bangunan', 'nilai'];
|
||||
foreach ($requiredKeys as $requiredKey) {
|
||||
if (!isset($item[$requiredKey])) {
|
||||
$missingFields[] = $field . '.' . $requiredKey;
|
||||
// Validasi khusus untuk npw_tambahan
|
||||
if ($field === 'npw_tambahan' && is_array($data[$field])) {
|
||||
foreach ($data[$field] as $index => $item) {
|
||||
$requiredKeys = ['name', 'luas', 'nilai_1', 'nilai_2'];
|
||||
foreach ($requiredKeys as $key) {
|
||||
if (!isset($item[$key])) {
|
||||
$missingFields[] = "npw_tambahan[$index].$key";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Jika ada field yang kosong, kembalikan error
|
||||
if (!empty($missingFields)) {
|
||||
return response()->json([
|
||||
'status' => null,
|
||||
'message' => "Silahkan lengkapi data resume terlebih dahulu.",
|
||||
'missing_fields' => $missingFields,
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
// Jika data valid
|
||||
return response()->json([
|
||||
'status' => $type,
|
||||
'message' => "Data resume valid.",
|
||||
]);
|
||||
}
|
||||
|
||||
public function checkDataLpj($type, $statusLpj)
|
||||
{
|
||||
// Ambil data JSON dari statusLpj
|
||||
$data = json_decode($statusLpj->lpj, true) ?? [];
|
||||
|
||||
$validationRules = [
|
||||
'lpj' => [
|
||||
'luas_tanah',
|
||||
'nilai_tanah_1',
|
||||
'nilai_tanah_2',
|
||||
'luas_bangunan',
|
||||
'nilai_bangunan_1',
|
||||
'nilai_bangunan_2',
|
||||
'total_nilai_pasar_wajar',
|
||||
'likuidasi',
|
||||
'likuidasi_nilai_1',
|
||||
'likuidasi_nilai_2',
|
||||
'asuransi_luas_bangunan',
|
||||
'asuransi_nilai_1',
|
||||
'asuransi_nilai_2',
|
||||
'npw_tambahan'
|
||||
],
|
||||
];
|
||||
|
||||
// Validasi data JSON
|
||||
if (isset($validationRules[$type])) {
|
||||
$missingFields = [];
|
||||
|
||||
foreach ($validationRules[$type] as $field) {
|
||||
// Penanganan khusus untuk field yang boleh null
|
||||
if (in_array($field, ['sarana_pelengkap_penilai', 'nilai_sarana_pelengkap_1', 'nilai_sarana_pelengkap_2'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($data[$field])) {
|
||||
$missingFields[] = $field;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validasi khusus untuk npw_tambahan
|
||||
if ($field === 'npw_tambahan' && is_array($data[$field])) {
|
||||
foreach ($data[$field] as $index => $item) {
|
||||
$requiredKeys = ['name', 'luas', 'nilai_1', 'nilai_2'];
|
||||
foreach ($requiredKeys as $key) {
|
||||
if (!isset($item[$key])) {
|
||||
$missingFields[] = "npw_tambahan[$index].$key";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Jika ada field yang kosong, kembalikan error
|
||||
if (!empty($missingFields)) {
|
||||
return response()->json([
|
||||
'status' => null,
|
||||
'message' => "Silahkan lengkapi data LPJ terlebih dahulu.",
|
||||
'missing_fields' => $missingFields,
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Jika ada field yang kosong, kembalikan error
|
||||
if (!empty($missingFields)) {
|
||||
return response()->json([
|
||||
'status' => null,
|
||||
'message' => "Silahkan lengkapi data LPJ terlebih dahulu.",
|
||||
'missing_fields' => $missingFields,
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
|
||||
// Jika data valid
|
||||
return response()->json([
|
||||
'status' => $type,
|
||||
'message' => "Data LPJ valid.",
|
||||
]);
|
||||
}
|
||||
|
||||
public function checkDataRap($type, $statusLpj)
|
||||
{
|
||||
// Ambil data JSON dari statusLpj
|
||||
$data = json_decode($statusLpj->rap, true) ?? [];
|
||||
|
||||
$requiredFields = [
|
||||
'dari',
|
||||
'kepada',
|
||||
'perihal',
|
||||
'tanggal',
|
||||
'nomor_rap'
|
||||
];
|
||||
|
||||
// Cek apakah ada field yang kosong
|
||||
$missingFields = [];
|
||||
foreach ($requiredFields as $field) {
|
||||
if (!isset($data[$field]) || empty($data[$field])) {
|
||||
$missingFields[] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
// Jika ada field yang kosong, kembalikan error
|
||||
if (!empty($missingFields)) {
|
||||
// Jika data valid
|
||||
return response()->json([
|
||||
'status' => null,
|
||||
'message' => "Silahkan lengkapi data RAP terlebih dahulu.",
|
||||
'missing_fields' => $missingFields
|
||||
], 400);
|
||||
'status' => $type,
|
||||
'message' => "Data LPJ valid.",
|
||||
]);
|
||||
}
|
||||
|
||||
// Jika semua data terisi
|
||||
return response()->json([
|
||||
'status' => $type,
|
||||
'message' => "Data RAP valid."
|
||||
]);
|
||||
}
|
||||
public function checkDataRap($type, $statusLpj)
|
||||
{
|
||||
// Ambil data JSON dari statusLpj
|
||||
$data = json_decode($statusLpj->rap, true) ?? [];
|
||||
|
||||
$requiredFields = [
|
||||
'dari',
|
||||
'kepada',
|
||||
'perihal',
|
||||
'tanggal',
|
||||
'nomor_rap'
|
||||
];
|
||||
|
||||
// Cek apakah ada field yang kosong
|
||||
$missingFields = [];
|
||||
foreach ($requiredFields as $field) {
|
||||
if (!isset($data[$field]) || empty($data[$field])) {
|
||||
$missingFields[] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
// Jika ada field yang kosong, kembalikan error
|
||||
if (!empty($missingFields)) {
|
||||
return response()->json([
|
||||
'status' => null,
|
||||
'message' => "Silahkan lengkapi data RAP terlebih dahulu.",
|
||||
'missing_fields' => $missingFields
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Jika semua data terisi
|
||||
return response()->json([
|
||||
'status' => $type,
|
||||
'message' => "Data RAP valid."
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ class SurveyorController extends Controller
|
||||
|
||||
// Simpan file dengan nama asli
|
||||
$path = $file->storeAs(
|
||||
'surveyor/lantai_unit',
|
||||
'surveyor/lantai_unit',
|
||||
$uniqueFileName . '/' . time() . '_' . $file->getClientOriginalName(),
|
||||
'public'
|
||||
);
|
||||
@@ -1020,15 +1020,15 @@ class SurveyorController extends Controller
|
||||
public function storeFreeze($id, Request $request)
|
||||
{
|
||||
try {
|
||||
$permohonan = Permohonan::findOrFail($id);
|
||||
$permohonan = Permohonan::findOrFail($id);
|
||||
|
||||
Authorization::updateOrCreate([
|
||||
'permohonan_id' => $permohonan->id,
|
||||
'jenis' => 'sla'
|
||||
],[
|
||||
'request' => 'freeze',
|
||||
'user_id' => Auth::user()->id
|
||||
]);
|
||||
Authorization::updateOrCreate([
|
||||
'permohonan_id' => $permohonan->id,
|
||||
'jenis' => 'sla'
|
||||
], [
|
||||
'request' => 'freeze',
|
||||
'user_id' => Auth::user()->id
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
@@ -2375,6 +2375,7 @@ class SurveyorController extends Controller
|
||||
$data['hub_cadeb_penghuni'] => ($data['hub_cadeb_penghuni'] == 'sesuai') ? $data['hub_cadeb_penghuni_sesuai'] : $data['hub_penghuni_tidak_sesuai']
|
||||
],
|
||||
'pihak_bank' => $data['pihak_bank'] ?? null,
|
||||
'nomor_nib' => $data['nomor_nib'] ?? null,
|
||||
'kordinat_lng' => $data['kordinat_lng'] ?? null,
|
||||
'kordinat_lat' => $data['kordinat_lat'] ?? null,
|
||||
]
|
||||
@@ -3181,4 +3182,56 @@ class SurveyorController extends Controller
|
||||
// Return Excel download
|
||||
return Excel::download(new BasicDataSurveyorExport($modelClass), $type . '.xlsx');
|
||||
}
|
||||
|
||||
|
||||
public function signature()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function signatureStore(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'signature' => 'required',
|
||||
'type' => 'required|in:penilai,cabang,debitur,kjjp',
|
||||
'document_id' => 'nullable|string'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => $validator->errors()->first()
|
||||
], 422);
|
||||
}
|
||||
|
||||
// Hapus prefix data:image/png;base64,
|
||||
$image = explode(',', $request->signature)[1];
|
||||
$imageName = 'signatures/' . $request->type . '_' . time() . '.png';
|
||||
|
||||
// Simpan file
|
||||
Storage::disk('public')->put($imageName, base64_decode($image));
|
||||
$existingData = $inspeksi->exists && $inspeksi->foto_form
|
||||
? json_decode($inspeksi->foto_form, true)
|
||||
: [];
|
||||
|
||||
$formatFotojson = $existingData;
|
||||
$inspeksi = Inspeksi::save(
|
||||
[
|
||||
'permohonan_id' => $request->input('permohonan_id'),
|
||||
'dokument_id' => $request->input('dokument_id')
|
||||
],
|
||||
[
|
||||
'data_form' => json_encode($processedData),
|
||||
]
|
||||
);
|
||||
}
|
||||
public function signatureShow()
|
||||
{
|
||||
|
||||
}
|
||||
public function signatureDestroy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -569,6 +569,7 @@ class FormSurveyorRequest extends FormRequest
|
||||
'permohonan_id' => 'required',
|
||||
'type' => 'required',
|
||||
'nomor_registrasi' => 'required',
|
||||
'nomor_nib' => 'nullable',
|
||||
'debitur_perwakilan' => 'required|array',
|
||||
'jenis_asset_name' => 'nullable|',
|
||||
'jenis_asset' => 'required',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div style="display: none">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5" style="margin-top: 20px">
|
||||
|
||||
<label class="form-label max-w-56">Debitur/Perwakilan</label>
|
||||
|
||||
@if (isset($forminspeksi['asset']['debitur_perwakilan']) && !empty($forminspeksi['asset']['debitur_perwakilan']))
|
||||
@@ -518,6 +519,13 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@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="{{ $forminspeksi['asset']['nomor_nib'] ?? '' }}" placeholder="Masukkan Nomor NIB">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -609,7 +617,7 @@
|
||||
{{ $labelNilai[$item] }}
|
||||
</label>
|
||||
<input type="text" id="luas_{{ $item }}"
|
||||
class="input w-full currency-format" name="luas_{{ $item }}"
|
||||
class="input w-full" name="luas_{{ $item }}"
|
||||
value="{{ old('luas_' . $item, $lpjData['luas_' . $item] ?? null) }}"
|
||||
oninput="calculateTotal()">
|
||||
</div>
|
||||
@@ -618,7 +626,7 @@
|
||||
<label class="input">
|
||||
<i class="">Rp</i>
|
||||
<input type="text" id="nilai_{{ $item }}_1"
|
||||
class="w-full currency-format" name="nilai_{{ $item }}_1"
|
||||
class="w-full currency" name="nilai_{{ $item }}_1"
|
||||
value="{{ old('nilai_' . $item . '_1', $lpjData['nilai_' . $item . '_1'] ?? null) }}"
|
||||
oninput="calculateTotal()">
|
||||
</label>
|
||||
@@ -752,7 +760,7 @@
|
||||
<div class="flex grid-col-3 gap-2.5 w-full">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
|
||||
<label for="province" class="form-label">Luas Bangunan</label>
|
||||
<input type="text" class="input w-full currency-format" id="asuransi_luas_bangunan"
|
||||
<input type="text" class="input w-full" id="asuransi_luas_bangunan"
|
||||
name="asuransi_luas_bangunan"
|
||||
value="{{ old('asuransi_luas_bangunan', $lpjData['asuransi_luas_bangunan'] ?? null) }}"
|
||||
oninput="calculateTotal()">
|
||||
@@ -762,7 +770,7 @@
|
||||
<label class="input">
|
||||
<i class="">Rp
|
||||
</i>
|
||||
<input type="text" class="input w-full currency-format" id="asuransi_nilai_1"
|
||||
<input type="text" class="input w-full currency" id="asuransi_nilai_1"
|
||||
name="asuransi_nilai_1"
|
||||
value="{{ old('asuransi_nilai_1', $lpjData['asuransi_nilai_1'] ?? null) }}"
|
||||
oninput="calculateTotal()">
|
||||
@@ -788,6 +796,8 @@
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
|
||||
const tambahNPWButton = document.getElementById('tambah-npw');
|
||||
const addPasarWajarContainer = document.getElementById('add_pasar_wajar');
|
||||
let npwCounter = 0;
|
||||
@@ -807,7 +817,7 @@
|
||||
|
||||
<input type="text"
|
||||
id="luas_npw_${npwCounter}"
|
||||
class="input w-full currency-format"
|
||||
class="input w-full "
|
||||
name="luas_npw_${npwCounter}"
|
||||
placeholder="Luas NPW"
|
||||
oninput="calculateTotal()">
|
||||
@@ -819,7 +829,7 @@
|
||||
</i>
|
||||
<input type="text"
|
||||
id="nilai_npw_${npwCounter}_1"
|
||||
class=" w-full currency-format"
|
||||
class=" w-full currency"
|
||||
name="nilai_npw_${npwCounter}_1"
|
||||
placeholder="Harga per meter"
|
||||
oninput="calculateTotal()">
|
||||
@@ -899,7 +909,7 @@
|
||||
</i>
|
||||
<input type="text"
|
||||
id="nilai_npw_${npwCounter}_1"
|
||||
class=" w-full currency-format"
|
||||
class=" w-full currency"
|
||||
name="nilai_npw_${npwCounter}_1"
|
||||
placeholder="Harga per meter"
|
||||
value="${npw.nilai_1 || ''}"
|
||||
@@ -953,6 +963,12 @@
|
||||
|
||||
// Panggil fungsi load NPW saat halaman dimuat
|
||||
loadSavedNPW();
|
||||
document.querySelectorAll('.currency-format').forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
formatCurrency(this);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function calculateTotal() {
|
||||
@@ -974,17 +990,30 @@
|
||||
let totalNilaiPasarWajar = 0;
|
||||
|
||||
// Perhitungan untuk input yang sudah ada
|
||||
const standardInputs = [{
|
||||
luas: 'luas_tanah',
|
||||
nilai: 'nilai_tanah_1',
|
||||
output: 'nilai_tanah_2'
|
||||
},
|
||||
{
|
||||
const jenisAsetData = @json($jenisAset);
|
||||
|
||||
// Menentukan input yang akan dihitung berdasarkan jenis aset
|
||||
let standardInputs = [];
|
||||
|
||||
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'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
standardInputs.forEach(input => {
|
||||
let luas = parseInput(document.getElementById(input.luas).value);
|
||||
@@ -1083,5 +1112,18 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function formatCurrencyInput(input) {
|
||||
const value = input.value.replace(/[^0-9]/g, ''); // Hapus karakter non-angka
|
||||
if (!value) {
|
||||
input.value = ''; // Kosongkan jika tidak ada angka
|
||||
return;
|
||||
}
|
||||
|
||||
// Format ke mata uang
|
||||
const formattedValue = new Intl.NumberFormat('id-ID', { style: 'currency', currency: 'IDR' }).format(value);
|
||||
|
||||
input.value = formattedValue;
|
||||
}
|
||||
</script>
|
||||
@include('lpj::surveyor.js.utils')
|
||||
|
||||
|
||||
@@ -331,7 +331,11 @@
|
||||
<td style="">
|
||||
{{ ucwords(str_replace('_', ' ', $key)) ?? '' }}</td>
|
||||
<td style=" padding: 2px;">:</td>
|
||||
<td style="">{{ $value ?? '' }} <sup> m2</sup></td>
|
||||
<td style="">{{ $value ?? '' }}
|
||||
@if ($key == 'luas_tanah' || $key == 'luas_bangunan')
|
||||
M<sup>2</sup>
|
||||
@endif
|
||||
</td>
|
||||
@endforeach
|
||||
@endif
|
||||
@endif
|
||||
@@ -339,6 +343,11 @@
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
<tr>
|
||||
<td style=" padding: 2px;">Nomor NIB</td>
|
||||
<td style=" padding: 2px;">:</td>
|
||||
<td style=" padding: 2px;">{{ $forminspeksi['asset']['nomor_nib']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style=" padding: 2px;">Atas Nama</td>
|
||||
<td style=" padding: 2px;">:</td>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<div class=" card w-full bg-white rounded-lg shadow-md ">
|
||||
<div class="card-header bg-agi-50">
|
||||
@php
|
||||
$title = $title ?? 'Form Inspeksi';
|
||||
@endphp
|
||||
$title = $title ?? 'Form Inspeksi';
|
||||
@endphp
|
||||
<h3 class="card-title uppercase">
|
||||
{{ $title }}
|
||||
{{ $title }}
|
||||
</h3>
|
||||
<div class="flex items-center gap-2">
|
||||
@if (isset($id))
|
||||
<a href="{{ route($backLink, ['id' => $id]) }}" class="btn btn-xs btn-info">
|
||||
<i class="ki-filled ki-exit-left"></i> Back
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ url()->previous() }}" class="btn btn-xs btn-info">
|
||||
<i class="ki-filled ki-exit-left"></i> Back
|
||||
</a>
|
||||
@endif
|
||||
<a href="{{ route($backLink, ['id' => $id]) }}" class="btn btn-xs btn-info">
|
||||
<i class="ki-filled ki-exit-left"></i> Back
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ url()->previous() }}" class="btn btn-xs btn-info">
|
||||
<i class="ki-filled ki-exit-left"></i> Back
|
||||
</a>
|
||||
@endif
|
||||
{{-- <a href="{{ route('surveyor.show', ['id' => request('inspeksi')]) }}" class="btn btn-xs btn-info">
|
||||
<i class="ki-filled ki-exit-left"></i> Back
|
||||
</a> --}}
|
||||
@@ -264,8 +264,17 @@
|
||||
<div class="card-header bg-agi-50">
|
||||
<h1 class="text-md font-medium text-gray-900 uppercase">Status</h1>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<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="{{ $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>
|
||||
@@ -562,4 +571,4 @@
|
||||
});
|
||||
// Fungsi untuk memuat data lokasi yang tersimpan
|
||||
</script>
|
||||
@include('lpj::surveyor.js.utils')
|
||||
@include('lpj::surveyor.js.utils')
|
||||
|
||||
Reference in New Issue
Block a user