{"size": 1529, "ext": "js", "max_stars_repo_path": "modules/purrweb/components/design/resources/js/views/layout/addSelectOption/AddSelectOption.js", "max_stars_repo_name": "Art3mk4/purrweb", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "modules/purrweb/components/design/resources/js/views/layout/addSelectOption/AddSelectOption.js", "max_issues_repo_name": "Art3mk4/purrweb", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "modules/purrweb/components/design/resources/js/views/layout/addSelectOption/AddSelectOption.js", "max_forks_repo_name": "Art3mk4/purrweb", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.8541666667, "max_line_length": 92, "alphanum_fraction": 0.458469588}
jQuery(document).ready(function() {
    var AddSelectOption = function() {
        var $addOptiomBtn = jQuery('.m-addOptionBtn'),
            $confirmAddOptionBtn = jQuery('.confirmAddOptionBtn'),
            that = this;

        this.init = function() {
            $addOptiomBtn.tooltip();
            bindEvents();  
        };
        var bindEvents = function() {
            $addOptiomBtn.on('click', showPopup);
            $confirmAddOptionBtn.on('click', confirmAddOption);

        };
        var confirmAddOption = function(e) {
            e.preventDefault();
            
            var inputVal = $(this).parents('.addOptionPopup').find('.f-fieldSetText').val();
                url = $(this).data('url');
            if (inputVal == "") {
                alert("Введите значение");
            } else {
                appRequest.send(url, 'POST', {addSelect: inputVal}, {
                    success: function() {
                        hideAllPopup();
                        location.reload();
                    },
                });
            }   
            
        };
        var showPopup = function(e) {
            e.preventDefault();
            var popup = $(this).parent().find('.addOptionPopup');

            $('body').addClass('m-overlay');
            popup.show();
        };
        var hideAllPopup = function() {
            $('body').removeClass('m-overlay');
            $('.popup').hide();
        }
        this.init();
    };

    var addSelectOption = new AddSelectOption();
});