// Load RETS classes dynamically
function esLoadClassesField($resourceField, classesFieldClass, callback) {
var value = $resourceField.val();
if (value && $depEl.length) {
$.get(ajaxurl, {
action: 'esh_load_classes',
resource: value
}, function(response) {
$depEl.html('').removeProp('disabled');
for (var i in response) {
$depEl.append('');
}
}, 'json');
}
}
// Progress tracking for imports
function startRetsImportProgress(data) {
$.post(ajaxurl, data, function(response) {
if (typeof response.progress != 'undefined') {
$progressContainer.show().percent(response.progress);
}
if (response.progress < 100) {
startRetsImportProgress(response);
}
}, 'json');
}
$('.js-es-select2-filter').select2({
tags: true,
multiple: true
});
$progressContainer.Progress({
width: $progressContainer.parent().width(),
height: 31,
percent: 0,
backgroundColor: '#d1d1d1',
barColor: '#82C728'
});
RETS profile configuration with credential management
// RETS profile switching
$('.es-resource__field').on('change', function() {
esLoadClassesField($(this), '.es-classes__field', function($el) {
var resource = $el.find('option:selected').val();
esLoadFilterFields(resource, className, entity, $container);
});
});
Dynamic RETS field to WordPress field mapping
// Sortable field management
function initSortableFields($list) {
$list.sortable();
}
// Field form submission
$fieldsList.on('change', '.js-field-form input, .js-field-form select', function() {
var $form = $(this).closest('form');
$.post(ajaxurl, $form.serialize(), function(response) {
if (response) {
$field.replaceWith(response);
}
});
});
Real-time progress tracking with AJAX updates
// Import form submission
$(document).on('submit', '#es-rets-import-form-inner', function() {
var $form = $(this);
if ($form.find('.check-column input:checked').length) {
$form.find('input[type=submit]').prop('disabled', 'disabled');
startRetsImportProgress($form.serialize());
}
return false;
});
// Tab navigation system
$('.nav-tab-wrapper .nav-tab-menu li a').click(function() {
var $wrapper = $(this).closest('.nav-tab-wrapper');
var tabContainer = $(this).attr('href');
if (tabContainer.length > 1) {
$wrapper.find('li').removeClass('active');
$(this).closest('li').addClass('active');
$wrapper.find('.es-tab').hide();
$(tabContainer).show();
if (history.pushState) {
history.pushState(null, null, tabContainer);
}
}
return false;
});
function initTooltips() {
var toolTipsterConfig = {
contentAsHTML: true,
theme: 'tooltipster-borderless',
side: ['right'],
debug: false,
interactive: true
};
$('.js-tooltipster-schedules').tooltipster(toolTipsterConfig)
.tooltipster('content', Esh.tr.schedulesDescription);
$('.js-tooltipster-limit').tooltipster(toolTipsterConfig)
.tooltipster('content', Esh.tr.limitDescription);
$('.js-tooltipster-non-stop').tooltipster(toolTipsterConfig)
.tooltipster('content', Esh.tr.nonStopDescription);
}
Tooltips provide detailed explanations for complex features like scheduling and field mapping
Visual feedback during import processes with detailed status messages
User-friendly error messages with actionable guidance