Merge branch 'staging' into feature/senior-officer
This commit is contained in:
@@ -69,16 +69,28 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="py-3 max-w-[100px]">
|
||||
<td class="py-3 max-w-[100px] align-top" >
|
||||
Dokumen Jaminan
|
||||
</td>
|
||||
<td class="py-3 text-gray-700 text-2sm font-normal">
|
||||
|
||||
@if(isset($detail->dokumen_jaminan))
|
||||
@if(in_array(Auth::user()->roles[0]->name,['administrator','pemohon-eo']))
|
||||
<a href="{{ route('debitur.jaminan.download',['id'=>$permohonan->debiture->id,'dokumen'=>$detail->id]) }}" class="badge badge-sm badge-outline mt-2 badge-info"><i class="ki-filled ki-cloud-download mr-2"></i> Download</a>
|
||||
) @endif
|
||||
<span class="badge badge-sm badge-outline badge-warning mt-2" onclick="viewPDF('{{ Storage::url($detail->dokumen_jaminan) }}')"><i class="ki-filled ki-eye mr-2"></i>Preview</span>
|
||||
@php
|
||||
$dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan)) ? json_decode($detail->dokumen_jaminan) : [$detail->dokumen_jaminan];
|
||||
@endphp
|
||||
@foreach($dokumen_jaminan as $index => $dokumen)
|
||||
@if(in_array(Auth::user()->roles[0]->name,['administrator','pemohon-eo']))
|
||||
<a href="{{ route('debitur.jaminan.download', ['id' => $permohonan->debiture->id, 'dokumen' => $detail->id, 'index' => $index]) }}"
|
||||
class="badge badge-sm badge-outline mt-2 mr-2">
|
||||
{{ basename($dokumen) }}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
@endif
|
||||
<span class="badge badge-sm badge-outline badge-warning mt-2" onclick="viewPDF('{{ Storage::url($dokumen_jaminan[$index]) }}')"><i class="ki-filled ki-eye mr-2"></i>Preview</span>
|
||||
<br>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -132,41 +132,57 @@
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(isset($document->id))
|
||||
@foreach($document->detail as $detail)
|
||||
<input type="hidden" name="detail_dokumen_jaminan_id[]" value="{{ $detail->id }}">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 font-bold">
|
||||
{{ $loop->index + 1 }}. {{ $detail->jenisLegalitasJaminan->name }}
|
||||
</label>
|
||||
<input type="hidden" name="jenis_legalitas_jaminan_id[]" value=" {{ $detail->jenis_legalitas_jaminan_id }}">
|
||||
</div>
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Nama Dokumen
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="input " type="text" id="name" name="name[]" value="{{ $detail->name ?? "" }}" placeholder="Nama Dokumen">
|
||||
<div id="doctainer" class="grid gap-5">
|
||||
@if(isset($document->id))
|
||||
@php $n = 0; @endphp
|
||||
@foreach($document->detail as $detail)
|
||||
<input type="hidden" name="detail_dokumen_jaminan_id[]" value="{{ $detail->id }}">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 font-bold">
|
||||
{{ $n + 1 }}. {{ $detail->jenisLegalitasJaminan->name }}
|
||||
</label>
|
||||
<input type="hidden" name="jenis_legalitas_jaminan_id[]" value=" {{ $detail->jenis_legalitas_jaminan_id }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Dokumen Jaminan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="file-input" type="file" name="dokumen_jaminan[]" value="">
|
||||
@if(isset($detail->dokumen_jaminan))
|
||||
<a href="{{ route('debitur.jaminan.download',['id'=>$debitur->id,'dokumen'=>$detail->id]) }}" class="badge badge-sm badge-outline mt-2">{{ basename($detail->dokumen_jaminan) }}
|
||||
<i class="ki-filled ki-cloud-download"></i></a>
|
||||
@endif
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Nama Dokumen
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="input " type="text" id="name" name="name[]" value="{{ $detail->name ?? "" }}" placeholder="Nama Dokumen">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($detail->details)
|
||||
@php $custom_field = json_decode($detail->details,true) @endphp
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Dokumen Jaminan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<div class="flex flex-col w-full gap-2" id="file-container-{{$n}}">
|
||||
<div class="flex items-center gap-2">
|
||||
<input class="file-input" type="file" name="dokumen_jaminan[{{ $n }}][]" multiple>
|
||||
<button type="button" class="btn btn-primary w-[100px] text-center" onclick="addFileInput({{ $n }})">Add More</button>
|
||||
</div>
|
||||
<div id="additional-files-{{ $n }}"></div>
|
||||
</div>
|
||||
|
||||
@if(isset($detail->dokumen_jaminan))
|
||||
@php
|
||||
$dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan)) ? json_decode($detail->dokumen_jaminan) : [$detail->dokumen_jaminan];
|
||||
@endphp
|
||||
@foreach($dokumen_jaminan as $index => $dokumen)
|
||||
<a href="{{ route('debitur.jaminan.download', ['id' => $debitur->id, 'dokumen' => $detail->id, 'index' => $index]) }}"
|
||||
class="badge badge-sm badge-outline mt-2 mr-2">
|
||||
{{ basename($dokumen) }}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($detail->details)
|
||||
@php $custom_field = json_decode($detail->details,true) @endphp
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 capitalize">
|
||||
{{ str_replace('_',' ',$detail->jenisLegalitasJaminan->custom_field) }}
|
||||
@@ -175,21 +191,97 @@
|
||||
<input class="input" type="text" name="custom_field[][$detail->jenisLegalitasJaminan->custom_field]" value="{{ $custom_field[$detail->jenisLegalitasJaminan->custom_field] }}">
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
@if($detail->jenisLegalitasJaminan->custom_field)
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 capitalize">
|
||||
{{ str_replace('_',' ',$detail->jenisLegalitasJaminan->custom_field) }}
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
@if($detail->jenisLegalitasJaminan->custom_field_type === "text")
|
||||
<input class="input" type="text" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2">
|
||||
@elseif($detail->jenisLegalitasJaminan->custom_field_type === "number")
|
||||
<input class="input" type="number" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2">
|
||||
@elseif($detail->jenisLegalitasJaminan->custom_field_type === "date")
|
||||
<input class="input" type="date" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2">
|
||||
@elseif($detail->jenisLegalitasJaminan->custom_field_type === "textarea")
|
||||
<textarea class="textarea" rows="3" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2"></textarea>
|
||||
@else
|
||||
<input class="input" type="text" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2">
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Keterangan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea class="textarea" rows="3" type="number" name="keterangan[]">{{ $detail->keterangan ?? "" }}</textarea>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Keterangan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea class="textarea" rows="3" type="number" name="keterangan[]">{{ $detail->keterangan ?? "" }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
@php $n++; @endphp
|
||||
@endforeach
|
||||
@foreach($legalitas as $item)
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 font-bold">
|
||||
{{ $n + 1 }}. {{ $item->name }}
|
||||
</label>
|
||||
<input type="hidden" name="jenis_legalitas_jaminan_id[]" value=" {{ $item->id }}">
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<div id="doctainer" class="grid gap-5">
|
||||
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Nama Dokumen
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="input " type="text" id="name" name="name[]" value="" placeholder="Nama Dokumen">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Dokumen Jaminan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="file-input" type="file" name="dokumen_jaminan[]" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($item->custom_field)
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 capitalize">
|
||||
{{ str_replace('_',' ',$item->custom_field) }}
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
@if($item->custom_field_type === "text")
|
||||
<input class="input" type="text" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2">
|
||||
@elseif($item->custom_field_type === "number")
|
||||
<input class="input" type="number" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2">
|
||||
@elseif($item->custom_field_type === "date")
|
||||
<input class="input" type="date" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2">
|
||||
@elseif($item->custom_field_type === "textarea")
|
||||
<textarea class="textarea" rows="3" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2"></textarea>
|
||||
@else
|
||||
<input class="input" type="text" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2">
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Keterangan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea class="textarea" rows="3" type="number" name="keterangan[]"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
@php $n++; @endphp
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
@@ -311,13 +403,13 @@
|
||||
@push('scripts')
|
||||
{{--Pemilik Jaminan--}}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const namaSertifikatDiv = document.getElementById("nama_sertifikat");
|
||||
|
||||
// Function to add delete event listeners to existing buttons
|
||||
function addDeleteListeners() {
|
||||
document.querySelectorAll(".delete-button").forEach(button => {
|
||||
button.addEventListener("click", function() {
|
||||
button.addEventListener("click", function () {
|
||||
this.closest(".flex.items-baseline.flex-wrap.lg\\:flex-nowrap.gap-2\\.5.mb-5").remove();
|
||||
});
|
||||
});
|
||||
@@ -326,7 +418,7 @@
|
||||
// Add delete listeners to existing buttons
|
||||
addDeleteListeners();
|
||||
|
||||
document.getElementById("tambah_sertifikat").addEventListener("click", function() {
|
||||
document.getElementById("tambah_sertifikat").addEventListener("click", function () {
|
||||
const newDiv = document.createElement("div");
|
||||
newDiv.className = "flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 mb-5";
|
||||
newDiv.innerHTML = `
|
||||
@@ -367,11 +459,14 @@
|
||||
<script>
|
||||
function getLegalitasJaminan() {
|
||||
var legalitasJaminan = document.getElementById("jenis_jaminan_id").value;
|
||||
var url = "/basic-data/jenis-jaminan/legalitas/" + legalitasJaminan;
|
||||
var documentId = "{{ $document->id ?? "0" }}";
|
||||
var debiturId = "{{ $debitur->id }}";
|
||||
var url = `/basic-data/jenis-jaminan/legalitas/${documentId}/${legalitasJaminan}`;
|
||||
fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
@@ -385,66 +480,128 @@
|
||||
doctainer.innerHTML = "";
|
||||
data.forEach((item, index) => {
|
||||
doctainer.innerHTML += `
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 font-bold">
|
||||
${index + 1}. ${item.name}
|
||||
</label>
|
||||
<input type="hidden" name="jenis_legalitas_jaminan_id[]" value="${item.id}">
|
||||
</div>
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Nama Dokumen
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="input " type="text" id="name" name="name[]" value="" placeholder="Nama Dokumen">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 font-bold">
|
||||
${index + 1}. ${item.name}
|
||||
</label>
|
||||
<input type="hidden" name="jenis_legalitas_jaminan_id[]" value="${item.jenis_legalitas_jaminan_id}">
|
||||
${item.is_existing ? `<input type="hidden" name="detail_dokumen_jaminan_id[]" value="${item.id}">` : ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Dokumen Jaminan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="file-input" type="file" name="dokumen_jaminan[]" value="">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Nama Dokumen
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="input" type="text" name="name[]" value="${item.name || ''}" placeholder="Nama Dokumen">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
${item.custom_field && item.custom_field.length > 0 ? `
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 capitalize">
|
||||
${item.custom_field.replace(/_/g, " ")}
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
${item.custom_field_type === "text" ? `
|
||||
<input class="input" type="text" name="custom_field[][${item.custom_field}]">
|
||||
` : item.custom_field_type === "number" ? `
|
||||
<input class="input" type="number" name="custom_field[][${item.custom_field}]">
|
||||
` : item.custom_field_type === "date" ? `
|
||||
<input class="input" type="date" name="custom_field[][${item.custom_field}]">
|
||||
` : item.custom_field_type === "textarea" ? `
|
||||
<textarea class="textarea" rows="3" name="custom_field[][${item.custom_field}]"></textarea>
|
||||
` : `
|
||||
<input class="input" type="text" name="custom_field[][${item.custom_field}]">
|
||||
`}
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Dokumen Jaminan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full" id="file-container-${index}">
|
||||
${item.dokumen_jaminan ? renderExistingFiles(item.dokumen_jaminan, debiturId, item.id) : ''}
|
||||
<div class="flex items-center gap-2 my-2 w-full">
|
||||
<input class="file-input" type="file" name="dokumen_jaminan[${index}][]" multiple>
|
||||
<button type="button" class="btn btn-primary w-[100px] text-center" onclick="addFileInput(${index})">Add File</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
` : ""}
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Keterangan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea class="textarea" rows="3" type="number" name="keterangan[]"></textarea>
|
||||
${item.custom_field ? `
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56 capitalize">
|
||||
${item.custom_field.replace(/_/g, " ")}
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
${getCustomFieldInput(item.custom_field_type, item.custom_field, item.details)}
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
` : ''}
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Keterangan
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea class="textarea" rows="3" name="keterangan[]">${item.keterangan || ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error:", error);
|
||||
// Handle the error here
|
||||
});
|
||||
.catch(error => console.error('Error:', error));
|
||||
}
|
||||
|
||||
function renderExistingFiles(dokumenJaminan, debiturId, itemId) {
|
||||
if (typeof dokumenJaminan === 'string') {
|
||||
return `
|
||||
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}" class="badge badge-sm badge-outline mt-2 mr-2">
|
||||
${dokumenJaminan.split('/').pop()}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
`;
|
||||
} else if (Array.isArray(dokumenJaminan)) {
|
||||
return dokumenJaminan.map(file => `
|
||||
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}&file=${encodeURIComponent(file)}" class="badge badge-sm badge-outline mt-2 mr-2">
|
||||
${file.split('/').pop()}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
`).join('');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function addFileInput(index) {
|
||||
const container = document.getElementById(`file-container-${index}`);
|
||||
const newInput = document.createElement('div');
|
||||
newInput.className = 'flex items-center gap-2 mb-2 w-full';
|
||||
newInput.innerHTML = `
|
||||
<input class="file-input" type="file" name="dokumen_jaminan[${index}][]" multiple>
|
||||
<button type="button" class="btn btn-danger w-[100px] text-center" onclick="removeFileInput(this)">Remove</button>
|
||||
`;
|
||||
container.appendChild(newInput);
|
||||
}
|
||||
|
||||
function removeFileInput(button) {
|
||||
button.closest('.flex.items-center.gap-2.mb-2').remove();
|
||||
}
|
||||
|
||||
function renderExistingFiles(dokumenJaminan, debiturId, itemId) {
|
||||
if (typeof dokumenJaminan === 'string') {
|
||||
return `
|
||||
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}" class="badge badge-sm badge-outline mt-2">
|
||||
${dokumenJaminan.split('/').pop()}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
`;
|
||||
} else if (Array.isArray(dokumenJaminan)) {
|
||||
return dokumenJaminan.map(file => `
|
||||
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}&file=${file}" class="badge badge-sm badge-outline mt-2 mr-2">
|
||||
${file.split('/').pop()}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
`).join('');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function getCustomFieldInput(type, fieldName, value) {
|
||||
value = value ? JSON.parse(value)[fieldName] || '' : '';
|
||||
switch (type) {
|
||||
case "text":
|
||||
return `<input class="input" type="text" name="custom_field[][${fieldName}]" value="${value}">`;
|
||||
case "number":
|
||||
return `<input class="input" type="number" name="custom_field[][${fieldName}]" value="${value}">`;
|
||||
case "date":
|
||||
return `<input class="input" type="date" name="custom_field[][${fieldName}]" value="${value}">`;
|
||||
case "textarea":
|
||||
return `<textarea class="textarea" rows="3" name="custom_field[][${fieldName}]">${value}</textarea>`;
|
||||
default:
|
||||
return `<input class="input" type="text" name="custom_field[][${fieldName}]" value="${value}">`;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
189
resources/views/spk/documentSPK.blade.php
Normal file
189
resources/views/spk/documentSPK.blade.php
Normal file
File diff suppressed because one or more lines are too long
185
resources/views/spk/dokumennya.blade.php
Normal file
185
resources/views/spk/dokumennya.blade.php
Normal file
File diff suppressed because one or more lines are too long
211
resources/views/spk/edit.blade.php
Normal file
211
resources/views/spk/edit.blade.php
Normal file
File diff suppressed because one or more lines are too long
@@ -1,27 +1,26 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render('basicdata.tujuan-penilaian') }}
|
||||
{{ Breadcrumbs::render('spk') }}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="grid">
|
||||
<div class="card card-grid min-w-full" data-datatable="false" data-datatable-page-size="5" data-datatable-state-save="false" id="tujuan-penilaian-table" data-api-url="{{ route('basicdata.tujuan-penilaian.datatables') }}">
|
||||
<div class="card card-grid min-w-full" data-datatable="false" data-datatable-page-size="5" data-datatable-state-save="false" id="spk-table" data-api-url="{{ route('spk.datatables') }}">
|
||||
<div class="card-header py-5 flex-wrap">
|
||||
<h3 class="card-title">
|
||||
SPK Menu
|
||||
Daftar SPK
|
||||
</h3>
|
||||
<div class="flex flex-wrap gap-2 lg:gap-5">
|
||||
<div class="flex">
|
||||
<label class="input input-sm"> <i class="ki-filled ki-magnifier"> </i>
|
||||
<input placeholder="Search Doc SPK" id="search" type="text" value="">
|
||||
<input placeholder="Search SPK" id="search" type="text" value="">
|
||||
</label>
|
||||
</div>
|
||||
<!-- <div class="flex flex-wrap gap-2.5">
|
||||
<div class="flex flex-wrap gap-2.5">
|
||||
<div class="h-[24px] border border-r-gray-200"></div>
|
||||
<a class="btn btn-sm btn-light" href="{{ route('basicdata.tujuan-penilaian.export') }}"> Export to Excel </a>
|
||||
<a class="btn btn-sm btn-primary" href="{{ route('basicdata.tujuan-penilaian.create') }}"> Tambah Tujuan Penilaian </a>
|
||||
</div> -->
|
||||
<a class="btn btn-sm btn-light" href="#"> Export to Excel </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@@ -32,12 +31,28 @@
|
||||
<th class="w-14">
|
||||
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
|
||||
</th>
|
||||
<th class="min-w-[250px]" data-datatable-column="code">
|
||||
<span class="sort"> <span class="sort-label"> No SPK </span>
|
||||
<th class="min-w-[150px]" data-datatable-column="nomor_registrasi">
|
||||
<span class="sort"> <span class="sort-label"> Nomor Registrasi </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[250px]" data-datatable-column="name">
|
||||
<span class="sort"> <span class="sort-label"> Perihal </span>
|
||||
<th class="min-w-[150px]" data-datatable-column="code">
|
||||
<span class="sort"> <span class="sort-label"> Kode Penawaran </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="start_date">
|
||||
<span class="sort"> <span class="sort-label"> Tanggal Penawaran </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_kjpp_id">
|
||||
<span class="sort"> <span class="sort-label"> Tujuan Penilaian </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="nama_kjpp_sebelumnya">
|
||||
<span class="sort"> <span class="sort-label">KJPP Data</span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="status">
|
||||
<span class="sort"> <span class="sort-label"> Status </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||
@@ -62,87 +77,103 @@
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script type="text/javascript">
|
||||
function deleteData(data) {
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "You won't be able to revert this!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
}
|
||||
});
|
||||
<script type="text/javascript">
|
||||
function spkShow(regId)
|
||||
{
|
||||
var url = "{{ url('show') }}/"+regId;
|
||||
$(location).attr('href',url);
|
||||
}
|
||||
|
||||
$.ajax(`basic-data/tujuan-penilaian/${data}`, {
|
||||
type: 'DELETE'
|
||||
}).then((response) => {
|
||||
swal.fire('Deleted!', 'User has been deleted.', 'success').then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
}).catch((error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Error!', 'An error occurred while deleting the file.', 'error');
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<script type="module">
|
||||
const element = document.querySelector('#tujuan-penilaian-table');
|
||||
const searchInput = document.getElementById('search');
|
||||
function spkCreate(regId)
|
||||
{
|
||||
var url1 = "/spk/"+regId+"/edit";
|
||||
var url = "{{ url('/') }}"+url1;
|
||||
$(location).attr('href',url);
|
||||
}
|
||||
</script>
|
||||
<script type="module">
|
||||
const element = document.querySelector('#spk-table');
|
||||
const searchInput = document.getElementById('search');
|
||||
|
||||
const apiUrl = element.getAttribute('data-api-url');
|
||||
const dataTableOptions = {
|
||||
apiEndpoint: apiUrl,
|
||||
pageSize: 5,
|
||||
columns: {
|
||||
select: {
|
||||
render: (item, data, context) => {
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.className = 'checkbox checkbox-sm';
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.value = data.id.toString();
|
||||
checkbox.setAttribute('data-datatable-row-check', 'true');
|
||||
return checkbox.outerHTML.trim();
|
||||
},
|
||||
const apiUrl = element.getAttribute('data-api-url');
|
||||
const dataTableOptions = {
|
||||
apiEndpoint: apiUrl,
|
||||
pageSize: 5,
|
||||
columns: {
|
||||
select: {
|
||||
render: (item, data, context) => {
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.className = 'checkbox checkbox-sm';
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.value = data.id.toString();
|
||||
checkbox.setAttribute('data-datatable-row-check', 'true');
|
||||
return checkbox.outerHTML.trim();
|
||||
},
|
||||
code: {
|
||||
title: 'Code',
|
||||
},
|
||||
name: {
|
||||
title: 'Tujuan Penilaian',
|
||||
},
|
||||
actions: {
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
return `<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-info" href="basic-data/tujuan-penilaian/${data.id}/edit">
|
||||
<i class="ki-outline ki-notepad-edit"></i>
|
||||
</a>
|
||||
<a onclick="deleteData(${data.id})" class="delete btn btn-sm btn-icon btn-clear btn-danger">
|
||||
<i class="ki-outline ki-trash"></i>
|
||||
</a>
|
||||
</div>`;
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
'nomor_registrasi': {
|
||||
title: 'Nomor Registrasi',
|
||||
},
|
||||
code: {
|
||||
title: 'Kode Penawaran',
|
||||
},
|
||||
date_range: {
|
||||
title: 'Tanggal Penawaran',
|
||||
},
|
||||
tujuan_penilaian_kjpp_name: {
|
||||
title: 'Tujuan Penilaian',
|
||||
},
|
||||
nama_kjpp_sebelumnya: {
|
||||
title: 'Nama KJPP Terpilih',
|
||||
render: (item, data) => {
|
||||
return `${data.nama_kjpp_sebelumnya}`+'<br />'
|
||||
+`${data.biaya_kjpp_sebelumnya}`+'<br /> '
|
||||
+`${data.tanggal_penilaian_sebelumnya}`;
|
||||
},
|
||||
},
|
||||
status: {
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
return `${data.status}`.toUpperCase();
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
var spkShow ='';
|
||||
var spkCreate='';
|
||||
if(!data.dokumenSPK)
|
||||
{
|
||||
spkCreate=`<a class="btn btn-sm btn-icon btn-clear btn-info" title="Proses Penawaran" onclick="spkCreate(${data.id})" >
|
||||
<i class="ki-outline ki-notepad-edit"></i>
|
||||
</a>`;
|
||||
}
|
||||
else
|
||||
{
|
||||
spkShow =`<div class="flex flex-nowrap justify-center">
|
||||
<a onclick="spkShow(${data.id})" class="btn btn-sm btn-icon btn-clear btn-primary" title="Lihat SPK">
|
||||
<i class="ki-outline ki-eye"></i>
|
||||
</a> `;
|
||||
spkCreate=`<a class="btn btn-sm btn-icon btn-clear btn-info" title="Buat SPK" onclick="spkCreate(${data.id})" >
|
||||
<i class="ki-outline ki-notepad-edit"></i>
|
||||
</a>`;
|
||||
}
|
||||
|
||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||
// Custom search functionality
|
||||
searchInput.addEventListener('input', function () {
|
||||
const searchValue = this.value.trim();
|
||||
dataTable.search(searchValue, true);
|
||||
return `<div class="flex flex-nowrap justify-center">`
|
||||
+spkShow+spkCreate+
|
||||
`</div>`;
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||
// Custom search functionality
|
||||
searchInput.addEventListener('input', function () {
|
||||
const searchValue = this.value.trim();
|
||||
dataTable.search(searchValue, true);
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
39
resources/views/spk/js/editjs.blade.php
Normal file
39
resources/views/spk/js/editjs.blade.php
Normal file
@@ -0,0 +1,39 @@
|
||||
@push('scripts')
|
||||
@include('lpj::assetsku.includenya')
|
||||
<script type="text/javascript">
|
||||
function buildSPKPDF(penawaran_id) {
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Yakin Generate SPK ke PDF?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax(`spk/${penawaran_id}`, {
|
||||
type: 'PUT'
|
||||
}).then((response) => {
|
||||
// alert('ok Sukses');
|
||||
swal.fire('Success!', 'File SPK berhasil di generate.', 'success').then(() => {
|
||||
// window.location.reload();
|
||||
});
|
||||
$('#download-button').removeAttr('disabled');
|
||||
$("#download-button").attr("href", response.spkpenawaran_path);
|
||||
|
||||
}).catch((error) => {
|
||||
console.error('Error:', error);
|
||||
Swal.fire('Error!', 'An error occurred while generate the PDF file.', 'error');
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user