v1.0.4.0
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Core.Web.Admin.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// System - Ajax - Database controller
|
||||
//=======================================================================
|
||||
partial class SystemController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Database data.
|
||||
public class DatabaseTableData
|
||||
{
|
||||
public String Name { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Database Table List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_DatabaseTableList : AjaxResponse_Data
|
||||
{
|
||||
public List<DatabaseTableData> Tables { get; } = new List<DatabaseTableData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("System/Ajax/GetDatabaseTables")]
|
||||
public IActionResult Ajax_GetDatabaseTables(Model_Sport model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetDatabaseTables";
|
||||
String messageTitle = Localiser["system.caption.database"];
|
||||
AjaxResponse_DatabaseTableList responseData = new AjaxResponse_DatabaseTableList();
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Core.Web.Admin.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// System - Ajax - Database controller
|
||||
//=======================================================================
|
||||
partial class SystemController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Database data.
|
||||
public class LogFileData
|
||||
{
|
||||
public String Name { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Database Table List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_LogFileList : AjaxResponse_Data
|
||||
{
|
||||
public List<LogFileData> Tables { get; } = new List<LogFileData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("System/Ajax/GetLogFileList")]
|
||||
public IActionResult Ajax_GetLogFileList(Model_Sport model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetLogFileList";
|
||||
String messageTitle = Localiser["system.caption.logs"];
|
||||
AjaxResponse_LogFileList responseData = new AjaxResponse_LogFileList();
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Admin.Models;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
public partial class SystemController : SaxController_Admin
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SystemController(SaxLocaliser localiser, ILogger<HomeController> logger) :
|
||||
base(localiser, logger)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// System - Home.
|
||||
/// <para>- No 'System' home page for now, redirect to home page.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public IActionResult Index()
|
||||
{
|
||||
return RedirectToAction("", "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// System - Database page.
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public IActionResult Database(Model_System model)
|
||||
{
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// System - Logs page.
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public IActionResult Logs(Model_System model)
|
||||
{
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
// Check for duplicate name.
|
||||
SaxSport.Params prmSport = new SaxSport.Params();
|
||||
if (SysId.IsValid(SportId))
|
||||
prmSport.ExcludedIds.Add(SportId);
|
||||
prmSport.IdsExcluded.Add(SportId);
|
||||
prmSport.NamePartial = SportName;
|
||||
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
||||
if (ReferenceMgr.GetSportCount(prmSport) > 0)
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
{
|
||||
//=======================================================================
|
||||
public class Model_System : SaxModel_Admin
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public Model_System(SaxLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Database page properties.
|
||||
public class DatabaseFilterData
|
||||
{
|
||||
public String Table { get; set; }
|
||||
}
|
||||
public DatabaseFilterData DatabaseFilter { get; } = new DatabaseFilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Logs page properties.
|
||||
public class LogsFilterData
|
||||
{
|
||||
public String Filename { get; set; }
|
||||
}
|
||||
public LogsFilterData LogsFilter { get; } = new LogsFilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -162,12 +162,21 @@
|
||||
<data name="label.create" xml:space="preserve">
|
||||
<value>Create</value>
|
||||
</data>
|
||||
<data name="label.database" xml:space="preserve">
|
||||
<value>Database</value>
|
||||
</data>
|
||||
<data name="label.database.table" xml:space="preserve">
|
||||
<value>Database table</value>
|
||||
</data>
|
||||
<data name="label.delete" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="label.email.address" xml:space="preserve">
|
||||
<value>Email address</value>
|
||||
</data>
|
||||
<data name="label.filename" xml:space="preserve">
|
||||
<value>Filename</value>
|
||||
</data>
|
||||
<data name="label.first.name" xml:space="preserve">
|
||||
<value>First name</value>
|
||||
</data>
|
||||
@@ -189,6 +198,9 @@
|
||||
<data name="label.last.name" xml:space="preserve">
|
||||
<value>Last name</value>
|
||||
</data>
|
||||
<data name="label.logs" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
<data name="label.members" xml:space="preserve">
|
||||
<value>Members</value>
|
||||
</data>
|
||||
@@ -249,6 +261,9 @@
|
||||
<data name="label.strength" xml:space="preserve">
|
||||
<value>Strength</value>
|
||||
</data>
|
||||
<data name="label.system" xml:space="preserve">
|
||||
<value>System</value>
|
||||
</data>
|
||||
<data name="label.title" xml:space="preserve">
|
||||
<value>Title</value>
|
||||
</data>
|
||||
@@ -414,6 +429,12 @@
|
||||
<data name="sport.caption.sports" xml:space="preserve">
|
||||
<value>Sports</value>
|
||||
</data>
|
||||
<data name="system.caption.database" xml:space="preserve">
|
||||
<value>System - Database</value>
|
||||
</data>
|
||||
<data name="system.caption.logs" xml:space="preserve">
|
||||
<value>System - Logs</value>
|
||||
</data>
|
||||
<data name="user.caption.select.user.roles" xml:space="preserve">
|
||||
<value>Select User Roles</value>
|
||||
</data>
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
@model SaxModel_Admin
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
<link rel="stylesheet" href="~/css/sax-organisationSelection.css?@Model.HrefVersion" />
|
||||
<script src="~/js/sax-organisationSelection.js?@Model.HrefVersion"></script>
|
||||
<script type="text/javascript">
|
||||
sax.organisationSelection.dlgTitleSelectOrganisation = '@Localiser.GetJavascriptText("organisation.caption.select.organisation")';
|
||||
</script>
|
||||
|
||||
<div id="dlgOrganisationSelection" class="sax-dialog sax-form">
|
||||
|
||||
@* Filter *@
|
||||
<div class="sax-panel-filter">
|
||||
|
||||
<div class="sax-content">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationSelectionFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["organisation.caption.organisation"]</div>
|
||||
<div class="col-sm-7"><input type="text" id="" class="sax-input FilterOrganisation" name="Filter.Organisation" maxlength="32" /></div>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
|
||||
@* Organisations *@
|
||||
<div class="sax-selection-results Organisations"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item Organisation">
|
||||
<div class="Name"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,42 @@
|
||||
@model SaxModel_Admin
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
<link rel="stylesheet" href="~/css/sax-selectOrganisation.css?@Model.HrefVersion" />
|
||||
<script src="~/js/sax-selectOrganisation.js?@Model.HrefVersion"></script>
|
||||
<script type="text/javascript">
|
||||
sax.selectOrganisation.dlgTitleSelectOrganisation = '@Localiser.GetJavascriptText("organisation.caption.select.organisation")';
|
||||
</script>
|
||||
|
||||
<div id="dlgSelectOrganisation" class="sax-dialog sax-form">
|
||||
|
||||
@* Filter *@
|
||||
<div class="sax-panel-filter">
|
||||
|
||||
<div class="sax-content">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSelectOrganisationFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["organisation.caption.organisation"]</div>
|
||||
<div class="col-sm-7"><input type="text" class="sax-input FilterOrganisation" name="Filter.Organisation" maxlength="32" /></div>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
|
||||
@* Organisations *@
|
||||
<div class="sax-selection-results Organisations"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item Organisation">
|
||||
<div class="Name"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@
|
||||
@Html.HiddenFor(model => model.Filter.OrganisationId, new { @id = "ifFilterOrganisationId" })
|
||||
<input type="text" id="ifFilterOrganisation" class="sax-input" readonly="readonly" value="@(Model.MemberOrganisationName)" />
|
||||
</div>
|
||||
<div class="fixed"><button id="" class="sax-button" onclick="sax.selectOrganisation()">@Localiser["label.select"]</button></div>
|
||||
<div class="fixed"><button id="" class="sax-button" onclick="sax.selectFilterOrganisation()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -62,4 +62,4 @@
|
||||
|
||||
<partial name="Panel-MemberDialog.cshtml" />
|
||||
|
||||
<partial name="~/Views/Common/OrganisationSelection.cshtml" />
|
||||
<partial name="~/Views/Common/SelectOrganisation.cshtml" />
|
||||
|
||||
@@ -134,6 +134,15 @@
|
||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Organisation');">@Localiser["organisation.caption.organisations"]</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link text-dark dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
@Localiser["label.system"]
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('System/Database');">@Localiser["label.database"]</div>
|
||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('System/Logs');">@Localiser["label.logs"]</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link text-dark dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
@Localiser["label.security"]
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
@model Model_System
|
||||
@inject SaxLocaliser Localiser
|
||||
@{
|
||||
ViewData["Title"] = "System - Database";
|
||||
}
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="sax-panel-filter">
|
||||
<div class="sax-header">
|
||||
<div class="floatl sax-caption">@Localiser["system.caption.database"]</div>
|
||||
<div class="floatr sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||
<div class="clearb"></div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmDatabaseFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.database.table"]</div>
|
||||
<div class="col-sm-7">@Html.TextBoxFor(model => model.DatabaseFilter.Table, new { @id = "ifFilterDatabaseTable", @class = "FilterDatabaseTable", @maxlength = "32" })</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-results">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item DatabaseTable">
|
||||
<div class="sax-header">
|
||||
<div class="sax-caption TableName"></div>
|
||||
</div>
|
||||
<div class="sax-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,39 @@
|
||||
@model Model_System
|
||||
@inject SaxLocaliser Localiser
|
||||
@{
|
||||
ViewData["Title"] = "System - Logs";
|
||||
}
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="sax-panel-filter">
|
||||
<div class="sax-header">
|
||||
<div class="floatl sax-caption">@Localiser["system.caption.logs"]</div>
|
||||
<div class="floatr sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||
<div class="clearb"></div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmLogsFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.filename"]</div>
|
||||
<div class="col-sm-7">@Html.TextBoxFor(model => model.LogsFilter.Filename, new { @id = "ifFilterLogFilename", @class = "FilterLogFilename", @maxlength = "32" })</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-results">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item LogFile">
|
||||
<div class="sax-header">
|
||||
<div class="sax-caption Filename"></div>
|
||||
</div>
|
||||
<div class="sax-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
+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