(function( $ ) {
	$(document).ready(function(){
			
		$('.password-hidden').click(function () {
			let input_field = $(this).parent().children('input');
			if ($(input_field).attr('type') == 'text') {
				$(input_field).attr('type', 'password');
			} else {
				$(input_field).attr('type', 'text');
			}
		});

		 if (ffld.modal_enable ==0) {
			$('.enable-modal').addClass('hidden-el');
			$('.checkout-hooks').removeClass('hidden-el');
		}else{
			$('.enable-modal').removeClass('hidden-el');
			$('.checkout-hooks').addClass('hidden-el');
		} 
		if (ffld.shortcode_enable ==0) {
			$('.shortcodes').addClass('hidden-el');
			$('.checkout-hooks').removeClass('hidden-el');
		}else{
			$('.shortcodes').removeClass('hidden-el');
			$('.enable-shortcode').addClass('hidden-el');
		}
		
		if (ffld.google_map_enable ==0) {
			$('.google-map-enable').addClass('hidden-el');
		}else{
			$('.google-map-enable').removeClass('hidden-el');
		} 
		$('#locator_modal_enable').click(function() {
			 if ($('#locator_modal_enable').is(':checked')) {
				$('.enable-modal').removeClass('hidden-el');
				$('.checkout-hooks').addClass('hidden-el');
			 }else{
				 $('.enable-modal').addClass('hidden-el');
				$('.checkout-hooks').removeClass('hidden-el');
			 }
		});
		$('#locator_shortcode_enable').click(function() {
			 if ($('#locator_shortcode_enable').is(':checked')) {
				$('.shortcodes').removeClass('hidden-el');
				$('.checkout-hooks').addClass('hidden-el');
			 }else{ 
				$('.shortcodes').addClass('hidden-el');
				$('.checkout-hooks').removeClass('hidden-el');
			 } 
		});
		$('#ffl_dealer_google_map_enable').click(function() {
			 if ($('#ffl_dealer_google_map_enable').is(':checked')) {
				$('.google-map-enable').removeClass('hidden-el');
			 }else{
				$('.google-map-enable').addClass('hidden-el');
			 } 
		});
		 
		$('#upload_locatior_icon').click(function(e) {
			e.preventDefault();
			var image = wp.media({ 
				title: 'Upload Icon',
				// mutiple: true if you want to upload multiple files at once
				multiple: false
			}).open().on('select', function(e){
				// This will return the selected image from the Media Uploader, the result is an object
				var uploaded_image = image.state().get('selection').first();
				// We convert uploaded_image to a JSON object to make accessing it easier
				// Output to the console uploaded_image
				var image_url = uploaded_image.toJSON().url;
				// Let's assign the url value to the input field
				$('#ffl_dealers_locator_icon').val(image_url);
			});
		});

		$("#map_display_by_product_category").select2({
			multiple: true,
			placeholder: "select",
			allowClear: true
		});
		if ($('.colorpicker').length > 0) {
			$(".colorpicker").spectrum({
			flat: false,
			showInput: true,
			showButtons: true,
			preferredFormat: "hex"
			});
		}
	});
})( jQuery );
function initFFLMap() {

    var autocompleteSettingsFields = document.getElementsByClassName('google-autocomplete-field');
    for (var i = 0; i < autocompleteSettingsFields.length; i++) {
        var settingsField = autocompleteSettingsFields[i];
        var autocomplete = new google.maps.places.Autocomplete(settingsField);
        google.maps.event.addListener(autocomplete, 'place_changed', function () {
            jQuery(settingsField).css('border', '1px solid #1dc156');
            var addressValue = jQuery(settingsField).val();
            //$(settingsField).siblings('.quote_rides-hidden-autocomplete-field').val(addressValue);
        });
    }
}