v1.0.4.0
This commit is contained in:
+4
-4
@@ -4,18 +4,18 @@
|
||||
|
||||
/* Panels */
|
||||
|
||||
#dlgOrganisationSelection .sax-panel-filter
|
||||
#dlgSelectOrganisation .sax-panel-filter
|
||||
{
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
#dlgOrganisationSelection .sax-panel-filter .sax-content
|
||||
#dlgSelectOrganisation .sax-panel-filter .sax-content
|
||||
{
|
||||
margin:4px 8px;
|
||||
padding:2px 4px;
|
||||
}
|
||||
|
||||
#dlgOrganisationSelection .sax-selection-results.Organisations
|
||||
#dlgSelectOrganisation .sax-selection-results.Organisations
|
||||
{
|
||||
padding:2px 0;
|
||||
background-color:#f0f0f0;
|
||||
@@ -23,7 +23,7 @@
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
#dlgOrganisationSelection.sax-form button.sax-button
|
||||
#dlgSelectOrganisation.sax-form button.sax-button
|
||||
{
|
||||
margin: 4px 0;
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
}
|
||||
sax.doRefreshResults = function (response)
|
||||
{
|
||||
sax.debug('doRefreshResults', response);
|
||||
//sax.debug('doRefreshResults', response);
|
||||
delete sax.awaitingRefreshResponse;
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
var $results = $('.sax-panel-results');
|
||||
@@ -62,12 +62,12 @@
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectOrganisation = function ()
|
||||
sax.selectFilterOrganisation = function ()
|
||||
{
|
||||
//sax.debug('sax.selectOrganisation');
|
||||
sax.organisationSelection.fn.openDialog({ caption: sax.dlg.title.selectOrganisation, fnCallback: sax.onOrganisationSelected });
|
||||
//sax.debug('sax.selectFilterOrganisation');
|
||||
sax.selectOrganisation.fn.openDialog({ caption: sax.dlg.title.selectOrganisation, fnCallback: sax.onFilterOrganisationSelected });
|
||||
}
|
||||
sax.onOrganisationSelected = function (id, name)
|
||||
sax.onFilterOrganisationSelected = function (id, name)
|
||||
{
|
||||
//sax.debug('sax.onOrganisationSelected', id, name);
|
||||
$('#frmMemberFilter #ifFilterOrganisationId').val(id);
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Admin - User page scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let os = sax.organisationSelection = sax.organisationSelection || { data: {}, fn: {}, $dlg: {}, itemIdPrefix: 'Org_' };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
/*
|
||||
* Organisation selection config:
|
||||
* - caption - dialog title.
|
||||
* - width: preferred dialog width (default: 400).
|
||||
* - height: preferred dialog height (default: 400).
|
||||
* - fnCallback - method to call on completion.
|
||||
*/
|
||||
os.fn.openDialog = function (cfg)
|
||||
{
|
||||
//sax.debug('openDialog', cfg);
|
||||
os.fn.init();
|
||||
os.cfg = cfg;
|
||||
sax.openDialog(os.$dlg.dialog('option', { title: cfg.caption || os.dlgTitleSelectOrganisation || 'Select Organisation' }), os.cfg.width || 480, os.cfg.height || 600);
|
||||
}
|
||||
os.fn.refreshOrganisations = function (delay)
|
||||
{
|
||||
//sax.debug('refreshOrganisations');
|
||||
os.ajaxRefreshResults = os.ajaxRefreshResults || { url: sax.url.base + 'Organisation/Ajax/GetList', formId: 'frmOrganisationSelectionFilter', callbackFn: os.fn.doRefreshResults };
|
||||
sax.doAjaxRequest(os.ajaxRefreshResults, delay || 50);
|
||||
}
|
||||
os.fn.doRefreshResults = function (response)
|
||||
{
|
||||
//sax.debug('os.doRefreshResults', response);
|
||||
if (!response.success) return;
|
||||
let $results = $('.sax-selection-results.Organisations', os.$dlg).empty().hide();
|
||||
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', os.$dlg);
|
||||
let items = response.organisations;
|
||||
if (items)
|
||||
{
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
let $item = $tmpl.clone().prop('id', os.itemIdPrefix + item.id).on('click', function () { os.fn.onClickOrganisation(item); }).on('dblclick', function () { os.fn.onDblClickOrganisation(item); });
|
||||
$('.Name', $item).text(item.name);
|
||||
$results.append($item);
|
||||
}
|
||||
}
|
||||
$results.fadeIn(200);
|
||||
}
|
||||
os.fn.onClickOrganisation = function (item)
|
||||
{
|
||||
//sax.debug('onClickOrganisation', item);
|
||||
os.data.item = item;
|
||||
$('.sax-panel-item.Organisation', os.$dlg).removeClass('sel');
|
||||
$('.sax-panel-item.Organisation#' + os.itemIdPrefix + item.id, os.$dlg).addClass('sel');
|
||||
}
|
||||
os.fn.onDblClickOrganisation = function (item)
|
||||
{
|
||||
//sax.debug('onDblClickCode', item);
|
||||
os.data.item = item;
|
||||
os.fn.confirmSelection();
|
||||
}
|
||||
os.fn.confirmSelection = function ()
|
||||
{
|
||||
//sax.debug('confirmSelection', os.data.item);
|
||||
if (!os.data.item) return;
|
||||
if (os.cfg.fnCallback) os.cfg.fnCallback(os.data.item.id, os.data.item.name);
|
||||
os.$dlg.dialog('close');
|
||||
delete os.cfg;
|
||||
delete os.data.item;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
os.fn.init = function ()
|
||||
{
|
||||
if (!os.$dlg) return;
|
||||
var opt = sax.dlgOpts();
|
||||
opt.open = function () { os.fn.refreshOrganisations(200); };
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { os.fn.confirmSelection(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
os.$dlg = $('#dlgOrganisationSelection').dialog(opt);
|
||||
|
||||
$('.sax-input.FilterOrganisation', os.$dlg).on('input', function () { sax.organisationSelection.fn.refreshOrganisations(250); });
|
||||
}
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -98,6 +98,10 @@
|
||||
//sax.debug('storeSelectCode', sc.cfg, sc.selectedCodes);
|
||||
if (sc.cfg.fnCallback) sc.cfg.fnCallback(sc.selectedCodes);
|
||||
sc.$dlg.dialog('close');
|
||||
sc.fn.cleanUp();
|
||||
}
|
||||
sc.fn.cleanUp = function ()
|
||||
{
|
||||
delete sc.cfg;
|
||||
delete sc.selectedCodes;
|
||||
}
|
||||
@@ -108,7 +112,7 @@
|
||||
if (!sc.$dlg) return;
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sc.fn.storeSelectCode(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { sc.fn.cleanUp(); $(this).dialog('close'); };
|
||||
sc.$dlg = $('#dlgSelectCode').dialog(opt);
|
||||
$('.sax-button.Select', sc.$dlg).on('click', function () { sc.fn.onClickSelect(); });
|
||||
$('.sax-button.Remove', sc.$dlg).on('click', function () { sc.fn.onClickRemove(); });
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Admin - User page scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let so = sax.selectOrganisation = sax.selectOrganisation || { data: {}, fn: {}, $dlg: {}, itemIdPrefix: 'Org_' };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
/*
|
||||
* Organisation selection config:
|
||||
* - caption - dialog title.
|
||||
* - width: preferred dialog width (default: 400).
|
||||
* - height: preferred dialog height (default: 400).
|
||||
* - fnCallback - method to call on completion.
|
||||
*/
|
||||
so.fn.openDialog = function (cfg)
|
||||
{
|
||||
//sax.debug('openDialog', cfg);
|
||||
so.fn.init();
|
||||
so.cfg = cfg;
|
||||
sax.openDialog(so.$dlg.dialog('option', { title: cfg.caption || so.dlgTitleSelectOrganisation || 'Select Organisation' }), so.cfg.width || 480, so.cfg.height || 600);
|
||||
}
|
||||
so.fn.refreshOrganisations = function (delay)
|
||||
{
|
||||
//sax.debug('refreshOrganisations');
|
||||
$('.sax-selection-results.Organisations', so.$dlg).empty().hide();
|
||||
so.ajaxRefreshResults = so.ajaxRefreshResults || { url: sax.url.base + 'Organisation/Ajax/GetList', formId: 'frmSelectOrganisationFilter', callbackFn: so.fn.doRefreshResults };
|
||||
sax.doAjaxRequest(so.ajaxRefreshResults, delay || 50);
|
||||
}
|
||||
so.fn.doRefreshResults = function (response)
|
||||
{
|
||||
//sax.debug('so.doRefreshResults', response);
|
||||
if (!response.success) return;
|
||||
let $results = $('.sax-selection-results.Organisations', so.$dlg).empty().hide();
|
||||
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', so.$dlg);
|
||||
let items = response.organisations;
|
||||
if (items)
|
||||
{
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
let $item = $tmpl.clone().prop('id', so.itemIdPrefix + item.id).on('click', function () { so.fn.onClickOrganisation(item); }).on('dblclick', function () { so.fn.onDblClickOrganisation(item); });
|
||||
$('.Name', $item).text(item.name);
|
||||
$results.append($item);
|
||||
}
|
||||
}
|
||||
$results.fadeIn(200);
|
||||
}
|
||||
so.fn.onClickOrganisation = function (item)
|
||||
{
|
||||
//sax.debug('onClickOrganisation', item);
|
||||
so.data.item = item;
|
||||
$('.sax-panel-item.Organisation', so.$dlg).removeClass('sel');
|
||||
$('.sax-panel-item.Organisation#' + so.itemIdPrefix + item.id, so.$dlg).addClass('sel');
|
||||
}
|
||||
so.fn.onDblClickOrganisation = function (item)
|
||||
{
|
||||
//sax.debug('onDblClickCode', item);
|
||||
so.data.item = item;
|
||||
so.fn.confirmSelection();
|
||||
}
|
||||
so.fn.confirmSelection = function ()
|
||||
{
|
||||
//sax.debug('confirmSelection', so.data.item);
|
||||
if (!so.data.item) return;
|
||||
if (so.cfg.fnCallback) so.cfg.fnCallback(so.data.item.id, so.data.item.name);
|
||||
so.$dlg.dialog('close');
|
||||
so.fn.cleanUp();
|
||||
}
|
||||
so.fn.cleanUp = function ()
|
||||
{
|
||||
$('.sax-selection-results.Organisations', so.$dlg).empty().hide();
|
||||
delete so.cfg;
|
||||
delete so.data.item;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
so.fn.init = function ()
|
||||
{
|
||||
if (!so.$dlg) return;
|
||||
var opt = sax.dlgOpts();
|
||||
opt.open = function () { so.fn.refreshOrganisations(200); };
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { so.fn.confirmSelection(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { so.fn.cleanUp(); $(this).dialog('close'); };
|
||||
so.$dlg = $('#dlgSelectOrganisation').dialog(opt);
|
||||
|
||||
$('.sax-input.FilterOrganisation', so.$dlg).on('input', function () { sax.selectOrganisation.fn.refreshOrganisations(250); });
|
||||
}
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
Reference in New Issue
Block a user