⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
dalily.dev-unit.com
/
public
/
assets
/
js
/
app
/
View File Name :
d.modal.location.js
/* * LaraClassifier - Classified Ads Web Application * Copyright (c) BeDigit. All Rights Reserved * * Website: https://laraclassifier.com * Author: Mayeul Akpovi (BeDigit - https://bedigit.com) * * LICENSE * ------- * This software is provided under a license agreement and may only be used or copied * in accordance with its terms, including the inclusion of the above copyright notice. * As this software is sold exclusively on CodeCanyon, * please review the full license details here: https://codecanyon.net/licenses/standard */ onDocumentReady((event) => { /* Handle the locations modal */ let locationsModal = null; let browseLocationsEl = document.getElementById('browseLocations'); if (isDefined(browseLocationsEl) && browseLocationsEl != null) { locationsModal = new bootstrap.Modal(browseLocationsEl, {}); } /* When trying to open the city select box, open the locations modal */ $(document).on('select2:opening', '#cityId', function (e) { e.preventDefault(); $('#modalTriggerName').val('select'); if (locationsModal != null) { locationsModal.show(this); /* The browseLocations() function will be fired */ } return false; }); /* Retrieve selected city and its admin. division */ selectCity(); /* When clicking on a city link, add the city in the select box option and select it (without fire the HTML link) */ $(document).on('click', '#browseLocations .is-city', function (e) { let modalTriggerName = $('#modalTriggerName').val(); if (modalTriggerName === 'select') { e.preventDefault(); selectCity(this); if (locationsModal != null) { locationsModal.hide(); } return false; } }); }); /** * Click on a city link to select it (to add it in the city's select box) * * @param jsThis * @returns {boolean} */ function selectCity(jsThis = null) { /* Check required variables */ if (typeof languageCode === 'undefined' || typeof countryCode === 'undefined') { return false; } /* Location's modal fields */ let adminTypeEl = $('#modalAdminType'); let adminCodeEl = $('#modalAdminCode'); /* Main form fields */ let selectedAdminTypeEl = $('#selectedAdminType'); let selectedAdminCodeEl = $('#selectedAdminCode'); let selectedCityIdEl = $('#selectedCityId'); let selectedCityNameEl = $('#selectedCityName'); let cityIdEl = $('#cityId'); if ( !isDefined(adminTypeEl) || !isDefined(adminCodeEl) || !isDefined(selectedAdminTypeEl) || !isDefined(selectedAdminCodeEl) || !isDefined(selectedCityIdEl) || !isDefined(selectedCityNameEl) || !isDefined(cityIdEl) ) { return false; } let adminType, adminCode, cityId, cityName; if (isDefined(jsThis) && jsThis !== null) { let thisEl = $(jsThis); adminType = thisEl.data('adminType'); adminCode = thisEl.data('adminCode'); cityId = thisEl.data('id'); cityName = thisEl.data('name'); if (!isEmpty(cityId) && !isEmpty(cityName)) { cityIdEl.empty().append('<option value="' + cityId + '">' + cityName + '</option>').val(cityId).trigger('change'); adminTypeEl.val(adminType); adminCodeEl.val(adminCode); selectedAdminTypeEl.val(adminType); selectedAdminCodeEl.val(adminCode) selectedCityIdEl.val(cityId); selectedCityNameEl.val(cityName); /* Update the modal form */ if (!isEmpty(adminType) && !isEmpty(adminCode)) { let urlEl = $('#modalUrl'); if (isDefined(urlEl)) { let url = `${siteUrl}/browsing/locations/${strToLower(countryCode)}/admins/${adminType}/${adminCode}/cities`; urlEl.val(url); } } let queryEl = $('#modalQuery'); if (isDefined(queryEl)) { queryEl.val(''); } } else { let error = 'Error: Impossible to select the city.'; jsAlert(error, 'error', false, true); } } else { adminTypeEl.val(selectedAdminTypeEl.val()); adminCodeEl.val(selectedAdminCodeEl.val()); cityId = selectedCityIdEl.val(); cityName = selectedCityNameEl.val(); if (!isEmpty(cityId) && !isEmpty(cityName)) { cityIdEl.empty().append('<option value="' + cityId + '">' + cityName + '</option>').val(cityId).trigger('change'); } } }