Merge remote-tracking branch 'composer/tender' into staging

This commit is contained in:
Daeng Deni Mardaeni
2024-11-13 17:18:56 +07:00
6 changed files with 217 additions and 28 deletions

View File

@@ -55,8 +55,11 @@ class KJPPController extends Controller
{
$validated = $request->validated();
if ($validated) {
$detailEmailKantor = [];
$detailNamaPimpinan = [];
$detailNomorPicPimpinan = [];
$detailNamaPicReviewer = [];
$detailNomorHpPicReviewer = [];
$detailNamaPicAdmin = [];
@@ -65,6 +68,8 @@ class KJPPController extends Controller
$detailNomorHpPicMarketing = [];
$emailKantor = $request->input('detail_email_kantor.email_kantor', []);
$namaPimpinan = $request->input('detail_nama_pimpinan.nama_pimpinan', []);
$nomorHpPimpinan = $request->input('detail_nomor_hp_pimpinan.nomor_hp_pimpinan', []);
$namaPicReviewer = $request->input('detail_nama_pic_reviewer.nama_pic_reviewer', []);
$nomorHpPicReviewer = $request->input('detail_nomor_hp_pic_reviewer.nomor_hp_pic_reviewer', []);
$namaPicAdmin = $request->input('detail_nama_pic_admin.nama_pic_admin', []);
@@ -80,6 +85,22 @@ class KJPPController extends Controller
// Encode to JSON and store
$detailEmailKantorJson = json_encode($detailEmailKantor);
// Process detail_nama_pimpinan
foreach ($namaPimpinan as $value) {
$detailNamaPimpinan[] = [
'nama_pimpinan' => $value
];
}
$detailNamaPimpinanJson = json_encode($detailNamaPimpinan);
// Process detail_nomor_pic_pimpinan
foreach ($nomorHpPimpinan as $value) {
$detailNomorPicPimpinan[] = [
'nomor_hp_pimpinan' => $value
];
}
$detailNomorPicPimpinanJson = json_encode($detailNomorPicPimpinan);
// Process detail_nama_pic_reviewer
foreach ($namaPicReviewer as $value) {
$detailNamaPicReviewer[] = [
@@ -141,6 +162,8 @@ class KJPPController extends Controller
}
$validated['detail_email_kantor'] = $detailEmailKantorJson;
$validated['detail_nama_pimpinan'] = $detailNamaPimpinanJson;
$validated['detail_nomor_hp_pimpinan'] = $detailNomorPicPimpinanJson;
$validated['detail_nama_pic_reviewer'] = $detailNamaPicReviewerJson;
$validated['detail_nomor_hp_pic_reviewer'] = $detailNomorHpPicReviewerJson;
$validated['detail_nama_pic_admin'] = $detailNamaPicAdminJson;
@@ -181,6 +204,8 @@ class KJPPController extends Controller
$districts = District::where('code', $kjpp->district_code)->get();
$villages = Village::where('code', $kjpp->village_code)->get();
$detailEmailKantor = json_decode($kjpp->detail_email_kantor);
$detailNamaPimpinan = json_decode($kjpp->detail_nama_pimpinan);
$detailNomorHpPimpinan = json_decode($kjpp->detail_nomor_hp_pimpinan);
$detailNamaPicReviewer = json_decode($kjpp->detail_nama_pic_reviewer);
$detailNomorHpPicReviewer = json_decode($kjpp->detail_nomor_hp_pic_reviewer);
$detailNamaPicAdmin = json_decode($kjpp->detail_nama_pic_admin);
@@ -188,6 +213,14 @@ class KJPPController extends Controller
$detailNamaPicMarketing = json_decode($kjpp->detail_nama_pic_marketing);
$detailNomorHpPicMarketing = json_decode($kjpp->detail_nomor_hp_pic_marketing);
$detailJoinPimpinan = json_encode(array_map(function ($nama, $nomor) {
return [
'nama_pimpinan' => $nama->nama_pimpinan,
'nomor_hp_pimpinan' => $nomor->nomor_hp_pimpinan
];
}, $detailNamaPimpinan, $detailNomorHpPimpinan));
$detailJoinPicReviewer = json_encode(array_map(function ($nama, $nomor) {
return [
'nama_pic_reviewer' => $nama->nama_pic_reviewer,
@@ -209,7 +242,7 @@ class KJPPController extends Controller
];
}, $detailNamaPicMarketing, $detailNomorHpPicMarketing));
return view('lpj::kjpp.show', compact('jenis_jaminan', 'ijin_usahas', 'ijin_usaha', 'kjpp', 'provinces', 'cities', 'districts', 'villages', 'detailEmailKantor', 'detailJoinPicReviewer', 'detailJoinPicAdmin', 'detailJoinPicMarketing'));
return view('lpj::kjpp.show', compact('jenis_jaminan', 'ijin_usahas', 'ijin_usaha', 'kjpp', 'provinces', 'cities', 'districts', 'villages', 'detailEmailKantor', 'detailJoinPicReviewer', 'detailJoinPicAdmin', 'detailJoinPicMarketing', 'detailJoinPimpinan'));
}
/**
@@ -225,6 +258,8 @@ class KJPPController extends Controller
$districts = District::where('city_code', $kjpp->city_code)->get();
$villages = Village::where('district_code', $kjpp->district_code)->get();
$detailEmailKantor = json_decode($kjpp->detail_email_kantor);
$detailNamaPimpinan = json_decode($kjpp->detail_nama_pimpinan);
$detailNomorHpPimpinan = json_decode($kjpp->detail_nomor_hp_pimpinan);
$detailNamaPicReviewer = json_decode($kjpp->detail_nama_pic_reviewer);
$detailNomorHpPicReviewer = json_decode($kjpp->detail_nomor_hp_pic_reviewer);
$detailNamaPicAdmin = json_decode($kjpp->detail_nama_pic_admin);
@@ -232,6 +267,17 @@ class KJPPController extends Controller
$detailNamaPicMarketing = json_decode($kjpp->detail_nama_pic_marketing);
$detailNomorHpPicMarketing = json_decode($kjpp->detail_nomor_hp_pic_marketing);
// dd($detailNamaPimpinan);
$detailJoinPimpinan = json_encode(array_map(function ($nama, $nomor) {
return [
'nama_pimpinan' => $nama->nama_pimpinan,
'nomor_hp_pimpinan' => $nomor->nomor_hp_pimpinan
];
}, $detailNamaPimpinan, $detailNomorHpPimpinan));
// dd($detailJoinPimpinan);
$detailJoinPicReviewer = json_encode(array_map(function ($nama, $nomor) {
return [
'nama_pic_reviewer' => $nama->nama_pic_reviewer,
@@ -253,7 +299,7 @@ class KJPPController extends Controller
];
}, $detailNamaPicMarketing, $detailNomorHpPicMarketing));
return view('lpj::kjpp.create', compact('kjpp', 'ijin_usaha', 'jenis_aset', 'provinces', 'cities', 'districts', 'villages', 'detailJoinPicReviewer', 'detailJoinPicAdmin', 'detailJoinPicMarketing', 'detailEmailKantor'));
return view('lpj::kjpp.create', compact('kjpp', 'ijin_usaha', 'jenis_aset', 'provinces', 'cities', 'districts', 'villages', 'detailJoinPicReviewer', 'detailJoinPicAdmin', 'detailJoinPicMarketing', 'detailEmailKantor', 'detailJoinPimpinan'));
}
/**
@@ -267,6 +313,8 @@ class KJPPController extends Controller
if ($validated) {
$detailEmailKantor = [];
$detailNamaPimpinan = [];
$detailNomorHpPimpinan = [];
$detailNamaPicReviewer = [];
$detailNomorHpPicReviewer = [];
$detailNamaPicAdmin = [];
@@ -275,6 +323,8 @@ class KJPPController extends Controller
$detailNomorHpPicMarketing = [];
$emailKantor = $request->input('detail_email_kantor.email_kantor', []);
$namaPimpinan = $request->input('detail_nama_pimpinan.nama_pimpinan', []);
$nomorHpPimpinan = $request->input('detail_nomor_hp_pimpinan.nomor_hp_pimpinan', []);
$namaPicReviewer = $request->input('detail_nama_pic_reviewer.nama_pic_reviewer', []);
$nomorHpPicReviewer = $request->input('detail_nomor_hp_pic_reviewer.nomor_hp_pic_reviewer', []);
$namaPicAdmin = $request->input('detail_nama_pic_admin.nama_pic_admin', []);
@@ -290,6 +340,22 @@ class KJPPController extends Controller
// Encode to JSON and store
$detailEmailKantorJson = json_encode($detailEmailKantor);
// Process detail_nama_pimpinan
foreach ($namaPimpinan as $value) {
$detailNamaPimpinan[] = [
'nama_pimpinan' => $value
];
}
$detailNamaPimpinanJson = json_encode($detailNamaPimpinan);
// Process detail_nomor_hp_pimpinan
foreach ($nomorHpPimpinan as $value) {
$detailNomorHpPimpinan[] = [
'nomor_hp_pimpinan' => $value
];
}
$detailNomorHpPimpinanJson = json_encode($detailNomorHpPimpinan);
// Process detail_nama_pic_reviewer
foreach ($namaPicReviewer as $value) {
$detailNamaPicReviewer[] = [
@@ -359,6 +425,8 @@ class KJPPController extends Controller
}
$validated['detail_email_kantor'] = $detailEmailKantorJson;
$validated['detail_nama_pimpinan'] = $detailNamaPimpinanJson;
$validated['detail_nomor_hp_pimpinan'] = $detailNomorHpPimpinanJson;
$validated['detail_nama_pic_reviewer'] = $detailNamaPicReviewerJson;
$validated['detail_nomor_hp_pic_reviewer'] = $detailNomorHpPicReviewerJson;
$validated['detail_nama_pic_admin'] = $detailNamaPicAdminJson;
@@ -409,8 +477,8 @@ class KJPPController extends Controller
//abort(403, 'Sorry! You are not allowed to view users.');
}
// Retrieve data from the database
$query = KJPP::query();
// Retrieve data from the database order by code ascending
$query = KJPP::query()->orderBy('code', 'asc');
// Apply search filter if provided
if ($request->has('search') && !empty($request->get('search'))) {

View File

@@ -25,7 +25,9 @@ class KJPPRequest extends FormRequest
'email_kantor' => 'required|email',
'detail_email_kantor' => 'nullable',
'nama_pimpinan' => 'required|string|not_regex:/^\d+$/|max:255',
'detail_nama_pimpinan' => 'nullable',
'nomor_hp_pimpinan' => 'required|numeric|digits_between:10,15',
'detail_nomor_pic_pimpinan' => 'nullable',
'nama_pic_reviewer' => 'nullable|string|not_regex:/^\d+$/|max:255',
'detail_nama_pic_reviewer' => 'nullable',
'nomor_hp_pic_reviewer' => 'nullable|numeric|digits_between:10,15',