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',

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('kjpp', function (Blueprint $table) {
$table->string('detail_nama_pimpinan')->nullable()->after('nama_pimpinan');
$table->string('detail_nomor_hp_pimpinan')->nullable()->after('nomor_hp_pimpinan');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('kjpp', function (Blueprint $table) {
$table->dropColumn('detail_nama_pimpinan');
$table->dropColumn('detail_nomor_hp_pimpinan');
});
}
};

View File

@@ -273,6 +273,50 @@
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap">
<div id="detail_nama_pimpinan" class="flex flex-wrap items-baseline w-full gap-2.5">
@if (isset($kjpp->detail_nama_pimpinan) && isset($kjpp->detail_nomor_hp_pimpinan))
@foreach (json_decode($detailJoinPimpinan) as $detail_pimpinan)
<div class="flex flex-col lg:flex-row gap-2 items-baseline lg:items-center w-full">
<label class="form-label max-w-56">
Nama Pimpinan
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nama_pimpinan') border-danger @enderror"
type="text" name="detail_nama_pimpinan[nama_pimpinan][]"
value="{{ $detail_pimpinan->nama_pimpinan ?? old('detail_nama_pimpinan.nama_pimpinan') }}">
@error('nama_pimpinan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<label class="form-label max-w-56">
Nomor HP Pimpinan
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nomor_hp_pimpinan') border-danger @enderror"
type="text" name="detail_nomor_hp_pimpinan[nomor_hp_pimpinan][]"
value="{{ $detail_pimpinan->nomor_hp_pimpinan ?? old('detail_nomor_hp_pimpinan.nomor_hp_pimpinan') }}">
@error('nomor_hp_pimpinan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<button type="button" class="btn btn-danger btn-xs delete-button-edit">
Hapus
</button>
</div>
@endforeach
@endif
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
&nbsp;
</label>
<div class="flex flex-wrap items-baseline w-full">
<button type="button" id="tambah_nama_pimpinan" class="btn btn-primary btn-xs">Tambah
Pimpinan</button>
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Nama PIC Reviewer
@@ -413,22 +457,26 @@
<label class="form-label max-w-56">
Nama PIC Marketing
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nama_pic_marketing') border-danger @enderror" type="text"
name="nama_pic_marketing"
value="{{ $kjpp->nama_pic_marketing ?? old('nama_pic_marketing') }}">
@error('nama_pic_marketing')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<label class="form-label max-w-56">
Nomor HP PIC Marketing
</label>
<input class="input @error('nomor_hp_pic_marketing') border-danger @enderror" type="text"
name="nomor_hp_pic_marketing"
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nomor_hp_pic_marketing') border-danger @enderror"
type="text" name="nomor_hp_pic_marketing"
value="{{ $kjpp->nomor_hp_pic_marketing ?? old('nomor_hp_pic_marketing') }}">
@error('nomor_hp_pic_marketing')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap">
<div id="detail_nama_pic_marketing" class="flex flex-wrap items-baseline w-full gap-2.5">
@if (isset($kjpp->detail_nama_pic_marketing) && isset($kjpp->detail_nomor_hp_pic_marketing))

View File

@@ -41,6 +41,31 @@
addDeleteListeners();
});
const namaPimpinanDiv = document.getElementById('detail_nama_pimpinan');
document.getElementById("tambah_nama_pimpinan").addEventListener("click", function() {
const newDiv = document.createElement("div");
newDiv.className = "flex flex-col lg:flex-row gap-2 items-baseline lg:items-center w-full";
newDiv.innerHTML = `
<label class="form-label max-w-56">
Nama Pimpinan
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input" type="text" name="detail_nama_pimpinan[nama_pimpinan][]" value="">
</div>
<label class="form-label max-w-56">
Nomor HP Pimpinan
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input" type="text" name="detail_nomor_hp_pimpinan[nomor_hp_pimpinan][]" value="">
</div>
<button type="button" class="btn btn-danger btn-xs delete-button">Hapus</button>
`;
namaPimpinanDiv.appendChild(newDiv);
addDeleteListeners();
});
const namaPicReviewerDiv = document.getElementById('detail_nama_pic_reviewer');
document.getElementById("tambah_nama_pic_reviewer").addEventListener("click", function() {

View File

@@ -111,12 +111,26 @@
</label>
<div class="flex flex-wrap items-baseline w-full">
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nama_pimpinan }}</p>
@if (isset($kjpp->detail_nama_pimpinan))
@foreach (json_decode($detailJoinPimpinan) as $detail_nama_pimpinan)
<p class="flex w-full text-gray-600 font-medium text-sm">
{{ $detail_nama_pimpinan->nama_pimpinan }}
</p>
@endforeach
@endif
</div>
<label class="form-label max-w-56">
Nomor HP Pimpinan
</label>
<div class="flex flex-wrap items-baseline w-full">
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nomor_hp_pimpinan }}</p>
@if (isset($kjpp->detail_nomor_hp_pimpinan))
@foreach (json_decode($detailJoinPimpinan) as $detail_nomor_hp_pimpinan)
<p class="flex w-full text-gray-600 font-medium text-sm">
{{ $detail_nomor_hp_pimpinan->nomor_hp_pimpinan }}
</p>
@endforeach
@endif
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
@@ -124,9 +138,9 @@
Nama PIC Reviewer
</label>
<div class="flex flex-wrap items-baseline w-full">
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nama_pic_reviewer }}</p>
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nama_pic_reviewer ?? '-' }}</p>
@if (isset($kjpp->detail_nama_pic_reviewer))
@foreach (json_decode($kjpp->detail_nama_pic_reviewer) as $detail_nama_pic_reviewer)
@foreach (json_decode($detailJoinPicReviewer) as $detail_nama_pic_reviewer)
<p class="flex w-full text-gray-600 font-medium text-sm">
{{ $detail_nama_pic_reviewer->nama_pic_reviewer }}
</p>
@@ -137,9 +151,10 @@
Nomor HP PIC Reviewer
</label>
<div class="flex flex-wrap items-baseline w-full">
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nomor_hp_pic_reviewer }}</p>
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nomor_hp_pic_reviewer ?? '-' }}
</p>
@if (isset($kjpp->detail_nomor_hp_pic_reviewer))
@foreach (json_decode($kjpp->detail_nomor_hp_pic_reviewer) as $detail_nomor_hp_pic_reviewer)
@foreach (json_decode($detailJoinPicReviewer) as $detail_nomor_hp_pic_reviewer)
<p class="flex w-full text-gray-600 font-medium text-sm">
{{ $detail_nomor_hp_pic_reviewer->nomor_hp_pic_reviewer }}
</p>
@@ -152,9 +167,9 @@
Nama PIC Admin
</label>
<div class="flex flex-wrap items-baseline w-full">
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nama_pic_admin }}</p>
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nama_pic_admin ?? '-' }}</p>
@if (isset($kjpp->detail_nama_pic_admin))
@foreach (json_decode($kjpp->detail_nama_pic_admin) as $detail_nama_pic_admin)
@foreach (json_decode($detailJoinPicAdmin) as $detail_nama_pic_admin)
<p class="flex w-full text-gray-600 font-medium text-sm">
{{ $detail_nama_pic_admin->nama_pic_admin }}
</p>
@@ -165,9 +180,9 @@
Nomor HP PIC Admin
</label>
<div class="flex flex-wrap items-baseline w-full">
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nomor_hp_pic_admin }}</p>
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nomor_hp_pic_admin ?? '-' }}</p>
@if (isset($kjpp->detail_nomor_hp_pic_admin))
@foreach (json_decode($kjpp->detail_nomor_hp_pic_admin) as $detail_nomor_hp_pic_admin)
@foreach (json_decode($detailJoinPicAdmin) as $detail_nomor_hp_pic_admin)
<p class="flex w-full text-gray-600 font-medium text-sm">
{{ $detail_nomor_hp_pic_admin->nomor_hp_pic_admin }}
</p>
@@ -180,9 +195,9 @@
Nama PIC Marketing
</label>
<div class="flex flex-wrap items-baseline w-full">
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nama_pic_marketing }}</p>
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nama_pic_marketing ?? '-' }}</p>
@if (isset($kjpp->detail_nama_pic_marketing))
@foreach (json_decode($kjpp->detail_nama_pic_marketing) as $detail_nama_pic_marketing)
@foreach (json_decode($detailJoinPicMarketing) as $detail_nama_pic_marketing)
<p class="flex w-full text-gray-600 font-medium text-sm">
{{ $detail_nama_pic_marketing->nama_pic_marketing }}
</p>
@@ -193,9 +208,10 @@
Nomor HP PIC Marketing
</label>
<div class="flex flex-wrap items-baseline w-full">
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nomor_hp_pic_marketing }}</p>
<p class="flex w-full text-gray-600 font-medium text-sm">{{ $kjpp->nomor_hp_pic_marketing ?? '-' }}
</p>
@if (isset($kjpp->detail_nomor_hp_pic_marketing))
@foreach (json_decode($kjpp->detail_nomor_hp_pic_marketing) as $detail_nomor_hp_pic_marketing)
@foreach (json_decode($detailJoinPicMarketing) as $detail_nomor_hp_pic_marketing)
<p class="flex w-full text-gray-600 font-medium text-sm">
{{ $detail_nomor_hp_pic_marketing->nomor_hp_pic_marketing }}
</p>