"use strict";
(function ($) {
    $.field_radius = function (element, options) {
        var defaults = {
            input_name: ""
        }
        var plugin = this;
        plugin.settings = {}
        var $element = $(element), 
            element = element;
        plugin.init = function () {
            plugin.settings = $.extend({}, defaults, options);
            let $radiusNumeric = $element.find('input[type="text"].radius');
            let $radius = $element.find(`input[name="${plugin.settings.input_name}"]`);
            $radiusNumeric.autoNumeric('init', {
                mDec: '0'
            });
            $radiusNumeric.on('keyup', function () {
                $radius.val($radiusNumeric.autoNumeric('get'));
            })
        }
        plugin.example_function = function () {
        };
        plugin.init();
    }
    
    $.fn.field_radius = function (options) {
        
        return this.each(function () {
            
            if (undefined == $(this).data('field_radius')) {
                var plugin = new $.field_radius(this, options);
                $(this).data('field_radius', plugin);
            }
        });
    }
})(jQuery);
