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>
186 lines
7.2 KiB
JavaScript
186 lines
7.2 KiB
JavaScript
/*
|
|
* Support Feedback page scripts.
|
|
*/
|
|
(function (win, doc, undef)
|
|
{
|
|
"use strict";
|
|
let sf = sax.mdl.supportFeedback = sax.mdl.supportFeedback || { data: {}, ajax: {}, rjs: {}, $ctrl: {} };
|
|
let $pnl = sf.$pnl = {}, $dlg = sf.$dlg = {}, $frm = sf.$frm = {};
|
|
//--------------------------------------------------------------
|
|
sf.refreshResults = function (delay)
|
|
{
|
|
$pnl.items.fadeOut(200).empty();
|
|
if (!sax.awaitingRefreshResponse)
|
|
{
|
|
$('.sax-burger', $pnl.filter).hide();
|
|
$pnl.items.fadeOut(200).empty();
|
|
$pnl.msgs.hide().empty().append($('<div class="sax-message">' + sax.msg.dataQuerying + '</div>')).fadeIn(200);
|
|
//sax.showDataRefreshingMsg($pnl.rpts);
|
|
}
|
|
sf.ajax.userReports = sf.ajax.userReports || { url: sax.url.base + 'Support/Ajax/GetUserReports', formId: 'frmUserReportFilter', callbackFn: sf.onRefreshResults, noWaitIcon: true };
|
|
sax.doAjaxRequest(sf.ajax.userReports, 50);
|
|
sf.awaitingRefreshResponse = true;
|
|
}
|
|
sf.onRefreshResults = function (response)
|
|
{
|
|
//sax.debug('onRefreshResults', response);
|
|
delete sax.awaitingRefreshResponse;
|
|
sax.refreshControlValues(response.controlValues);
|
|
let $msgs = $pnl.msgs.hide().empty();
|
|
let $items = $pnl.items.hide().empty();
|
|
if (!response || !response.success) return;
|
|
$('.sax-message', $pnl.rpts).stop(true, false).fadeOut(200).empty();
|
|
sf.data.reportTypes = response.reportTypes;
|
|
// Menu.
|
|
let $bgr = $('.sax-burger', $pnl.filter);
|
|
let $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
|
|
$mnu.append(sf.getFilterMenuOption(sax.lbl.refresh, function () { sf.refreshResults(); }, 'sax-refresh'));
|
|
$mnu.append(sf.getFilterMenuOption(sax.lbl.add, function () { sf.createItem(); }, 'sax-edit'));
|
|
$bgr.toggle(!!$('.sax-dropdown-item', $mnu).length);
|
|
// Items.
|
|
let items = response.reports;
|
|
if (!items) return;
|
|
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
|
$items.append(sf.populateItem(sf.getItemTemplate(), items[itemIdx]));
|
|
$items.fadeIn(50);
|
|
}
|
|
sf.populateItem = function ($item, item)
|
|
{
|
|
if (!item) return;
|
|
$('.ReportTitle', $item).text(item.reportTitle);
|
|
$('.ReportTypeDesc', $item).text(item.reportTypeDesc);
|
|
$('.UserDisplayName', $item).text(item.userDisplayName);
|
|
$('.ReportRecordedOn', $item).text(item.recordedOnDisp);
|
|
|
|
let $bgr = $('.sax-burger', $item);
|
|
let $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
|
|
if (item.ownReport)
|
|
{
|
|
let fnUpd = function () { sf.updateItem($item, item); };
|
|
$mnu.append(sf.getItemMenuOption(sax.lbl.edit, fnUpd, 'sax-edit'));
|
|
$('.sax-caption .sax-action', $item).off('click').on('click', fnUpd);
|
|
$item.off('dblclick').on('dblclick', fnUpd);
|
|
}
|
|
else $('.sax-caption .sax-action', $item).removeClass('sax-action');
|
|
$bgr.toggle(!!$('.sax-dropdown-menu .sax-dropdown-item', $item).length);
|
|
|
|
return $item;
|
|
}
|
|
//--------------------------------------------------------------
|
|
sf.getFilterDropdownTemplate = function ()
|
|
{
|
|
return $('.sax-panel-item-template .sax-dropdown-menu.UserReports li.sax-dropdown-item', $pnl.filter).clone();
|
|
}
|
|
sf.getItemTemplate = function ()
|
|
{
|
|
return $('.sax-panel-item-template .sax-panel-item.UserReport', $pnl.rpts).clone();
|
|
}
|
|
sf.getItemDropdownTemplate = function ()
|
|
{
|
|
return $('.sax-panel-item-template .sax-dropdown-menu.UserReport li.sax-dropdown-item', $pnl.rpts).clone();
|
|
}
|
|
sf.getFilterMenuOption = function (lbl, fn, cls)
|
|
{
|
|
return sf.getMenuOption(sf.getFilterDropdownTemplate(), lbl, fn, cls);
|
|
}
|
|
sf.getItemMenuOption = function (lbl, fn, cls)
|
|
{
|
|
return sf.getMenuOption(sf.getItemDropdownTemplate(), lbl, fn, cls);
|
|
}
|
|
sf.getMenuOption = function ($opt, lbl, fn, cls)
|
|
{
|
|
return $opt.find('div.sax-label').text(lbl).end().on('click', fn).addClass(cls);
|
|
}
|
|
//--------------------------------------------------------------
|
|
sf.createItem = function ()
|
|
{
|
|
sf.clearItem();
|
|
$('#cbReportType', $frm.rpt).prepend($("<option>", { value: '', selected: true }));
|
|
sf.rjs.reportEditor = sax.rjs.init(sf.$pnl.reportEditor, sf.$ctrl.reportInput, '');
|
|
$dlg.rpt.dialog('option', 'title', sax.dlg.title.createUserReport);
|
|
sf.openItemDialog();
|
|
}
|
|
sf.openItemDialog = function ()
|
|
{
|
|
sax.openDialog($dlg.rpt, 960, 720);
|
|
}
|
|
sf.clearItem = function ()
|
|
{
|
|
sf.cleanUp();
|
|
if (sf.data.reportTypes) sax.populateSelectCodeDesc($('.sax-select.UserReportType', $frm.org), sf.data.reportTypes);
|
|
$('#ifUserReportId,#ifUserReportExists,#ifUserAccountId,input[type="text"],textarea,select', $frm.rpt).val('');
|
|
$('#cbUserReportType', $frm.rpt).find('option[value=""]').remove();
|
|
sax.clearControlErrors($frm.rpt);
|
|
}
|
|
//--------------------------------------------------------------
|
|
sf.updateItem = function ($item, item)
|
|
{
|
|
//sax.debug('updateItem', $item, item);
|
|
$('.UserReportId', $frm.rptId).val(item.id);
|
|
sf.clearItem();
|
|
sf.data.$item = $item; sf.data.item = item;
|
|
sf.ajax.userReport = sf.ajax.userReport || { url: sax.url.base + 'Support/Ajax/GetUserReport', formId: 'frmUserReportId', callbackFn: sf.doUpdateItem };
|
|
sax.doAjaxRequest(sf.ajax.userReport, 50);
|
|
}
|
|
sf.doUpdateItem = function (response)
|
|
{
|
|
//sax.debug('doUpdateItem', response);
|
|
if (!response || !response.success) return;
|
|
let item = response.report;
|
|
if (!item) return;
|
|
$('input.UserReportId', $frm.rpt).val(item.id);
|
|
$('input.UserReportExists', $frm.rpt).val(1);
|
|
$('select.UserReportType', $frm.rpt).val(item.reportType);
|
|
$('input.UserReportTitle', $frm.rpt).val(item.reportTitle);
|
|
sf.rjs.reportEditor = sax.rjs.init(sf.$pnl.reportEditor, sf.$ctrl.reportInput, item.report);
|
|
sf.openItemDialog();
|
|
}
|
|
sf.storeItem = function ()
|
|
{
|
|
let fn = function (response)
|
|
{
|
|
//sax.debug('onStoreItem', response);
|
|
if (!response) return;
|
|
sax.refreshControlValues(response.controlValues, $frm.rpt);
|
|
if (!response.success) return;
|
|
$dlg.rpt.dialog('close');
|
|
if (!sf.data.$item)
|
|
{
|
|
sf.data.$item = sf.getItemTemplate();
|
|
$pnl.items.prepend(sf.data.$item);
|
|
}
|
|
sf.populateItem(sf.data.$item, response.report);
|
|
sf.cleanUp();
|
|
}
|
|
sf.ajax.storeOrg = sf.ajax.storeOrg || { url: sax.url.base + 'Support/Ajax/StoreUserReport', formId: 'frmUserReport', callbackFn: fn };
|
|
sax.doAjaxRequest(sf.ajax.storeOrg, 50);
|
|
}
|
|
sf.cleanUp = function ()
|
|
{
|
|
delete sf.data.item;
|
|
delete sf.data.$item;
|
|
}
|
|
//--------------------------------------------------------------
|
|
$(function ()
|
|
{
|
|
$pnl.rpts = $('.sax-panel.UserReports');
|
|
$pnl.filter = $('.sax-panel-filter', $pnl.rpts);
|
|
$pnl.results = $('.sax-panel-results', $pnl.rpts);
|
|
$pnl.msgs = $('.sax-panel-messages', $pnl.results);
|
|
$pnl.items = $('.sax-panel-item-list', $pnl.results);
|
|
$frm.rptId = $('#frmUserReportId', $pnl.rpts);
|
|
|
|
var opt = sax.dlgOpts();
|
|
opt.buttons[sax.dlg.btn.ok] = function () { sf.storeItem(); };
|
|
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
|
$dlg.rpt = $('#dlgUserReport').dialog(opt);
|
|
$frm.rpt = $('#frmUserReport', $dlg.rpt);
|
|
$frm.rpt.on('input', '.sax-input, .sax-textarea', function () { sax.clearControlError(this); }).on('change', '.sax-select', function () { sax.clearControlError(this); });
|
|
sf.$ctrl.reportInput = $(".UserReportReport .sax-control .UserReportReport");
|
|
sf.$pnl.reportEditor = $(".UserReportReport .sax-control .rjs-editor");
|
|
|
|
setTimeout(sf.refreshResults, 250);
|
|
});
|
|
//--------------------------------------------------------------
|
|
}(window, window.document));
|
|
/* The End */ |