Merge branch 'staging' into feature/senior-officer
This commit is contained in:
@@ -166,6 +166,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="imageModal" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
||||
<div class="bg-white p-4 rounded-lg max-w-3xl max-h-[100vh] overflow-auto">
|
||||
<img id="modalImage" src="" alt="Zoomed Image" class="max-w-full h-auto">
|
||||
<button id="closeModal" class="mt-4 px-4 py-2 bg-red-300 text-gray-800 rounded hover:bg-red-400" onclick="closeImageModal()">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@@ -183,6 +190,26 @@
|
||||
});
|
||||
}
|
||||
|
||||
function openImageModal(src) {
|
||||
const modal = document.getElementById('imageModal');
|
||||
const modalImage = document.getElementById('modalImage');
|
||||
modalImage.src = src;
|
||||
modal.classList.remove('hidden');
|
||||
modal.classList.add('flex');
|
||||
}
|
||||
|
||||
function closeImageModal() {
|
||||
const modal = document.getElementById('imageModal');
|
||||
modal.classList.remove('flex');
|
||||
modal.classList.add('hidden');
|
||||
}
|
||||
|
||||
function changeMainPhoto(thumbnail, index) {
|
||||
const mainPhoto = thumbnail.closest('.photo-gallery').querySelector('.main-photo img');
|
||||
mainPhoto.src = thumbnail.src;
|
||||
mainPhoto.alt = thumbnail.alt;
|
||||
}
|
||||
|
||||
function updateMapMarkers(data) {
|
||||
// Clear existing markers
|
||||
markers.forEach(marker => marker.setMap(null));
|
||||
@@ -218,7 +245,7 @@
|
||||
|
||||
// Create info window content
|
||||
const contentString = `
|
||||
<div id='content' style='width: 500px; max-width: 100%;'>
|
||||
<div id='content' style='width: 550px; max-width: 100%;'>
|
||||
<div id='siteNotice'></div>
|
||||
<h2 class='card-title mb-5'>
|
||||
${item.jenis_aset}
|
||||
@@ -320,6 +347,29 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
${item.photos && item.photos.length > 0 ? `
|
||||
<div class="photo-gallery mb-5">
|
||||
<div class="main-photo mb-2">
|
||||
<img src="storage/${item.photos[0]}" alt="${item.jenis_aset}"
|
||||
style="width: 100%; height: auto; object-fit: cover; cursor: pointer;"
|
||||
onclick="openImageModal(this.src)">
|
||||
</div>
|
||||
<div class="thumbnail-container flex gap-2 overflow-x-auto">
|
||||
${item.photos.map((photo, index) => `
|
||||
<img src="storage/${photo}" alt="${item.jenis_aset} ${index + 1}"
|
||||
class="thumbnail cursor-pointer"
|
||||
style="width: 60px; height: 60px; object-fit: cover;"
|
||||
onclick="changeMainPhoto(this, ${index})">
|
||||
`).join('')}
|
||||
</div>
|
||||
</div>
|
||||
` : ''}
|
||||
<div class="border-t border-gray-300 border-dashed"></div>
|
||||
<div class='flex justify-end mt-3'>
|
||||
<button onclick="getDirections(${lat}, ${lng})" class='btn btn-sm btn-primary'>
|
||||
Get Directions
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -354,6 +404,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getDirections(lat, lng) {
|
||||
console.log('Getting directions to:', lat, lng);
|
||||
if (navigator.geolocation) {
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
(position) => {
|
||||
const origin = position.coords.latitude + ',' + position.coords.longitude;
|
||||
const destination = lat + ',' + lng;
|
||||
const url = `https://www.google.com/maps/dir/?api=1&origin=${origin}&destination=${destination}`;
|
||||
window.open(url, '_blank');
|
||||
},
|
||||
() => {
|
||||
alert('Unable to get your current location. Please enable location services.');
|
||||
}
|
||||
);
|
||||
} else {
|
||||
alert('Geolocation is not supported by your browser.');
|
||||
}
|
||||
}
|
||||
|
||||
function initializeDataTable() {
|
||||
const element = document.querySelector('#bank-data-table');
|
||||
const searchInput = document.getElementById('search');
|
||||
@@ -422,6 +492,7 @@
|
||||
dataTable.on('draw', () => {
|
||||
const data = dataTable._data;
|
||||
updateMapMarkers(data);
|
||||
updatePagination(data);
|
||||
})
|
||||
// Custom search functionality
|
||||
searchInput.addEventListener('input', function () {
|
||||
@@ -445,6 +516,20 @@
|
||||
dataTable.reload();
|
||||
});
|
||||
|
||||
function updatePagination(response) {
|
||||
const paginationInfo = document.querySelector('[data-datatable-info="true"]');
|
||||
|
||||
if (paginationInfo) {
|
||||
if (response.recordsFiltered > 0) {
|
||||
const start = (response.page - 1) * response.pageSize + 1;
|
||||
const end = Math.min(start + response.pageSize - 1, response.recordsFiltered);
|
||||
paginationInfo.textContent = `Showing ${start} to ${end} of ${response.recordsFiltered} entries`;
|
||||
} else {
|
||||
paginationInfo.textContent = 'No entries to show';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initializeEverything() {
|
||||
initMap();
|
||||
initializeDataTable();
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
href="{{ route('otorisator.view-laporan') }}?permohonanId={{ $permohonan->id }}&documentId={{ $documentId }}&jaminanId={{ $jenisJaminanId }}&statusLpj={{ true }}">
|
||||
Lihat Laporan
|
||||
</a>
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'senior-officer']) && $permohonan->approval_so == null)
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'senior-officer']) && $permohonan->approval_so == 0)
|
||||
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisator {{ $header ?? '' }}
|
||||
@@ -171,7 +171,7 @@
|
||||
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'EO Appraisal']) &&
|
||||
$permohonan->approval_so &&
|
||||
$permohonan->approval_eo == null &&
|
||||
$permohonan->approval_eo == 0 &&
|
||||
in_array($permohonan->nilai_plafond_id, [1, 2]))
|
||||
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
@@ -181,7 +181,7 @@
|
||||
|
||||
@if (Auth::user()->hasAnyRole(['administrator', 'DD Appraisal']) &&
|
||||
$permohonan->approval_eo &&
|
||||
$permohonan->approval_dd == null &&
|
||||
$permohonan->approval_dd == 0 &&
|
||||
in_array($permohonan->nilai_plafond_id, [1, 2, 4]))
|
||||
<button onclick="otorisatorData({{ $permohonan->id }})" type="button" class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
|
||||
Reference in New Issue
Block a user