first commit

This commit is contained in:
dev-chiefworks
2022-05-31 16:21:53 -04:00
commit f76abffdcd
5978 changed files with 1078901 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
window.addEventListener('load', function() {
var countryEl = $('#country-code');
var cityEl = $('#city-id');
var countryVal = countryEl.val();
if (countryVal == '') {
cityEl.html('<option value="">Select</option>');
cityEl.prop('disabled', true);
} else {
cityEl.prop('disabled', false);
}
getCityFromCountryCodeAjax(countryVal, cityEl);
countryEl.on('change', function() {
var countryCode = $(this).val();
if (countryCode == '') {
cityEl.prop('disabled', true);
} else {
cityEl.prop('disabled', false);
}
getCityFromCountryCodeAjax(countryCode, cityEl);
})
///////// FUNCTION //////////////////
function getCityFromCountryCodeAjax(countryCode, cityEl) {
$.ajax({
type: "GET",
url: "/geofence_area/getCityListDependOnCountryCodeAjax",
data: {
'country_code' : countryCode
},
cache: false,
success: function(res) {
res = JSON.parse(res);
if (res.success) {
var options = '<option value="">Select</option>';
var cityOldVal = cityEl.val();
var selected = '';
res.data.forEach(function(item, index) {
if (cityOldVal == item.id) {
selected = 'selected';
} else {
selected = '';
}
options += '<option ' + selected + ' value="' + item.id + '"' + '' + '>' + item.city + '</option>'
});
cityEl.html(options);
}
}
});
}
});
+18
View File
@@ -0,0 +1,18 @@
window.addEventListener('load', function() {
$('.btn-remove').on('click', function(e) {
e.preventDefault();
const itemId = $(this).data('id');
const areaName = $(this).data('area-name');
$modal = $('#remove-geofence-area-modal');
$modal.find('h4.modal-title').text(`Removing area: ${areaName}`);
$modal.find('#removeBtn').data('id', itemId);
});
$('#removeBtn').on('click', function(e) {
e.preventDefault();
const itemId = $(this).data('id');
window.__api__.remove(`/geofence_area/${itemId}/delete`, itemId);
})
});