update form data surveyor
This commit is contained in:
@@ -225,6 +225,10 @@
|
||||
|
||||
// Get the total count of records
|
||||
$totalRecords = $query->count();
|
||||
$size = $request->get('size', 10);
|
||||
if ($size == 0) {
|
||||
$size = 10;
|
||||
}
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
@@ -239,13 +243,13 @@
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->get();
|
||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian','penilaian'])->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
$pageCount = ceil($totalRecords / $size);
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
$currentPage = max(1, $request->get('page', 1));
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,75 +19,50 @@ class FormSurveyorRequest extends FormRequest
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$commonRules = $this->getBangunanRules();
|
||||
|
||||
$actionSpecificRules = $this->getActionSpecificRules();
|
||||
|
||||
return array_merge($commonRules, $actionSpecificRules);
|
||||
return $actionSpecificRules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get common rules that apply to all actions.
|
||||
*/
|
||||
private function getCommonRules(): array
|
||||
{
|
||||
return [
|
||||
'fakta_positif' => 'nullable|array',
|
||||
'fakta_negatif' => 'nullable|array',
|
||||
'rute_menuju' => 'nullable',
|
||||
'batas_batas' => 'nullable|array',
|
||||
'kondisi_linkungan' => 'nullable|array',
|
||||
'kondisi_lain_bangunan' => 'nullable|array',
|
||||
'informasi_dokument' => 'nullable',
|
||||
'peruntukan' => 'nullable',
|
||||
'kdb' => 'nullable',
|
||||
'kdh' => 'nullable',
|
||||
'gsb' => 'nullable',
|
||||
'max_lantai' => 'nullable',
|
||||
'klb' => 'nullable',
|
||||
'gss' => 'nullable',
|
||||
'pelebaran_jalan' => 'nullable',
|
||||
'nama_petugas' => 'nullable',
|
||||
'lat' => 'nullable|numeric',
|
||||
'lng' => 'nullable|numeric',
|
||||
'foto_gistaru' => 'nullable',
|
||||
'foto_bhumi' => 'nullable',
|
||||
'foto_argis_region' => 'nullable',
|
||||
'foto_tempat' => 'nullable',
|
||||
'keterangan' => 'nullable',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rules specific to the action.
|
||||
*/
|
||||
private function getActionSpecificRules(): array
|
||||
{
|
||||
$action = $this->input('action');
|
||||
$pisah = explode(',', $action);
|
||||
|
||||
switch ($action) {
|
||||
case 'tanah':
|
||||
return $this->getTanahRules();
|
||||
case 'unit':
|
||||
return $this->getUnitRules();
|
||||
case 'kapal':
|
||||
return $this->getUnitRules();
|
||||
case 'kendaraan':
|
||||
return $this->getUnitRules();
|
||||
case 'mesin':
|
||||
return $this->getUnitRules();
|
||||
case 'bangunan':
|
||||
return $this->getTanahBangunanRules();
|
||||
case 'tanah_bangunan':
|
||||
return array_merge($this->getAssetDescriptionRules(),$this->getTanahRules(), $this->getBangunanRules(), $this->getLinkunganRules(), $this->getCommonRules());
|
||||
$allRules = [
|
||||
'tanah' => $this->getTanahRules(),
|
||||
'bangunan' => $this->getBangunanRules(),
|
||||
'kapal' => $this->getKapalRules(),
|
||||
'kendaraan' => $this->getKendaraanRules(),
|
||||
'mesin' => $this->getMesinRules(),
|
||||
'pesawat' => $this->getLinkunganRules(),
|
||||
'alat-berat' => $this->getLinkunganRules(),
|
||||
'apartemen-kantor' => $this->getUnitRules(),
|
||||
'lingkungan' => $this->getLinkunganRules(),
|
||||
'fakta' => $this->getCommonRules(),
|
||||
];
|
||||
|
||||
case 'alat-berat':
|
||||
return $this->getUnitRules();
|
||||
default:
|
||||
return [];
|
||||
$rules = [];
|
||||
$hasAssetDescriptionRules = false;
|
||||
|
||||
foreach ($pisah as $act) {
|
||||
if (isset($allRules[$act])) {
|
||||
$rules = array_merge($rules, $allRules[$act]);
|
||||
if ($act == 'tanah' || $act == 'bangunan') {
|
||||
$hasAssetDescriptionRules = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($hasAssetDescriptionRules) {
|
||||
$rules = array_merge($rules, $this->getAssetDescriptionRules());
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
/**
|
||||
* Get rules specific to tanah action.
|
||||
*/
|
||||
@@ -133,9 +108,9 @@ class FormSurveyorRequest extends FormRequest
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rules specific to unit action.
|
||||
*/
|
||||
/**
|
||||
* Get rules specific to unit action.
|
||||
*/
|
||||
private function getUnitRules(): array
|
||||
{
|
||||
return [
|
||||
@@ -164,7 +139,7 @@ class FormSurveyorRequest extends FormRequest
|
||||
'jarak_cbd_point' => 'nullable',
|
||||
'nama_cbd_point' => 'nullable',
|
||||
'lebar_perkerasan_jalan' => 'nullable',
|
||||
'perkerasan_jalan' => 'nullable',
|
||||
'perkerasan_jalan.*' => 'nullable',
|
||||
'lalu_lintas' => 'nullable',
|
||||
'gol_mas_sekitar' => 'nullable',
|
||||
'tingkat_keramaian' => 'nullable',
|
||||
@@ -223,24 +198,57 @@ class FormSurveyorRequest extends FormRequest
|
||||
|
||||
|
||||
private function getAssetDescriptionRules(): array
|
||||
{
|
||||
return [
|
||||
'permohonan_id' => 'required',
|
||||
'type' => 'required',
|
||||
'debitur_perwakilan' => 'required|array',
|
||||
'jenis_asset' => 'required',
|
||||
'jenis_asset_tidak_sesuai' => 'nullable',
|
||||
'alamat_sesuai' => 'required',
|
||||
'alamat_tidak_sesuai' => 'nullable',
|
||||
'nama_jalan' => 'nullable',
|
||||
'desa_kelurahan' => 'nullable',
|
||||
'kecamatan' => 'nullable',
|
||||
'kota_kabupaten' => 'nullable',
|
||||
'provinsi' => 'nullable',
|
||||
'kordinat_lng' => 'nullable',
|
||||
'kordinat_lat' => 'nullable',
|
||||
];
|
||||
}
|
||||
{
|
||||
return [
|
||||
'permohonan_id' => 'required',
|
||||
'type' => 'required',
|
||||
'debitur_perwakilan' => 'required|array',
|
||||
'jenis_asset' => 'required',
|
||||
'jenis_asset_tidak_sesuai' => 'nullable',
|
||||
'alamat_sesuai' => 'required',
|
||||
'alamat_tidak_sesuai' => 'nullable',
|
||||
'nama_jalan' => 'nullable',
|
||||
'desa_kelurahan' => 'nullable',
|
||||
'kecamatan' => 'nullable',
|
||||
'kota_kabupaten' => 'nullable',
|
||||
'provinsi' => 'nullable',
|
||||
'kordinat_lng' => 'nullable',
|
||||
'kordinat_lat' => 'nullable',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get common rules that apply to all actions.
|
||||
*/
|
||||
private function getCommonRules(): array
|
||||
{
|
||||
return [
|
||||
'fakta_positif' => 'nullable|array',
|
||||
'fakta_negatif' => 'nullable|array',
|
||||
'rute_menuju' => 'nullable',
|
||||
'batas_batas' => 'nullable|array',
|
||||
'kondisi_lingkungan' => 'nullable|array',
|
||||
'kondisi_lain_bangunan' => 'nullable|array',
|
||||
'informasi_dokument' => 'nullable',
|
||||
'peruntukan' => 'nullable',
|
||||
'kdb' => 'nullable',
|
||||
'kdh' => 'nullable',
|
||||
'gsb' => 'nullable',
|
||||
'max_lantai' => 'nullable',
|
||||
'klb' => 'nullable',
|
||||
'gss' => 'nullable',
|
||||
'pelebaran_jalan' => 'nullable',
|
||||
'nama_petugas' => 'nullable',
|
||||
'lat' => 'nullable|numeric',
|
||||
'lng' => 'nullable|numeric',
|
||||
'foto_gistaru' => 'nullable',
|
||||
'foto_bhumi' => 'nullable',
|
||||
'foto_argis_region' => 'nullable',
|
||||
'foto_tempat' => 'nullable',
|
||||
'keterangan' => 'nullable',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
'name' => 'required|max:255',
|
||||
'slug' => 'required|max:255',
|
||||
'jenis_legalitas_jaminan_id' => 'nullable',
|
||||
'form_kategori.*' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@ namespace Modules\Lpj\Models;
|
||||
class JenisJaminan extends Base
|
||||
{
|
||||
protected $table = 'jenis_jaminan';
|
||||
protected $fillable = ['code', 'name', 'slug', 'jenis_legalitas_jaminan_id'];
|
||||
protected $fillable = ['code', 'name', 'slug', 'jenis_legalitas_jaminan_id', 'form_kategori'];
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class Penilaian extends Model
|
||||
protected $fillable = [
|
||||
'jenis_penilaian_id', 'penilaian_id', 'tanggal_kunjungan', 'keterangan','nomor_registrasi',
|
||||
'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_at',
|
||||
'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
|
||||
'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by','waktu_penilaian', 'deskripsi_penilaian'
|
||||
];
|
||||
|
||||
public function jenis_penilaian()
|
||||
|
||||
Reference in New Issue
Block a user