Mengubah tampilan pada edit dan create email kantor, PIC Reviewer, PIC Admin, PIC Marketing pada Menu Basic Data -> KJPP part 1
This commit is contained in:
@@ -57,6 +57,8 @@ class KJPPController extends Controller
|
||||
{
|
||||
$validated = $request->validated();
|
||||
|
||||
dd($validated);
|
||||
|
||||
if ($validated) {
|
||||
$file = $request->file('attachment');
|
||||
$filename = $file ? time() . '.' . $file->getClientOriginalExtension() : 'default.pdf';
|
||||
@@ -69,9 +71,6 @@ class KJPPController extends Controller
|
||||
Storage::copy('public/test/default.pdf', 'public/uploads_pdf/' . $filename);
|
||||
}
|
||||
|
||||
$validated['ijin_usaha_id'] = json_encode($request->input('ijin_usaha_id'));
|
||||
$validated['jenis_aset_id'] = json_encode($request->input('jenis_aset_id'));
|
||||
|
||||
// Tambahkan nama file ke data yang divalidasi
|
||||
$validated['attachment'] = $filename;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use daengdeni\LaravelIdGenerator\IdGenerator;
|
||||
|
||||
class KJPPRequest extends FormRequest
|
||||
{
|
||||
@@ -17,24 +16,31 @@ class KJPPRequest extends FormRequest
|
||||
'jenis_kantor' => 'required',
|
||||
'nomor_ijin_usaha' => 'required',
|
||||
'province_code' => 'required',
|
||||
'city_code' => 'required',
|
||||
'district_code' => 'required',
|
||||
'village_code' => 'required',
|
||||
'city_code' => 'nullable',
|
||||
'district_code' => 'nullable',
|
||||
'village_code' => 'nullable',
|
||||
'address' => 'required',
|
||||
'postal_code' => 'required|numeric',
|
||||
'nomor_telepon_kantor' => 'required|numeric|digits_between:8,15',
|
||||
'postal_code' => 'nullable|numeric',
|
||||
'nomor_telepon_kantor' => 'nullable|numeric|digits_between:8,15',
|
||||
'email_kantor' => 'required|email',
|
||||
'detail_email_kantor' => 'nullable|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',
|
||||
'nama_pic_reviewer' => 'nullable|string|not_regex:/^\d+$/|max:255',
|
||||
// 'detail_nama_pic_reviewer' => 'nullable|string|not_regex:/^\d+$/|max:255',
|
||||
'nomor_hp_pic_reviewer' => 'nullable|numeric|digits_between:10,15',
|
||||
// 'detail_nomor_hp_pic_reviewer' => 'nullable|numeric|digits_between:10,15',
|
||||
'nama_pic_admin' => 'nullable|string|not_regex:/^\d+$/|max:255',
|
||||
// 'detail_nama_pic_admin' => 'nullable|string|not_regex:/^\d+$/|max:255',
|
||||
'nomor_hp_pic_admin' => 'nullable|numeric|digits_between:10,15',
|
||||
// 'detail_nomor_hp_pic_admin' => 'nullable|numeric|digits_between:10,15',
|
||||
'nama_pic_marketing' => 'nullable|string|not_regex:/^\d+$/|max:255',
|
||||
// 'detail_nama_pic_marketing' => 'nullable|string|not_regex:/^\d+$/|max:255',
|
||||
'nomor_hp_pic_marketing' => 'nullable|numeric|digits_between:10,15',
|
||||
// 'detail_nomor_hp_pic_marketing' => 'nullable|numeric|digits_between:10,15',
|
||||
'ijin_usaha_id' => 'nullable|array',
|
||||
'ijin_usaha_id.*' => 'exists:ijin_usaha,code',
|
||||
'jenis_aset_id' => 'required|array',
|
||||
'jenis_aset_id' => 'nullable|array',
|
||||
'jenis_aset_id.*' => 'exists:jenis_jaminan,code',
|
||||
'attachment' => 'nullable|mimes:pdf|max:1024'
|
||||
];
|
||||
@@ -69,37 +75,36 @@ class KJPPRequest extends FormRequest
|
||||
'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!',
|
||||
// 'detail_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!',
|
||||
// 'detail_nama_pic_reviewer.not_regex' => 'Nama PIC Reviewer harus berupa huruf!',
|
||||
'nomor_hp_pic_reviewer.numeric' => 'Nomor HP PIC Reviewer harus berupa angka!',
|
||||
// 'detail_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!',
|
||||
// 'detail_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!',
|
||||
'nomor_hp_pic_admin.required' => 'Nomor HP PIC Admin Wajib diisi!',
|
||||
// 'detail_nama_pic_admin.not_regex' => 'Nama PIC Admin harus berupa huruf!',
|
||||
'nomor_hp_pic_admin.numeric' => 'Nomor HP PIC Admin harus berupa angka!',
|
||||
// 'detail_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!',
|
||||
// 'detail_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!',
|
||||
'nomor_hp_pic_marketing.required' => 'Nomor HP PIC Marketing Wajib diisi!',
|
||||
// 'detail_nama_pic_marketing.not_regex' => 'Nama PIC Marketing harus berupa huruf!',
|
||||
'nomor_hp_pic_marketing.numeric' => 'Nomor HP PIC Marketing harus berupa angka!',
|
||||
// 'detail_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.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!',
|
||||
@@ -108,4 +113,94 @@ class KJPPRequest extends FormRequest
|
||||
'attachment.max' => 'Attachment berukuran maksimum 1 MB!',
|
||||
];
|
||||
}
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$detailEmailKantor = [];
|
||||
$detailNamaPicReviewer = [];
|
||||
$detailNomorHpPicReviewer = [];
|
||||
$detailNamaPicAdmin = [];
|
||||
$detailNomorHpPicAdmin = [];
|
||||
$detailNamaPicMarketing = [];
|
||||
$detailNomorHpPicMarketing = [];
|
||||
|
||||
// Get input data with safe default values
|
||||
$emailKantor = $this->input('detail_email_kantor.email_kantor', []);
|
||||
$namaPicReviewer = $this->input('detail_nama_pic_reviewer.nama_pic_reviewer', []);
|
||||
$nomorHpPicReviewer = $this->input('detail_nomor_hp_pic_reviewer.nomor_hp_pic_reviewer', []);
|
||||
$namaPicAdmin = $this->input('detail_nama_pic_admin.nama_pic_admin', []);
|
||||
$nomorHpPicAdmin = $this->input('detail_nomor_hp_pic_admin.nomor_hp_pic_admin', []);
|
||||
$namaPicMarketing = $this->input('detail_nama_pic_marketing.nama_pic_marketing', []);
|
||||
$nomorHpPicMarketing = $this->input('detail_nomor_hp_pic_marketing.nomor_hp_pic_marketing', []);
|
||||
|
||||
foreach ($emailKantor as $value) {
|
||||
$detailEmailKantor[] = [
|
||||
'email_kantor' => $value
|
||||
];
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'detail_email_kantor' => json_encode($detailEmailKantor),
|
||||
]);
|
||||
|
||||
foreach ($namaPicReviewer as $value) {
|
||||
$detailNamaPicReviewer[] = [
|
||||
'nama_pic_reviewer' => $value
|
||||
];
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'detail_nama_pic_reviewer' => json_encode($detailNamaPicReviewer),
|
||||
]);
|
||||
|
||||
foreach ($nomorHpPicReviewer as $value) {
|
||||
$detailNomorHpPicReviewer[] = [
|
||||
'nomor_hp_pic_reviewer' => $value
|
||||
];
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'detail_nomor_hp_pic_reviewer' => json_encode($detailNomorHpPicReviewer),
|
||||
]);
|
||||
|
||||
foreach ($namaPicAdmin as $value) {
|
||||
$detailNamaPicAdmin[] = [
|
||||
'nama_pic_admin' => $value
|
||||
];
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'detail_nama_pic_admin' => json_encode($detailNamaPicAdmin),
|
||||
]);
|
||||
|
||||
foreach ($nomorHpPicAdmin as $value) {
|
||||
$detailNomorHpPicAdmin[] = [
|
||||
'nomor_hp_pic_admin' => $value
|
||||
];
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'detail_nomor_hp_pic_admin' => json_encode($detailNomorHpPicAdmin),
|
||||
]);
|
||||
|
||||
foreach ($namaPicMarketing as $value) {
|
||||
$detailNamaPicMarketing[] = [
|
||||
'nama_pic_marketing' => $value
|
||||
];
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'detail_nama_pic_marketing' => json_encode($detailNamaPicMarketing),
|
||||
]);
|
||||
|
||||
foreach ($nomorHpPicMarketing as $value) {
|
||||
$detailNomorHpPicMarketing[] = [
|
||||
'nomor_hp_pic_marketing' => $value
|
||||
];
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'detail_nomor_hp_pic_marketing' => json_encode($detailNomorHpPicMarketing),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,16 +31,23 @@ class KJPP extends Model
|
||||
'postal_code',
|
||||
'nomor_telepon_kantor',
|
||||
'email_kantor',
|
||||
'detail_email_kantor',
|
||||
'nama_pimpinan',
|
||||
'nomor_hp_pimpinan',
|
||||
'nama_pic_reviewer',
|
||||
'detail_nama_pic_reviewer',
|
||||
'nomor_hp_pic_reviewer',
|
||||
'detail_nomor_hp_pic_reviewer',
|
||||
'nama_pic_admin',
|
||||
'detail_nama_pic_admin',
|
||||
'nomor_hp_pic_admin',
|
||||
'detail_nomor_hp_pic_admin',
|
||||
'nama_pic_marketing',
|
||||
'detail_nama_pic_marketing',
|
||||
'nomor_hp_pic_marketing',
|
||||
'detail_nomor_hp_pic_marketing',
|
||||
'ijin_usaha_id',
|
||||
'jenis_aset_id',
|
||||
'attachment'
|
||||
'attachment',
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user