Memperbaiki create, edit, dan show pada kjpp basic data ketika data nya itu ada yang salah masukin maka mempertahankan isi nya ketika di validasi
This commit is contained in:
@@ -44,8 +44,13 @@ class KJPPController extends Controller
|
||||
|
||||
// Combine KJPP number with branch code
|
||||
$fullKjppNumber = $kjppNumber;
|
||||
$detailJoinEmailKantor = json_encode([]);
|
||||
$detailJoinPimpinan = json_encode([]);
|
||||
$detailJoinPicReviewer = json_encode([]);
|
||||
$detailJoinPicAdmin = json_encode([]);
|
||||
$detailJoinPicMarketing = json_encode([]);
|
||||
|
||||
return view('lpj::kjpp.create', compact('ijin_usaha', 'jenis_aset', 'provinces', 'fullKjppNumber'));
|
||||
return view('lpj::kjpp.create', compact('ijin_usaha', 'jenis_aset', 'provinces', 'fullKjppNumber', 'detailJoinEmailKantor', 'detailJoinPimpinan', 'detailJoinPicReviewer', 'detailJoinPicAdmin', 'detailJoinPicMarketing'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,74 +83,56 @@ class KJPPController extends Controller
|
||||
$nomorHpPicMarketing = $request->input('detail_nomor_hp_pic_marketing.nomor_hp_pic_marketing', []);
|
||||
|
||||
foreach ($emailKantor as $value) {
|
||||
$detailEmailKantor[] = [
|
||||
'email_kantor' => $value
|
||||
];
|
||||
$detailEmailKantor[] = $value;
|
||||
}
|
||||
// Encode to JSON and store
|
||||
$detailEmailKantorJson = json_encode($detailEmailKantor);
|
||||
|
||||
// Process detail_nama_pimpinan
|
||||
foreach ($namaPimpinan as $value) {
|
||||
$detailNamaPimpinan[] = [
|
||||
'nama_pimpinan' => $value
|
||||
];
|
||||
$detailNamaPimpinan[] = $value;
|
||||
}
|
||||
$detailNamaPimpinanJson = json_encode($detailNamaPimpinan);
|
||||
|
||||
// Process detail_nomor_pic_pimpinan
|
||||
foreach ($nomorHpPimpinan as $value) {
|
||||
$detailNomorPicPimpinan[] = [
|
||||
'nomor_hp_pimpinan' => $value
|
||||
];
|
||||
$detailNomorPicPimpinan[] = $value;
|
||||
}
|
||||
$detailNomorPicPimpinanJson = json_encode($detailNomorPicPimpinan);
|
||||
|
||||
// Process detail_nama_pic_reviewer
|
||||
foreach ($namaPicReviewer as $value) {
|
||||
$detailNamaPicReviewer[] = [
|
||||
'nama_pic_reviewer' => $value
|
||||
];
|
||||
$detailNamaPicReviewer[] = $value;
|
||||
}
|
||||
$detailNamaPicReviewerJson = json_encode($detailNamaPicReviewer);
|
||||
|
||||
// Process detail_nomor_hp_pic_reviewer
|
||||
foreach ($nomorHpPicReviewer as $value) {
|
||||
$detailNomorHpPicReviewer[] = [
|
||||
'nomor_hp_pic_reviewer' => $value
|
||||
];
|
||||
$detailNomorHpPicReviewer[] = $value;
|
||||
}
|
||||
$detailNomorHpPicReviewerJson = json_encode($detailNomorHpPicReviewer);
|
||||
|
||||
// Process detail_nama_pic_admin
|
||||
foreach ($namaPicAdmin as $value) {
|
||||
$detailNamaPicAdmin[] = [
|
||||
'nama_pic_admin' => $value
|
||||
];
|
||||
$detailNamaPicAdmin[] = $value;
|
||||
}
|
||||
$detailNamaPicAdminJson = json_encode($detailNamaPicAdmin);
|
||||
|
||||
// Process detail_nomor_hp_pic_admin
|
||||
foreach ($nomorHpPicAdmin as $value) {
|
||||
$detailNomorHpPicAdmin[] = [
|
||||
'nomor_hp_pic_admin' => $value
|
||||
];
|
||||
$detailNomorHpPicAdmin[] = $value;
|
||||
}
|
||||
$detailNomorHpPicAdminJson = json_encode($detailNomorHpPicAdmin);
|
||||
|
||||
// Process detail_nama_pic_marketing
|
||||
foreach ($namaPicMarketing as $value) {
|
||||
$detailNamaPicMarketing[] = [
|
||||
'nama_pic_marketing' => $value
|
||||
];
|
||||
$detailNamaPicMarketing[] = $value;
|
||||
}
|
||||
$detailNamaPicMarketingJson = json_encode($detailNamaPicMarketing);
|
||||
|
||||
// Process detail_nomor_hp_pic_marketing
|
||||
foreach ($nomorHpPicMarketing as $value) {
|
||||
$detailNomorHpPicMarketing[] = [
|
||||
'nomor_hp_pic_marketing' => $value
|
||||
];
|
||||
$detailNomorHpPicMarketing[] = $value;
|
||||
}
|
||||
$detailNomorHpPicMarketingJson = json_encode($detailNomorHpPicMarketing);
|
||||
|
||||
@@ -217,15 +204,18 @@ class KJPPController extends Controller
|
||||
$detailNamaPicMarketing = json_decode($kjpp->detail_nama_pic_marketing);
|
||||
$detailNomorHpPicMarketing = json_decode($kjpp->detail_nomor_hp_pic_marketing);
|
||||
|
||||
$detailJoinPimpinan = [];
|
||||
if ($detailNamaPimpinan) {
|
||||
$detailJoinPimpinan = json_encode(array_map(function ($nama, $nomor) {
|
||||
return [
|
||||
'nama_pimpinan' => $nama,
|
||||
'nomor_hp_pimpinan' => $nomor
|
||||
];
|
||||
}, $detailNamaPimpinan, $detailNomorHpPimpinan));
|
||||
}
|
||||
$detailJoinEmailKantor = json_encode(array_map(function ($email) {
|
||||
return [
|
||||
'email_kantor' => $email
|
||||
];
|
||||
}, $detailEmailKantor));
|
||||
|
||||
$detailJoinPimpinan = json_encode(array_map(function ($nama, $nomor) {
|
||||
return [
|
||||
'nama_pimpinan' => $nama,
|
||||
'nomor_hp_pimpinan' => $nomor
|
||||
];
|
||||
}, $detailNamaPimpinan, $detailNomorHpPimpinan));
|
||||
|
||||
|
||||
$detailJoinPicReviewer = json_encode(array_map(function ($nama, $nomor) {
|
||||
@@ -249,7 +239,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', 'detailJoinPimpinan'));
|
||||
return view('lpj::kjpp.show', compact('jenis_jaminan', 'ijin_usahas', 'ijin_usaha', 'kjpp', 'provinces', 'cities', 'districts', 'villages', 'detailJoinEmailKantor', 'detailJoinPicReviewer', 'detailJoinPicAdmin', 'detailJoinPicMarketing', 'detailJoinPimpinan'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,19 +264,19 @@ class KJPPController extends Controller
|
||||
$detailNamaPicMarketing = json_decode($kjpp->detail_nama_pic_marketing);
|
||||
$detailNomorHpPicMarketing = json_decode($kjpp->detail_nomor_hp_pic_marketing);
|
||||
|
||||
//dd($detailNamaPimpinan);
|
||||
$detailJoinEmailKantor = json_encode(array_map(function ($email) {
|
||||
return [
|
||||
'email_kantor' => $email
|
||||
];
|
||||
}, $detailEmailKantor));
|
||||
|
||||
$detailJoinPimpinan = [];
|
||||
if ($detailNamaPimpinan) {
|
||||
$detailJoinPimpinan = json_encode(array_map(function ($nama, $nomor) {
|
||||
return [
|
||||
'nama_pimpinan' => $nama,
|
||||
'nomor_hp_pimpinan' => $nomor
|
||||
];
|
||||
}, $detailNamaPimpinan, $detailNomorHpPimpinan));
|
||||
}
|
||||
$detailJoinPimpinan = json_encode(array_map(function ($nama, $nomor) {
|
||||
return [
|
||||
'nama_pimpinan' => $nama,
|
||||
'nomor_hp_pimpinan' => $nomor
|
||||
];
|
||||
}, $detailNamaPimpinan, $detailNomorHpPimpinan));
|
||||
|
||||
//dd($detailNamaPicReviewer );
|
||||
|
||||
$detailJoinPicReviewer = json_encode(array_map(function ($nama, $nomor) {
|
||||
return [
|
||||
@@ -309,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', 'detailJoinPimpinan'));
|
||||
return view('lpj::kjpp.create', compact('kjpp', 'ijin_usaha', 'jenis_aset', 'provinces', 'cities', 'districts', 'villages', 'detailJoinPicReviewer', 'detailJoinPicAdmin', 'detailJoinPicMarketing', 'detailJoinEmailKantor', 'detailJoinPimpinan'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -343,74 +333,56 @@ class KJPPController extends Controller
|
||||
$nomorHpPicMarketing = $request->input('detail_nomor_hp_pic_marketing.nomor_hp_pic_marketing', []);
|
||||
|
||||
foreach ($emailKantor as $value) {
|
||||
$detailEmailKantor[] = [
|
||||
'email_kantor' => $value
|
||||
];
|
||||
$detailEmailKantor[] = $value;
|
||||
}
|
||||
// Encode to JSON and store
|
||||
$detailEmailKantorJson = json_encode($detailEmailKantor);
|
||||
|
||||
// Process detail_nama_pimpinan
|
||||
foreach ($namaPimpinan as $value) {
|
||||
$detailNamaPimpinan[] = [
|
||||
'nama_pimpinan' => $value
|
||||
];
|
||||
$detailNamaPimpinan[] = $value;
|
||||
}
|
||||
$detailNamaPimpinanJson = json_encode($detailNamaPimpinan);
|
||||
|
||||
// Process detail_nomor_hp_pimpinan
|
||||
foreach ($nomorHpPimpinan as $value) {
|
||||
$detailNomorHpPimpinan[] = [
|
||||
'nomor_hp_pimpinan' => $value
|
||||
];
|
||||
$detailNomorHpPimpinan[] = $value;
|
||||
}
|
||||
$detailNomorHpPimpinanJson = json_encode($detailNomorHpPimpinan);
|
||||
|
||||
// Process detail_nama_pic_reviewer
|
||||
foreach ($namaPicReviewer as $value) {
|
||||
$detailNamaPicReviewer[] = [
|
||||
'nama_pic_reviewer' => $value
|
||||
];
|
||||
$detailNamaPicReviewer[] = $value;
|
||||
}
|
||||
$detailNamaPicReviewerJson = json_encode($detailNamaPicReviewer);
|
||||
|
||||
// Process detail_nomor_hp_pic_reviewer
|
||||
foreach ($nomorHpPicReviewer as $value) {
|
||||
$detailNomorHpPicReviewer[] = [
|
||||
'nomor_hp_pic_reviewer' => $value
|
||||
];
|
||||
$detailNomorHpPicReviewer[] = $value;
|
||||
}
|
||||
$detailNomorHpPicReviewerJson = json_encode($detailNomorHpPicReviewer);
|
||||
|
||||
// Process detail_nama_pic_admin
|
||||
foreach ($namaPicAdmin as $value) {
|
||||
$detailNamaPicAdmin[] = [
|
||||
'nama_pic_admin' => $value
|
||||
];
|
||||
$detailNamaPicAdmin[] = $value;
|
||||
}
|
||||
$detailNamaPicAdminJson = json_encode($detailNamaPicAdmin);
|
||||
|
||||
// Process detail_nomor_hp_pic_admin
|
||||
foreach ($nomorHpPicAdmin as $value) {
|
||||
$detailNomorHpPicAdmin[] = [
|
||||
'nomor_hp_pic_admin' => $value
|
||||
];
|
||||
$detailNomorHpPicAdmin[] = $value;
|
||||
}
|
||||
$detailNomorHpPicAdminJson = json_encode($detailNomorHpPicAdmin);
|
||||
|
||||
// Process detail_nama_pic_marketing
|
||||
foreach ($namaPicMarketing as $value) {
|
||||
$detailNamaPicMarketing[] = [
|
||||
'nama_pic_marketing' => $value
|
||||
];
|
||||
$detailNamaPicMarketing[] = $value;
|
||||
}
|
||||
$detailNamaPicMarketingJson = json_encode($detailNamaPicMarketing);
|
||||
|
||||
// Process detail_nomor_hp_pic_marketing
|
||||
foreach ($nomorHpPicMarketing as $value) {
|
||||
$detailNomorHpPicMarketing[] = [
|
||||
'nomor_hp_pic_marketing' => $value
|
||||
];
|
||||
$detailNomorHpPicMarketing[] = $value;
|
||||
}
|
||||
$detailNomorHpPicMarketingJson = json_encode($detailNomorHpPicMarketing);
|
||||
|
||||
@@ -449,7 +421,6 @@ class KJPPController extends Controller
|
||||
} else {
|
||||
$validated['jenis_aset_id'] = json_encode($validated['jenis_aset_id']);
|
||||
}
|
||||
|
||||
// Perbarui data di database
|
||||
KJPP::where('id', $id)->update($validated);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user