$(document).ready(function() {
  var token = $('body').data('token');

  $('.js-btn-filter').on('click', function() {
    url = 'index.php?route=report/product_viewed/filter&token=' + token;

    var filter_name = $("input[name='filter_name']").attr('value');
    if (filter_name) {
      url += '&filter_name=' + encodeURIComponent(filter_name);
    }

    var filter_model = $("input[name='filter_model']").attr('value');
    if (filter_model) {
      url += '&filter_model=' + encodeURIComponent(filter_model);
    }

    location = url;
  });
});
