"use strict";
(function ($) {
    $.field_wordpress_user = function (element, options) {
        var defaults = {
            input_name: ""
        }
        var plugin = this;
        plugin.settings = {}
        var $element = $(element), 
            element = element;
        plugin.init = function () {
            $element.find('.open-source-user').select2();
            $element.find('.btn-date').on('click', function (e) {
                let input_name = plugin.settings.input_name;
                e.preventDefault();
                $.dateSelect.show({
                    element: `input[name="${input_name}"]`
                });
            });
        }
        plugin.example_function = function () {
        };
        plugin.init();
    }
    
    $.fn.field_wordpress_user = function (options) {
        
        return this.each(function () {
            
            if (undefined == $(this).data('field_wordpress_user')) {
                var plugin = new $.field_wordpress_user(this, options);
                $(this).data('field_wordpress_user', plugin);
            }
        });
    }
})(jQuery);
