v1.2.6.3
This commit is contained in:
@@ -420,17 +420,14 @@
|
||||
{
|
||||
var $frmCtrls = $('.sax-form-control', $(context || doc.body)).removeClass('sax-error');
|
||||
sax.clearControlErrors(context);
|
||||
var values = (controlValues || []);
|
||||
var valuesLen = values.length;
|
||||
for (var valIdx = 0; valIdx < (controlValues || []).length; valIdx++)
|
||||
for (let ctrlValue of controlValues || [])
|
||||
{
|
||||
let ctrlValue = controlValues[valIdx];
|
||||
$frmCtrls.each(function (idx, frmCtrl)
|
||||
{
|
||||
var $frmCtrl = $(frmCtrl);
|
||||
var $ctrl = $('input,textarea,select', $frmCtrl);
|
||||
if ($ctrl.prop('name') != ctrlValue.controlName) return;
|
||||
if (ctrlValue.value)
|
||||
if (!$frmCtrl.hasClass(ctrlValue.controlName)) return;
|
||||
var $ctrl = $('sax-input,sax-textarea,sax-select', $frmCtrl);
|
||||
if ($ctrl.length && sax.isDef(ctrlValue.value))
|
||||
$ctrl.val(ctrlValue.value);
|
||||
if (ctrlValue.error)
|
||||
$frmCtrl.addClass('sax-error').find('.sax-message').text(ctrlValue.error);
|
||||
|
||||
@@ -25,16 +25,14 @@
|
||||
{
|
||||
//sax.debug('doRefreshResults', response);
|
||||
delete op.awaitingRefreshResponse;
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
var $msgs = $('.sax-panel-messages', $pnl.results).hide().empty();
|
||||
var $items = $('.sax-panel-item-list', $pnl.results).hide().empty();
|
||||
sax.refreshPaging(response, '#frmOrganisationFilter', op.refreshResults);
|
||||
if (!response.success) return;
|
||||
sax.refreshPaging(response, '#frmOrganisationFilter', op.refreshResults);
|
||||
// Reference data.
|
||||
op.data.contactMethods = response.contactMethods;
|
||||
if (response.defaultStatusCode) op.data.defaultStatusCode = response.defaultStatusCode;
|
||||
if (response.statuses)
|
||||
sax.populateSelectCodeDesc('#cbOrganisationStatus', response.statuses);
|
||||
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();
|
||||
@@ -65,10 +63,12 @@
|
||||
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'));
|
||||
$item.on('click', '.sax-header .sax-action.sax-item-update', fnUpdItm).on('dblclick', fnUpdItm);
|
||||
$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'));
|
||||
}
|
||||
$('.sax-burger', $item).toggle(!!$('.sax-dropdown-item', $mnu).length);
|
||||
$('.sax-panel-messages', $pnl.results).hide().empty();
|
||||
@@ -101,6 +101,16 @@
|
||||
return $opt.find('div.sax-label').text(lbl).end().on('click', fn).addClass(cls);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
op.onClickMemberCount = function (id)
|
||||
{
|
||||
if (!(id * 1)) return;
|
||||
sax.doPleaseWait();
|
||||
let frm = $('#frmOrganisationId');
|
||||
$('.OrganisationId', frm).val(id);
|
||||
frm.prop('action', sax.url.base + 'Organisation/Members').submit();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
op.getFilterSport = function ()
|
||||
{
|
||||
@@ -242,6 +252,7 @@
|
||||
{
|
||||
let frm = $frm.org;
|
||||
$('.OrganisationId,.OrganisationSportId,.OrganisationRegionIdCountry,input[type="text"],textarea,select', frm).val('');
|
||||
$pnl.tblconMths.empty();
|
||||
$('.OrganisationStatus', frm).val(op.data.defaultStatusCode);
|
||||
sax.clearControlErrors();
|
||||
}
|
||||
@@ -289,17 +300,7 @@
|
||||
$pnl.tblconMths.append(op.getConMthEl(conMth.method, conMth.methodCaption, conMth.value));
|
||||
}
|
||||
op.sortConMths();
|
||||
// Address.
|
||||
let address = item.address || {};
|
||||
$('input.OrganisationAddressId', $frm.org).val(address.id);
|
||||
$('input.OrganisationAddressLine1', $frm.org).val(address.line1);
|
||||
$('input.OrganisationAddressLine2', $frm.org).val(address.line2);
|
||||
$('input.OrganisationAddressLine3', $frm.org).val(address.line3);
|
||||
$('input.OrganisationAddressTown', $frm.org).val(address.town);
|
||||
$('input.OrganisationAddressProvince', $frm.org).val(address.province);
|
||||
$('input.OrganisationAddressCountry', $frm.org).val(address.country);
|
||||
$('input.OrganisationAddressPostalCode', $frm.org).val(address.postalCode);
|
||||
sax.clearControlErrors();
|
||||
sax.clearControlErrors(frm);
|
||||
$dlg.organisation.dialog('option', 'title', sax.dlg.title.updateOrganisation);
|
||||
sax.openOrgDialog();
|
||||
}
|
||||
@@ -312,7 +313,7 @@
|
||||
}
|
||||
op.getUsedMths = function ()
|
||||
{
|
||||
return $('input[name="Organisation.ContactMethod"]', $frm.org).map(function () { return $(this).val(); }).get();
|
||||
return $('input[name="ContactMethod"]', $frm.org).map(function () { return $(this).val(); }).get();
|
||||
}
|
||||
op.addConMth = function ()
|
||||
{
|
||||
@@ -366,7 +367,7 @@
|
||||
op.onStoreItem = function (response)
|
||||
{
|
||||
//sax.debug('onStoreItem', response);
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
sax.refreshControlValues(response.controlValues, $frm.org);
|
||||
if (!response.success) return;
|
||||
$dlg.organisation.dialog('close');
|
||||
op.refreshItem(response.organisation);
|
||||
@@ -437,13 +438,53 @@
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
op.onClickMemberCount = function (id)
|
||||
op.updateItemImages = function (item, $item)
|
||||
{
|
||||
if (!(id * 1)) return;
|
||||
sax.doPleaseWait();
|
||||
let frm = $('#frmOrganisationId');
|
||||
$('.OrganisationId', frm).val(id);
|
||||
frm.prop('action', sax.url.base + 'Organisation/Members').submit();
|
||||
sax.debug('updateItemImages');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
op.updateItemAddress = function (item, $item)
|
||||
{
|
||||
sax.debug('updateItemAddress');
|
||||
$('.OrganisationId', $frm.orgId).val(item.id);
|
||||
op.ajax.updateItemAddr = op.ajax.updateItemAddr || { url: sax.url.base + 'Organisation/Ajax/GetItem', formId: 'frmOrganisationId', callbackFn: op.onUpdateItemAddress };
|
||||
sax.doAjaxRequest(op.ajax.updateItemAddr, 50);
|
||||
}
|
||||
op.onUpdateItemAddress = function (response)
|
||||
{
|
||||
sax.debug('onUpdateItemAddress', response);
|
||||
if (!response.success) return;
|
||||
// Address.
|
||||
let item = response.organisation;
|
||||
let address = item.address || {};
|
||||
let frm = $frm.orgAddr;
|
||||
$('input.OrganisationId', frm).val(item.id);
|
||||
$('.OrganisationName', frm).val(item.name);
|
||||
$('input.AddressId', frm).val(address.id);
|
||||
$('input.AddressLine1', frm).val(address.line1);
|
||||
$('input.AddressLine2', frm).val(address.line2);
|
||||
$('input.AddressLine3', frm).val(address.line3);
|
||||
$('input.AddressTown', frm).val(address.town);
|
||||
$('input.AddressProvince', frm).val(address.province);
|
||||
$('input.AddressCountry', frm).val(address.country);
|
||||
$('input.AddressPostalCode', frm).val(address.postalCode);
|
||||
sax.clearControlErrors(frm);
|
||||
sax.openDialog($dlg.orgAddr, 640, 480);
|
||||
}
|
||||
op.storeItemAddress = function ()
|
||||
{
|
||||
sax.debug('storeItemAddress');
|
||||
op.ajax.storeItemAddr = op.ajax.storeItemAddr || { url: sax.url.base + 'Organisation/Ajax/StoreItem', formId: 'frmOrganisationAddress', callbackFn: op.onStoreItemAddress };
|
||||
sax.doAjaxRequest(op.ajax.storeItemAddr, 50);
|
||||
}
|
||||
op.onStoreItemAddress = function (response)
|
||||
{
|
||||
sax.debug('onStoreItemAddress', response);
|
||||
sax.refreshControlValues(response.controlValues, $frm.orgAddr);
|
||||
if (!response.success) return;
|
||||
$dlg.orgAddr.dialog('close');
|
||||
op.refreshItem(response.organisation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -459,13 +500,15 @@
|
||||
$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.orgId = $('#frmOrganisationId');
|
||||
$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);
|
||||
@@ -474,11 +517,21 @@
|
||||
$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);
|
||||
|
||||
// Activate Organisation Address dialog and form.
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { op.storeItemAddress(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.orgAddr = $('#dlgOrganisationAddress').dialog(opt);
|
||||
|
||||
$frm.orgAddr = $('#frmOrganisationAddress');
|
||||
$frm.orgAddr.on('input', '.sax-input, .sax-textarea', function () { sax.clearControlError(this); }).on('change', '.sax-select', function () { sax.clearControlError(this); });
|
||||
|
||||
setTimeout(op.refreshResults, 250);
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
{
|
||||
//sax.debug('doRefreshResults', response);
|
||||
delete sax.awaitingRefreshResponse;
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
var $results = $('.sax-panel-results');
|
||||
var $msgs = $('.sax-panel-messages', $results).hide().empty();
|
||||
var $items = $('.sax-panel-item-list', $results).hide().empty();
|
||||
|
||||
Reference in New Issue
Block a user