This commit is contained in:
2021-10-14 21:08:07 +01:00
parent 46b90cea74
commit 7417981a34
51 changed files with 1418 additions and 326 deletions
@@ -8,7 +8,7 @@
{
margin: 8px auto;
background-color: #f8f8f8;
border: solid 2px var(--color-primary);
border: solid 1px var(--color-primary);
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
@@ -159,6 +159,11 @@
background-image: url('../img/action/process24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-close
{
background-image: url('../img/action/prev24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item:hover
{
background-color: #f8f8f8;
@@ -223,9 +223,9 @@
/* Buttons */
.sax-form button.sax-button,
.sax-form input[type="button"].sax-button,
.sax-form input[type="submit"].sax-button
button.sax-button,
input[type="button"].sax-button,
input[type="submit"].sax-button
{
height: auto;
width: auto;
@@ -242,9 +242,9 @@
border-radius: 4px;
}
.sax-form button.sax-button:hover,
.sax-form input[type="button"].sax-button:hover,
.sax-form input[type="submit"].sax-button:hover
button.sax-button:hover,
input[type="button"].sax-button:hover,
input[type="submit"].sax-button:hover
{
background-color: #EFE8F0;
}
@@ -288,7 +288,7 @@ a:focus
.ui-dialog.ui-widget.ui-widget-content
{
border-width: 2px;
border-width: 1px;
border-color: #606060;
border-color: var(--color-dialog);
-moz-box-shadow: 4px 4px 6px var(--color-dialog);
+3 -3
View File
@@ -32,7 +32,7 @@
var $items = $('.sax-panel-item-list', $pnl.results).hide().empty();
if (!response.success) return;
sax.data.articleOrganisations = response.organisations;
sax.refreshPaging(response);
sax.refreshPaging(response, '#frmArticleFilter', sax.refreshResults);
// Menu.
let $mnu = $('.sax-burger ul.sax-dropdown-menu', $pnl.filter).empty();
$mnu.append(sax.getFilterMenuOption(sax.lbl.refresh, function () { sax.refreshResults(); }, 'sax-refresh'));
@@ -405,7 +405,7 @@
//--------------------------------------------------------------
sax.selectSport = function ()
{
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#ifArticleSportId').val(), fnCallback: sax.onSelectSport })
sax.mdl.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#ifArticleSportId').val(), fnCallback: sax.onSelectSport })
}
sax.onSelectSport = function (sport)
{
@@ -416,7 +416,7 @@
//--------------------------------------------------------------
sax.selectRegion = function ()
{
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('#ifArticleRegionId').val(), fnCallback: sax.onSelectRegion })
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('#ifArticleRegionId').val(), fnCallback: sax.onSelectRegion })
}
sax.onSelectRegion = function (region)
{
+2 -2
View File
@@ -135,8 +135,8 @@
}
sax.refreshPaging = function (response, context, refreshFn)
{
if (sax.resultsPaging.fn.refreshPaging)
sax.resultsPaging.fn.refreshPaging(response.paging, context, refreshFn);
if (sax.mdl.resultsPaging.fn.refreshPaging)
sax.mdl.resultsPaging.fn.refreshPaging(response.paging, context, refreshFn);
}
//--------------------------------------------------------------
@@ -154,10 +154,6 @@
$('.MemberDisplayName,.MemberTitle,.MemberFirstName,.MemberLastName', $frmM).hide();
sax.clearControlErrors();
}
sax.doCreateItem = function ()
{
sax.storeItem();
}
//--------------------------------------------------------------
sax.updateItem = function (item)
@@ -189,10 +185,6 @@
$dlg.member.dialog('option', 'title', sax.dlg.title.updateMember);
sax.openDialog($dlg.member, 600, 600);
}
sax.doUpdateItem = function ()
{
sax.storeItem();
}
//--------------------------------------------------------------
// Member Roles.
@@ -315,7 +307,7 @@
$('.sax-input', $frm.member).on('input', function () { sax.clearControlError(this); });
var opt = sax.dlgOpts();
opt.buttons[sax.dlg.btn.ok] = function () { sax.doCreateItem(); };
opt.buttons[sax.dlg.btn.ok] = function () { sax.storeItem()onUpdateItem; };
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
$dlg.member = $('#dlgMember').dialog(opt);
+12 -12
View File
@@ -145,21 +145,10 @@
sax.refreshResults(50);
}
//--------------------------------------------------------------
sax.selectRegion = function ()
{
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('#ifOpportunityRegionId').val(), fnCallback: sax.onSelectRegion })
}
sax.onSelectRegion = function (region)
{
sax.clearControlError($('#ifOpportunityRegionId').val(region.id));
$('#ifOpportunityRegionCaption').val(region ? region.name : '');
}
//--------------------------------------------------------------
sax.selectSport = function ()
{
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#ifOpportunitySportId').val(), fnCallback: sax.onSelectSport })
sax.mdl.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#ifOpportunitySportId').val(), fnCallback: sax.onSelectSport })
}
sax.onSelectSport = function (sport)
{
@@ -167,6 +156,17 @@
$('#ifOpportunitySportCaption').val(sport ? sport.name : '');
}
//--------------------------------------------------------------
sax.selectRegion = function ()
{
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('#ifOpportunityRegionId').val(), fnCallback: sax.onSelectRegion })
}
sax.onSelectRegion = function (region)
{
sax.clearControlError($('#ifOpportunityRegionId').val(region.id));
$('#ifOpportunityRegionCaption').val(region ? region.name : '');
}
//--------------------------------------------------------------
sax.createItem = function ()
{
@@ -40,7 +40,7 @@
//--------------------------------------------------------------
sax.selectOrgSport = function ()
{
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('.OrganisationSportId', or.$frm).val(), fnCallback: sax.onSelectOrgSport })
sax.mdl.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('.OrganisationSportId', or.$frm).val(), fnCallback: sax.onSelectOrgSport })
}
sax.onSelectOrgSport = function (sport)
{
@@ -51,7 +51,7 @@
//--------------------------------------------------------------
sax.selectOrgRegion = function ()
{
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionIdCountry', or.$frm).val(), typesInc:[30], fnCallback: sax.onSelectOrgRegion })
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionIdCountry', or.$frm).val(), typesInc:[30], fnCallback: sax.onSelectOrgRegion })
}
sax.onSelectOrgRegion = function (region)
{
+10 -10
View File
@@ -5,7 +5,7 @@
(function (win, doc, undef)
{
"use strict";
let sr = sax.data.selectRegion;
let sr = sax.mdl.selectRegion = sax.mdl.selectRegion || {};
sr.regions = {}; sr.fn = {}; sr.ajax = {}; sr.itemIdPrefix = 'Rgn_';
//--------------------------------------------------------------
@@ -31,9 +31,9 @@
}
sr.fn.refreshRegionsAndSelect = function (response)
{
//sax.debug('refreshRegionsAndSelect', response);
if (!response || !response.success) return;
sr.regions = response.regions;
//sax.debug(sr.cfg);
sr.fn.showSelectRegion();
}
sr.fn.showSelectRegion = function ()
@@ -61,8 +61,8 @@
let $regionsAvail = $('.sax-selectRegion-regions.AvailableRegions', sr.$dlg).empty();
let $regionTmpl = $('.sax-panel-item-template .sax-panel-item.Region', sr.$dlg);
let regions = [...sr.regions];
let typesInc = sr.cfg.typesInc||[];
let typesExc = sr.cfg.typesExc||[];
let typesInc = sr.cfg.typesInc || [];
let typesExc = sr.cfg.typesExc || [];
regions.sort(sr.fn.compareRegions);
for (let rgnIdx = 0; rgnIdx < regions.length; rgnIdx++)
{
@@ -72,7 +72,7 @@
if (typesInc.length && !typesInc.includes(region.regionType)) continue;
if (typesExc.length && typesExc.includes(region.regionType)) continue;
let $region = $regionTmpl.clone();
$region.prop('id', sr.itemIdPrefix + id).on('click', function () { sr.fn.onClickRegion(id); }).on('dblclick', function () { sr.fn.onDblClickRegion(id); }).find('.RegionName').text(region.name).end();
$region.on('click', function () { sr.fn.onClickRegion(region, $region); }).on('dblclick', function () { sr.fn.onDblClickRegion(region, $region); }).find('.RegionName').text(region.name).end();
if (id == sr.regionId) $region.addClass('sel');
$regionsAvail.append($region);
}
@@ -92,15 +92,15 @@
}
//--------------------------------------------------------------
sr.fn.onClickRegion = function (id)
sr.fn.onClickRegion = function (region, $region)
{
$('.SelectedRegionName', sr.$dlg).text(sr.fn.getRegionName(sr.regionId = id));
$('.SelectedRegionName', sr.$dlg).text(sr.fn.getRegionName(sr.regionId = region.id));
$('.sax-panel-item.Region', sr.$dlg).removeClass('sel');
$('.sax-panel-item.Region#' + sr.itemIdPrefix + id, sr.$dlg).addClass('sel');
$region.addClass('sel');
}
sr.fn.onDblClickRegion = function (id)
sr.fn.onDblClickRegion = function (region, $region)
{
sr.regionId = id;
sr.regionId = region.id;
sr.fn.storeSelectRegion();
}
sr.fn.storeSelectRegion = function ()
@@ -5,59 +5,77 @@
(function (win, doc, undef)
{
"use strict";
let rp = sax.resultsPaging = sax.resultsPaging || { fn: {}, msg: {} };
let rp = sax.mdl.resultsPaging = sax.mdl.resultsPaging || { fn: {}, msg: {}, contexts: [] };
//--------------------------------------------------------------
rp.fn.refreshPaging = function (paging)
rp.fn.refreshPaging = function (paging, contextSel, refreshFn)
{
//sax.debug('refreshPaging', paging);
rp.fn.init();
rp.paging = paging = paging || {};
rp.$rp.toggle(paging.paged);
$('.sax-paging-info', rp.$rp).text(sax.resultsPaging.msg.pageInfo.format(paging.pageNo, paging.pageCount));
//$('.sax-paging-first,.sax-paging-prev', rp.$rp).toggle(paging.pageNo > 1);
//$('.sax-paging-next,.sax-paging-last', rp.$rp).toggle(paging.pageNo < paging.pageCount);
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.mdl.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.firstPage = function ()
rp.fn.getContext = function (contextSel, refreshFn)
{
let page = rp.$pageNo.val() * 1;
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;
rp.$pageNo.val(1);
sax.refreshResults();
context.$pageNo.val(1);
context.refreshFn();
}
rp.fn.prevPage = function ()
rp.fn.prevPage = function (context)
{
let page = rp.$pageNo.val() * 1;
let page = context.$pageNo.val() * 1;
if (page < 2) return;
rp.$pageNo.val(page - 1);
sax.refreshResults();
context.$pageNo.val(page - 1);
context.refreshFn();
}
rp.fn.nextPage = function ()
rp.fn.nextPage = function (context)
{
let page = rp.$pageNo.val() * 1;
if (page > rp.paging.pageCount - 1) return;
rp.$pageNo.val(page + 1);
sax.refreshResults();
let page = context.$pageNo.val() * 1;
if (page > context.paging.pageCount - 1) return;
context.$pageNo.val(page + 1);
context.refreshFn();
}
rp.fn.lastPage = function ()
rp.fn.lastPage = function (context)
{
let page = rp.$pageNo.val() * 1;
if (page > rp.paging.pageCount - 1) return;
rp.$pageNo.val(rp.paging.pageCount);
sax.refreshResults();
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 ()
rp.fn.init = function (context)
{
rp.$rp = $('.sax-results-paging');
rp.$pageNo = $('.PagingPageNo', rp.$rp);
$('.sax-paging-first', rp.$rp).on('click',rp.fn.firstPage);
$('.sax-paging-prev', rp.$rp).on('click', rp.fn.prevPage);
$('.sax-paging-next', rp.$rp).on('click', rp.fn.nextPage);
$('.sax-paging-last', rp.$rp).on('click', rp.fn.lastPage);
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); });
}
}(window, window.document));
@@ -5,8 +5,8 @@
(function (win, doc, undef)
{
"use strict";
let ss = sax.data.selectSport;
ss.sports = {}; ss.fn = {}; ss.ajax = {}; ss.itemIdPrefix = 'Spt_';
let ss = sax.mdl.selectSport = sax.mdl.selectSport || {};
ss.sports = {}; ss.fn = {}; ss.ajax = {};;
//--------------------------------------------------------------
/*
@@ -30,6 +30,7 @@
}
ss.fn.refreshSportsAndSelect = function (response)
{
//sax.debug('refreshSportsAndSelect', response);
if (!response || !response.success) return;
ss.sports = response.sports;
ss.fn.showSelectSport();
@@ -67,7 +68,7 @@
let id = sport.id;
if (filter && !sport.name.match(reFilter)) continue;
let $sport = $sportTmpl.clone();
$sport.prop('id', ss.itemIdPrefix + id).on('click', function () { ss.fn.onClickSport(id); }).on('dblclick', function () { ss.fn.onDblClickSport(id); }).find('.SportName').text(sport.name).end();
$sport.on('click', function () { ss.fn.onClickSport(sport, $sport); }).on('dblclick', function () { ss.fn.onDblClickSport(sport, $sport); }).find('.SportName').text(sport.name).end();
if (id == ss.sportId) $sport.addClass('sel');
$sportsAvail.append($sport);
}
@@ -87,15 +88,15 @@
}
//--------------------------------------------------------------
ss.fn.onClickSport = function (id)
ss.fn.onClickSport = function (sport, $sport)
{
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId = id) || ' ');
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId = sport.id) || ' ');
$('.sax-panel-item.Sport', ss.$dlg).removeClass('sel');
$('.sax-panel-item.Sport#' + ss.itemIdPrefix + id, ss.$dlg).addClass('sel');
$sport.addClass('sel');
}
ss.fn.onDblClickSport = function (id)
ss.fn.onDblClickSport = function (sport, $sport)
{
ss.sportId = id;
ss.sportId = sport.id;
ss.fn.storeSelectSport();
}
ss.fn.storeSelectSport = function ()
@@ -0,0 +1,175 @@
/*
* Search - Organisations.
*/
(function (win, doc, undef)
{
"use strict";
let so = sax.searchOrganisations = {};
so.ajax = {}; so.data = {}; so.fn = {};
let $pnl = so.$pnl = {}, $frm = so.$frm = {}, $dlg = so.$dlg = {};
//--------------------------------------------------------------
so.refreshResults = function (delay)
{
if (!so.awaitingRefreshResponse)
{
$('.sax-burger', $pnl.filter).hide();
$('.sax-panel-item-list', $pnl.results).fadeOut(200).empty();
$('.sax-panel-messages', $pnl.results).hide().empty().append($('<div class="sax-message">' + sax.msg.dataQuerying + '</div>')).fadeIn(200);
}
so.ajax.refreshResults = so.ajax.refreshResults || { url: sax.url.base + 'Search/Ajax/Organisations', formId: 'frmOrganisationFilter', callbackFn: so.doRefreshResults };
sax.doAjaxRequest(so.ajax.refreshResults, delay || 50);
so.awaitingRefreshResponse = true;
}
so.doRefreshResults = function (response)
{
sax.debug('doRefreshResults', response);
delete sax.awaitingRefreshResponse;
sax.refreshControlValues(response.controlValues);
var $msgs = $('.sax-panel-messages', $pnl.results).hide().empty();
var $items = $('.sax-panel-item-list', $pnl.results).hide().empty();
if (!response.success) return;
sax.refreshPaging(response, '#frmOrganisationFilter', so.refreshResults);
// Menu.
let $bgr = $('.sax-burger', $pnl.filter);
let $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
$mnu.append(so.getFilterMenuOption(sax.lbl.refresh, function () { so.refreshResults(); }, 'sax-refresh'));
$bgr.toggle(!!$('.sax-dropdown-item', $mnu).length);
// Items.
var items = response.organisations;
if (!items.length)
return $msgs.append($('<div class="sax-message">' + sax.msg.dataNoneFound + '</div>')).fadeIn(500);
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
$items.append(so.populateItem(so.getItemTemplate(), items[itemIdx]));
$items.fadeIn(50);
}
so.populateItem = function ($item, item)
{
if (!item) return;
$('.sax-panel-messages', $pnl.results).hide().empty();
$('.OrganisationName', $item).text(item.name);
$('.OrganisationEmail', $item).text(item.emailAddress);
let $bgr = $('.sax-burger', $item);
let $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
{
let fnView = function () { so.viewItem(item) };
// ToDo $mnu.append(so.getItemMenuOption(sax.lbl.view, fnView, 'sax-view'));
$('.sax-caption .sax-action', $item).off('click').on('click', fnView);
$('.sax-content', $item).off('dblclick').on('dblclick', fnView);
}
$bgr.toggle(!!$('.sax-dropdown-menu .sax-dropdown-item', $item).length);
return $item;
}
//--------------------------------------------------------------
so.getFilterDropdownTemplate = function ()
{
return $('.sax-panel-item-template .sax-dropdown-menu.Organisations li.sax-dropdown-item', $pnl.filter).clone();
}
so.getFilterMenuOption = function (lbl, fn, cls)
{
return so.getMenuOption(so.getFilterDropdownTemplate(), lbl, fn, cls);
}
so.getItemTemplate = function ()
{
return $('.sax-panel-item-template .sax-panel-item.Organisation', $pnl.results).clone();
}
so.getItemDropdownTemplate = function ()
{
return $('.sax-panel-item-template .sax-dropdown-menu.Organisation li.sax-dropdown-item', $pnl.results).clone();
}
so.getItemMenuOption = function (lbl, fn, cls)
{
return so.getMenuOption(so.getItemDropdownTemplate(), lbl, fn, cls);
}
so.getMenuOption = function ($opt, lbl, fn, cls)
{
return $opt.find('div.sax-label').text(lbl).end().on('click', fn).addClass(cls);
}
//--------------------------------------------------------------
so.selectFilterSport = function ()
{
sax.debug('selectFilterSport');
let excludeIds = [];
sax.mdl.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('.FilterSportId', $frm.filter).val(), excludeIds: excludeIds, fnCallback: so.onFilterSportSelected })
}
so.onFilterSportSelected = function (spt)
{
sax.debug('onFilterSportSelected', spt)
$('.FilterSportId', $frm.filter).val(spt ? spt.id : '');
$('.FilterSportCaption', $frm.filter).val(spt ? spt.name : '');
so.refreshResults();
}
so.clearFilterSport = function ()
{
$('.FilterSportId,.FilterSportCaption', $frm.filter).val('');
so.refreshResults();
}
//--------------------------------------------------------------
so.selectFilterRegion = function ()
{
sax.debug('selectFilterRegion');
let excludeIds = [];
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.FilterRegionId', $frm.filter).val(), excludeIds: excludeIds, fnCallback: so.onFilterRegionSelected })
}
so.onFilterRegionSelected = function (rgn)
{
sax.debug('onFilterRegionSelected', rgn)
$('.FilterRegionId', $frm.filter).val(rgn ? rgn.id : '');
$('.FilterRegionCaption', $frm.filter).val(rgn ? rgn.name : '');
so.refreshResults();
}
so.clearFilterRegion = function ()
{
$('.FilterRegionId,.FilterRegionCaption', $frm.filter).val('');
so.refreshResults();
}
//--------------------------------------------------------------
so.viewItem = function (item)
{
$('.OrganisationId', $frm.orgId).val(item.id);
so.ajax.organisation = so.ajax.organisation || { url: sax.url.base + 'Search/Ajax/GetOrganisation', formId: 'frmOrganisationId', callbackFn: so.onViewItem };
sax.doAjaxRequest(so.ajax.organisation, 50);
}
so.onViewItem = function (response)
{
sax.debug('onViewItem', response);
if (!response.success) return;
let frm = $frm.org;
let item = so.data.organisation = response.organisation;
$('.OrganisationName', frm).toggle(!item.awaiting).val(item.name);
sax.clearControlErrors();
$dlg.org.dialog('option', 'title', sax.dlg.title.organisation);
sax.openDialog($dlg.org, 600, 600);
}
//--------------------------------------------------------------
$(function ()
{
$pnl.orgs = $('.sax-panel.Organisations');
$pnl.filter = $('.sax-panel-filter', $pnl.orgs);
$pnl.results = $('.sax-panel-results', $pnl.orgs);
$frm.filter = $('#frmOrganisationFilter', $pnl.orgs);
$('.FilterOrganisation', $frm.filter).on('input', function () { so.refreshResults(250); }).on('keypress', function (event)
{
if (event.keyCode == 13) setTimeout(so.refreshResults, 50);
});
$('.FilterCategory', $frm.filter).on('change', function () { so.refreshResults(); });
var opt = sax.dlgOpts();
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
$dlg.org = $('#dlgOrganisation').dialog(opt);
$frm.orgId = $('#frmOrganisationId');
$frm.org = $('#frmOrganisation', $dlg.org);
setTimeout(so.refreshResults, 250);
});
}(window, window.document));
/* The End */
+43 -44
View File
@@ -10,10 +10,10 @@
//--------------------------------------------------------------
sax.refreshProfileContactInfo = function ()
{
var $section = $('.sax-panel-section.ProfileContact');
$section.removeClass('sax-edit').addClass('sax-populating');
$('.sax-property', $section).hide();
sax.showDataRefreshingMsg($section);
if ($pnl.proCon.hasClass('sax-edit'))
$pnl.proCon.slideUp(750, function () { $pnl.proCon.removeClass('sax-edit').addClass('sax-populating').slideDown(750); });
$('.sax-property', $pnl.proCon).hide();
sax.showDataRefreshingMsg($pnl.proCon);
sax.refreshProfileContact(sax.onRefreshProfileContactInfo);
}
sax.refreshProfileContactForm = function ()
@@ -32,16 +32,15 @@
{
//sax.debug('onRefreshProfileContactInfo', response);
if (!response || !response.success || !response.contact) return;
$('.sax-panel-section').show();
var $section = $('.sax-panel-section.ProfileContact');
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
$('.sax-value', $section).empty();
sax.refreshInfo($section, 'AccountEmailAddress', response.contact.emailAddress);
sax.refreshInfo($section, 'AccountName', response.contact.displayName);
sax.refreshInfo($section, 'AccountLocation', response.contact.locationCaption);
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
sax.showNoInfoMsg($section);
$section.removeClass('sax-populating');
$('.sax-panel-section').slideDown(750);
$('.sax-message', $pnl.proCon).stop(true, false).fadeOut(200).empty();
$('.sax-value', $pnl.proConInf).empty();
sax.refreshInfo($pnl.proConInf, 'AccountEmailAddress', response.contact.emailAddress);
sax.refreshInfo($pnl.proConInf, 'AccountName', response.contact.displayName);
sax.refreshInfo($pnl.proConInf, 'AccountLocation', response.contact.locationCaption);
$('img.AccountContact', $pnl.proConInf).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
sax.showNoInfoMsg($pnl.proConInf);
$pnl.proCon.removeClass('sax-populating');
}
sax.onRefreshProfileContactForm = function (response)
{
@@ -49,30 +48,28 @@
if (!response || !response.success) return;
sax.data.genders = response.genders;
sax.data.months = response.months;
$('.sax-panel-section').hide();
var $section = $('.sax-panel-section.ProfileContact').show();
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
sax.refreshInput($section, 'AccountEmailAddress', response.contact.emailAddress);
sax.refreshSelect($section, 'AccountTitle', response.contact.title);
sax.refreshInput($section, 'AccountFirstName', response.contact.firstName);
sax.refreshInput($section, 'AccountLastName', response.contact.lastName);
sax.refreshTextArea($section, 'AccountAbout', response.contact.about);
$('.sax-message', $pnl.proCon).stop(true, false).fadeOut(200).empty();
sax.refreshInput($pnl.proConFrm, 'AccountEmailAddress', response.contact.emailAddress);
sax.refreshSelect($pnl.proConFrm, 'AccountTitle', response.contact.title);
sax.refreshInput($pnl.proConFrm, 'AccountFirstName', response.contact.firstName);
sax.refreshInput($pnl.proConFrm, 'AccountLastName', response.contact.lastName);
sax.refreshTextArea($pnl.proConFrm, 'AccountAbout', response.contact.about);
let $selGender = $('#cbAccountGender');
if (response.genders && response.genders.length)
sax.populateSelectCodeDesc($('#cbAccountGender'), response.genders);
sax.refreshSelect($section, 'AccountGender', response.contact.gender || '');
sax.refreshSelect($pnl.proConFrm, 'AccountGender', response.contact.gender || '');
sax.refreshDob();
sax.refreshSelect($section, 'AccountDobYear', response.contact.dobYear);
sax.refreshSelect($pnl.proConFrm, 'AccountDobYear', response.contact.dobYear);
sax.refreshDob();
sax.refreshSelect($section, 'AccountDobMonth', response.contact.dobMonth);
sax.refreshSelect($pnl.proConFrm, 'AccountDobMonth', response.contact.dobMonth);
sax.refreshDob();
sax.refreshSelect($section, 'AccountDobDay', response.contact.dobDay);
sax.refreshInput($section, 'AccountRegionIdCountry', response.contact.regionIdCountry);
sax.refreshInput($section, 'AccountRegionCaptionCountry', response.contact.regionCaptionCountry);
sax.refreshInput($section, 'AccountRegionIdProvince', response.contact.regionIdProvince);
sax.refreshInput($section, 'AccountRegionCaptionProvince', response.contact.regionCaptionProvince);
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
$section.addClass('sax-edit');
sax.refreshSelect($pnl.proConFrm, 'AccountDobDay', response.contact.dobDay);
sax.refreshInput($pnl.proConFrm, 'AccountRegionIdCountry', response.contact.regionIdCountry);
sax.refreshInput($pnl.proConFrm, 'AccountRegionCaptionCountry', response.contact.regionCaptionCountry);
sax.refreshInput($pnl.proConFrm, 'AccountRegionIdProvince', response.contact.regionIdProvince);
sax.refreshInput($pnl.proConFrm, 'AccountRegionCaptionProvince', response.contact.regionCaptionProvince);
$('img.AccountContact', $pnl.proConFrm).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
$('.sax-panel-section').slideUp(750, function () { $pnl.proCon.addClass('sax-edit').slideDown(750); });
}
sax.storeProfileContact = function ()
{
@@ -129,7 +126,7 @@
//--------------------------------------------------------------
sax.selectRegionCountry = function ()
{
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegionCountry, regionId: $('#ifAccountRegionIdCountry').val(), fnCallback: sax.onSelectRegionCountry })
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegionCountry, regionId: $('#ifAccountRegionIdCountry').val(), fnCallback: sax.onSelectRegionCountry })
}
sax.onSelectRegionCountry = function (region)
{
@@ -154,7 +151,7 @@
if (file.type != 'image/jpg' && file.type != 'image/jpeg' && file.type != 'image/png') return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileTypeInvalid.format(sax.getFileType(file)));
$(".UploadMessage", context).text(sax.msg.uploadingFile.format(file.name));
$('img.ContactImageUploadProgress', context).fadeIn(200);
sax.clearControlError(sax.$pnl.contactImageDrag);
sax.clearControlError($pnl.contactImageDrag);
sax.data.contactImageUploadContext = context;
sax.ajax.uploadContactImage = sax.ajax.uploadContactImage || { url: sax.url.base + 'Account/Ajax/UploadContactImage', callbackFn: sax.handleContactImageUploadResponse, noWaitIcon: true };
@@ -168,14 +165,13 @@
let context = sax.data.contactImageUploadContext;
//sax.debug('handleContactImageUploadResponse', response, context);
if (!response) return;
var $section = $('.sax-panel-section.ProfileContact');
sax.refreshControlValues(response.controlValues, context);
$(".UploadMessage", context).empty();
$('img.ContactImageUploadProgress', context).hide();
if (response.success)
{
$dlg.selectContactImage.dialog('close');
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
$('img.AccountContact', $pnl.proConFrm).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
}
}
sax.selectContactImage = function ()
@@ -198,16 +194,19 @@
//--------------------------------------------------------------
$(function ()
{
sax.$pnl.proCon = $('.sax-panel-section.ProfileContact');
$('.sax-action.sax-edit', sax.$pnl.proCon).on('click', function (evt) { sax.refreshProfileContactForm(); });
$('input,textarea', sax.$pnl.proCon).on('input', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
$('select', sax.$pnl.proCon).on('change', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
$pnl.proCon = $('.sax-panel-section.ProfileContact');
$pnl.proConInf = $('.sax-panel-info', $pnl.proCon);
$pnl.proConFrm = $('.sax-panel-form', $pnl.proCon);
$('.sax-action.sax-edit', $pnl.proConInf).on('click', function (evt) { sax.refreshProfileContactForm(); });
$('.sax-content', $pnl.proConInf).on('dblclick', function (evt) { sax.refreshProfileContactForm(); });
$('input,textarea', $pnl.proConFrm).on('input', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
$('select', $pnl.proConFrm).on('change', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
sax.$pnl.contactImageDrag = $('#pnlContactImageDrop')
$pnl.contactImageDrag = $('#pnlContactImageDrop')
.on("dragenter", function (evt) { sax.haltEvent(evt); })
.on("dragover", function (evt) { sax.haltEvent(evt); if (!sax.$pnl.contactImageDrag.hasClass(sax.classFileDrag)) sax.$pnl.contactImageDrag.addClass(sax.classFileDrag); })
.on("dragleave", function (evt) { sax.haltEvent(evt); sax.$pnl.contactImageDrag.removeClass(sax.classFileDrag); })
.on("drop", function (evt) { sax.haltEvent(evt); sax.$pnl.contactImageDrag.removeClass(sax.classFileDrag); sax.onDropContactImage(evt); });
.on("dragover", function (evt) { sax.haltEvent(evt); if (!$pnl.contactImageDrag.hasClass(sax.classFileDrag)) $pnl.contactImageDrag.addClass(sax.classFileDrag); })
.on("dragleave", function (evt) { sax.haltEvent(evt); $pnl.contactImageDrag.removeClass(sax.classFileDrag); })
.on("drop", function (evt) { sax.haltEvent(evt); $pnl.contactImageDrag.removeClass(sax.classFileDrag); sax.onDropContactImage(evt); });
var opt = sax.dlgOpts();
opt.buttons[sax.dlg.btn.ok] = function () { sax.uploadContactImage(); };
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
+35 -32
View File
@@ -5,16 +5,17 @@
(function (win, doc, undef)
{
"use strict";
let $pnl = sax.$pnl, $dlg = sax.$dlg, $frm = sax.$frm;
let ps = sax.mdl.profileSports = sax.mdl.profileSports || {};
let $pnl = ps.$pnl = {}, $dlg = ps.$dlg = {}, $frm = ps.$frm = {};
ps.data = { };
//--------------------------------------------------------------
sax.refreshProfileSportsInfo = function (delay)
{
var $section = $('.sax-panel-section.ProfileSports');
$section.removeClass('sax-edit').addClass('sax-populating');
$('.sax-property', $section).hide();
sax.showDataRefreshingMsg($section);
sax.refreshProfileSports(sax.onRefreshProfileSportsInfo);
$pnl.proSpt.removeClass('sax-edit').addClass('sax-populating');
$('.sax-property', $pnl.proSpt).hide();
sax.showDataRefreshingMsg($pnl.proSpt);
sax.refreshProfileSports(ps.onRefreshProfileSportsInfo);
}
sax.refreshProfileSports = function (callbackFn)
{
@@ -24,23 +25,23 @@
sax.ajax.profileSports.callbackFn = callbackFn;
sax.doAjaxRequest(sax.ajax.profileSports, 50);
}
sax.onRefreshProfileSportsInfo = function (response)
ps.onRefreshProfileSportsInfo = function (response)
{
//sax.debug('onRefreshProfileSportsInfo', response);
if (!response || !response.success) return;
var $section = $('.sax-panel-section.ProfileSports');
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
$('.sax-message', $pnl.proSpt).stop(true, false).fadeOut(200).empty();
sax.profile.sports.Ids = [];
let items = response.sports;
if (!items) return;
let $items = $('.sax-panel-results.ProfileSports', $section).empty();
let $tmpl = $('.sax-panel-item-template .sax-panel-item.ProfileSport', $section);
let $items = $('.sax-panel-results.ProfileSports', $pnl.proSpt).empty();
let $tmpl = $('.sax-panel-item-template .sax-panel-item.ProfileSport', $pnl.proSpt);
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
{
let item = items[itemIdx];
sax.profile.sports.Ids.push(item.sportId);
let $item = $tmpl.clone().prop('id', 'ProSpt_' + item.id);
$('.sax-header .sax-action.sax-edit', $item).on('click', function (evt) { sax.updateProfileSport(item.id); });
$('.sax-header .sax-action.sax-edit', $item).on('click', function (evt) { ps.updateProfileSport(item.id); });
$('.sax-content', $item).on('dblclick', function (evt) { ps.updateProfileSport(item.id); });
$('.sax-header .sax-action.sax-experience', $item).on('click', function (evt) { sax.showSportExperience(item); });
$('.SportName', $item).text(item.sportName);
$('.SportParticipationValue', $item).text(item.sportParticipation);
@@ -50,74 +51,76 @@
$items.append($item);
}
$items.show();
sax.showNoInfoMsg($section);
$section.removeClass('sax-populating');
sax.showNoInfoMsg($pnl.proSpt);
$pnl.proSpt.removeClass('sax-populating');
}
sax.addProfileSport = function ()
ps.addProfileSport = function ()
{
//sax.debug('addProfileSport');
let dlg = $dlg.profileSport;
$('.UserSportId,.ProfileSportExists,#ifProfileSportId,input.sax-input,select.sax-select', dlg).val('');
let dlg = $dlg.proSpt;
$('.UserSportId,.ProfileSportExists,#ifProfileSportId,input.sax-input,textarea.sax-textarea,select.sax-select', dlg).val('');
$('.SelectSport', dlg).show();
dlg.dialog('option', 'title', sax.dlg.title.addUserSport);
sax.openDialog(dlg, 480, 400);
sax.openDialog(dlg, 640, 480);
}
sax.updateProfileSport = function (id)
ps.updateProfileSport = function (id)
{
//sax.debug('updateProfileSport', id);
$('#frmProfileSportId .UserSportId').val(id);
sax.ajax.profileSport = sax.ajax.profileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport };
sax.ajax.profileSport = sax.ajax.profileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: ps.doUpdateProfileSport };
sax.doAjaxRequest(sax.ajax.profileSport, 50);
}
sax.doUpdateProfileSport = function (response)
ps.doUpdateProfileSport = function (response)
{
//sax.debug('doUpdateProfileSport', response);
let dlg = $dlg.profileSport;
let dlg = $dlg.proSpt;
let item = response.sport;
$('.UserSportId', dlg).val(item.id);
$('.ProfileSportExists', dlg).val(1);
$('#ifProfileSportId', dlg).val(item.sportId);
$('#ifProfileSport', dlg).val(item.sportName);
$('#ifProfileSportAbout', dlg).val(item.sportAbout);
$('#cbProfileSportParticipation', dlg).val(item.sportParticipationCode);
$('#cbProfileSportOfficiating', dlg).val(item.sportOfficiatingCode);
$('.SelectSport', dlg).hide();
dlg.dialog('option', 'title', sax.dlg.title.updateUserSport);
sax.openDialog(dlg, 480, 400);
sax.openDialog(dlg, 640, 480);
}
sax.selectUserSport = function (sport)
{
//sax.debug('selectUserSport');
let excludeIds = $.grep(sax.profile.sports.Ids, function (value) { return !sport || value != sport.id; });
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#frmProfileSport #ifProfileSportId').val(), excludeIds: excludeIds, fnCallback: sax.onSelectUserSport })
sax.mdl.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#frmProfileSport #ifProfileSportId').val(), excludeIds: excludeIds, fnCallback: ps.onSelectUserSport })
}
sax.onSelectUserSport = function (sport)
ps.onSelectUserSport = function (sport)
{
sax.clearControlError($('#ifProfileSportId').val(sport ? sport.id : ''));
$('#ifProfileSport').val(sport ? sport.name : '');
}
sax.storeProfileSport = function ()
ps.storeProfileSport = function ()
{
//sax.debug('storeProfileSport');
sax.clearControlErrors();
sax.ajax.storeProfileSport = sax.ajax.storeProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport };
sax.ajax.storeProfileSport = sax.ajax.storeProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: ps.onStoreProfileSport };
sax.doAjaxRequest(sax.ajax.storeProfileSport, 50);
}
sax.onStoreProfileSport = function (response)
ps.onStoreProfileSport = function (response)
{
sax.refreshControlValues(response.controlValues);
if (!response || !response.success) return;
$dlg.profileSport.dialog('close');
$dlg.proSpt.dialog('close');
sax.refreshProfileSportsInfo();
}
//--------------------------------------------------------------
$(function ()
{
$('.sax-panel-section.ProfileSports .sax-action.sax-add').on('click', function (evt) { sax.addProfileSport(); });
$pnl.proSpt = $('.sax-panel-section.ProfileSports');
$('.sax-action.sax-add', $pnl.proSpt).on('click', function (evt) { ps.addProfileSport(); });
var opt = sax.dlgOpts();
opt.buttons[sax.dlg.btn.ok] = function () { sax.storeProfileSport(); };
opt.buttons[sax.dlg.btn.ok] = function () { ps.storeProfileSport(); };
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
$dlg.profileSport = $('#dlgProfileSport').dialog(opt);
$dlg.proSpt = $('#dlgProfileSport').dialog(opt);
});
//--------------------------------------------------------------