"use strict";
(function ($) {
    $.view_list_state = function (element, options) {
        let defaults = {
            row_state_template: ""
        };
        let plugin = this;
        plugin.settings = {}
        let $element = $(element);
        plugin.init = function () {
            plugin.settings = $.extend({}, defaults, options);
            $element.find('input[type="checkbox"]').iCheck({
                checkboxClass: 'icheckbox_square-red',
                radioClass: 'iradio_square-red',
                increaseArea: '20%'
            });
            $element.find('select#searchByVendor').select2();
            $element.find('select#searchByVendor').on('change', function () {
                let $form = $(this).closest('form[name="admin-form"]');
                $form.submit();
            });
        }
        plugin.example_function = function () {
        }
        plugin.init();
    }
    $.fn.view_list_state = function (options) {
        return this.each(function () {
            if (undefined == $(this).data('view_list_state')) {
                let plugin = new $.view_list_state(this, options);
                $(this).data('view_list_state'
                    , plugin);
            }
        });
    }
})(jQuery);
