update foto jaminan dan laporan preview
This commit is contained in:
@@ -18,6 +18,7 @@ use Modules\Location\Models\City;
|
|||||||
use Modules\Location\Models\District;
|
use Modules\Location\Models\District;
|
||||||
use Modules\Location\Models\Village;
|
use Modules\Location\Models\Village;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
use App\Helpers\Lpj;
|
use App\Helpers\Lpj;
|
||||||
|
|
||||||
class PenilaiController extends Controller
|
class PenilaiController extends Controller
|
||||||
@@ -661,7 +662,8 @@ class PenilaiController extends Controller
|
|||||||
'alamat',
|
'alamat',
|
||||||
'dataPembanding',
|
'dataPembanding',
|
||||||
'nomorLaporan'
|
'nomorLaporan'
|
||||||
));
|
))->render();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
|
$pdf = PDF::loadView('lpj::' . $viewLaporan, compact(
|
||||||
'permohonan',
|
'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: {
|
due_date: {
|
||||||
title: 'Due Date',
|
title: 'Due Date',
|
||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
const mulai = new Date(data.permohonan.created_at);
|
const jenis_asset = data.permohonan.debiture.documents.map(d => d.jenis_jaminan.name );
|
||||||
const selesai = new Date(data.tanggal_kunjungan)
|
|
||||||
return `${mulai.getDate()}-${mulai.getMonth() + 1}-${mulai.getFullYear()} - ${selesai.getDate()}-${selesai.getMonth() + 1}-${selesai.getFullYear()}`
|
return `${calculateDateSLA(jenis_asset, data.tanggal_kunjungan)}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -254,6 +254,12 @@
|
|||||||
const year = String(date.getFullYear()).slice(-2);
|
const year = String(date.getFullYear()).slice(-2);
|
||||||
return `${day}-${month}-${year}`;
|
return `${day}-${month}-${year}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function calculateDateSLA($jenis, $date){
|
||||||
|
let date = new Date($date);
|
||||||
|
return $jenis, $date;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@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')
|
@if ($dataHeader == 'pelaporan')
|
||||||
<a class="btn btn-success"
|
<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
|
Lihat Laporan
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -806,11 +806,11 @@
|
|||||||
icon: 'success',
|
icon: 'success',
|
||||||
confirmButtonText: 'OK'
|
confirmButtonText: 'OK'
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
// if (response.isConfirmed) {
|
if (response.isConfirmed) {
|
||||||
// window.location.href =
|
window.location.href =
|
||||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}';
|
||||||
// }
|
}
|
||||||
console.log(response);
|
// console.log(response);
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
const ruteLainnyaDiv = document.getElementById("ruteLainnya");
|
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 to add delete event listeners to existing buttons
|
||||||
function addDeleteListeners(container) {
|
function addDeleteListeners(container) {
|
||||||
container.querySelectorAll(".delete-button").forEach(button => {
|
container.querySelectorAll(".delete-btn").forEach(button => {
|
||||||
button.addEventListener("click", function() {
|
button.addEventListener("click", function() {
|
||||||
this.closest(
|
this.closest(
|
||||||
".flex.items-baseline.flex-wrap.lg\\:flex-nowrap.gap-2\\.5.mb-5"
|
".flex.items-baseline.flex-wrap.lg\\:flex-nowrap.gap-2\\.5.mb-5"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
// Add delete listeners to existing buttons
|
// Add delete listeners to existing buttons
|
||||||
addDeleteListeners(ruteLainnyaDiv);
|
addDeleteListeners(ruteLainnyaDiv);
|
||||||
addDeleteListeners(lantaiLainnyaDiv);
|
// addDeleteListeners(lantaiLainnyaDiv);
|
||||||
|
|
||||||
function createNewDiv(container, inputName) {
|
function createNewDiv(container, inputName) {
|
||||||
const newDiv = document.createElement("div");
|
const newDiv = document.createElement("div");
|
||||||
@@ -49,12 +49,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</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>
|
<i class="ki-filled ki-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;x
|
||||||
container.appendChild(newDiv);
|
container.appendChild(newDiv);
|
||||||
addDeleteListeners(container);
|
addDeleteListeners(container);
|
||||||
}
|
}
|
||||||
@@ -63,12 +63,9 @@
|
|||||||
createNewDiv(ruteLainnyaDiv, "rute_lainnya");
|
createNewDiv(ruteLainnyaDiv, "rute_lainnya");
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("btnAddMoreObject").addEventListener("click", function() {
|
// document.getElementById("btnAddMoreObject").addEventListener("click", function() {
|
||||||
createNewDiv(lantaiLainnyaDiv, "lantai_lainnya");
|
// createNewDiv(lantaiLainnyaDiv, "lantai_lainnya");
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function setupInputHandlers(containerId, buttonId, labelText, inputDataClass, buttonDeleteClass) {
|
function setupInputHandlers(containerId, buttonId, labelText, inputDataClass, buttonDeleteClass) {
|
||||||
const addButton = document.getElementById(buttonId);
|
const addButton = document.getElementById(buttonId);
|
||||||
@@ -190,8 +187,8 @@
|
|||||||
|
|
||||||
setupInputHandlers('inputContainerRute', 'btnRute', 'Foto Rute Menuju Lokasi', 'file-input',
|
setupInputHandlers('inputContainerRute', 'btnRute', 'Foto Rute Menuju Lokasi', 'file-input',
|
||||||
'delete-btn');
|
'delete-btn');
|
||||||
// setupInputHandlers('inputContainerLantai', 'btnLantai', 'Foto Lantai', 'file-input',
|
setupInputHandlers('inputContainerLantai', 'btnLantai', 'Foto Lantai', 'file-input',
|
||||||
// 'delete-btn');
|
'delete-btn');
|
||||||
setupInputHandlers('inputContainerLingkungan', 'btnLingkungan', 'Lingkungan', 'file-input',
|
setupInputHandlers('inputContainerLingkungan', 'btnLingkungan', 'Lingkungan', 'file-input',
|
||||||
'delete-btn');
|
'delete-btn');
|
||||||
|
|
||||||
|
|||||||
@@ -502,6 +502,9 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
'type',
|
'type',
|
||||||
'pelaporan',
|
'pelaporan',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Route::get('view-laporan', [PenilaianController::class, 'view_laporan'])->name('view-laporan');
|
||||||
|
|
||||||
Route::get('pembayaran', [PenilaianController::class, 'otorisator'])->name('pembayaran.index')->defaults(
|
Route::get('pembayaran', [PenilaianController::class, 'otorisator'])->name('pembayaran.index')->defaults(
|
||||||
'type',
|
'type',
|
||||||
'pembayaran',
|
'pembayaran',
|
||||||
|
|||||||
Reference in New Issue
Block a user