🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:main.js
$(document).ready(function() { AOS.init({ duration: 800, offset: 100, once: true }); $('.navbar-nav .nav-link').on('click', function() { if ($(window).width() < 992) { $('.navbar-collapse').collapse('hide'); } }); $(window).on('scroll', function() { if ($(this).scrollTop() > 100) { $('.navbar-premium').addClass('scrolled'); } else { $('.navbar-premium').removeClass('scrolled'); } }); var $grid = $('.masonry-grid').masonry ? $('.masonry-grid').masonry({ itemSelector: '.gallery-item', columnWidth: '.gallery-item', percentPosition: true }) : null; $('.gallery-filter .btn').on('click', function() { var filter = $(this).data('filter'); $('.gallery-filter .btn').removeClass('active'); $(this).addClass('active'); if (filter === 'all') { $('.gallery-item').show(); } else { $('.gallery-item').hide(); $('.gallery-item[data-category="' + filter + '"]').show(); } if ($grid) $grid.masonry('layout'); }); $('.gallery-item').on('click', function() { var img = $(this).find('img').attr('src'); $('#lightboxImage').attr('src', img); $('.lightbox').addClass('active'); }); $('.lightbox .close, .lightbox').on('click', function(e) { if (e.target !== e.currentTarget) return; $('.lightbox').removeClass('active'); }); $(document).on('keyup', function(e) { if (e.key === 'Escape') $('.lightbox').removeClass('active'); }); $('.category-select').on('change', function() { var catId = $(this).val(); if (catId) { $.ajax({ url: siteUrl + 'ajax/get_packages.php', type: 'POST', data: { category_id: catId }, dataType: 'json', success: function(data) { var select = $('.package-select'); select.html('<option value="">Select a Package</option>'); $.each(data, function(i, pkg) { select.append('<option value="' + pkg.id + '" data-price="' + pkg.price + '">' + pkg.name + ' - ' + currSymbol + ' ' + parseFloat(pkg.price).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + '</option>'); }); $('.package-section').show(); select.trigger('change'); } }); } else { $('.package-section').hide(); $('.package-select').html('<option value="">Select a Package</option>').trigger('change'); } }); function updatePriceSummary() { var packagePrice = parseFloat($('.package-select').find(':selected').data('price')) || 0; var distanceVal = parseFloat($('#distance').val()) || 0; var transportCostVal = parseFloat($('#transport_cost').val()) || 0; if (packagePrice > 0) { var totalPrice = packagePrice + transportCostVal; var advancePct = parseFloat(window.advancePercentage) || 50; var advanceVal = totalPrice * (advancePct / 100); var balanceVal = totalPrice - advanceVal; $('#summary-package-price').text(window.currencySymbol + ' ' + packagePrice.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })); $('#summary-distance').text(distanceVal.toFixed(2)); $('#summary-transport-cost').text(window.currencySymbol + ' ' + transportCostVal.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })); $('#summary-total-price').text(window.currencySymbol + ' ' + totalPrice.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })); $('#summary-advance-amount').text(window.currencySymbol + ' ' + advanceVal.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })); $('#summary-balance-amount').text(window.currencySymbol + ' ' + balanceVal.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })); $('.booking-summary-card').slideDown(); } else { $('.booking-summary-card').slideUp(); } } $('.package-select').on('change', function() { updatePriceSummary(); }); if ($('#location-map').length > 0) { var officeLat = window.officeLocation.lat; var officeLng = window.officeLocation.lng; var costPerKm = window.transportCostPerKm; var map = L.map('location-map').setView([officeLat, officeLng], 12); L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }).addTo(map); var officeIcon = L.icon({ iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png', shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41] }); L.marker([officeLat, officeLng], { icon: officeIcon }) .addTo(map) .bindPopup("<b>Our Office</b><br>Start location for transport.") .openPopup(); var eventMarker = L.marker([officeLat, officeLng], { draggable: true }).addTo(map); eventMarker.bindPopup("<b>Event Location</b><br>Drag me to your venue!").openPopup(); var routeLine = null; function getHaversineDistance(lat1, lon1, lat2, lon2) { var R = 6371; // Radius of earth in km var dLat = (lat2 - lat1) * Math.PI / 180; var dLon = (lon2 - lon1) * Math.PI / 180; var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon/2) * Math.sin(dLon/2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); return R * c; } function updateRouteAndCost() { var pos = eventMarker.getLatLng(); $('#latitude').val(pos.lat.toFixed(8)); $('#longitude').val(pos.lng.toFixed(8)); var osrmUrl = 'https://router.project-osrm.org/route/v1/driving/' + pos.lng + ',' + pos.lat + ';' + officeLng + ',' + officeLat + '?overview=full&geometries=geojson'; $.ajax({ url: osrmUrl, method: 'GET', dataType: 'json', success: function(response) { var distanceKm = 0; if (response && response.routes && response.routes.length > 0) { distanceKm = response.routes[0].distance / 1000; if (routeLine) { map.removeLayer(routeLine); } var coordinates = response.routes[0].geometry.coordinates.map(function(coord) { return [coord[1], coord[0]]; }); routeLine = L.polyline(coordinates, { color: '#FF7A00', weight: 4, opacity: 0.8 }).addTo(map); } else { distanceKm = getHaversineDistance(officeLat, officeLng, pos.lat, pos.lng); drawSimpleLine(pos); } finalizePricing(distanceKm); }, error: function() { var distanceKm = getHaversineDistance(officeLat, officeLng, pos.lat, pos.lng); drawSimpleLine(pos); finalizePricing(distanceKm); } }); } function drawSimpleLine(pos) { if (routeLine) { map.removeLayer(routeLine); } routeLine = L.polyline([[officeLat, officeLng], [pos.lat, pos.lng]], { color: '#FF7A00', weight: 3, dashArray: '5, 10' }).addTo(map); } function finalizePricing(distanceKm) { distanceKm = parseFloat(distanceKm.toFixed(2)); $('#distance').val(distanceKm); var transCost = distanceKm * costPerKm; $('#transport_cost').val(transCost.toFixed(2)); updatePriceSummary(); } eventMarker.on('dragend', function() { updateRouteAndCost(); }); map.on('click', function(e) { eventMarker.setLatLng(e.latlng); updateRouteAndCost(); }); $('#btn-get-location').on('click', function() { var btn = $(this); btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm me-1"></span> Locating...'); if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( function(position) { var clientLat = position.coords.latitude; var clientLng = position.coords.longitude; var latlng = L.latLng(clientLat, clientLng); eventMarker.setLatLng(latlng); map.setView(latlng, 14); updateRouteAndCost(); btn.prop('disabled', false).html('<i class="bi bi-geo-alt-fill me-1"></i>Use My Current Location'); }, function(error) { Swal.fire({ icon: 'error', title: 'Location Error', text: 'Could not fetch your current location. Please select it manually on the map.' }); btn.prop('disabled', false).html('<i class="bi bi-geo-alt-fill me-1"></i>Use My Current Location'); }, { enableHighAccuracy: true, timeout: 8000 } ); } else { Swal.fire({ icon: 'warning', title: 'Not Supported', text: 'Geolocation is not supported by your browser.' }); btn.prop('disabled', false).html('<i class="bi bi-geo-alt-fill me-1"></i>Use My Current Location'); } }); updateRouteAndCost(); } $('.booking-form').on('submit', function(e) { e.preventDefault(); var form = $(this); var btn = form.find('.btn-submit'); btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm"></span> Processing...'); $.ajax({ url: siteUrl + 'ajax/submit_booking.php', type: 'POST', data: new FormData(this), contentType: false, processData: false, dataType: 'json', success: function(res) { if (res.success) { Swal.fire({ icon: 'success', title: 'Booking Submitted!', text: res.message, showConfirmButton: true }).then(function() { window.location.href = siteUrl + 'customer/dashboard.php'; }); } else { Swal.fire({ icon: 'error', title: 'Error!', text: res.message }); btn.prop('disabled', false).html('Submit Booking'); } }, error: function() { Swal.fire({ icon: 'error', title: 'Error!', text: 'Something went wrong. Please try again.' }); btn.prop('disabled', false).html('Submit Booking'); } }); }); $('.contact-form').on('submit', function(e) { e.preventDefault(); var form = $(this); var btn = form.find('.btn-submit'); btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm"></span> Sending...'); $.ajax({ url: siteUrl + 'ajax/contact_submit.php', type: 'POST', data: form.serialize(), dataType: 'json', success: function(res) { if (res.success) { Swal.fire({ icon: 'success', title: 'Message Sent!', text: res.message }); form[0].reset(); } else { Swal.fire({ icon: 'error', title: 'Error!', text: res.message }); } btn.prop('disabled', false).html('Send Message'); } }); }); $('.rental-inquiry-form').on('submit', function(e) { e.preventDefault(); var form = $(this); var btn = form.find('.btn-submit'); btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm"></span> Sending...'); $.ajax({ url: siteUrl + 'ajax/rental_inquiry.php', type: 'POST', data: form.serialize(), dataType: 'json', success: function(res) { if (res.success) { Swal.fire({ icon: 'success', title: 'Inquiry Sent!', text: res.message }); form[0].reset(); } else { Swal.fire({ icon: 'error', title: 'Error!', text: res.message }); } btn.prop('disabled', false).html('Send Inquiry'); } }); }); $('#loginForm').on('submit', function(e) { e.preventDefault(); var btn = $(this).find('.btn-login'); btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm"></span> Logging in...'); $.ajax({ url: siteUrl + 'ajax/login.php', type: 'POST', data: $(this).serialize(), dataType: 'json', success: function(res) { if (res.success) { window.location.href = res.redirect; } else { Swal.fire({ icon: 'error', title: 'Error!', text: res.message }); btn.prop('disabled', false).html('Login'); } } }); }); $('#registerForm').on('submit', function(e) { e.preventDefault(); var btn = $(this).find('.btn-register'); btn.prop('disabled', true).html('<span class="spinner-border spinner-border-sm"></span> Creating Account...'); $.ajax({ url: siteUrl + 'ajax/register.php', type: 'POST', data: $(this).serialize(), dataType: 'json', success: function(res) { if (res.success) { Swal.fire({ icon: 'success', title: 'Registration Successful!', text: res.message }).then(function() { window.location.href = siteUrl + 'customer/login.php'; }); } else { Swal.fire({ icon: 'error', title: 'Error!', text: res.message }); btn.prop('disabled', false).html('Create Account'); } } }); }); $('#checkAvailabilityBtn').on('click', function() { var date = $('#event_date').val(); if (!date) { Swal.fire({ icon: 'warning', title: 'Please select a date' }); return; } $.ajax({ url: siteUrl + 'ajax/check_availability.php', type: 'POST', data: { date: date }, dataType: 'json', success: function(res) { if (res.available) { Swal.fire({ icon: 'success', title: 'Date Available!', text: 'This date is available for booking.' }); } else { Swal.fire({ icon: 'error', title: 'Not Available', text: 'This date is not available. Please choose another date.' }); } } }); }); $('[data-bs-toggle="tooltip"]').tooltip(); $('[data-bs-toggle="popover"]').popover(); if (typeof bsCustomFileInput !== 'undefined' && bsCustomFileInput) { bsCustomFileInput.init(); } });
Save Changes
Cancel
Create New File
Create New Folder