<?php
/**
 * Copyright © 2016 maijindou.com All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>

<div class="reports-content">
    <?php echo $block->getChildHtml('grid.filter.form') ?>
</div>

<?php echo $block->getGridHtml() ?>

<script>
require([
    'jquery',
    'mage/backend/validation',
    "prototype"
], function(jQuery){

//<![CDATA[
    jQuery('#filter_form').mage('validation', {errorClass: 'mage-error'});
    function filterFormSubmit() {
        var filters = $$('#filter_form input', '#filter_form select');
        var elements = [];
        for(var i in filters){
            if(filters[i].value && filters[i].value.length && !filters[i].disabled) elements.push(filters[i]);
        }
        if (jQuery('#filter_form').valid()) {
            setLocation('<?php /* @escapeNotVerified */ echo $block->getFilterUrl(); ?>filter/'+Base64.encode(Form.serializeElements(elements))+'/');
        }
    }
//]]>
    window.filterFormSubmit = filterFormSubmit;
});
</script>
