Move Saxonite’s projects into a dedicated `Workspace` folder and align the solution with .NET 10 and the current Common workspace. Update encryption integration, test project structure and coverage, and repository guidance and upgrade notes. - Relocate application and library projects while retaining Git rename history. - Split tests into Admin, Online, and Shared projects; add representative behavioral and serialization tests. - Update Common integration, application version, and repository documentation. Application version: 1.3.0 Reviewed-on: #1 Co-authored-by: andy <andy@sarand.com>
90 lines
3.0 KiB
JavaScript
90 lines
3.0 KiB
JavaScript
/*
|
|
* Admin - Results paging.
|
|
*/
|
|
|
|
(function (win, doc, undef)
|
|
{
|
|
"use strict";
|
|
let rp = sax.resultsPaging = sax.resultsPaging || { fn: {}, msg: {}, contexts: [] };
|
|
|
|
//--------------------------------------------------------------
|
|
rp.fn.refreshPaging = function (paging, contextSel, refreshFn)
|
|
{
|
|
let context = rp.fn.getContext(contextSel, refreshFn);
|
|
rp.fn.init(context);
|
|
context.paging = paging = paging || {};
|
|
context.$rp.toggle(paging.paged);
|
|
context.$pageNo.val(paging.pageNo);
|
|
context.$pageLen.val(paging.pageLength);
|
|
$('.sax-paging-info', context.$rp).text(sax.resultsPaging.msg.pageInfo.format(paging.pageNo, paging.pageCount));
|
|
//$('.sax-paging-first,.sax-paging-prev', context.$rp).toggle(paging.pageNo > 1);
|
|
//$('.sax-paging-next,.sax-paging-last', context.$rp).toggle(paging.pageNo < paging.pageCount);
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
rp.fn.getContext = function (contextSel, refreshFn)
|
|
{
|
|
for (let idx = 0; idx < rp.contexts.length; idx++)
|
|
{
|
|
if (rp.contexts[idx].sel == contextSel) return rp.contexts[idx];
|
|
}
|
|
//sax.debug('getContext Creating new context for: ', contextSel);
|
|
let context = { sel: contextSel, refreshFn: refreshFn }
|
|
rp.contexts.push(context);
|
|
return context;
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
rp.fn.firstPage = function (context)
|
|
{
|
|
let page = context.$pageNo.val() * 1;
|
|
if (page < 2) return;
|
|
context.$pageNo.val(1);
|
|
context.refreshFn();
|
|
}
|
|
rp.fn.prevPage = function (context)
|
|
{
|
|
let page = context.$pageNo.val() * 1;
|
|
if (page < 2) return;
|
|
context.$pageNo.val(page - 1);
|
|
context.refreshFn();
|
|
}
|
|
rp.fn.nextPage = function (context)
|
|
{
|
|
let page = context.$pageNo.val() * 1;
|
|
if (page > context.paging.pageCount - 1) return;
|
|
context.$pageNo.val(page + 1);
|
|
context.refreshFn();
|
|
}
|
|
rp.fn.lastPage = function (context)
|
|
{
|
|
let page = context.$pageNo.val() * 1;
|
|
if (page > context.paging.pageCount - 1) return;
|
|
context.$pageNo.val(context.paging.pageCount);
|
|
context.refreshFn();
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
rp.fn.init = function (context)
|
|
{
|
|
// Initialise context.
|
|
if (context.$rp) return;
|
|
//sax.debug('resultsPaging.init Initialising Paging.', context);
|
|
context.$rp = $('.sax-results-paging', $(context.sel));
|
|
context.$pageNo = $('.PagingPageNo', context.$rp);
|
|
context.$pageLen = $('.PagingPageLength', context.$rp);
|
|
$('.sax-paging-first', context.$rp).off('click').on('click', function () { rp.fn.firstPage(context); });
|
|
$('.sax-paging-prev', context.$rp).off('click').on('click', function () { rp.fn.prevPage(context); });
|
|
$('.sax-paging-next', context.$rp).off('click').on('click', function () { rp.fn.nextPage(context); });
|
|
$('.sax-paging-last', context.$rp).off('click').on('click', function () { rp.fn.lastPage(context); });
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
$(function ()
|
|
{
|
|
});
|
|
|
|
//--------------------------------------------------------------
|
|
}(window, window.document));
|
|
|
|
/* The End */ |