63 lines
2.3 KiB
JavaScript
63 lines
2.3 KiB
JavaScript
/*
|
|
* Account page scripts.
|
|
*/
|
|
|
|
(function (win, doc, undef)
|
|
{
|
|
"use strict";
|
|
let $pnl = sax.$pnl, $dlg = sax.$dlg, $frm = sax.$frm;
|
|
|
|
//--------------------------------------------------------------
|
|
sax.refreshProfileOrganisationsInfo = function (delay)
|
|
{
|
|
var $section = $('.sax-panel-section.ProfileOrganisations');
|
|
$section.removeClass('sax-edit').addClass('sax-populating');
|
|
$('.sax-property', $section).hide();
|
|
sax.showDataRefreshingMsg($section);
|
|
sax.refreshProfileOrganisations(sax.onRefreshProfileOrganisationsInfo);
|
|
}
|
|
sax.refreshProfileOrganisations = function (callbackFn)
|
|
{
|
|
//sax.debug('refreshProfileOrganisations');
|
|
delete sax.page.profileOrganisationsChanged;
|
|
sax.ajax.profileOrganisations = sax.ajax.profileOrganisations || { url: sax.url.base + 'Account/Ajax/GetProfileOrganisations', formId: 'frmNavigate', noWaitIcon: true };
|
|
sax.ajax.profileOrganisations.callbackFn = callbackFn;
|
|
sax.doAjaxRequest(sax.ajax.profileOrganisations, 50);
|
|
}
|
|
sax.onRefreshProfileOrganisationsInfo = function (response)
|
|
{
|
|
//sax.debug('onRefreshProfileOrganisationsInfo', response);
|
|
if (!response || !response.success) return;
|
|
var $section = $('.sax-panel-section.ProfileOrganisations');
|
|
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
|
|
|
let items = response.organisations;
|
|
if (!items) return;
|
|
let $items = $('.sax-panel-results.Organisations', $section).empty();
|
|
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', $section);
|
|
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
|
{
|
|
let item = items[itemIdx];
|
|
let $item = $tmpl.clone().prop('id', 'ProOrg_' + item.id);
|
|
$('.OrganisationName', $item).text(item.name);
|
|
$('.OrganisationSport', $item).text(item.sportName);
|
|
$('.OrganisationRegion', $item).text(item.regionName);
|
|
$('.OrganisationMemberCount', $item).toggle(!!item.memberCount).find('.MemberCount').text(item.memberCount);
|
|
$('.OrganisationOpportunityCount', $item).toggle(!!item.opportunityCount).find('.MemberCount').text(item.opportunityCount);
|
|
$items.append($item);
|
|
}
|
|
$items.show();
|
|
sax.showNoInfoMsg($section);
|
|
$section.removeClass('sax-populating');
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
$(function ()
|
|
{
|
|
});
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
}(window, window.document));
|
|
|
|
/* The End */ |