65 lines
2.5 KiB
JavaScript
65 lines
2.5 KiB
JavaScript
/*
|
|
* Account page scripts.
|
|
*/
|
|
|
|
(function (win, doc, undef)
|
|
{
|
|
"use strict";
|
|
let po = sax.mdl.profileOrganisations = sax.mdl.profileOrganisations || { $pnl: {}, $dlg: {}, $frm: {} };
|
|
let $pnl = po.$pnl, $dlg = po.$dlg, $frm = po.$frm;
|
|
|
|
//--------------------------------------------------------------
|
|
sax.refreshProfileOrganisationsInfo = function (delay)
|
|
{
|
|
$pnl.section.removeClass('sax-edit').addClass('sax-populating');
|
|
$('.sax-property', $pnl.section).hide();
|
|
sax.showDataRefreshingMsg($pnl.section);
|
|
sax.refreshProfileOrganisations(po.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);
|
|
}
|
|
po.onRefreshProfileOrganisationsInfo = function (response)
|
|
{
|
|
sax.debug('onRefreshProfileOrganisationsInfo', response);
|
|
if (!response || !response.success) return;
|
|
$('.sax-message', $pnl.section).stop(true, false).fadeOut(200).empty();
|
|
|
|
let items = response.organisations;
|
|
if (!items) return;
|
|
let $items = $('.sax-panel-results.Organisations', $pnl.section).empty();
|
|
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', $pnl.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($pnl.section);
|
|
$pnl.section.removeClass('sax-populating');
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------
|
|
$(function ()
|
|
{
|
|
$pnl.section = $('.sax-panel-section.ProfileOrganisations');
|
|
});
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
}(window, window.document));
|
|
|
|
/* The End */ |