505 lines
20 KiB
JavaScript
505 lines
20 KiB
JavaScript
/*
|
|
* Admin - Organisation page scripts.
|
|
*/
|
|
|
|
(function (win, doc, undef)
|
|
{
|
|
"use strict";
|
|
let op = sax.mdl.organisations = { data: {}, ajax: {} };
|
|
let $pnl = op.$pnl = {}, $frm = op.$frm = {}, $dlg = op.$dlg = {};
|
|
|
|
//--------------------------------------------------------------
|
|
op.refreshResults = function (delay)
|
|
{
|
|
if (!op.awaitingRefreshResponse)
|
|
{
|
|
var $items = $('.sax-panel-item-list', $pnl.results).fadeOut(200).empty();
|
|
var $msgs = $('.sax-panel-messages', $pnl.results).hide().empty().append($('<div class="sax-message">' + sax.msg.dataQuerying + '</div>')).fadeIn(200);
|
|
}
|
|
op.ajax.refreshResults = op.ajax.refreshResults || { url: sax.url.base + 'Organisation/Ajax/GetList', formId: 'frmOrganisationFilter', callbackFn: op.doRefreshResults };
|
|
sax.doAjaxRequest(op.ajax.refreshResults, delay || 50);
|
|
op.awaitingRefreshResponse = true;
|
|
}
|
|
op.doRefreshResults = function (response)
|
|
{
|
|
//sax.debug('doRefreshResults', response);
|
|
delete op.awaitingRefreshResponse;
|
|
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', op.refreshResults);
|
|
// Reference data.
|
|
op.data.contactMethods = response.contactMethods;
|
|
op.data.defaultStatusCode = response.defaultStatusCode;
|
|
sax.populateSelectCodeDesc('#cbOrganisationStatus', response.statuses);
|
|
// Menu.
|
|
var $bgr = $('.sax-burger', $pnl.filter).hide();
|
|
var $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
|
|
$mnu.append(op.getFilterMenuOption(sax.lbl.refresh, function () { op.refreshResults(); }, 'sax-refresh'));
|
|
$mnu.append(op.getFilterMenuOption(sax.lbl.create, function () { op.createItem(); }, 'sax-add'));
|
|
$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(op.populateItem(op.getItemTemplate(), items[itemIdx]));
|
|
$items.fadeIn(50);
|
|
}
|
|
op.getItemIdProp = function (id)
|
|
{
|
|
return 'Org_' + id;
|
|
}
|
|
op.populateItem = function ($item, item)
|
|
{
|
|
//sax.debug('populateItem', item);
|
|
if (!item) return;
|
|
$item.prop('id', op.getItemIdProp(item.id));
|
|
$('img.OrganisationLogo', $item).prop('src', item.logoImageUrl).toggle(!!item.logoImageUrl);
|
|
$('.OrganisationName', $item).text(item.name);
|
|
$('.OrganisationType', $item).text(item.typeDesc);
|
|
$('.OrganisationCategory', $item).text(item.categoryDesc);
|
|
$('.OrganisationSport', $item).text(item.sportName);
|
|
$('.OrganisationRegion', $item).text(item.regionPrimary.name);
|
|
$('.OrganisationMemberCount', $item).on('click', function () { op.onClickMemberCount(item.id); }).find('.MemberCount').text(item.memberCount);
|
|
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
|
|
$('.sax-caption .sax-action').toggleClass('sax-action', !item.deleted);
|
|
let $mnu = $('ul.sax-dropdown-menu', $item).empty();
|
|
if (!item.deleted)
|
|
{
|
|
let fnUpdItm = function () { op.updateItem(item, $item) };
|
|
$item.on('click', '.sax-header .sax-action.sax-item-update', fnUpdItm).on('dblclick', fnUpdItm);
|
|
$mnu.append(op.getItemMenuOption(sax.lbl.edit, fnUpdItm, 'sax-edit'));
|
|
if (item.awaiting)
|
|
$mnu.append(op.getItemMenuOption(sax.lbl.activate, function () { op.activateItem(item) }, 'sax-unlock'));
|
|
$mnu.append(op.getItemMenuOption(sax.lbl.images, function () { op.updateItemImages(item, $item) }, 'sax-image'));
|
|
$mnu.append(op.getItemMenuOption(sax.lbl.location, function () { op.updateItemAddress(item, $item) }, 'sax-location'));
|
|
$mnu.append(op.getItemMenuOption(sax.lbl.associations, function () { op.viewItemAssociations(item, $item) }, 'sax-network'));
|
|
}
|
|
$('.sax-burger', $item).toggle(!!$('.sax-dropdown-item', $mnu).length);
|
|
$('.sax-panel-messages', $pnl.results).hide().empty();
|
|
return $item;
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.getFilterDropdownTemplate = function ()
|
|
{
|
|
return $('.sax-panel-item-template .sax-dropdown-menu.OrganisationFilter li.sax-dropdown-item', $pnl.filter).clone();
|
|
}
|
|
op.getItemTemplate = function ()
|
|
{
|
|
return $('.sax-panel-item-template .sax-panel-item.Organisation', $pnl.results).clone();
|
|
}
|
|
op.getItemDropdownTemplate = function ()
|
|
{
|
|
return $('.sax-panel-item-template .sax-dropdown-menu.Organisation li.sax-dropdown-item', $pnl.results).clone();
|
|
}
|
|
op.getFilterMenuOption = function (lbl, fn, cls)
|
|
{
|
|
return op.getMenuOption(op.getFilterDropdownTemplate(), lbl, fn, cls);
|
|
}
|
|
op.getItemMenuOption = function (lbl, fn, cls)
|
|
{
|
|
return op.getMenuOption(op.getItemDropdownTemplate(), lbl, fn, cls);
|
|
}
|
|
op.getMenuOption = function ($opt, lbl, fn, cls)
|
|
{
|
|
return $opt.find('div.sax-label').text(lbl).end().on('click', fn).addClass(cls);
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.getFilterSport = function ()
|
|
{
|
|
let frm = $frm.filter;
|
|
return { id: $('.FilterOrganisationSportId', frm).val(), name: $('.FilterOrganisationSportCaption', frm).val() };
|
|
}
|
|
op.selectFilterSport = function ()
|
|
{
|
|
if (!op.data.sports)
|
|
op.populateSports(op.showSelectFilterSport);
|
|
else op.showSelectFilterSport();
|
|
}
|
|
op.showSelectFilterSport = function ()
|
|
{
|
|
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, itemId: op.getFilterSport().id, items: op.data.sports, fnCallback: op.onFilterSportSelected });
|
|
}
|
|
op.onFilterSportSelected = function (spt)
|
|
{
|
|
let frm = $frm.filter;
|
|
$('.FilterOrganisationSportId', frm).val(spt.id);
|
|
$('.FilterOrganisationSportCaption', frm).val(spt.name);
|
|
op.refreshResults();
|
|
}
|
|
op.clearFilterSport = function ()
|
|
{
|
|
$('.FilterOrganisationSportId,.FilterOrganisationSportCaption', $frm.filter).val('');
|
|
op.refreshResults();
|
|
}
|
|
op.populateSports = function (nextFn)
|
|
{
|
|
let handleResponse = function (response)
|
|
{
|
|
if (response && response.success && response.sports)
|
|
op.data.sports = response.sports;
|
|
if (nextFn) nextFn();
|
|
}
|
|
op.ajax.sports = op.ajax.sports || { url: sax.url.base + 'Sport/Ajax/GetList', formId: 'frmNavigate', callbackFn: handleResponse };
|
|
sax.doAjaxRequest(op.ajax.sports, 50);
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.selectOrgSport = function ()
|
|
{
|
|
if (!op.data.sports)
|
|
op.populateSports(op.showSelectOrgSport);
|
|
else op.showSelectOrgSport();
|
|
}
|
|
op.showSelectOrgSport = function ()
|
|
{
|
|
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, itemId: $('.OrganisationSportId', $frm.org).val(), items: op.data.sports, fnCallback: op.onOrgSportSelected });
|
|
}
|
|
op.onOrgSportSelected = function (spt)
|
|
{
|
|
let frm = $frm.org;
|
|
$('.OrganisationSportId', frm).val(spt.id);
|
|
$('.OrganisationSportCaption', frm).val(spt.name);
|
|
sax.clearControlError($('.OrganisationSportId', frm));
|
|
}
|
|
op.clearOrgSport = function ()
|
|
{
|
|
$('.OrganisationSportId,.OrganisationSportCaption', $frm.org).val('');
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.getFilterRegion = function ()
|
|
{
|
|
let frm = $frm.filter;
|
|
return { id: $('.FilterOrganisationRegionId', frm).val(), name: $('.FilterOrganisationRegionCaption', frm).val() };
|
|
}
|
|
op.selectFilterRegion = function ()
|
|
{
|
|
if (!op.data.regions)
|
|
op.populateRegions(op.showSelectFilterRegion);
|
|
else op.showSelectFilterRegion();
|
|
}
|
|
op.showSelectFilterRegion = function ()
|
|
{
|
|
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectFilterRegion, itemId: op.getFilterRegion().id, items: op.data.regions, fnCallback: op.onFilterRegionSelected });
|
|
}
|
|
op.onFilterRegionSelected = function (rgn)
|
|
{
|
|
//sax.debug('onFilterRegionSelected', rgn);
|
|
let frm = $frm.filter;
|
|
$('.FilterOrganisationRegionId', frm).val(rgn.id);
|
|
$('.FilterOrganisationRegionCaption', frm).val(rgn.name);
|
|
op.refreshResults();
|
|
}
|
|
op.clearFilterRegion = function ()
|
|
{
|
|
$('.FilterOrganisationRegionId,.FilterOrganisationRegionCaption', $frm.filter).val('');
|
|
op.refreshResults();
|
|
}
|
|
op.populateRegions = function (nextFn)
|
|
{
|
|
let handleResponse = function (response)
|
|
{
|
|
if (response && response.success && response.regions)
|
|
op.data.regions = response.regions;
|
|
if (nextFn) nextFn();
|
|
}
|
|
op.ajax.regions = op.ajax.regions || { url: sax.url.base + 'Region/Ajax/GetList', formId: 'frmNavigate', callbackFn: handleResponse };
|
|
sax.doAjaxRequest(op.ajax.regions, 50);
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.selectOrgRegion = function ()
|
|
{
|
|
if (!op.data.regions)
|
|
op.populateRegions(op.showSelectOrgRegion);
|
|
else op.showSelectOrgRegion();
|
|
}
|
|
op.showSelectOrgRegion = function ()
|
|
{
|
|
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectRegion, itemId: $('.OrganisationRegionIdPrimary', $frm.org).val(), items: op.data.regions, fnCallback: op.onOrgRegionSelected });
|
|
}
|
|
op.onOrgRegionSelected = function (rgn)
|
|
{
|
|
//sax.debug('onRegionSelected', rgn);
|
|
let frm = $frm.org;
|
|
$('.OrganisationRegionIdPrimary', frm).val(rgn.id);
|
|
$('.OrganisationRegionNamePrimary', frm).val(rgn.name);
|
|
sax.clearControlError($('.OrganisationRegionIdPrimary', frm));
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.createItem = function ()
|
|
{
|
|
op.clearItem();
|
|
let spt = op.getFilterSport();
|
|
if (spt.id && spt.name)
|
|
{
|
|
$('.OrganisationSportId', $frm.org).val(spt.id);
|
|
$('.OrganisationSportCaption', $frm.org).val(spt.name);
|
|
}
|
|
$dlg.organisation.dialog('option', 'title', sax.dlg.title.createOrganisation);
|
|
sax.openOrgDialog();
|
|
}
|
|
op.clearItem = function ()
|
|
{
|
|
let frm = $frm.org;
|
|
$('.OrganisationId,.OrganisationSportId,.OrganisationRegionIdPrimary,input[name="ContactMethods"],input[type="text"],textarea,select', frm).val('');
|
|
$pnl.tblconMths.empty();
|
|
$('.OrganisationStatus', frm).val(op.data.defaultStatusCode);
|
|
sax.clearControlErrors();
|
|
}
|
|
sax.openOrgDialog = function ()
|
|
{
|
|
sax.openDialog($dlg.organisation, 640, 720);
|
|
}
|
|
sax.onOpenOrgDialog = function ()
|
|
{
|
|
$('textarea').scrollTop(0);
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.updateItem = function (item, $item)
|
|
{
|
|
$('.OrganisationId', $frm.orgId).val(item.id);
|
|
op.ajax.updateItem = op.ajax.updateItem || { url: sax.url.base + 'Organisation/Ajax/GetItem', formId: 'frmOrganisationId', callbackFn: op.onUpdateItem };
|
|
sax.doAjaxRequest(op.ajax.updateItem, 50);
|
|
}
|
|
op.onUpdateItem = function (response)
|
|
{
|
|
//sax.debug('onUpdateItem', response);
|
|
op.clearItem();
|
|
if (!response.success) return;
|
|
let item = response.organisation;
|
|
let frm = $frm.org;
|
|
$('.OrganisationId', frm).val(item.id);
|
|
$('.OrganisationName', frm).val(item.name);
|
|
$('.OrganisationType', frm).val(item.typeCode);
|
|
$('.OrganisationCategory', frm).val(item.categoryCode);
|
|
$('.OrganisationSportId', frm).val(item.sportId);
|
|
$('.OrganisationSportCaption', frm).val(item.sportName);
|
|
$('.OrganisationRegionIdPrimary', frm).val(item.regionPrimary.id);
|
|
$('.OrganisationRegionNamePrimary', frm).val(item.regionPrimary.name);
|
|
$('.OrganisationAbout', frm).val(item.about);
|
|
$('.OrganisationFacilities', frm).val(item.facilities);
|
|
$('.OrganisationNotes', frm).val(item.notes);
|
|
$('.OrganisationStatus', frm).val(item.statusCode);
|
|
// Contact methods.
|
|
$pnl.tblconMths.empty();
|
|
let conMths = item.contactMethods || [];
|
|
for (let idx = 0; idx < conMths.length; idx++)
|
|
{
|
|
let conMth = conMths[idx];
|
|
$pnl.tblconMths.append(op.getConMthEl(conMth.method, conMth.methodCaption, conMth.value));
|
|
}
|
|
op.sortConMths();
|
|
sax.clearControlErrors(frm);
|
|
$dlg.organisation.dialog('option', 'title', sax.dlg.title.updateOrganisation);
|
|
sax.openOrgDialog();
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.getConMthCfg = function (usedMths, mth, val)
|
|
{
|
|
let cfg = { fnCallback: op.applyConMth, methods: op.data.contactMethods, methodsUsed: usedMths, method: mth, value: val };
|
|
return cfg;
|
|
}
|
|
op.getUsedMths = function ()
|
|
{
|
|
return $('input[name="ContactMethod"]', $frm.org).map(function () { return $(this).val(); }).get();
|
|
}
|
|
op.addConMth = function ()
|
|
{
|
|
sax.editContactMethod(op.getConMthCfg(op.getUsedMths()));
|
|
}
|
|
op.editConMth = function (mth, val)
|
|
{
|
|
sax.editContactMethod(op.getConMthCfg(op.getUsedMths(), mth, val));
|
|
}
|
|
op.getConMthId = function (mth)
|
|
{
|
|
return 'ConMth_' + mth;
|
|
}
|
|
op.applyConMth = function (mth, mthDsc, val)
|
|
{
|
|
//sax.debug('applyConMth(\'' + mth + '\',\'' + mthDsc + '\',\'' + val + '\')');
|
|
$('#' + op.getConMthId(mth), $pnl.conMths).remove();
|
|
$pnl.tblconMths.append(op.getConMthEl(mth, mthDsc, val));
|
|
op.sortConMths();
|
|
}
|
|
op.sortConMths = function ()
|
|
{
|
|
let $rows = $pnl.tblconMths.find('tr').detach().sort(function (a, b)
|
|
{
|
|
return $('.sax-label', a).text().localeCompare($('.sax-label', b).text());
|
|
}).appendTo($pnl.tblconMths);
|
|
$('input[name="ContactMethods"]', $pnl.conMths).val($rows.length);
|
|
}
|
|
op.getConMthEl = function (mth, mthDsc, val)
|
|
{
|
|
let $conMth = $('.sax-panel-item-template .ContactMethod', $pnl.conMths).clone().prop('id', op.getConMthId(mth));
|
|
$('.sax-label', $conMth).text(mthDsc);
|
|
$('.sax-value', $conMth).text(val);
|
|
$('input[name="ContactMethod"]', $conMth).val(mth);
|
|
$('input[name="ContactValue"]', $conMth).val(val);
|
|
$conMth.on('click', '.sax-action.sax-edit', function () { op.editConMth(mth, val); });
|
|
$conMth.on('click', '.sax-action.sax-remove', function () { op.clearConMth(mth); });
|
|
return $conMth;
|
|
}
|
|
op.clearConMth = function (mth)
|
|
{
|
|
$('#' + op.getConMthId(mth), $pnl.conMths).remove();
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.storeItem = function ()
|
|
{
|
|
op.ajax.storeItem = op.ajax.storeItem || { url: sax.url.base + 'Organisation/Ajax/StoreItem', formId: 'frmOrganisation', callbackFn: op.onStoreItem };
|
|
sax.doAjaxRequest(op.ajax.storeItem, 50);
|
|
}
|
|
op.onStoreItem = function (response)
|
|
{
|
|
//sax.debug('onStoreItem', response);
|
|
sax.refreshControlValues(response.controlValues, $frm.org);
|
|
if (!response.success) return;
|
|
$dlg.organisation.dialog('close');
|
|
op.refreshItem(response.organisation);
|
|
}
|
|
op.refreshItem = function (item)
|
|
{
|
|
var $item = $('#' + op.getItemIdProp(item.id));
|
|
if (!$item.length)
|
|
{
|
|
$item = op.getItemTemplate();
|
|
$('.sax-panel-item-list', $pnl.results).prepend($item).show();
|
|
}
|
|
op.populateItem($item, item);
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.activateItem = function (item)
|
|
{
|
|
//sax.debug('activateItem(' + item.id + ')')
|
|
$('.OrganisationId', $frm.orgId).val(item.id);
|
|
op.ajax.getActivationInfo = op.ajax.getActivationInfo || { url: sax.url.base + 'Organisation/Ajax/GetActivationInfo', formId: 'frmOrganisationId', callbackFn: op.showActivationInfo };
|
|
sax.doAjaxRequest(op.ajax.getActivationInfo, 50);
|
|
}
|
|
op.showActivationInfo = function (response)
|
|
{
|
|
//sax.debug('showActivationInfo', response);
|
|
if (!response.success || !response.organisation) return;
|
|
let item = response.organisation;
|
|
let frm = $('#frmOrganisationActivation');
|
|
$('.OrganisationId', frm).val($('.OrganisationId', $frm.orgId).val());
|
|
let popItemValue = function (sel, val)
|
|
{
|
|
$(sel, frm).toggle(!!val).find('.sax-value').text(val);
|
|
}
|
|
popItemValue('.OrganisationName', item.name);
|
|
popItemValue('.OrganisationSport', item.sportName);
|
|
popItemValue('.OrganisationRegion', item.regionPrimary.name);
|
|
popItemValue('.OrganisationCategory', item.categoryDesc);
|
|
popItemValue('.OrganisationAddress', item.addressSummary);
|
|
let $orgMbrs = $('.OrganisationMembers', $dlg.activate).empty();
|
|
let $mbrTmpl = $('.sax-panel-item-template tr.sax-item.Member');
|
|
let members = response.members;
|
|
for (let idx = 0; idx < members.length; idx++)
|
|
{
|
|
let item = members[idx];
|
|
let $item = $mbrTmpl.clone();
|
|
$('.MemberId', $item).val(item.id);
|
|
$('.MemberActivate', $item).prop('name', 'MemberActivate_' + item.id)
|
|
$('.MemberEmail', $item).text(item.emailAddress);
|
|
$('.MemberName', $item).text(item.displayName);
|
|
$orgMbrs.append($item);
|
|
}
|
|
$('.MembersAwaitingActivation', $dlg.activate).toggle(!!members.length);
|
|
sax.openDialog($dlg.activate, 480, 420);
|
|
}
|
|
op.activateOrganisation = function ()
|
|
{
|
|
let frm = $('#frmOrganisationActivation');
|
|
op.ajax.activateOrganisation = op.ajax.activateOrganisation || { url: sax.url.base + 'Organisation/Ajax/Activate', formId: frm.prop('id'), callbackFn: op.handleAtivateResponse };
|
|
sax.doAjaxRequest(op.ajax.activateOrganisation, 50);
|
|
}
|
|
op.handleAtivateResponse = function (response)
|
|
{
|
|
//sax.debug('handleAtivateResponse', response);
|
|
if (!response.success) return;
|
|
$dlg.activate.dialog('close');
|
|
op.refreshItem(response.organisation);
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
op.onClickMemberCount = function (id)
|
|
{
|
|
if (!(id * 1)) return;
|
|
sax.doPleaseWait();
|
|
$('.OrganisationId', $frm.orgId).val(id);
|
|
$frm.orgId.prop('action', sax.url.base + 'Organisation/Members').submit();
|
|
}
|
|
|
|
op.updateItemImages = function (item, $item)
|
|
{
|
|
sax.mdl.organisationImages.updateItemImages(item, $item)
|
|
}
|
|
|
|
op.updateItemAddress = function (item, $item)
|
|
{
|
|
sax.mdl.organisationAddress.updateItemAddress(item, $item);
|
|
}
|
|
|
|
op.viewItemAssociations = function (item, $item)
|
|
{
|
|
if (!(item.id * 1)) return;
|
|
sax.doPleaseWait();
|
|
$('.OrganisationId', $frm.orgId).val(item.id);
|
|
$frm.orgId.prop('action', sax.url.base + 'Organisation/Associations').submit();
|
|
}
|
|
|
|
//--------------------------------------------------------------
|
|
$(function ()
|
|
{
|
|
$pnl.orgs = $('.sax-panel.Organisations');
|
|
$pnl.filter = $('.sax-panel-filter', $pnl.orgs);
|
|
$pnl.results = $('.sax-panel-results', $pnl.orgs);
|
|
|
|
$frm.filter = $('#frmOrganisationFilter');
|
|
$('.FilterOrganisation', $frm.filter).on('input', function () { op.refreshResults(250); });
|
|
$('.FilterOrganisationCategory,.FilterOrganisationStatusCategory', $frm.filter).on('change', function () { op.refreshResults(50); });
|
|
$frm.filter.on('dblclick', '.FilterOrganisationSportCaption', op.selectFilterSport).on('click', '.FilterSportSelect', op.selectFilterSport).on('click', '.FilterSportClear', op.clearFilterSport);
|
|
$frm.filter.on('dblclick', '.FilterOrganisationRegionCaption', op.selectFilterRegion).on('click', '.FilterRegionSelect', op.selectFilterRegion).on('click', '.FilterRegionClear', op.clearFilterRegion);
|
|
|
|
$frm.orgId = $('#frmOrganisationId');
|
|
|
|
// Organisation dialog and form.
|
|
var opt = sax.dlgOpts();
|
|
opt.open = sax.onOpenOrgDialog;
|
|
opt.buttons[sax.dlg.btn.ok] = function () { op.storeItem(); };
|
|
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
|
$dlg.organisation = $('#dlgOrganisation').dialog(opt);
|
|
|
|
$frm.org = $('#frmOrganisation');
|
|
$frm.org.on('input', '.sax-input, .sax-textarea', function () { sax.clearControlError(this); }).on('change', '.sax-select', function () { sax.clearControlError(this); });
|
|
$frm.org.on('dblclick', '.OrganisationSportCaption', op.selectOrgSport).on('click', '#pbSelectSport', op.selectOrgSport).on('click', '.OrganisationSportClear', op.clearOrgSport);
|
|
$frm.org.on('dblclick', '.OrganisationRegionNamePrimary', op.selectOrgRegion).on('click', '#pbSelectOrganisationRegionPrimary', op.selectOrgRegion);
|
|
$frm.org.on('click', '.ItemContactMethods .sax-action.sax-add', op.addConMth);
|
|
$pnl.conMths = $('.ItemContactMethods', $frm.org);
|
|
$pnl.tblconMths = $('table.sax-data', $pnl.conMths);
|
|
|
|
// Activate Organisation dialog.
|
|
var opt = sax.dlgOpts();
|
|
opt.buttons[sax.dlg.btn.ok] = function () { op.activateOrganisation(); };
|
|
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
|
$dlg.activate = $('#dlgOrganisationActivation').dialog(opt);
|
|
|
|
setTimeout(op.refreshResults, 250);
|
|
});
|
|
|
|
//--------------------------------------------------------------
|
|
}(window, window.document));
|
|
|
|
/* The End */ |