"use strict";
(function ($) {
    $.field_servicecategory = function (element, options) {
        var defaults = {
            field_name: ""
        }
        var plugin = this;
        plugin.settings = {}
        var $element = $(element),
            element = element;
        plugin.init = function () {
            plugin.settings = $.extend({}, defaults, options);
            $element.find('select.list-servicecategory').select2();
        };
        plugin.getValue = function () {
            let field_name = plugin.settings.field_name;
            return $element.find(`select[name="${field_name}"]`).val();
        };
        plugin.example_function = function () {
        };
        plugin.init();
    }

    $.fn.field_servicecategory = function (options) {

        return this.each(function () {

            if (undefined == $(this).data('field_servicecategory')) {
                var plugin = new $.field_servicecategory(this, options);
                $(this).data('field_servicecategory', plugin);
            }
        });
    }
})(jQuery);