Files
andy 9f22b522df v1.3.0 Restructure Saxonite workspace and upgrade to .NET 10 (#1)
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>
2026-10-16 18:24:16 +01:00

112 lines
4.6 KiB
JavaScript

/*
* Sport contacts.
*/
(function (win, doc, undef)
{
//--------------------------------------------------------------
"use strict";
let sc = sax.mdl.sportContact = { fn: {}, ajax: {}, data: {}, $pnl: {}, $dlg: {}, $frm: {}, $ctrl: {} };
//--------------------------------------------------------------
/*
* Sport Contact config:
* - caption - dialog title.
* - contact:
* - type
* - name
* - email
* - phone
* - typesUsed
* - fnCallback - method to call on completion to store details.
*/
sc.showSportContact = function (cfg)
{
//sax.debug('showSportContact', cfg);
sc.fn.cleanUp();
cfg.contact = cfg.contact || {};
sc.data.cfg = cfg;
sc.populateContactTypes(cfg);
sc.populateTitles(cfg);
sc.fn.displaySportContact(cfg.contact);
sax.clearControlErrors(sc.$dlg.sptCnt);
sax.openDialog(sc.$dlg.sptCnt.dialog('option', { title: sc.data.cfg.caption || 'Sport Contact' }), sc.data.cfg.width || 640, sc.data.cfg.height || 320);
}
//--------------------------------------------------------------
sc.populateContactTypes = function (cfg)
{
let contact = cfg.contact;
sc.$ctrl.contactType.empty();
if (!contact.contactType)
sc.$ctrl.contactType.append($('<option>').prop('selected', true));
for (let typ of cfg.contactTypes || [])
{
if (typ.code && typ.code == cfg.contactType || !(cfg.contactTypesUsed || []).includes(typ.code))
sc.$ctrl.contactType.append($('<option>').prop('value', typ.code).text(typ.desc));
}
sc.$ctrl.contactType.val(contact.contactType).attr('disabled', contact.contactType && sc.$ctrl.contactType.val() == contact.contactType ? true : null);
}
sc.populateTitles = function (cfg)
{
sc.$ctrl.title.empty();
sc.$ctrl.title.append($('<option>').prop('selected', true));
for (let typ of cfg.titles || [])
{
if (typ.code && typ.code == cfg.title || !(cfg.titlesUsed || []).includes(typ.code))
sc.$ctrl.title.append($('<option>').prop('value', typ.code).text(typ.desc));
}
}
sc.fn.displaySportContact = function (contact)
{
sc.$ctrl.contactType.val(contact.contactType);
sc.$ctrl.emailAddress.val(contact.emailAddress);
sc.$ctrl.title.val(contact.title);
sc.$ctrl.firstName.val(contact.firstName);
sc.$ctrl.lastName.val(contact.lastName);
}
//--------------------------------------------------------------
sc.fn.storeSportContact = function ()
{
//sax.debug('storeSportContact');
let cfg = sc.data.cfg;
sax.clearControlErrors(sc.$dlg.sptCnt);
let fn = function (response)
{
//sax.debug('storeSportContact handle response', response);
sax.refreshControlValues(response.controlValues, sc.$dlg.sptCnt);
if (!response.success || sax.hasControlErrors(sc.$dlg.sptCnt)) return;
let contact = { contactType: sc.$ctrl.contactType.val(), contactTypeDesc: $('option:selected', sc.$ctrl.contactType).text(), emailAddress: sc.$ctrl.emailAddress.val(), title: sc.$ctrl.title.val(), firstName: sc.$ctrl.firstName.val(), lastName: sc.$ctrl.lastName.val() };
if (cfg.fnCallback) cfg.fnCallback(contact);
sc.$dlg.sptCnt.dialog('close');
sc.fn.cleanUp();
}
sc.ajax.sportContact = sc.ajax.sportContact || { url: sax.url.base + 'Account/Ajax/ValidateProfileSportContact', formId: sc.$frm.sptCnt.prop('id'), callbackFn: fn };
sax.doAjaxRequest(sc.ajax.sportContact, 50);
}
//--------------------------------------------------------------
sc.fn.onDlgSize = function ()
{
}
sc.fn.cleanUp = function ()
{
$('.sax-input,.sax-textarea,.sax-select', sc.$frm.sptCnt).val('');
sc.data = {};
}
//--------------------------------------------------------------
$(function ()
{
var opt = sax.dlgOpts();
opt.open = function (evt, ui) { sc.fn.onDlgSize(); };
opt.resize = function (evt, ui) { sc.fn.onDlgSize(); };
opt.buttons[sax.dlg.btn.ok] = function () { sc.fn.storeSportContact(); };
opt.buttons[sax.dlg.btn.cancel] = function () { sc.fn.cleanUp(); $(this).dialog('close'); };
sc.$dlg.sptCnt = $('#dlgSportContact').dialog(opt);
sc.$frm.sptCnt = $('#frmProfileSportContact', sc.$dlg.sptCnt);
sc.$frm.sptCnt.on('input', '.sax-input, .sax-textarea', function () { sax.clearControlError(this); }).on('change', '.sax-select', function () { sax.clearControlError(this); });
sc.$ctrl.contactType = $('.sax-select.ContactType', sc.$frm.sptCnt);
sc.$ctrl.emailAddress = $('.sax-input.ContactEmailAddress', sc.$frm.sptCnt);
sc.$ctrl.title = $('.sax-select.ContactTitle', sc.$frm.sptCnt);
sc.$ctrl.firstName = $('.sax-input.ContactFirstName', sc.$frm.sptCnt);
sc.$ctrl.lastName = $('.sax-input.ContactLastName', sc.$frm.sptCnt);
});
//--------------------------------------------------------------
}(window, window.document));
/* The End */