memperbaiki konflik dari branch staging
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Modules\Lpj\Rules\UniqueCifExceptZero;
|
||||
|
||||
class DebitureRequest extends FormRequest
|
||||
{
|
||||
@@ -21,7 +22,7 @@
|
||||
'nomor_rekening' => 'nullable|string|max:50',
|
||||
'name' => 'required',
|
||||
'registered_at' => 'nullable|date',
|
||||
'npwp' => 'nullable|string|max:16',
|
||||
'npwp' => 'nullable|string|min:15|max:16',
|
||||
'email' => 'nullable|email',
|
||||
'phone' => 'nullable|string|max:15',
|
||||
'address' => 'nullable|string',
|
||||
@@ -29,10 +30,10 @@
|
||||
'status' => 'nullable|boolean'
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['cif'] = 'nullable|unique:debitures,cif,' . $this->id;
|
||||
} else {
|
||||
$rules['cif'] = 'nullable|unique:debitures,cif';
|
||||
if($this->method() == 'PUT'){
|
||||
$rules['cif'] = ['required', new UniqueCifExceptZero($this->id)];
|
||||
}else{
|
||||
$rules['cif'] = ['required', new UniqueCifExceptZero(null)];
|
||||
}
|
||||
|
||||
return $rules;
|
||||
|
||||
43
app/Http/Requests/DetailDokumenJaminanRequest.php
Normal file
43
app/Http/Requests/DetailDokumenJaminanRequest.php
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,10 @@
|
||||
'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',
|
||||
|
||||
46
app/Http/Requests/IjinUsahaRequest.php
Normal file
46
app/Http/Requests/IjinUsahaRequest.php
Normal 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!'
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use daengdeni\LaravelIdGenerator\IdGenerator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class JenisJaminanRequest extends FormRequest
|
||||
{
|
||||
@@ -12,16 +14,12 @@
|
||||
public function rules()
|
||||
: array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|max:255',
|
||||
return [
|
||||
'code' => 'required|max:5',
|
||||
'name' => 'required|max:255',
|
||||
'slug' => 'required|max:255',
|
||||
'jenis_legalitas_jaminan_id' => 'nullable',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:50|unique:jenis_jaminan,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:50|unique:jenis_jaminan,code';
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,4 +30,21 @@
|
||||
{
|
||||
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),
|
||||
'slug' => Str::slug($this->name),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
46
app/Http/Requests/JenisLaporanRequest.php
Normal file
46
app/Http/Requests/JenisLaporanRequest.php
Normal 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!'
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use daengdeni\LaravelIdGenerator\IdGenerator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class JenisLegalitasJaminanRequest extends FormRequest
|
||||
{
|
||||
@@ -12,16 +14,11 @@
|
||||
public function rules()
|
||||
: array
|
||||
{
|
||||
$rules = [
|
||||
return [
|
||||
'code' => 'required|max:6',
|
||||
'name' => 'required|max:255',
|
||||
'slug' => 'required|max:255',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:50|unique:jenis_legalitas_jaminan,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:50|unique:jenis_legalitas_jaminan,code';
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,4 +29,20 @@
|
||||
{
|
||||
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),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
45
app/Http/Requests/JenisPenilaianKJPPRequest.php
Normal file
45
app/Http/Requests/JenisPenilaianKJPPRequest.php
Normal 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!'
|
||||
];
|
||||
}
|
||||
}
|
||||
41
app/Http/Requests/JenisPenilaianRequest.php
Normal file
41
app/Http/Requests/JenisPenilaianRequest.php
Normal 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;
|
||||
}
|
||||
}
|
||||
111
app/Http/Requests/KJPPRequest.php
Normal file
111
app/Http/Requests/KJPPRequest.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use daengdeni\LaravelIdGenerator\IdGenerator;
|
||||
|
||||
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' => 'required',
|
||||
'district_code' => 'required',
|
||||
'village_code' => 'required',
|
||||
'address' => 'required',
|
||||
'postal_code' => 'required|numeric',
|
||||
'nomor_telepon_kantor' => 'required|numeric|digits_between:8,15',
|
||||
'email_kantor' => 'required|email',
|
||||
'nama_pimpinan' => 'required|string|not_regex:/^\d+$/|max:255',
|
||||
'nomor_hp_pimpinan' => 'required|numeric|digits_between:10,15',
|
||||
'nama_pic_reviewer' => 'required|string|not_regex:/^\d+$/|max:255',
|
||||
'nomor_hp_pic_reviewer' => 'required|numeric|digits_between:10,15',
|
||||
'nama_pic_admin' => 'required|string|not_regex:/^\d+$/|max:255',
|
||||
'nomor_hp_pic_admin' => 'required|numeric|digits_between:10,15',
|
||||
'nama_pic_marketing' => 'required|string|not_regex:/^\d+$/|max:255',
|
||||
'nomor_hp_pic_marketing' => 'required|numeric|digits_between:10,15',
|
||||
'ijin_usaha_id' => 'required|array',
|
||||
'ijin_usaha_id.*' => 'exists:ijin_usaha,code',
|
||||
'jenis_aset_id' => 'required|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!',
|
||||
'city_code.required' => 'Kota / Kabupaten Wajib diisi!',
|
||||
'district_code.required' => 'Kecamatan Wajib diisi!',
|
||||
'village_code.required' => 'Kelurahan Wajib diisi!',
|
||||
'postal_code.required' => 'Kode Pos Wajib diisi!',
|
||||
'postal_code.numeric' => 'Kode Pos harus berupa angka!',
|
||||
'address.required' => 'Alamat Kantor Wajib diisi!',
|
||||
'nomor_telepon_kantor.required' => 'Nomor Telepon 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!',
|
||||
'nama_pimpinan.required' => 'Nama Pimpinan Wajib diisi!',
|
||||
'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!',
|
||||
'nama_pic_reviewer.required' => 'Nama PIC Reviewer Wajib diisi!',
|
||||
'nama_pic_reviewer.not_regex' => 'Nama PIC Reviewer harus berupa huruf!',
|
||||
'nomor_hp_pic_reviewer.required' => 'Nomor HP PIC Reviewer Wajib diisi!',
|
||||
'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!',
|
||||
'nama_pic_admin.required' => 'Nama PIC Admin Wajib diisi!',
|
||||
'nama_pic_admin.not_regex' => 'Nama PIC Admin harus berupa huruf!',
|
||||
'nomor_hp_pic_admin.required' => 'Nomor HP PIC Admin Wajib diisi!',
|
||||
'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!',
|
||||
'nama_pic_marketing.required' => 'Nama PIC Marketing Wajib diisi!',
|
||||
'nama_pic_marketing.not_regex' => 'Nama PIC Marketing harus berupa huruf!',
|
||||
'nomor_hp_pic_marketing.required' => 'Nomor HP PIC Marketing Wajib diisi!',
|
||||
'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!',
|
||||
'ijin_usaha_id.required' => 'Ijin Usaha Wajib diisi!',
|
||||
'ijin_usaha_id.min' => 'Ijin Usaha Wajib diisi minimal satu atau lebih!',
|
||||
'jenis_aset_id.required' => 'Jenis Aset Wajib diisi!',
|
||||
'jenis_aset_id.min' => 'Jenis Aset Wajib diisi minimal satu atau lebih!',
|
||||
'attachment.mimes' => 'Attachment harus berformat pdf!',
|
||||
'attachment.max' => 'Attachment berukuran maksimum 1 MB!',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,8 @@
|
||||
'status' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
$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,nomor_id,debiture_id,' . $this->debiture_id;
|
||||
$rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,debiture_id,' . $this->debiture_id;
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
||||
59
app/Http/Requests/PenilaianRequest.php
Normal file
59
app/Http/Requests/PenilaianRequest.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?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:penilai_surveyor_id',
|
||||
'penilaian_id' => 'nullable|required_without:penilai_surveyor_id',
|
||||
'penilai_surveyor_id' => 'nullable|required_without_all:surveyor_id,penilaian_id',
|
||||
'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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,17 @@
|
||||
: array
|
||||
{
|
||||
$rules = [
|
||||
'nomor_registrasi' => 'nullable|string|max:10',
|
||||
'tanggal_permohonan' => 'nullable|date',
|
||||
'user_id' => 'nullable|exists:users,id',
|
||||
'branch_id' => 'required|exists:branches,id',
|
||||
'tujuan_penilaian_id' => 'required|exists:tujuan_penilaian,id',
|
||||
'debiture_id' => 'required|exists:debitures,id',
|
||||
'status' => 'required|string',
|
||||
'nomor_registrasi' => 'nullable|string|max:10',
|
||||
'tanggal_permohonan' => 'nullable|date',
|
||||
'user_id' => 'nullable|exists:users,id',
|
||||
'branch_id' => 'required|exists:branches,id',
|
||||
'tujuan_penilaian_id' => 'required|exists:tujuan_penilaian,id',
|
||||
'debiture_id' => 'required|exists:debitures,id',
|
||||
'status' => 'required|string',
|
||||
'jenis_fasilitas_kredit_id' => 'required|exists:jenis_fasilitas_kredit,id',
|
||||
'nilai_plafond_id' => 'required|exists:nilai_plafond,id',
|
||||
'status_bayar' => 'required|string',
|
||||
'nilai_njop' => 'nullable|numeric'
|
||||
];
|
||||
|
||||
return $rules;
|
||||
@@ -40,10 +44,11 @@
|
||||
if (!$this->id) {
|
||||
$this->merge([
|
||||
'nomor_registrasi' => IdGenerator::generate(
|
||||
['table' => 'permohonan', 'length' => 10, 'prefix'=>'REG', 'field' => 'nomor_registrasi'],
|
||||
['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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
38
app/Http/Requests/RegionRequest.php
Normal file
38
app/Http/Requests/RegionRequest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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',
|
||||
'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;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
$rules = [
|
||||
'description' => 'nullable|max:255',
|
||||
'status' => 'required|boolean',
|
||||
'slug' => 'nullable|max:255',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
@@ -37,9 +38,9 @@
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
return $this->merge([
|
||||
'status' => isset($this->status) ? 1 : 0,
|
||||
'slug'=> Str::slug($this->name)
|
||||
'slug' => Str::slug($this->name),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
41
app/Http/Requests/TeamsRequest.php
Normal file
41
app/Http/Requests/TeamsRequest.php
Normal 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;
|
||||
}
|
||||
}
|
||||
75
app/Http/Requests/TenderPenawaranRequest.php
Normal file
75
app/Http/Requests/TenderPenawaranRequest.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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' => 'required|array',
|
||||
'nama_kjpp_sebelumnya.*' => 'exists:kjpp,name',
|
||||
'biaya_kjpp_sebelumnya' => 'required|numeric',
|
||||
'tanggal_penilaian_sebelumnya' => 'required',
|
||||
'nomor_registrasi' => 'required',
|
||||
'tujuan_penilaian_kjpp_id' => 'required',
|
||||
'jenis_laporan_id' => 'required',
|
||||
'start_date' => 'required',
|
||||
'end_date' => 'required',
|
||||
'catatan' => 'nullable',
|
||||
'status' => 'required'
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:50|unique:penawaran,code,' . $this->id;
|
||||
} 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!',
|
||||
'nama_kjpp_sebelumnya.required' => 'Nama KJPP Sebelumnya Wajib diisi!',
|
||||
'biaya_kjpp_sebelumnya.required' => 'Biaya KJPP Sebelumnya Wajib diisi!',
|
||||
'biaya_kjpp_sebelumnya.numeric' => 'Biaya KJPP Sebelumnya harus berupa angka!',
|
||||
'tanggal_penilaian_sebelumnya.required' => 'Tanggal Penilaian Sebelumnya Wajib diisi!',
|
||||
'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!',
|
||||
'status.required' => 'Status Wajib diisi!'
|
||||
];
|
||||
}
|
||||
|
||||
public function withValidator($validator)
|
||||
{
|
||||
$validator->after(function ($validator) {
|
||||
$startDate = strtotime($this->input('start_date'));
|
||||
$endDate = strtotime($this->input('end_date'));
|
||||
|
||||
if ($endDate < $startDate) {
|
||||
$validator->errors()->add('end_date', 'Tanggal Akhir tidak boleh lebih awal dari Tanggal Awal.');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user