jQuery(document).ready(function($){
	$('#generate-pins').click(function(){
	    $.confirm({
	    	theme: 'supervan',
	        title: 'How Many Pins?',
	        content: '' +
	        '<form action="contents/plugins/eedu_portal/ajax.php" id="comment">' +
	        '<div class="form-group">' +
	        '<label>Please add a comment</label>' +
	        '<input type="number" placeholder="" class="count form-control" required >' +
	        '</div>' +
	        '</form>',
	        buttons: {
	            formSubmit: {
	                text: 'Submit',
	                btnClass: 'btn-blue',
	                action: function () {
	                    var count = this.$content.find('.count').val();
	                    if(!count){
	                        $.alert('Please let us know how many pins you would like to generate!');
	                        return false;
	                    }
	                    window.location = $('#generate-pins').data('url') + '&count=' + count;
	                }
	            },
	            cancel: function () {
	                //close
	            },
	        },
	        onContentReady: function () {
	            // bind to events
	            var jc = this;
	            this.$content.find('form').on('submit', function (e) {
	                // if the user submits the form by pressing enter in the field.
	                e.preventDefault();
	                jc.$$formSubmit.trigger('click'); // reference the button and click it
	            });
	        }
	    });
	})
})