"use strict";
(function ($) {
    $.view_list_tourlocator = function (element, options) {
        let defaults = {
            row_state_template: "",
            data_input:[],
            page_list_service:'',
            list_service:[],
            url_plugin:'',
        };
        let plugin = this;
        plugin.settings = {}
        let $element = $(element);
        plugin.init = function () {
            plugin.settings = $.extend({}, defaults, options);
            let url_plugin = plugin.settings.url_plugin;
            $element.find('#bh-sl-map-container').storeLocator({
                'querystringParams' : true,
                'fullMapStart': true,
                // The following paths are set because this example is in a subdirectory
                'dataLocation': `${wpbookingpro_root_url}${wpbookingpro_api_task}/?task=tours.ajax_get_list_tour`,
                'infowindowTemplatePath': `${wpbookingpro_root_url}/wp-content/plugins/${url_plugin}/frontend/resources/store_locator/assets/js/plugins/storeLocator/templates/infowindow-description.html`,
                'listTemplatePath': `${wpbookingpro_root_url}/wp-content/plugins/${url_plugin}/frontend/resources/store_locator/assets/js/plugins/storeLocator/templates/location-list-description.html`
            });

        };

        plugin.example_function = function () {
        }
        plugin.init();
    }
    $.fn.view_list_tourlocator = function (options) {
        return this.each(function () {
            if (undefined == $(this).data('view_list_tourlocator')) {
                let plugin = new $.view_list_tourlocator(this, options);
                $(this).data('view_list_tourlocator', plugin);
            }
        });
    }
})(jQuery);
