Initial Commit

This commit is contained in:
2025-05-06 15:05:09 +07:00
commit 7b885d7d45
695 changed files with 119779 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ArahMataAnginRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|max:255',
];
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class BankDataRequest extends FormRequest
{
public function authorize()
{
return true; // Adjust this based on your authorization logic
}
public function rules()
{
return [
'address' => 'nullable|string|max:255',
'village_code' => 'nullable|string|max:20',
'district_code' => 'nullable|string|max:20',
'city_code' => 'nullable|string|max:20',
'province_code' => 'nullable|string|max:20',
'tahun' => 'nullable|integer',
'luas_tanah' => 'nullable|numeric',
'luas_bangunan' => 'nullable|numeric',
'tahun_bangunan' => 'nullable|integer',
'status_nara_sumber' => 'nullable|string|max:50',
'harga' => 'nullable|numeric',
'harga_diskon' => 'nullable|numeric',
'diskon' => 'nullable|numeric',
'total' => 'nullable|numeric',
'nama_nara_sumber' => 'nullable|string|max:100',
'peruntukan' => 'nullable|string|max:100',
'penawaran' => 'nullable|string|max:50',
'telepon' => 'nullable|string|max:20',
'hak_properti' => 'nullable|string|max:50',
'kordinat_lat' => 'nullable|numeric',
'kordinat_lng' => 'nullable|numeric',
'jenis_aset' => 'nullable|string|max:50',
'foto_objek' => 'nullable|image|max:2048',
'tanggal' => 'nullable|date',
'harga_penawaran' => 'nullable|numeric',
'nomor_laporan' => 'nullable|string|max:50',
'tgl_final_laporan' => 'nullable|date',
'nilai_pasar' => 'nullable|numeric',
'indikasi_nilai_likuidasi' => 'nullable|numeric',
'indikasi_nilai_pasar_tanah' => 'nullable|numeric',
'estimasi_harga_tanah' => 'nullable|numeric',
'estimasi_harga_bangunan' => 'nullable|numeric',
'indikasi_nilai_pasar_bangunan' => 'nullable|numeric',
'indikasi_nilai_pasar_sarana_pelengkap' => 'nullable|numeric',
'indikasi_nilai_pasar_mesin' => 'nullable|numeric',
'indikasi_nilai_pasar_kendaraan_alat_berat' => 'nullable|numeric',
'photos' => 'nullable|array',
'photos.*' => 'nullable|image|max:2048',
];
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Modules\Lpj\Models\CustomField;
use Illuminate\Validation\Rule;
class CustomFieldRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'name' => 'required|max:255',
'type' => 'required|in:text,select,radio,checkbox,date,number',
'label' => 'nullable|max:255',
'urutan_prioritas' => [
'nullable',
'integer',
Rule::unique('custom_fields')->ignore($this->route('custom_field')),
],
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
public function prepareValidationData($data){
if(!$this->type){
$this->merge(['type' => 'text']);
}
if (!$this->urutan_prioritas) {
$maxPrioritas = CustomField::max('urutan_prioritas') ?? 0;
$this->merge(['urutan_prioritas' => $maxPrioritas + 1]);
}
}
/**
* Get custom messages for validator errors.
*
* @return array
*/
public function messages()
{
return [
'urutan_prioritas.unique' => 'Urutan prioritas sudah digunakan. Silakan pilih nomor lain.',
];
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Modules\Lpj\Rules\UniqueCifExceptZero;
use Modules\Lpj\Rules\UniqueExcept;
class DebitureRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'branch_id' => 'required|exists:branches,id',
'province_code' => 'nullable|exists:provinces,code',
'city_code' => 'nullable|exists:cities,code',
'district_code' => 'nullable|exists:districts,code',
'village_code' => 'nullable|exists:villages,code',
'nomor_rekening' => 'nullable|string|max:50',
'name' => 'required',
'registered_at' => 'nullable|date',
'npwp' => 'nullable|string|min:15|max:16',
'email' => 'nullable|email',
'phone' => 'nullable|string|max:15',
'address' => 'nullable|string',
'postal_code' => 'nullable|string|max:10',
'status' => 'nullable|boolean'
];
if($this->method() == 'PUT'){
$rules['cif'] = ['required', new UniqueCifExceptZero($this->id)];
}else{
$rules['cif'] = ['required', new UniqueCifExceptZero(null)];
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class DokumenJaminanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'debiture_id' => 'required|exists:debitures,id',
'pemilik_jaminan_id' => 'required',
'jenis_jaminan_id' => 'required',
'jenis_legalitas_jaminan_id' => 'required',
'dokumen_jaminan' => 'nullable|file|mimes:pdf',
'keterangan' => 'nullable|string|max:255',
'province_code' => 'nullable|exists:provinces,code',
'city_code' => 'nullable|exists:cities,code',
'district_code' => 'nullable|exists:districts,code',
'village_code' => 'nullable|exists:villages,code',
'name' => 'required',
'address' => 'nullable|string',
'postal_code' => 'nullable|string|max:10',
'status' => 'nullable|boolean',
];
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class DokumenJaminanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'debiture_id' => 'required|exists:debitures,id',
'permohonan_id' => 'required|exists:permohonan,id',
'pemilik_jaminan_id' => 'required',
'jenis_jaminan_id' => 'required',
'province_code' => 'nullable|exists:provinces,code',
'city_code' => 'nullable|exists:cities,code',
'district_code' => 'nullable|exists:districts,code',
'village_code' => 'nullable|exists:villages,code',
'address' => 'nullable|string',
'postal_code' => 'nullable|string|max:10',
'status' => 'nullable|boolean',
];
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,699 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class FormSurveyorRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$actionSpecificRules = $this->getActionSpecificRules();
return $actionSpecificRules;
}
/**
* Get rules specific to the action.
*/
private function getActionSpecificRules(): array
{
$action = $this->input('action');
$pisah = explode(',', $action);
$allRules = [
'tanah' => $this->getTanahRules(),
'bangunan' => $this->getBangunanRules(),
'kapal' => $this->getKapalRules(),
'kendaraan' => $this->getKendaraanRules(),
'mesin' => $this->getMesinRules(),
'pesawat' => $this->getPesawatRules(),
'alat-berat' => $this->getAlatBeratRules(),
'apartemen-kantor' => $this->getUnitRules(),
'lingkungan' => $this->getLinkunganRules(),
'fakta' => $this->getCommonRules(),
'rap' => $this->getRapRules()
];
$rules = [];
$hasAssetDescriptionRules = false;
foreach ($pisah as $act) {
if (isset($allRules[$act])) {
$rules = array_merge($rules, $allRules[$act]);
if ($act == 'tanah' || $act == 'bangunan' || $act == 'apartemen-kantor' || $act == 'rap') {
$hasAssetDescriptionRules = true;
}
}
}
if ($hasAssetDescriptionRules) {
$rules = array_merge($rules, $this->getAssetDescriptionRules());
}
return $rules;
}
/**
* Get rules specific to tanah action.
*/
public function getTanahRules(): array
{
return [
'luas_tanah' => 'required',
'luas_tanah_sesuai' => 'nullable',
'luas_tanah_tidak_sesuai' => 'nullable',
'hadap_mata_angin' => 'required',
'hadap_mata_angin_sesuai' => 'nullable',
'hadap_mata_angin_tidak_sesuai' => 'nullable',
'bentuk_tanah' => 'required|array',
'bentuk_tanah_lainnya' => 'nullable',
'kontur_tanah' => 'required|array',
'ketinggian_jalan' => 'required|array',
'kontur_jalan' => 'required',
'posisi_kavling' => 'required|array',
'posisi_kavling_lainnya' => 'nullable',
'tusuk_sate' => 'required',
'lockland' => 'required',
'kondisi_fisik_tanah' => 'required|array',
'ketinggian_lebih_tinggi' => 'nullable',
'ketinggian_lebih_rendah' => 'nullable',
];
}
/**
* Get rules specific to Bangunan action.
*/
private function getBangunanRules(): array
{
return [
'action' => 'required',
'luas_tanah_bangunan_sesuai' => 'nullable',
'luas_tanah_bagunan' => 'required',
'luas_tanah_bangunan_tidak_sesuai' => 'nullable',
'jenis_bangunan' => 'required|array',
'kondisi_bangunan' => 'required|array',
'sifat_bangunan' => 'required|array',
'sifat_bangunan_input' => 'nullable|array',
'nama_bangunan.*' => 'required|string|max:255',
'spek_kategori_bangunan.*' => 'nullable|string',
'spek_bangunan.*.*.lainnya' => 'nullable|string',
'sarana_pelengkap' => 'required',
'sarana_pelengkap_input' => 'nullable|array',
];
}
/**
* Get rules specific to unit action.
*/
private function getUnitRules(): array
{
return [
'action' => 'required',
'luas_unit' => 'required',
'luas_unit_sesuai' => 'nullable',
'luas_unit_tidak_sesuai' => 'nullable',
'kondisi_unit' => 'required|array',
'posisi_unit' => 'required|array',
'lantai' => 'required|array',
'view' => 'required|array',
'bentuk_unit' => 'required|array',
];
}
/**
* Get rules specific to Linkungan action.
*/
private function getLinkunganRules(): array
{
return [
'action' => 'required',
'jarak_jalan_utama' => 'nullable',
'jalan_linkungan' => 'nullable',
'jarak_cbd_point' => 'nullable',
'nama_cbd_point' => 'nullable',
'lebar_perkerasan_jalan' => 'nullable',
'perkerasan_jalan' => 'nullable|array',
'perkerasan_jalan_lainnya' => 'nullable',
'lalu_lintas' => 'nullable',
'gol_mas_sekitar' => 'nullable',
'tingkat_keramaian' => 'nullable',
'terletak_diarea' => 'nullable',
'terletak_diarea_lainnya' => 'nullable',
'disekitar_lokasi' => 'required',
'kondisi_bagunan_disekitar_lokasi' => 'nullable',
'sifat_bagunan_disekitar_lokasi' => 'nullable',
'dekat_makam' => 'nullable',
'jarak_makam' => 'nullable',
'nama_makam' => 'nullable',
'dekat_tps' => 'nullable',
'jarak_tps' => 'nullable',
'nama_tpu' => 'nullable',
'dekat_lainnya' => 'nullable',
'merupakan_daerah' => 'nullable',
'fasilitas_dekat_object' => 'nullable|array',
'fasilitas_dekat_object_input' => 'nullable|array',
];
}
private function getKapalRules(): array
{
return [
'action' => 'required',
'nama_wakil_debitur' => 'nullable',
'hub_calon_debitur' => 'required',
'dermaga' => 'nullable',
'nama_jalan' => 'required',
'perumahan_gang' => 'required',
'blok_nomor' => 'required',
'village_code' => 'nullable|string',
'district_code' => 'nullable|string',
'city_code' => 'nullable|string',
'province_code' => 'nullable|string',
'jenis_kapal' => 'required',
'jenis_kapal_lainnya' => 'nullable',
'size' => 'required',
'kondisi' => 'required',
'klasifikasi' => 'required',
'nama_kapal' => 'required',
'pemilik_kapal' => 'required',
'bendera' => 'required',
'nomor_selar' => 'required',
'kapal' => 'required',
'galangan_kapal' => 'required',
'kapal_shipyard' => 'required',
'tahun_pembuatan' => 'required',
'tahun_launcing' => 'required',
'dwt' => 'required',
'lwt' => 'required',
'gross_tonnage' => 'required',
'net_tonnage' => 'required',
'tenaga_mesin' => 'required',
'loa' => 'required',
'lbp' => 'required',
'beam' => 'required',
'depth' => 'required',
'draft' => 'required',
'lambung_kapal' => 'required',
'dek' => 'required',
'struktur_rangka' => 'required',
'palka' => 'required',
'pondasi_mesin' => 'required',
'area_mesin' => 'required',
'cat_dan_korosi' => 'required',
'sistem_pengelasan' => 'required',
'deskripsi_struktur' => 'required',
'sekoci' => 'required',
'jaket_pelampung' => 'required',
'alat_pemadaman' => 'required',
'rambu_darurat' => 'required',
'sistem_alarm' => 'required',
'sistem_pencegah' => 'required',
'kebakaran' => 'required',
'lampu_darurat' => 'required',
'deskripsi_peralatan' => 'required',
'gps' => 'required',
'radar' => 'required',
'radio_komunikasi' => 'required',
'lampu_navigasi' => 'required',
'sistem_kendali_otomatis' => 'required',
'kompas' => 'required',
'deskripsi_navigasi' => 'required',
'mesin_utama' => 'required',
'mesin_bantu' => 'required',
'pompa_pendingin' => 'required',
'sistem_pelumasan' => 'required',
'propeller' => 'required',
'sistem_kelistrikan' => 'required',
'deskripsi_mesin_penggerak' => 'required',
'lampu_navigasi' => 'required',
'sistem_penerangan' => 'required',
'sistem_panel_distribusi' => 'required',
'kabel_perangkat' => 'required',
'deskripsi_kelistrikan' => 'required',
'kebersihan_dek_luar' => 'nullable',
'tangki_limbah' => 'nullable',
'sistem_pengelolaan_limbah' => 'nullable',
'pengelolaan_air_ballast' => 'nullable',
'deskripsi_kebersihan' => 'required',
'fakta_positif.*' => 'nullable',
'fakta_negatif.*' => 'nullable',
'analisa_makro.*' => 'nullable',
'kesimpulan.*' => 'nullable',
'catatan.*' => 'nullable',
];
}
public function getKendaraanRules(): array
{
return [
'action' => 'required',
'tanggal_survey' => 'required',
'nama_wakil' => 'required',
'hub_calon_debitur' => 'required',
'nama_jalan' => 'required',
'perumahan_gang' => 'required',
'blok_nomor' => 'required',
'village_code' => 'nullable|string',
'district_code' => 'nullable|string',
'city_code' => 'nullable|string',
'province_code' => 'nullable|string',
'masa_stnk' => 'required',
'masa_pajak' => 'required',
'kendaraan.*' => 'required',
'kendaraan_input.*' => 'nullable',
'kondisi' => 'required',
'nomor_polisi' => 'required',
'nomor_polis_tidak_sesuai' => 'nullable',
'merek' => 'required',
'merek_tidak_sesuai' => 'nullable',
'warna' => 'required',
'warna_tidak_sesuai' => 'nullable',
'nomor_rangka' => 'required',
'nomor_rangka_tidak_sesuai' => 'nullable',
'nomor_mesin' => 'required',
'nomor_mesin_tidak_sesuai' => 'nullable',
'posisi_kilometer' => 'required',
'transmisi' => 'required',
'transmisi_input' => 'nullable',
'mesin_panel_instrument.*' => 'required',
'mesin_panel_instrument_input.*' => 'nullable',
'fungsi_mesin_panel_instrument.*' => 'required',
'fungsi_mesin_panel_instrument_input.*' => 'nullable',
'interior.*' => 'required',
'interior_input.*' => 'nullable',
'jumlah_pintu.*' => 'required',
'jumlah_pintu_input.*' => 'nullable',
'rangka_karoseri.*' => 'required',
'rangka_karoseri_input.*' => 'nullable',
'ban.*' => 'required',
'ban_input.*' => 'nullable',
'velg.*' => 'required',
'velg_input.*' => 'nullable',
'bamper_depan.*' => 'required',
'bamper_depan_input.*' => 'nullable',
'bamper_belakang.*' => 'required',
'bamper_belakang_input.*' => 'nullable',
'lampu_depan.*' => 'required',
'lampu_depan_input.*' => 'nullable',
'lampu_belakang.*' => 'required',
'lampu_belakang_input.*' => 'nullable',
'kaca_kendaraan.*' => 'required',
'kaca_kendaraan_input.*' => 'nullable',
'air_conditioner.*' => 'required',
'air_conditioner_input.*' => 'nullable',
'tape_radio_cd.*' => 'required',
'tape_radio_cd_input.*' => 'nullable',
'sensor_parkir.*' => 'required',
'sensor_parkir_input.*' => 'nullable',
'sensor_camera_recorder.*' => 'required',
'sensor_camera_recorder_input.*' => 'nullable',
'lcd.*' => 'required',
'lcd_input.*' => 'nullable',
'sabuk_keselamatan.*' => 'required',
'sabuk_keselamatan_input.*' => 'nullable',
'airbag.*' => 'required',
'airbag_input.*' => 'nullable',
'asuransi.*' => 'required',
'asuransi_input.*' => 'nullable',
'perusahaan_asuransi' => 'required',
'tahun_berakhir' => 'required',
'fakta_positif.*' => 'nullable',
'fakta_negatif.*' => 'nullable',
'analisa_makro.*' => 'nullable',
'kesimpulan.*' => 'nullable',
'catatan.*' => 'nullable',
];
}
public function getMesinRules(): array
{
return [
'action' => 'required',
'nama_wakil' => 'required',
'nama_jalan' => 'required',
'perumahan_gang' => 'required',
'blok' => 'required',
'desa_kelurahan' => 'required',
'kecamatan' => 'required',
'kota_madya' => 'required',
'provinsi' => 'required',
'hub_calon_debitur' => 'required',
'tipe_model' => 'required',
'merek' => 'required',
'tahun_pembuatan' => 'required',
'negara_pembuat' => 'required',
'kondisi_mesin' => 'required',
'faktor_positif' => 'nullable',
'faktor_negatif' => 'nullable',
'kesimpulan' => 'nullable',
'catatan' => 'nullable',
];
}
public function getAlatBeratRules(): array
{
return [
'action' => 'required',
'nama_wakil' => 'required|string',
'hub_calon_debitur' => 'required|string',
'nama_jalan' => 'required',
'perumahan_gang' => 'required',
'blok_nomor' => 'required',
'village_code' => 'nullable|string',
'district_code' => 'nullable|string',
'city_code' => 'nullable|string',
'province_code' => 'nullable|string',
'jenis_model' => 'required',
'nomor_lambung' => 'required',
'model_unit' => 'required',
'tahun_pembuatan' => 'required',
'merk' => 'required',
'negara_pembuat' => 'required',
'tahun_pembelian' => 'required',
'nomor_faktur' => 'nullable',
'nomor_kontrak' => 'nullable',
'nama_pemilik' => 'nullable',
'alamat_pemilik' => 'nullable',
'nomor_asuransi' => 'nullable',
'nomor_rangka' => 'nullable',
'nomor_mesin' => 'nullable',
'hour_mesters' => 'nullable',
'overhaul_mesin' => 'nullable',
'mesin_panel.*' => 'nullable',
'mesin_panel_input.*' => 'nullable',
'fungsi_panel.*' => 'nullable',
'fungsi_panel_input.*' => 'nullable',
'interior.*' => 'nullable',
'interior_input.*' => 'nullable',
'rangka_Karoseri.*' => 'nullable',
'rangka_Karoseri_input.*' => 'nullable',
'ban.*' => 'nullable',
'ban_innput.*' => 'nullable',
'velg.*' => 'nullable',
'velg_input.*' => 'nullable',
'air_conditioner.*' => 'nullable',
'air_conditioner_input.*' => 'nullable',
'aksesoris.*' => 'nullable',
'aksesoris_input.*' => 'nullable',
'lcd.*' => 'nullable',
'lcd_innput.*' => 'nullable',
'perlengkapan.*' => 'nullable',
'perlengkapan_input.*' => 'nullable',
'asuransi.*' => 'nullable',
'asuransi_input.*' => 'nullable',
'perusahaan_asuransi' => 'nullable',
'tahun_berakhir.*' => 'nullable',
'sensor_kamera.*' => 'nullable',
'lcd.*' => 'nullable',
'sabuk_keselamatan.*' => 'nullable',
'air_bag.*' => 'nullable',
'asuransi.*' => 'nullable',
'perusahan_asuransi' => 'nullable',
'tahun_berakhir' => 'nullable',
'fakta_positif' => 'nullable|array',
'fakta_negatif' => 'nullable|array',
'kesimpulan' => 'nullable',
'catatan' => 'nullable|array',
];
}
private function getPesawatRules(): array
{
return [
'action' => 'required',
'nama_wakil' => 'required|string',
'hub_calon_debitur' => 'required|string',
'nama_jalan' => 'required',
'perumahan_gang' => 'required',
'blok_nomor' => 'required',
'village_code' => 'nullable|string',
'district_code' => 'nullable|string',
'city_code' => 'nullable|string',
'province_code' => 'nullable|string',
'jenis_pesawat' => 'required',
'jenis_pesawat_lainnya' => 'nullable',
'size' => 'required',
'kondisi' => 'required',
'nama_pesawat' => 'required',
'model' => 'required',
'nomor_registrasi' => 'required',
'tahun_pembuatan' => 'required',
'certificate_of_airworthines' => 'required',
'certificate_of_registration' => 'required',
'total_service_hours' => 'required',
'total_service_cycles' => 'required',
'last_a_check' => 'required',
'next_a_check' => 'required',
'last_b_check' => 'required',
'next_b_check' => 'required',
'last_c_check' => 'required',
'next_c_check' => 'required',
'next_d_check' => 'required',
'last_d_check' => 'required',
'deskripsi_maintenence' => 'nullable',
'instrument_landing_system' => 'required',
'traffic_collision_avoidance_system' => 'required',
'windshear' => 'required',
'electronic_flight' => 'required',
'winglets' => 'required',
'deskripsi_konfigurasi' => 'required',
'maksimal_penumpang' => 'required',
'jumlah_kursi' => 'required',
'kursi_pramugari_pramugara' => 'required',
'kartu_fitur_keselamatan' => 'required',
'sabuk_pengaman' => 'required',
'lampu_kabin' => 'required',
'lampu_pintu_keluar' => 'required',
'intercom_kabin' => 'required',
'deskripsi_kabin' => 'required',
'badan_pesawat' => 'nullable',
'sayap_pesawat' => 'required',
'ekor_pesawat' => 'required',
'landing_gear' => 'required',
'sabuk_pengaman' => 'required',
'sistem_pengelasan' => 'required',
'deskripsi_struktur' => 'required',
'gps' => 'required',
'radar' => 'required',
'radio_komunikasi' => 'required',
'lampu_navigasi' => 'required',
'sistem_autopilot' => 'required',
'deskripsi_navigasi' => 'required',
'tangki_bahan_bakar' => 'required',
'saluran_pipa_bahan_bakar' => 'required',
'pompa_bahan_bakar' => 'required',
'sistem_hidrolik_utama' => 'required',
'sistem_pendigin_hidrolik' => 'required',
'deskripsi_hidrolik' => 'required',
'mesin_utama' => 'required',
'sistem_pendorong' => 'required',
'sistem_pendigin_mesin' => 'required',
'sistem_pelumasan' => 'required',
'filter_dan_perangkat_pendukung' => 'required',
'deskripsi_kondisi_mesin' => 'required',
'jaket_pelampung' => 'required',
'pintu_darurat' => 'required',
'alat_pemadaman_kebakaran' => 'required',
'sistem_alaram_darurat' => 'required',
'sekoci' => 'required',
'masker_oxigen' => 'required',
'sabuk_pengaman' => 'required',
'deskripsi_fungsi_keselamatan' => 'required',
'sistem_ventilasi_ac' => 'required',
'sistem_penerangan_kabin' => 'required',
'panel_informasi_penumpang' => 'required',
'sistem_hiburan_kabin' => 'required',
'deskripsi_Interior' => 'required',
'fakta_positif' => 'nullable|array',
'fakta_negatif' => 'nullable|array',
'kesimpulan' => 'nullable',
'catatan' => 'nullable|array',
];
}
private function getAssetDescriptionRules(): array
{
return [
'permohonan_id' => 'required',
'dokument_id' => 'required',
'type' => 'required',
'nomor_registrasi' => 'required',
'debitur_perwakilan' => 'required|array',
'jenis_asset_name' => 'nullable|',
'jenis_asset' => 'required',
'jenis_asset_tidak_sesuai' => 'nullable|string',
'alamat_sesuai' => 'required',
'alamat_tidak_sesuai' => 'nullable|string',
'pihak_bank' => 'nullable|string',
'nomor_nib' => 'nullable|string',
'hub_cadeb' => 'nullable|string',
'hub_cadeb_sesuai' => 'nullable|string',
'hub_cadeb_tidak_sesuai' => 'nullable|string',
'hub_cadeb_penghuni' => 'nullable',
'hub_cadeb_penghuni_sesuai' => 'nullable|string',
'hub_penghuni_tidak_sesuai' => 'nullable|string',
'address' => 'nullable|string',
'village_code' => 'nullable|string',
'district_code' => 'nullable|string',
'city_code' => 'nullable|string',
'province_code' => 'nullable|string',
'kordinat_lng' => 'nullable|string',
'kordinat_lat' => 'nullable|string',
];
}
/**
* 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' => 'required|array',
'batas_batas_input' => 'nullable|array',
'kondisi_lingkungan' => 'nullable|array',
'kondisi_lain_bangunan' => 'nullable|array',
'informasi_dokument' => 'nullable|array',
'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',
'upload_gs' => 'nullable',
'foto_sentuh_tanahku' => 'nullable',
'keterangan' => 'nullable|array',
];
}
private function getRapRules()
{
return [
'perizinan' => 'nullable|array',
'perizinan.*' => 'nullable|string',
'perizinan_file' => 'nullable|array',
'perizinan_file.*' => 'nullable|file|mimes:pdf,docx',
'brosur_price_list' => 'nullable|array',
'brosur_price_list.*' => 'nullable|string',
'brosur_price_list_file' => 'nullable|array',
'brosur_price_list_file.*' => 'nullable|file|mimes:pdf,docx',
'pengalaman_developer' => 'nullable',
'developer_anggota' => 'nullable',
'lainnya_developer.*' => 'nullable',
'kapan_mulai_dibangun' => 'nullable',
'kondisi_perumahan' => 'nullable',
'progres_pembangunan' => 'nullable',
'kontraktor' => 'nullable',
'lingkungan_sekitar' => 'nullable',
'komplek_disekitar' => 'nullable',
'pusat_keramaian' => 'nullable',
'transportasi_umum' => 'nullable',
'lainnya_kondisi.*' => 'nullable',
// Validasi untuk partisi yang diperbarui
'partisi' => 'nullable|array',
'partisi.*' => 'nullable|array',
'partisi.*.nama' => 'nullable|string',
'partisi.*.value' => 'nullable|string|max:255',
'jumlah_unit.*' => 'nullable',
'batas_batas_perumahan' => 'nullable',
'fasus_fasum.*' => 'nullable',
'progres_penjualan.*' => 'nullable',
'harga_unit.*' => 'nullable',
'target_market.*' => 'nullable',
'kerjasama_dengan_bank' => 'nullable',
'rute_menuju_lokasi' => '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',
'upload_gs' => 'nullable',
'foto_sentuh_tanahku' => 'nullable',
'keterangan' => 'nullable|array',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class HubunganPemilikJaminanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|max:255',
];
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class HubunganPenghuniJaminanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|max:255',
];
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class IjinUsahaRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$rules = [
'name' => 'required|string|not_regex:/^\d+$/|max:255'
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|max:50|unique:ijin_usaha,code,' . $this->id;
} else {
$rules['code'] = 'required|max:50|unique:ijin_usaha,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
public function messages(): array
{
return [
'code.required' => 'Kode Ijin Usaha harus diisi!',
'code.max' => 'Kode Ijin Usaha maksimal 255 huruf!',
'code.unique' => 'Kode Ijin Usaha tidak boleh sama!',
'name.required' => 'Nama Ijin Usaha harus diisi!',
'name.not_regex' => 'Nama Ijin Usaha harus berupa huruf!',
'name.max' => 'Nama Ijin Usaha maksimal 255 huruf!'
];
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class JenisAsetRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|max:255',
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|max:50|unique:jenis_aset,code,' . $this->id;
} else {
$rules['code'] = 'required|max:50|unique:jenis_aset,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class JenisDokumenRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|max:255',
'max_size' => 'nullable|numeric',
'description' => 'nullable|max:255'
];
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class JenisFasilitasKreditRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|max:255|unique:jenis_fasilitas_kredit,name'
];
if ($this->method() == 'PUT') {
$rules['code'] = 'max:50|unique:jenis_fasilitas_kredit,code,' . $this->id;
$rules['name'] = 'required|unique:jenis_fasilitas_kredit,name,' . $this->id;
} else {
$rules['code'] = 'max:50|unique:jenis_fasilitas_kredit,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace Modules\Lpj\Http\Requests;
use daengdeni\LaravelIdGenerator\IdGenerator;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;
class JenisJaminanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
return [
'code' => 'required|max:5',
'name' => 'required|max:255',
'slug' => 'required|max:255',
'jenis_legalitas_jaminan_id' => 'nullable',
'form_kategori' => 'required',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
public function prepareForValidation()
: void
{
if ($this->method() == 'POST') {
$this->merge([
'code' => IdGenerator::generate(
['table' => 'jenis_jaminan', 'length' => 5, 'prefix' => 'JJ', 'field' => 'code'],
),
]);
}
$this->merge([
'jenis_legalitas_jaminan_id' => json_encode($this->jenis_legalitas_jaminan_id),
'form_kategori' => json_encode($this->form_kategori),
'slug' => Str::slug($this->name),
]);
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class JenisLampiranRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'nama' => [
'required',
'string',
'max:255',
Rule::unique('jenis_lampiran')->where(function ($query) {
return $query->whereNull('deleted_at');
})->ignore($this->route('jenis_lampiran')),
],
'deskripsi' => 'nullable|string',
];
return $rules;
}
/**
* Get custom messages for validator errors.
*
* @return array
*/
public function messages()
{
return [
'nama.required' => 'Nama jenis lampiran harus diisi.',
'nama.max' => 'Nama jenis lampiran tidak boleh lebih dari 255 karakter.',
];
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class JenisLaporanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$rules = [
'code' => 'required|max:5',
'name' => 'required|max:255',
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|max:5|unique:jenis_laporan,code,' . $this->id;
} else {
$rules['code'] = 'required|max:5|unique:jenis_laporan,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
public function messages(): array
{
return [
'code.required' => 'Kode Jenis Laporan Wajib diisi!',
'code.max' => 'Kode Jenis Laporan maksimum 5 huruf!',
'code.unique' => 'Kode Jenis Laporan tidak boleh sama!',
'name.required' => 'Nama Jenis Laporan Wajib diisi!',
'name.max' => 'Nama Jenis Laporan Wajib diisi!'
];
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace Modules\Lpj\Http\Requests;
use daengdeni\LaravelIdGenerator\IdGenerator;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;
class JenisLegalitasJaminanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
return [
'code' => 'required|max:6',
'name' => 'required|max:255',
'slug' => 'required|max:255',
'custom_field' => 'nullable|max:255',
'custom_field_type' => 'nullable|max:255',
'custom_fields' => 'nullable|array',
'custom_fields.*' => 'required|string|max:255',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
public function prepareForValidation()
{
if ($this->method() == 'POST' && $this->code == null) {
$this->merge([
'code' => IdGenerator::generate(
['table' => 'jenis_legalitas_jaminan', 'length' => 6, 'prefix' => 'JLJ', 'field' => 'code'],
),
'slug' => Str::slug($this->name),
]);
} else {
$this->merge([
'slug' => Str::slug($this->name),
]);
}
// Ensure custom_fields is always an array
if (!is_array($this->custom_fields)) {
$this->merge(['custom_fields' => []]);
}
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class JenisPenilaianKJPPRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$rules = [
'code' => 'required|max:5',
'name' => 'required|max:255',
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|max:5|unique:tujuan_penilaian_kjpp,code,' . $this->id;
} else {
$rules['code'] = 'required|max:5|unique:tujuan_penilaian_kjpp,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
public function messages(): array
{
return [
'code.required' => 'Kode Tujuan Penilaian KJPP Wajib diisi!',
'code.max' => 'Kode Tujuan Penilaian KJPP maksimum 5 huruf!',
'code.unique' => 'Kode Tujuan Penilaian KJPP tidak boleh sama!',
'name.required' => 'Nama Tujuan Penilaian KJPP Wajib diisi!',
'name.max' => 'Nama Tujuan Penilaian KJPP Wajib diisi!'
];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class JenisPenilaianRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$rules = [
'name' => 'required|string|max:255',
'status' => 'nullable|boolean',
'authorized_at' => 'nullable|datetime',
'authorized_status' => 'nullable|string|max:1',
'authorized_by' => 'nullable|exists:users,id',
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|string|max:3|unique:jenis_penilaian,code,' . $this->id;
} else {
$rules['code'] = 'required|string|max:3|unique:jenis_penilaian,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
}

View File

@@ -0,0 +1,127 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class KJPPRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$rules = [
'name' => 'required|string|not_regex:/^\d+$/|max:255',
'jenis_kantor' => 'required',
'nomor_ijin_usaha' => 'required',
'province_code' => 'required',
'city_code' => 'nullable',
'district_code' => 'nullable',
'village_code' => 'nullable',
'address' => 'required',
'postal_code' => 'nullable|numeric',
'nomor_telepon_kantor' => 'nullable|numeric|digits_between:8,15',
'email_kantor' => 'required|email',
'detail_email_kantor' => 'nullable',
'detail_email_kantor.email_kantor.*' => 'email',
'nama_pimpinan' => 'required|string|not_regex:/^\d+$/|max:255',
'detail_nama_pimpinan' => 'nullable',
'detail_nama_pimpinan.nama_pimpinan.*' => 'string|not_regex:/^\d+$/|max:255',
'nomor_hp_pimpinan' => 'required|numeric|digits_between:10,15',
'detail_nomor_hp_pimpinan' => 'nullable',
'detail_nomor_hp_pimpinan.nomor_hp_pimpinan.*' => 'numeric|digits_between:10,15',
'nama_pic_reviewer' => 'nullable|string|not_regex:/^\d+$/|max:255',
'detail_nama_pic_reviewer' => 'nullable',
'detail_nama_pic_reviewer.nama_pic_reviewer.*' => 'string|not_regex:/^\d+$/|max:255',
'nomor_hp_pic_reviewer' => 'nullable|numeric|digits_between:10,15',
'detail_nomor_hp_pic_reviewer' => 'nullable',
'detail_nomor_hp_pic_reviewer.nomor_hp_pic_reviewer.*' => 'numeric|digits_between:10,15',
'nama_pic_admin' => 'nullable|string|not_regex:/^\d+$/|max:255',
'detail_nama_pic_admin' => 'nullable',
'detail_nama_pic_admin.nama_pic_admin.*' => 'string|not_regex:/^\d+$/|max:255',
'nomor_hp_pic_admin' => 'nullable|numeric|digits_between:10,15',
'detail_nomor_hp_pic_admin' => 'nullable',
'detail_nomor_hp_pic_admin.nomor_hp_pic_admin.*' => 'numeric|digits_between:10,15',
'nama_pic_marketing' => 'nullable|string|not_regex:/^\d+$/|max:255',
'detail_nama_pic_marketing' => 'nullable',
'detail_nama_pic_marketing.nama_pic_marketing.*' => 'string|not_regex:/^\d+$/|max:255',
'nomor_hp_pic_marketing' => 'nullable|numeric|digits_between:10,15',
'detail_nomor_hp_pic_marketing' => 'nullable',
'detail_nomor_hp_pic_marketing.nomor_hp_pic_marketing.*' => 'numeric|digits_between:10,15',
'ijin_usaha_id' => 'required|array',
'ijin_usaha_id.*' => 'exists:ijin_usaha,code',
'jenis_aset_id' => 'nullable|array',
'jenis_aset_id.*' => 'exists:jenis_jaminan,code',
'attachment' => 'nullable|mimes:pdf|max:1024'
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|max:50|unique:kjpp,code,' . $this->id;
} else {
$rules['code'] = 'required|max:50|unique:kjpp,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
public function messages(): array
{
return [
'code.required' => 'Kode KJPP Wajib diisi!',
'code.max' => 'Kode KJPP maksimal 255 huruf!',
'code.unique' => 'Kode KJPP tidak boleh sama!',
'name.required' => 'Nama KJPP Wajib diisi!',
'name.not_regex' => 'Nama KJPP harus berupa huruf!',
'name.max' => 'Nama KJPP maksimal 255 huruf!',
'jenis_kantor.required' => 'Jenis Kantor Wajib diisi!',
'nomor_ijin_usaha.required' => 'Nomor Ijin Usaha Wajib diisi!',
'nomor_ijin_usaha.max' => 'Nomor Ijin Usaha maksimal 255 huruf!',
'province_code.required' => 'Provinsi Wajib diisi!',
'postal_code.numeric' => 'Kode Pos harus berupa angka!',
'address.required' => 'Alamat Kantor Wajib diisi!',
'nomor_telepon_kantor.numeric' => 'Nomor Telepon Kantor harus berupa angka!',
'nomor_telepon_kantor.digits_between' => 'Nomor Telepon Kantor minimum 8 digit dan maksimum 15 digit!',
'email_kantor.required' => 'Email Kantor Wajib diisi!',
'email_kantor.email' => 'Email Kantor tidak valid!',
'detail_email_kantor.email_kantor.*.email' => 'Email Kantor tidak valid!',
'nama_pimpinan.required' => 'Nama Pimpinan Wajib diisi!',
'nama_pimpinan.not_regex' => 'Nama Pimpinan harus berupa huruf!',
'detail_nama_pimpinan.nama_pimpinan.*.not_regex' => 'Nama Pimpinan harus berupa huruf!',
'nomor_hp_pimpinan.required' => 'Nomor HP Pimpinan Wajib diisi!',
'nomor_hp_pimpinan.numeric' => 'Nomor HP Pimpinan harus berupa angka!',
'nomor_hp_pimpinan.digits_between' => 'Nomor HP Pimpinan minimum 10 digit dan maksimum 15 digit!',
'detail_nomor_hp_pimpinan.nomor_hp_pimpinan.*.numeric' => 'Nomor HP Pimpinan harus berupa angka!',
'detail_nomor_hp_pimpinan.nomor_hp_pimpinan.*.digits_between' => 'Nomor HP Pimpinan minimum 10 digit dan maksimum 15 digit!',
'nama_pic_reviewer.not_regex' => 'Nama PIC Reviewer harus berupa huruf!',
'detail_nama_pic_reviewer.nama_pic_reviewer.*.not_regex' => 'Nama PIC Reviewer harus berupa huruf!',
'nomor_hp_pic_reviewer.numeric' => 'Nomor HP PIC Reviewer harus berupa angka!',
'nomor_hp_pic_reviewer.digits_between' => 'Nomor HP PIC Reviewer minimum 10 digit dan maksimum 15 digit!',
'detail_nomor_hp_pic_reviewer.nomor_hp_pic_reviewer.*.numeric' => 'Nomor HP PIC Reviewer harus berupa angka!',
'detail_nomor_hp_pic_reviewer.nomor_hp_pic_reviewer.*.digits_between' => 'Nomor HP PIC Reviewer minimum 10 digit dan maksimum 15 digit!',
'nama_pic_admin.not_regex' => 'Nama PIC Admin harus berupa huruf!',
'detail_nama_pic_admin.nama_pic_admin.*.not_regex' => 'Nama PIC Admin harus berupa huruf!',
'nomor_hp_pic_admin.numeric' => 'Nomor HP PIC Admin harus berupa angka!',
'nomor_hp_pic_admin.digits_between' => 'Nomor HP PIC Admin minimum 10 digit dan maksimum 15 digit!',
'detail_nomor_hp_pic_admin.nomor_hp_pic_admin.*.numeric' => 'Nomor HP PIC Admin harus berupa angka!',
'detail_nomor_hp_pic_admin.nomor_hp_pic_admin.*.digits_between' => 'Nomor HP PIC Admin minimum 10 digit dan maksimum 15 digit!',
'nama_pic_marketing.not_regex' => 'Nama PIC Marketing harus berupa huruf!',
'detail_nama_pic_marketing.nama_pic_marketing.*.not_regex' => 'Nama PIC Marketing harus berupa huruf!',
'nomor_hp_pic_marketing.numeric' => 'Nomor HP PIC Marketing harus berupa angka!',
'nomor_hp_pic_marketing.digits_between' => 'Nomor HP PIC Marketing minimum 10 digit dan maksimum 15 digit!',
'detail_nomor_hp_pic_marketing.nomor_hp_pic_marketing.*.numeric' => 'Nomor HP PIC Marketing harus berupa angka!',
'detail_nomor_hp_pic_marketing.nomor_hp_pic_marketing.*.digits_between' => 'Nomor HP PIC Marketing minimum 10 digit dan maksimum 15 digit!',
'ijin_usaha_id.required' => 'Ijin Usaha Wajib diisi!',
'attachment.mimes' => 'Attachment harus berformat pdf!',
'attachment.max' => 'Attachment berukuran maksimum 1 MB!',
];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class LaporanExternalRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
return [
'permohonan_id' => 'required|exists:permohonan,id',
'nomor_laporan' => 'nullable|string|max:255',
'tgl_final_laporan' => 'nullable|date',
'nilai_pasar' => 'nullable|numeric',
'indikasi_nilai_likuidasi' => 'nullable|numeric',
'indikasi_nilai_pasar_tanah' => 'nullable|numeric',
'estimasi_harga_tanah' => 'nullable|numeric',
'estimasi_harga_bangunan' => 'nullable|numeric',
'indikasi_nilai_pasar_bangunan' => 'nullable|numeric',
'indikasi_nilai_pasar_sarana_pelengkap' => 'nullable|numeric',
'indikasi_nilai_pasar_mesin' => 'nullable|numeric',
'indikasi_nilai_pasar_kendaraan_alat_berat' => 'nullable|numeric',
'file_resume' => 'nullable|file|mimes:pdf|max:10240', // 10MB max
'file_laporan' => 'nullable|file|mimes:pdf|max:10240',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class NilaiPlafondRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|max:255',
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|max:50|unique:nilai_plafond,code,' . $this->id;
} else {
$rules['code'] = 'required|max:50|unique:nilai_plafond,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -0,0 +1,153 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
/**
* Form Request untuk validasi data NOC (Notice of Completion)
*/
class NocRequest extends FormRequest
{
/**
* Konstanta untuk jenis file yang diizinkan
*/
private const ALLOWED_FILE_TYPES = 'pdf,jpg,jpeg,png';
/**
* Konstanta untuk ukuran file maksimum (dalam KB)
*/
private const MAX_FILE_SIZE = 10240;
/**
* Menentukan apakah pengguna berwenang untuk melakukan request ini
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Mengumpulkan semua aturan validasi
*
* @return array
*/
public function rules()
{
return array_merge(
$this->getBasicInfoRules(),
$this->getPaymentRules(),
$this->getSettlementRules(),
$this->getAuthorizationRules(),
);
}
/**
* Aturan validasi untuk informasi dasar
*
* @return array
*/
private function getBasicInfoRules()
{
return [
'permohonan_id' => 'required|exists:permohonan,id',
'persetujuan_penawaran_id' => 'required|exists:persetujuan_penawaran,id',
'status' => 'nullable|boolean',
'created_by' => 'nullable|exists:users,id',
'updated_by' => 'nullable|exists:users,id',
];
}
/**
* Aturan validasi untuk data pembayaran
*
* @return array
*/
private function getPaymentRules()
{
$fileRule = 'nullable|file|mimes:' . self::ALLOWED_FILE_TYPES . '|max:' . self::MAX_FILE_SIZE;
return [
'total_harus_bayar' => 'nullable|numeric|min:0',
'nominal_bayar' => 'nullable|numeric|min:0',
'bukti_ksl' => $fileRule,
'bukti_bayar' => $fileRule,
'status_bayar' => 'nullable|boolean',
'tanggal_pembayaran' => 'nullable|date',
];
}
/**
* Aturan validasi untuk data penyelesaian
*
* @return array
*/
private function getSettlementRules()
{
$fileRule = 'nullable|file|mimes:' . self::ALLOWED_FILE_TYPES . '|max:' . self::MAX_FILE_SIZE;
return [
'nominal_penyelesaian' => 'nullable|numeric|min:0',
'status_penyelesaian' => 'nullable|boolean',
'tanggal_penyelesaian' => 'nullable|date',
'bukti_penyelesaian' => $fileRule,
'memo_penyelesaian' => $fileRule,
'catatan_noc' => 'nullable|string',
];
}
/**
* Aturan validasi untuk otorisasi
*
* @return array
*/
private function getAuthorizationRules()
{
return [
'authorized_status' => 'nullable|boolean',
'authorized_at' => 'nullable|date',
'authorized_by' => 'nullable|exists:users,id',
];
}
/**
* Pesan khusus untuk validasi
*
* @return array
*/
public function messages()
{
return [
'permohonan_id.required' => 'ID Permohonan harus diisi',
'permohonan_id.exists' => 'ID Permohonan tidak valid',
'persetujuan_penawaran_id.required' => 'ID Persetujuan Penawaran harus diisi',
'persetujuan_penawaran_id.exists' => 'ID Persetujuan Penawaran tidak valid',
'nominal_bayar.numeric' => 'Nominal Bayar harus berupa angka',
'nominal_bayar.min' => 'Nominal Bayar minimal 0',
'bukti_ksl.file' => 'Bukti KSL harus berupa file',
'bukti_ksl.mimes' => 'Bukti KSL harus berformat pdf, jpg, jpeg, atau png',
'bukti_ksl.max' => 'Ukuran Bukti KSL maksimal 10MB',
'bukti_bayar.file' => 'Bukti Bayar harus berupa file',
'bukti_bayar.mimes' => 'Bukti Bayar harus berformat pdf, jpg, jpeg, atau png',
'bukti_bayar.max' => 'Ukuran Bukti Bayar maksimal 10MB',
'status.boolean' => 'Status harus berupa boolean',
'status_bayar.boolean' => 'Status Bayar harus berupa boolean',
'tanggal_pembayaran.date' => 'Format Tanggal Pembayaran tidak valid',
'nominal_penyelesaian.numeric' => 'Nominal Penyelesaian harus berupa angka',
'nominal_penyelesaian.min' => 'Nominal Penyelesaian minimal 0',
'status_penyelesaian.boolean' => 'Status Penyelesaian harus berupa boolean',
'tanggal_penyelesaian.date' => 'Format Tanggal Penyelesaian tidak valid',
'bukti_penyelesaian.file' => 'Bukti Penyelesaian harus berupa file',
'bukti_penyelesaian.mimes' => 'Bukti Penyelesaian harus berformat pdf, jpg, jpeg, atau png',
'bukti_penyelesaian.max' => 'Ukuran Bukti Penyelesaian maksimal 10MB',
'memo_penyelesaian.file' => 'Memo Penyelesaian harus berupa file',
'memo_penyelesaian.mimes' => 'Memo Penyelesaian harus berformat pdf, jpg, jpeg, atau png',
'memo_penyelesaian.max' => 'Ukuran Memo Penyelesaian maksimal 10MB',
'authorized_status.boolean' => 'Status Otorisasi harus berupa boolean',
'authorized_at.date' => 'Format Tanggal Otorisasi tidak valid',
'authorized_by.exists' => 'User Otorisasi tidak valid',
];
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class PemilikJaminanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'debiture_id' => 'required|exists:debitures,id',
'npwp' => 'nullable|string|max:16',
'email' => 'nullable|email|max:100',
'phone' => 'nullable|string|max:20',
'hubungan_pemilik_jaminan_id' => 'nullable|exists:hubungan_pemilik_jaminan,id',
'province_code' => 'nullable|exists:provinces,code',
'city_code' => 'nullable|exists:cities,code',
'district_code' => 'nullable|exists:districts,code',
'village_code' => 'nullable|exists:villages,code',
'name' => 'required',
'address' => 'nullable|string',
'postal_code' => 'nullable|string|max:10',
'status' => 'nullable|boolean',
'detail_sertifikat' => 'nullable|string|max:255',
];
//$rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,nomor_id,debiture_id,' . $this->debiture_id;
$rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,debiture_id,' . $this->debiture_id;
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
public function prepareForValidation() {
$detailSertifikat = [];
$names = $this->input('detail_sertifikat.name', []);
$nomorIds = $this->input('detail_sertifikat.nomor_id', []);
foreach ($names as $index => $name) {
if (isset($nomorIds[$index])) {
$detailSertifikat[] = [
'name' => $name,
'nomor_id' => $nomorIds[$index]
];
}
}
$this->merge([
'detail_sertifikat' => json_encode($detailSertifikat),
]);
}
}

View File

@@ -0,0 +1,61 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class PenilaianRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$action = $this->input('action');
if ($action === 'revisi') {
return [
'dokumen' => 'required|file|mimes:pdf',
'keterangan' => 'required|string',
];
}
return [
'jenis_penilaian_id' => 'required|max:255',
'teams_id' => 'required|max:255',
'tanggal_kunjungan' => 'required|max:255',
'status' => 'required|string',
'nomor_registrasi' => 'required|string',
'surveyor_id' => 'nullable|required_without_all:penilai_surveyor_id,surveyor_region_id,penilai_region_id,penilai_id',
'penilai_id' => 'nullable|required_without_all:penilai_surveyor_id,surveyor_region_id,penilai_region_id,surveyor_id',
'penilai_surveyor_id' => 'nullable',
'surveyor_region_id' => 'nullable|required_without_all:penilai_surveyor_id,penilai_region_id,penilai_id,surveyor_id',
'penilai_region_id' => 'nullable|required_without_all:penilai_surveyor_id,surveyor_region_id,penilai_id,surveyor_id',
'surveyor_penilai_region_id' => 'nullable',
'keterangan' => 'nullable',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
protected function prepareForValidation()
{
// Menetapkan nilai default untuk 'status' jika tidak ada dalam request
$this->merge([
'status' => $this->status ?? 'assign',
]);
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace Modules\Lpj\Http\Requests;
use daengdeni\LaravelIdGenerator\IdGenerator;
use Illuminate\Foundation\Http\FormRequest;
class PermohonanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'nomor_registrasi' => 'nullable|string|max:10',
'tanggal_permohonan' => 'nullable|date',
'user_id' => 'nullable|exists:users,id',
'branch_id' => 'nullable|exists:branches,id',
'tujuan_penilaian_id' => 'required|exists:tujuan_penilaian,id',
'debiture_id' => 'required|exists:debitures,id',
'status' => 'nullable|string',
'jenis_fasilitas_kredit_id' => 'required|exists:jenis_fasilitas_kredit,id',
'nilai_plafond_id' => 'required|exists:nilai_plafond,id',
'status_bayar' => 'nullable|string',
'nilai_njop' => 'nullable|numeric'
];
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
public function prepareForValidation()
{
if (!$this->id) {
$this->merge([
'nomor_registrasi' => IdGenerator::generate(
['table' => 'permohonan', 'length' => 10, 'prefix' => 'REG', 'field' => 'nomor_registrasi'],
),
'tanggal_permohonan' => date('Y-m-d'),
'user_id' => auth()->user()->id,
'branch_id' => auth()->user()->branch_id,
'status' => 'order'
]);
}
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class PersetujuanPenawaranRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'permohonan_id' => 'nullable|exists:permohonan,id',
'penawaran_id' => 'nullable|exists:penawaran,id',
'nomor_proposal_penawaran' => 'nullable|string|max:255',
'tanggal_proposal_penawaran' => 'nullable|date',
'biaya_final' => 'nullable|numeric|min:0',
'sla_resume' => 'nullable|numeric|min:0',
'sla_final' => 'nullable|numeric|min:0',
'file_persetujuan_penawaran' => 'nullable|file|mimes:pdf,doc,docx|max:10240',
'surat_representasi' => 'nullable|file|mimes:pdf,doc,docx|max:10240',
'status' => 'nullable|boolean',
'authorized_status' => 'boolean',
'authorized_at' => 'nullable|date',
'authorized_by' => 'nullable|exists:users,id',
'catatan' => 'nullable|string',
];
}
public function messages()
{
return [
'penawaran_id.required' => 'Penawaran ID wajib diisi.',
'penawaran_id.exists' => 'Penawaran ID tidak valid.',
'nomor_proposal_penawaran.required' => 'Nomor proposal penawaran wajib diisi.',
'tanggal_proposal_penawaran.required' => 'Tanggal proposal penawaran wajib diisi.',
'tanggal_proposal_penawaran.date' => 'Tanggal proposal penawaran harus berupa tanggal yang valid.',
'biaya_final.required' => 'Biaya final wajib diisi.',
'biaya_final.numeric' => 'Biaya final harus berupa angka.',
'biaya_final.min' => 'Biaya final tidak boleh kurang dari 0.',
'sla_resume.required' => 'SLA Resume wajib diisi.',
'sla_final.required' => 'SLA Final wajib diisi.',
'file_persetujuan_penawaran.file' => 'File Persetujuan Penawaran harus berupa file.',
'file_persetujuan_penawaran.mimes' => 'File Persetujuan Penawaran harus berupa file PDF, DOC, atau DOCX.',
'file_persetujuan_penawaran.max' => 'Ukuran File Persetujuan Penawaran tidak boleh lebih dari 10MB.',
'surat_representasi.file' => 'Surat Representasi harus berupa file.',
'surat_representasi.mimes' => 'Surat Representasi harus berupa file PDF, DOC, atau DOCX.',
'surat_representasi.max' => 'Ukuran Surat Representasi tidak boleh lebih dari 10MB.',
'region_id.required' => 'Region ID wajib diisi.',
'region_id.exists' => 'Region ID tidak valid.',
'status.required' => 'Status wajib diisi.',
'status.boolean' => 'Status harus berupa nilai boolean.',
'authorized_status.boolean' => 'Status otorisasi harus berupa nilai boolean.',
'authorized_at.date' => 'Tanggal otorisasi harus berupa tanggal yang valid.',
'authorized_by.exists' => 'ID pengguna yang mengotorisasi tidak valid.',
];
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ProsesPenawaranRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$rules = [
'kjpp.*' => 'exists:kjpp,id',
'tujuan_penilaian_kjpp_id' => 'required',
'jenis_laporan_id' => 'required',
'start_date' => 'required',
'end_date' => 'required',
'catatan' => 'nullable'
];
// if ($this->method() == 'PUT') {
// $rules['code'] = 'required|max:50';
// } else {
// $rules['code'] = 'required|max:50|unique:penawaran,code';
// }
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
public function messages(): array
{
return [
'code.required' => 'Kode Penawaran Wajib diisi!',
'code.max' => 'Kode Penawaran maksimal 255 huruf!',
'code.unique' => 'Kode Penawaran tidak boleh sama!',
'tujuan_penilaian_kjpp_id.required' => 'Tujuan Penilaian KJPP Wajib diisi!',
'jenis_laporan_id.required' => 'Jenis Laporan Wajib diisi!',
'start_date.required' => 'Tanggal Awal Wajib diisi!',
'end_date.required' => 'Tanggal Akhir Wajib diisi!',
];
}
public function withValidator($validator)
{
$validator->after(function ($validator) {
$startDate = strtotime($this->input('start_date'));
$endDate = strtotime($this->input('end_date'));
$today = strtotime(date('Y-m-d'));
// Jika dalam keadaan tambah penawaran maka munculkan pesan ini
// if ($this->method() !== 'PUT') {
// if ($startDate < $today) {
// $validator->errors()->add('start_date', 'Tanggal Awal tidak boleh sebelum hari ini.');
// }
// }
if ($endDate < $startDate) {
$validator->errors()->add('end_date', 'Tanggal Akhir tidak boleh lebih awal dari Tanggal Awal.');
}
// Validasi minimal 3 pilihan pada nama_kjpp
$namaKjpp = $this->input('kjpp', []);
// jika nama KJPP itu kosong
if (empty($namaKjpp)) {
$validator->errors()->add('kjpp', 'Nama KJPP wajib diisi.');
}
// jika terisi kurang dari 3 item
elseif (is_array($namaKjpp) && count($namaKjpp) < 3) {
$validator->errors()->add('kjpp', 'Nama KJPP minimal 3 pilihan.');
}
});
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class RegionRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$rules = [
'name' => 'required|string|max:255',
'status' => 'nullable|boolean',
'url' => 'nullable|string|max:255',
'name_url' => 'nullable|string|max:255',
'authorized_at' => 'nullable|datetime',
'authorized_status' => 'nullable|string|max:1',
'authorized_by' => 'nullable|exists:users,id',
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|string|max:3|unique:regions,code,' . $this->id;
} else {
$rules['code'] = 'required|string|max:3|unique:regions,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;
class StatusPermohonanRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'description' => 'nullable|max:255',
'status' => 'required|boolean',
'slug' => 'nullable|max:255',
];
if ($this->method() == 'PUT') {
$rules['name'] = 'required|max:50|unique:status_permohonan,name,' . $this->id;
} else {
$rules['name'] = 'required|max:50|unique:status_permohonan,name';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
public function prepareForValidation()
{
return $this->merge([
'status' => isset($this->status) ? 1 : 0,
'slug' => Str::slug($this->name),
]);
}
}

View File

@@ -0,0 +1,156 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class SurveyorRequest extends FormRequest
{
/**
* Table mapping for different actionszz
*/
private const TABLE_MAPPING = [
'bentuk-tanah' => 'bentuk_tanah',
'kontur-tanah' => 'kontur_tanah',
'posisi-kavling' => 'posisi_kavling',
'ketinggian-tanah' => 'ketinggian_tanah',
'kondisi-fisik-tanah' => 'kondisi_fisik_tanah',
'kondisi-bangunan' => 'kondisi_bangunan',
'jenis-bangunan' => 'jenis_bangunan',
'sifat-bangunan' => 'sifat_bangunan',
'sarana-pelengkap' => 'sarana_pelengkap',
'lalu-lintas-lokasi' => 'lalu_lintas_lokasi',
'tingkat-keramaian' => 'tingkat_keramaian',
'gol-mas-sekitar' => 'gol_mas_sekitar',
'spek-kategori-bangunan' => 'spek_kategori_bangunan',
'spek-bangunan' => 'spek_bangunan',
'lantai-unit' => 'lantai',
'view-unit' => 'view_unit',
'jenis-pesawat' => 'jenis_pesawat',
'model-alat-berat' => 'model_alat_berat',
'jenis-kapal' => 'jenis_kapal',
'jenis-kendaraan' => 'jenis_kendaraan',
'jenis-unit' => 'jenis_unit',
'terletak-area' => 'terletak_area',
'merupakan-daerah' => 'merupakan_daerah',
'posisi-unit' => 'posisi_unit',
'bentuk-unit' => 'bentuk_unit',
'fasilitas-objek' => 'fasilitas_objek',
'perkerasan-jalan' => 'perkerasan_jalan',
'foto-objek-jaminan' => 'foto_objek_jaminan',
'perizinan' => 'perizinan'
];
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return array_merge(
$this->getBaseRules(),
$this->getActionSpecificRules(),
$this->getCodeValidationRules()
);
}
/**
* Get base validation rules
*/
private function getBaseRules(): array
{
return [
'name' => 'required|max:255',
];
}
/**
* Get action specific validation rules
*/
private function getActionSpecificRules(): array
{
$action = $this->input('action');
return match ($action) {
'spek-bangunan' => [
'spek_kategori_bangunan_id' => [
'required',
],
],
'foto-objek-jaminan' => [
'kategori' => 'required',
],
// Add more action specific rules here
default => [],
};
}
/**
* Get code validation rules
*/
private function getCodeValidationRules(): array
{
$action = $this->input('action');
$table = self::TABLE_MAPPING[$action] ?? null;
if (!$table) {
return [];
}
$rules = ['required', 'max:50'];
if ($this->isMethod('PUT') || $this->isMethod('PATCH')) {
$rules[] = Rule::unique($table, 'code')->ignore($this->route('id'));
} else {
$rules[] = Rule::unique($table, 'code');
}
return ['code' => $rules];
}
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
$this->merge([
'status' => true,
]);
}
/**
* Get custom messages for validator errors.
*/
public function messages(): array
{
return [
'name.required' => 'Nama harus diisi',
'name.max' => 'Nama tidak boleh lebih dari 255 karakter',
'code.required' => 'Kode harus diisi',
'code.max' => 'Kode tidak boleh lebih dari 50 karakter',
'code.unique' => 'Kode sudah digunakan',
'spek_kategori_bangunan_id.required' => 'Kategori bangunan harus dipilih',
];
}
/**
* Get custom attributes for validator errors.
*/
public function attributes(): array
{
return [
'name' => 'Nama',
'code' => 'Kode',
'spek_kategori_bangunan_id' => 'Kategori Bangunan',
];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class TeamsRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$rules = [
'name' => 'required|string|max:255',
'status' => 'nullable|boolean',
'regions_id' => 'required|nullable|exists:regions,id',
'user.*' => 'nullable|exists:users,id',
'authorized_at' => 'nullable|datetime',
'authorized_status' => 'nullable|string|max:1',
'authorized_by' => 'nullable|exists:users,id',
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|string|max:3|unique:teams,code,' . $this->id;
} else {
$rules['code'] = 'required|string|max:3|unique:teams,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class TenderPenawaranRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
$rules = [
'nama_kjpp_sebelumnya' => 'nullable',
'biaya_kjpp_sebelumnya' => 'nullable',
'tanggal_penilaian_sebelumnya' => 'nullable',
'nomor_registrasi' => 'required',
'kjpp.*' => 'exists:kjpp,id',
'tujuan_penilaian_kjpp_id' => 'required',
'jenis_laporan_id' => 'required',
'start_date' => 'required',
'end_date' => 'required',
'catatan' => 'nullable',
'status' => 'nullable'
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|max:50';
} else {
$rules['code'] = 'required|max:50|unique:penawaran,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
public function messages(): array
{
return [
'code.required' => 'Kode Penawaran Wajib diisi!',
'code.max' => 'Kode Penawaran maksimal 255 huruf!',
'code.unique' => 'Kode Penawaran tidak boleh sama!',
'nomor_registrasi.required' => 'Nomor Registrasi Wajib diisi!',
'tujuan_penilaian_kjpp_id.required' => 'Tujuan Penilaian KJPP Wajib diisi!',
'jenis_laporan_id.required' => 'Jenis Laporan Wajib diisi!',
'start_date.required' => 'Tanggal Awal Wajib diisi!',
'end_date.required' => 'Tanggal Akhir Wajib diisi!',
];
}
public function withValidator($validator)
{
$validator->after(function ($validator) {
$startDate = strtotime($this->input('start_date'));
$endDate = strtotime($this->input('end_date'));
$today = strtotime(date('Y-m-d'));
// Jika dalam keadaan tambah penawaran maka munculkan pesan ini
if ($this->method() !== 'PUT') {
if ($startDate < $today) {
$validator->errors()->add('start_date', 'Tanggal Awal tidak boleh sebelum hari ini.');
}
}
if ($endDate < $startDate) {
$validator->errors()->add('end_date', 'Tanggal Akhir tidak boleh lebih awal dari Tanggal Awal.');
}
// Validasi minimal 3 pilihan pada nama_kjpp
$namaKjpp = $this->input('kjpp', []);
// jika nama KJPP itu kosong
if (empty($namaKjpp)) {
$validator->errors()->add('kjpp', 'Nama KJPP wajib diisi.');
}
// jika terisi kurang dari 3 item
elseif (is_array($namaKjpp) && count($namaKjpp) < 3) {
$validator->errors()->add('kjpp', 'Nama KJPP Sebelumnya harus memiliki minimal 3 pilihan jika diisi.');
}
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class TujuanPenilaianRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|max:255',
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|max:50|unique:tujuan_penilaian,code,' . $this->id;
} else {
$rules['code'] = 'required|max:50|unique:tujuan_penilaian,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}