/**
 * Pagination for VirtuHis Service Pages.
 * Refer to: theme/uikit_theme/assets/js/pages/pages_issues.min.js
 */

/**
 * Set pagination for table with the specified identifier
 * @param {type} idTable
 * @returns {undefined}
 */
function pagination_toolbar(idTable){
$(function () {
    if (Modernizr.touch) {
        var e = $('.focus-highlight');
        e.length && e.find('td, th').attr('tabindex', '1').on('touchstart', function () {
            $(this).focus()
        })
    }
    altair_issues.list_view()
}),
altair_issues = {
    list_view: function () {
        var e = $(idTable),
        t = {
            container: $('.ts_pager'),
            //output: '{startRow} - {endRow} / {filteredRows} ({totalRows})', possible variables: {page}, {totalPages}, {startRow}, {endRow} and {totalRows}
            output: '{page}/{totalPages}',
				//fixedHeight: !0,
            //removeRows: !1,
            cssGoto: '.ts_gotoPage'
        };
        e.tablesorter({
//			     theme: 'altair',
//            widthFixed: !0,
//            widgets: [
//                'zebra',
//                'filter'
//            ]          
        }).tablesorterPager(t).on('pagerComplete', function (e, t) {
            'undefined' != typeof selectizeObj && selectizeObj.data('selectize') && (selectizePage = selectizeObj[0].selectize, selectizePage.setValue($('select.ts_gotoPage option:selected').index() + 1, !1))
        });
        function i() {
            selectizeObj = $('select.ts_gotoPage').val($('select.ts_gotoPage option:selected').val()).after('<div class="selectize_fix"></div>').selectize({
                hideSelected: !0,
                onDropdownOpen: function (e) {
                    e.hide().velocity('slideDown', {
                        duration: 280,
                        easing: easing_swiftOut
                    })
                },
                onDropdownClose: function (e) {
                    e.show().velocity('slideUp', {
                        duration: 280,
                        easing: easing_swiftOut
                    }),
                    $('.uk-tooltip').hide()
                }
            })
        }
        i(),
        $('.pagesize.ts_selectize').after('<div class="selectize_fix"></div>').selectize({
            hideSelected: !0,
            onDropdownOpen: function (e) {
                e.hide().velocity('slideDown', {
                    duration: 280,
                    easing: easing_swiftOut
                })
            },
            onDropdownClose: function (e) {
                e.show().velocity('slideUp', {
                    duration: 280,
                    easing: easing_swiftOut
                }),
                $('.uk-tooltip').hide(),
                'undefined' != typeof selectizeObj && selectizeObj.data('selectize') && (selectizePage = selectizeObj[0].selectize, selectizePage.destroy(), $('.ts_gotoPage').next('.selectize_fix').remove(), setTimeout(function () {
                    i()
                }))
            }
        })
    }
};
}
