Menambahkan fitur nama pimpinan bisa lebih dari satu

This commit is contained in:
2024-11-11 16:25:23 +07:00
parent 5b5e45baf6
commit 486f0d758b
6 changed files with 215 additions and 26 deletions

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,21 +457,25 @@
<label class="form-label max-w-56">
Nama PIC Marketing
</label>
<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 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"
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 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">

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>