Merge remote-tracking branch 'composer/feature/senior-officer' into staging
This commit is contained in:
@@ -18,6 +18,7 @@ use Modules\Location\Models\City;
|
||||
use Modules\Location\Models\District;
|
||||
use Modules\Location\Models\Village;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Helpers\Lpj;
|
||||
|
||||
class PenilaiController extends Controller
|
||||
@@ -649,7 +650,7 @@ class PenilaiController extends Controller
|
||||
try {
|
||||
|
||||
if ($statusLpj) {
|
||||
return view('lpj::' . $viewLaporan, compact(
|
||||
return view('lpj::' . $viewLaporan, compact(
|
||||
'permohonan',
|
||||
'forminspeksi',
|
||||
'lpjData',
|
||||
@@ -661,7 +662,8 @@ class PenilaiController extends Controller
|
||||
'alamat',
|
||||
'dataPembanding',
|
||||
'nomorLaporan'
|
||||
));
|
||||
))->render();
|
||||
|
||||
} else {
|
||||
$pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
|
||||
'permohonan',
|
||||
|
||||
@@ -557,5 +557,12 @@
|
||||
]);
|
||||
}
|
||||
|
||||
public function view_laporan(Request $request){
|
||||
|
||||
$id = $request->permohonanId;
|
||||
|
||||
$permohonan = Permohonan::find($id);
|
||||
return view('lpj::penilaian.laporan-so', compact('permohonan'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -209,9 +209,9 @@
|
||||
due_date: {
|
||||
title: 'Due Date',
|
||||
render: (item, data) => {
|
||||
const mulai = new Date(data.permohonan.created_at);
|
||||
const selesai = new Date(data.tanggal_kunjungan)
|
||||
return `${mulai.getDate()}-${mulai.getMonth() + 1}-${mulai.getFullYear()} - ${selesai.getDate()}-${selesai.getMonth() + 1}-${selesai.getFullYear()}`
|
||||
const jenis_asset = data.permohonan.debiture.documents.map(d => d.jenis_jaminan.name );
|
||||
|
||||
return `${calculateDateSLA(jenis_asset, data.tanggal_kunjungan)}`;
|
||||
},
|
||||
},
|
||||
|
||||
@@ -254,6 +254,12 @@
|
||||
const year = String(date.getFullYear()).slice(-2);
|
||||
return `${day}-${month}-${year}`;
|
||||
}
|
||||
|
||||
|
||||
function calculateDateSLA($jenis, $date){
|
||||
let date = new Date($date);
|
||||
return $jenis, $date;
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
93
resources/views/penilaian/laporan-so.blade.php
Normal file
93
resources/views/penilaian/laporan-so.blade.php
Normal file
@@ -0,0 +1,93 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="card w-full bg-white rounded-lg shadow-md h-100vh">
|
||||
<div class="card-header flex justify-between items-center">
|
||||
<h3 class="card-title uppercase">
|
||||
Laporan
|
||||
</h3>
|
||||
<a href="{{ url()->previous() }}" class="btn btn-xs btn-info flex items-center">
|
||||
<i class="ki-filled ki-exit-left"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body relative flex flex-col h-[calc(100vh-4rem)]">
|
||||
<!-- Loading Spinner -->
|
||||
<div id="loading" class="absolute inset-0 flex items-center justify-center bg-gray-100 bg-opacity-50">
|
||||
<div class="loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-12 w-12"></div>
|
||||
<p class="text-gray-600 mt-2">Loading...</p>
|
||||
</div>
|
||||
|
||||
<!-- Iframe -->
|
||||
<iframe id="reportIframe" class="w-full h-full border rounded-lg hidden" frameborder="0"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@php
|
||||
$inspeksiId = null;
|
||||
$documentId = null;
|
||||
$jenisJaminanId = null;
|
||||
|
||||
foreach ($permohonan->debiture->documents as $item) {
|
||||
if (!empty($item->inspeksi)) {
|
||||
$inspeksiId = $item->inspeksi[0]->id; // Asumsi mengambil inspeksi pertama
|
||||
}
|
||||
$documentId = $item->id;
|
||||
$jenisJaminanId = $item->jenis_jaminan_id;
|
||||
}
|
||||
@endphp
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const iframe = document.getElementById('reportIframe');
|
||||
const loading = document.getElementById('loading');
|
||||
const url = `{{ route('penilai.print-out') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}&statusLpj=true`;
|
||||
|
||||
// Show loading indicator
|
||||
loading.style.display = 'flex';
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok ' + response.statusText);
|
||||
}
|
||||
return response.text();
|
||||
})
|
||||
.then(html => {
|
||||
// Load the content into iframe
|
||||
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
||||
iframeDoc.open();
|
||||
iframeDoc.write(html);
|
||||
iframeDoc.close();
|
||||
|
||||
// Hide loading indicator and show iframe
|
||||
loading.style.display = 'none';
|
||||
iframe.style.display = 'block';
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There has been a problem with your fetch operation:', error);
|
||||
loading.innerHTML = `<p class="text-red-500">Failed to load the report. Please try again later.</p>`;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Loader styles */
|
||||
.loader {
|
||||
border-color: #f3f3f3;
|
||||
border-top-color: #3498db;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* Full height for iframe */
|
||||
.card-body {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
@if ($dataHeader == 'pelaporan')
|
||||
<a class="btn btn-success"
|
||||
href="{{ route('penilai.print-out') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}&statusLpj={{true}}">
|
||||
href="{{ route('otorisator.view-laporan') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&inspeksiId={{ $inspeksiId }}&jaminanId={{ $jenisJaminanId }}&statusLpj={{true}}">
|
||||
Lihat Laporan
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@@ -398,10 +398,10 @@
|
||||
<div class="preview-container grid grid-cols-2 md:grid-cols-4 gap-4">
|
||||
@foreach ($lantaiFotos as $foto)
|
||||
<div class="preview-item relative">
|
||||
<img src="{{ asset('storage/' . $foto['path']) }}"
|
||||
alt="{{ $foto['name'] }}"
|
||||
<img src="{{ asset('storage/' . $foto['path']) }}"
|
||||
alt="{{ $foto['name'] }}"
|
||||
class="w-full h-40 object-cover rounded-lg">
|
||||
<button type="button"
|
||||
<button type="button"
|
||||
class="absolute top-2 right-2 btn btn-sm btn-danger btn-icon btnRemoveFoto"
|
||||
data-path="{{ $foto['path'] }}">
|
||||
<i class="ki-solid ki-cross"></i>
|
||||
@@ -409,12 +409,12 @@
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<input type="file"
|
||||
name="foto_lantai_unit[{{ $lantaiKey }}][]"
|
||||
class="file-input hidden"
|
||||
multiple
|
||||
accept="image/*"
|
||||
onchange="handleFileInput(this)"
|
||||
<input type="file"
|
||||
name="foto_lantai_unit[{{ $lantaiKey }}][]"
|
||||
class="file-input hidden"
|
||||
multiple
|
||||
accept="image/*"
|
||||
onchange="handleFileInput(this)"
|
||||
data-lantai="{{ $lantaiKey }}">
|
||||
<button type="button" class="btn btn-light btn-sm btnUploadFiles mt-2">
|
||||
<i class="ki-outline ki-upload"></i> Unggah Gambar
|
||||
@@ -604,7 +604,7 @@
|
||||
<script>
|
||||
|
||||
console.log('@json($formFoto)');
|
||||
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const lantaiContainer = document.getElementById("lantaiContainer");
|
||||
const btnAddLantai = document.getElementById("btnAddLantai");
|
||||
@@ -649,15 +649,15 @@
|
||||
Hapus
|
||||
</button>
|
||||
</div>
|
||||
<div class="dropzone w-full border-2 border-dashed border-gray-400 rounded-lg p-4 mt-2"
|
||||
ondrop="handleDrop(event)"
|
||||
<div class="dropzone w-full border-2 border-dashed border-gray-400 rounded-lg p-4 mt-2"
|
||||
ondrop="handleDrop(event)"
|
||||
ondragover="allowDrop(event)">
|
||||
<div class="preview-container grid grid-cols-2 md:grid-cols-4 gap-4"></div>
|
||||
<input type="file"
|
||||
name="foto_lantai_unit[${lantaiCount}][]"
|
||||
class="file-input hidden"
|
||||
multiple
|
||||
accept="image/*"
|
||||
<input type="file"
|
||||
name="foto_lantai_unit[${lantaiCount}][]"
|
||||
class="file-input hidden"
|
||||
multiple
|
||||
accept="image/*"
|
||||
data-lantai="${lantaiCount}"
|
||||
onchange="handleFileInput(this)">
|
||||
<button type="button" class="btn btn-light btn-sm btnUploadFiles">
|
||||
@@ -806,11 +806,11 @@
|
||||
icon: 'success',
|
||||
confirmButtonText: 'OK'
|
||||
}).then((response) => {
|
||||
// if (response.isConfirmed) {
|
||||
// window.location.href =
|
||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
// }
|
||||
console.log(response);
|
||||
if (response.isConfirmed) {
|
||||
window.location.href =
|
||||
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||
}
|
||||
// console.log(response);
|
||||
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const ruteLainnyaDiv = document.getElementById("ruteLainnya");
|
||||
const lantaiLainnyaDiv = document.getElementById("lantaiLainnya");
|
||||
// const lantaiLainnyaDiv = document.getElementById("lantaiLainnya");
|
||||
|
||||
// Function to add delete event listeners to existing buttons
|
||||
function addDeleteListeners(container) {
|
||||
container.querySelectorAll(".delete-button").forEach(button => {
|
||||
container.querySelectorAll(".delete-btn").forEach(button => {
|
||||
button.addEventListener("click", function() {
|
||||
this.closest(
|
||||
".flex.items-baseline.flex-wrap.lg\\:flex-nowrap.gap-2\\.5.mb-5"
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// Add delete listeners to existing buttons
|
||||
addDeleteListeners(ruteLainnyaDiv);
|
||||
addDeleteListeners(lantaiLainnyaDiv);
|
||||
// addDeleteListeners(lantaiLainnyaDiv);
|
||||
|
||||
function createNewDiv(container, inputName) {
|
||||
const newDiv = document.createElement("div");
|
||||
@@ -49,12 +49,12 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<button type="button" class="btn btn-danger btn-sm delete-button">
|
||||
<button type="button" class="btn btn-danger btn-sm delete-btn">
|
||||
<i class="ki-filled ki-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
`;x
|
||||
container.appendChild(newDiv);
|
||||
addDeleteListeners(container);
|
||||
}
|
||||
@@ -63,12 +63,9 @@
|
||||
createNewDiv(ruteLainnyaDiv, "rute_lainnya");
|
||||
});
|
||||
|
||||
document.getElementById("btnAddMoreObject").addEventListener("click", function() {
|
||||
createNewDiv(lantaiLainnyaDiv, "lantai_lainnya");
|
||||
});
|
||||
|
||||
|
||||
|
||||
// document.getElementById("btnAddMoreObject").addEventListener("click", function() {
|
||||
// createNewDiv(lantaiLainnyaDiv, "lantai_lainnya");
|
||||
// });
|
||||
|
||||
function setupInputHandlers(containerId, buttonId, labelText, inputDataClass, buttonDeleteClass) {
|
||||
const addButton = document.getElementById(buttonId);
|
||||
@@ -190,8 +187,8 @@
|
||||
|
||||
setupInputHandlers('inputContainerRute', 'btnRute', 'Foto Rute Menuju Lokasi', 'file-input',
|
||||
'delete-btn');
|
||||
// setupInputHandlers('inputContainerLantai', 'btnLantai', 'Foto Lantai', 'file-input',
|
||||
// 'delete-btn');
|
||||
setupInputHandlers('inputContainerLantai', 'btnLantai', 'Foto Lantai', 'file-input',
|
||||
'delete-btn');
|
||||
setupInputHandlers('inputContainerLingkungan', 'btnLingkungan', 'Lingkungan', 'file-input',
|
||||
'delete-btn');
|
||||
|
||||
|
||||
@@ -502,6 +502,9 @@ Route::middleware(['auth'])->group(function () {
|
||||
'type',
|
||||
'pelaporan',
|
||||
);
|
||||
|
||||
Route::get('view-laporan', [PenilaianController::class, 'view_laporan'])->name('view-laporan');
|
||||
|
||||
Route::get('pembayaran', [PenilaianController::class, 'otorisator'])->name('pembayaran.index')->defaults(
|
||||
'type',
|
||||
'pembayaran',
|
||||
|
||||
Reference in New Issue
Block a user