This commit is contained in:
2022-05-23 17:28:34 +01:00
parent 56f6b0bb7e
commit 25386026af
86 changed files with 2395 additions and 664 deletions
@@ -28,7 +28,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
// Construction.
public AjaxResponse_OrganisationActivationInfo(SaxModel_Admin model) : base(model) { }
// Organisation details.
public OrganisationData_Full organisation { get; } = new OrganisationData_Full();
public OrganisationItemData organisation { get; } = new OrganisationItemData();
// Member awaiting activation.
public List<MemberData_List> Members { get; } = new List<MemberData_List>();
}
@@ -69,8 +69,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Organisation address.
SaxItemAddress address = ItemDataMgr.GetFirstItemAddressByItemAndType(organisation.GetItemId());
disposableItems.Add(address);
// Construct response.
PopulateOrganisationResponseData(organisation, responseData.organisation);
PopulateOrganisationResponseItemData(organisation, address, responseData.organisation);
GetOrganisationMembers(model, organisationId, responseData.Members);
}
@@ -119,12 +123,16 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
SysId organisationId = model.OrganisationId.ToSysId();
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
disposableItems.Add(organisation);
if (organisation == null && SysId.IsValid(organisationId))
if (organisation == null)
{
SaLogger.Warn(fn + " Failed to retrieve organisation for. : '" + model.OrganisationId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Organisation address.
SaxItemAddress address = ItemDataMgr.GetFirstItemAddressByItemAndType(organisation.GetItemId());
disposableItems.Add(address);
// Retrieve users.
List<OrganisationMemberData> organisationMembersToActivate = new List<OrganisationMemberData>();
foreach (String userOrganisationId in model.OrganisationMemberIds)
@@ -206,7 +214,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
}
// Construct response.
PopulateOrganisationResponseData(organisation, responseData.organisation);
PopulateOrganisationResponseItemData(organisation, address, responseData.organisation);
}
// Complete response.
@@ -21,7 +21,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
{
//-------------------------------------------------------------------
// Organisation data.
private class OrganisationData_List : AjaxResponse_Data.ItemData_Base
private class OrganisationListData : AjaxResponse_Data.ItemData_Base
{
public String Name { get; set; }
public String TypeCode { get; set; }
@@ -38,12 +38,14 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
// Address.
public String AddressSummary { get; set; }
}
private class OrganisationData_Full : OrganisationData_List
private class OrganisationItemData : OrganisationListData
{
public String About { get; set; }
public String Facilities { get; set; }
public List<AjaxResponse_Data.ContactMethodData> ContactMethods { get; set; }
public AjaxResponse_Data.AddressData Address { get; set; }
}
private void PopulateOrganisationResponseData(SaxOrganisation organisation, OrganisationData_List data)
private void PopulateOrganisationResponseListData(SaxOrganisation organisation, OrganisationListData data)
{
data.Id = SysId.ToString(organisation.Id);
data.Name = organisation.Name;
@@ -64,11 +66,32 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
data.StatusCode = organisation.StatusCode;
data.StatusDesc = organisation.StatusDesc;
}
private void PopulateOrganisationResponseData(SaxOrganisation organisation, OrganisationData_Full data)
private void PopulateOrganisationResponseItemData(SaxOrganisation organisation, SaxItemAddress address, OrganisationItemData data)
{
PopulateOrganisationResponseData(organisation, data as OrganisationData_List);
PopulateOrganisationResponseListData(organisation, data as OrganisationListData);
data.About = organisation.About;
data.Facilities = organisation.Facilities;
// Contact methods.
SaxContactData contactData = new SaxContactData(organisation.ContactData);
foreach (Sax.ContactMethod method in contactData.Methods)
{
if (data.ContactMethods == null) data.ContactMethods = new List<AjaxResponse_Data.ContactMethodData>();
data.ContactMethods.Add(new AjaxResponse_Data.ContactMethodData() { Method = method.ToString(), MethodCaption = Localiser.GetContactMethodCaption(method), Value = contactData.GetContactMethodValue(method) });
}
// Address.
if (address != null)
{
data.Address = new AjaxResponse_Data.AddressData();
data.Address.Id = address.Id.ToString();
data.Address.Line1 = address.Line1;
data.Address.Line2 = address.Line2;
data.Address.Line3 = address.Line3;
data.Address.Town = address.Town;
data.Address.Province = address.Province;
data.Address.Country = address.Country;
data.Address.PostalCode = address.PostalCode;
}
// Common properties.
data.Notes = organisation.Notes;
}
@@ -80,8 +103,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
// Construction.
public AjaxResponse_OrganisationList(SaxModel_Admin model) : base(model) { }
// Organisation list.
public List<OrganisationData_List> Organisations { get; } = new List<OrganisationData_List>();
public List<OrganisationListData> Organisations { get; } = new List<OrganisationListData>();
// Reference data.
public List<AjaxResponse_Data.ItemCodeDesc> ContactMethods { get; } = new List<ItemCodeDesc>();
public List<CodeDesc> Statuses { get; } = new List<CodeDesc>();
public String DefaultStatusCode { get; set; }
}
@@ -98,6 +122,15 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
if (!ValidUserSession)
return GetAjaxResult_InvalidSession(responseData);
// Reference data - contact methods.
List<Sax.ContactMethod> validContactMethods = SaxOrganisation.ValidContactMethods;
foreach (TypeCodeDesc contactMethod in ContactMethodCodes)
{
// Skip methods that aren't associated with Organisations.
if (!validContactMethods.Contains((Sax.ContactMethod)contactMethod.Type)) continue;
responseData.ContactMethods.Add(new AjaxResponse_Data.ItemCodeDesc() { Code = contactMethod.Code, Desc = Localiser.GetContactMethodCaption((Sax.ContactMethod)contactMethod.Type) });
}
// Reference data - statuses.
foreach (SaStatus status in SaxOrganisation.ValidStatuses.FindAll(item => item != SaStatus.Deleted))
responseData.Statuses.Add(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status));
@@ -149,7 +182,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
{
NamedValue.Map values = resultSet.GetRecordValues();
OrganisationData_List organisationData = new OrganisationData_List()
OrganisationListData organisationData = new OrganisationListData()
{
Id = values.GetLong(colId.DataName).ToString(),
Name = values.GetString(colName.DataName),
@@ -185,7 +218,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
// Construction.
public AjaxResponse_Organisation(SaxModel_Admin model) : base(model) { }
// Organisation details.
public OrganisationData_Full organisation { get; } = new OrganisationData_Full();
public OrganisationItemData organisation { get; } = new OrganisationItemData();
}
//-------------------------------------------------------------------
[HttpPost]
@@ -200,25 +233,34 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
if (!ValidUserSession)
return GetAjaxResult_InvalidSession(responseData);
// Identify item.
SysId organisationId = model.OrganisationId.ToSysId();
if (!SysId.IsValid(organisationId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
if (organisation == null)
// Record disposable items as they are created so all can be disposed when needed.
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
{
SaLogger.Warn(fn + " Failed to retrieve organisation for Id: '" + model.OrganisationId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
// Identify item.
SysId organisationId = model.OrganisationId.ToSysId();
if (!SysId.IsValid(organisationId))
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
// Retrieve item.
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
disposableItems.Add(organisation);
if (organisation == null)
{
SaLogger.Warn(fn + " Failed to retrieve organisation for Id: '" + model.OrganisationId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Organisation address.
SaxItemAddress address = ItemDataMgr.GetFirstItemAddressByItemAndType(organisation.GetItemId());
disposableItems.Add(address);
// Construct response.
PopulateOrganisationResponseItemData(organisation, address, responseData.organisation);
// Complete response.
responseData.Success = true;
}
// Construct response.
PopulateOrganisationResponseData(organisation, responseData.organisation);
// Complete response.
responseData.Success = true;
return Json(responseData);
}
@@ -237,69 +279,148 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
if (!ValidUserSession)
return GetAjaxResult_InvalidSession(responseData);
// Validate item properties.
model.ValidateOrganisationData(responseData);
if (responseData.HasControlErrors())
return Json(responseData);
// Retrieve existing item.
SysId organisationId = model.OrganisationId.ToSysId();
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
if (organisation == null && SysId.IsValid(organisationId))
// Record disposable items as they are created so all can be disposed when needed.
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
{
SaLogger.Warn(fn + " Failed to retrieve organisation for Id: '" + model.OrganisationId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
// Create new item if required.
if (organisation == null)
organisation = AccountMgr.CreateOrganisation();
// Validate item properties.
model.ValidateOrganisationData(responseData);
if (responseData.HasControlErrors())
return Json(responseData);
// Populate item properties.
if (model.OrganisationName != null)
organisation.Name = model.OrganisationName;
if (model.OrganisationTypeValue != null)
organisation.OrganisationType = model.OrganisationType;
if (model.OrganisationCategoryValue != null)
organisation.OrganisationCategory = model.OrganisationCategory;
if (model.OrganisationSportId != null)
organisation.SportIdPrimary = model.OrganisationSportId.ToSysId();
if (model.OrganisationRegionIdCountry != null)
organisation.RegionIdPrimary = model.OrganisationRegionIdCountry.ToSysId();
if (model.OrganisationAbout != null)
organisation.About = model.OrganisationAbout;
if (model.OrganisationFacilities != null)
organisation.Facilities = model.OrganisationFacilities;
// Common properties.
if (model.OrganisationStatusCode != null)
organisation.Status = model.OrganisationStatus;
if (model.OrganisationNotes != null)
organisation.Notes = model.OrganisationNotes;
// Store item.
if (!SysId.IsValid(organisation.Id))
{
if (!AccountMgr.InsertOrganisation(organisation, DbUpdateInfo))
// Retrieve existing item.
SysId organisationId = model.OrganisationId.ToSysId();
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
disposableItems.Add(organisation);
if (organisation == null && SysId.IsValid(organisationId))
{
SaLogger.Warn(fn + " Failed to insert organisation: " + AccountMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + AccountMgr.ErrorStateMessage));
SaLogger.Warn(fn + " Failed to retrieve organisation for Id: '" + model.OrganisationId + "'");
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
}
}
else
{
if (!AccountMgr.UpdateOrganisation(organisation, DbUpdateInfo))
// Create new item if required.
if (organisation == null)
{
SaLogger.Warn(fn + " Failed to update organisation [Id:" + SysId.ToString(organisation.Id) + "]: " + AccountMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + AccountMgr.ErrorStateMessage));
organisation = AccountMgr.CreateOrganisation();
disposableItems.Add(organisation);
}
// Organisation address.
SaxItemAddress organisationAddress = ItemDataMgr.GetFirstItemAddressByItemAndType(organisation.GetItemId());
disposableItems.Add(organisationAddress);
// Populate item properties.
if (model.OrganisationName != null)
organisation.Name = model.OrganisationName;
if (model.OrganisationTypeValue != null)
organisation.OrganisationType = model.OrganisationType;
if (model.OrganisationCategoryValue != null)
organisation.OrganisationCategory = model.OrganisationCategory;
if (model.OrganisationSportId != null)
organisation.SportIdPrimary = model.OrganisationSportId.ToSysId();
if (model.OrganisationRegionIdCountry != null)
organisation.RegionIdPrimary = model.OrganisationRegionIdCountry.ToSysId();
if (model.OrganisationAbout != null)
organisation.About = model.OrganisationAbout;
if (model.OrganisationFacilities != null)
organisation.Facilities = model.OrganisationFacilities;
if (model.ContactData != null)
organisation.ContactData = model.ContactData.GetContactData();
// Common properties.
if (model.OrganisationStatusCode != null)
organisation.Status = model.OrganisationStatus;
if (model.OrganisationNotes != null)
organisation.Notes = model.OrganisationNotes;
// Store item.
if (!SysId.IsValid(organisation.Id))
{
if (!AccountMgr.InsertOrganisation(organisation, DbUpdateInfo))
{
SaLogger.Warn(fn + " Failed to insert organisation: " + AccountMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + AccountMgr.ErrorStateMessage));
}
}
else
{
if (!AccountMgr.UpdateOrganisation(organisation, DbUpdateInfo))
{
SaLogger.Warn(fn + " Failed to update organisation [Id:" + SysId.ToString(organisation.Id) + "]: " + AccountMgr.ErrorStateMessage);
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + AccountMgr.ErrorStateMessage));
}
}
if (model.Address.IsSpecified())
{
// Organisation regions.
SaxRegion.Data regionCountry = Internals.GetRegion(organisation.RegionIdPrimary);
if (regionCountry != null && regionCountry.RegionType != Sax.RegionType.Country)
regionCountry = null;
SaxRegion.Data regionProvince = null;
// Create Organisation address if required.
if (organisationAddress == null)
{
organisationAddress = ItemDataMgr.CreateItemAddress(organisation.GetItemId(), SaxItemAddress.DefaultOrganisationAddressType);
disposableItems.Add(organisationAddress);
}
// Store address.
if (model.Address.Line1 != null)
organisationAddress.Line1 = model.Address.Line1;
if (model.Address.Line2 != null)
organisationAddress.Line2 = model.Address.Line2;
if (model.Address.Line3 != null)
organisationAddress.Line3 = model.Address.Line3;
if (model.Address.Town != null)
organisationAddress.Town = model.Address.Town;
if (regionProvince != null)
{
organisationAddress.Province = regionProvince.Name;
organisationAddress.RegionIdProvince = regionProvince.Id;
}
else
{
if (model.Address.Province != null)
organisationAddress.Province = model.Address.Province;
}
if (regionCountry != null)
{
organisationAddress.Country = regionCountry.Name;
organisationAddress.RegionIdCountry = regionCountry.Id;
}
else
{
if (model.Address.Country != null)
organisationAddress.Country = model.Address.Country;
}
organisationAddress.PostalCode = model.Address.PostalCode;
if (!SysId.IsValid(organisationAddress.Id))
{
// Create new address.
if (!ItemDataMgr.InsertItemAddress(organisationAddress, DbUpdateInfo))
{
SaLogger.Warn(fn + " Failed to insert organisation address - " + ItemDataMgr.ErrorStateMessage);
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
}
}
else
{
// Update existing address.
if (!ItemDataMgr.UpdateItemAddress(organisationAddress, DbUpdateInfo))
{
SaLogger.Warn(fn + " Failed to update organisation address - " + ItemDataMgr.ErrorStateMessage);
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
}
}
}
// Construct response.
PopulateOrganisationResponseItemData(organisation, organisationAddress, responseData.organisation);
// Complete response.
responseData.Success = true;
}
// Construct response.
PopulateOrganisationResponseData(organisation, responseData.organisation);
// Complete response.
responseData.Success = true;
return Json(responseData);
}
@@ -0,0 +1,64 @@
using Microsoft.AspNetCore.Mvc;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Core.Web.Admin.Models;
using Saxonite.Net.Core.Web.Base.Models;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Helpers;
using System;
namespace Saxonite.Net.Core.Web.Admin.Controllers
{
//=======================================================================
// Admin Reference Controller - Contact Method Ajax actions only.
//=======================================================================
partial class ReferenceController
{
//-------------------------------------------------------------------
// Validate Contact Method.
//-------------------------------------------------------------------
private class AjaxResponse_ValidateContactMethod : AjaxResponse_Data
{
public AjaxResponse_ValidateContactMethod(SaxModel_Base model) : base(model) { }
}
[HttpPost]
[Route("Reference/Ajax/ValidateContactMethod")]
public IActionResult Ajax_ValidateContactMethod(Model_ContactMethod model)
{
String fn = GetType().Name + ".Ajax_ValidateContactMethod";
String messageTitle = Localiser["caption.contact.method"];
AjaxResponse_ValidateContactMethod responseData = new AjaxResponse_ValidateContactMethod(model);
// Validate session and referrer.
if (!ValidReferer) return Forbid();
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
// Validate method.
Sax.ContactMethod method = EnumUtil.ParseEnum(model.ContactMethod, Sax.ContactMethod.Unknown);
if (model.ContactMethod.IsEmpty() || (int)method < 1)
responseData.SetControlError(nameof(model.ContactMethod), Localiser["msg.validation.mandatory.value"]);
// Validate method.
if (model.ContactValue.IsEmpty())
responseData.SetControlError(nameof(model.ContactValue), Localiser["msg.validation.mandatory.value"]);
// Method specific value validation.
if (!SaxContactMethodHelper.IsValidContactMethodValue(method, model.ContactValue))
{
// Log invalid values so that the validation can be adjusted if needed.
SaLogger.Warn(fn + " Invalid contact method value. Mathod: " + method.ToString() + ". Value: " + model.ContactValue);
responseData.SetControlError(nameof(model.ContactValue), Localiser["msg.validation.invalid.value"]);
}
if (responseData.HasControlErrors())
return Json(responseData);
// Complete response.
responseData.Success = true;
return Json(responseData);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,31 @@
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.Dbas;
using Saxonite.Net.Core.Web.Base.App;
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
{
//=======================================================================
// Admin Reference Controller - Ajax actions only.
//=======================================================================
public partial class ReferenceController : SaxController_Admin
{
//-------------------------------------------------------------------
// Construction.
public ReferenceController(SaxLocaliser localiser, ILogger<HomeController> logger) :
base(localiser, logger)
{}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,141 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Helpers;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Base.App;
using Saxonite.Net.Core.Web.Base.App;
using Saxonite.Net.Core.Web.Base.Controllers;
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.Models
{
//=======================================================================
/// <summary>
/// Address model data properties.
/// </summary>
public class ModelData_Address : ModelData_Admin
{
//-------------------------------------------------------------------
// Construction.
public ModelData_Address(SaxModel_Admin model, String controlNameSuffix) : base(model)
{
this.ControlNameSuffix = StringUtil.EmptyOnNull(controlNameSuffix) + "Address";
}
//-------------------------------------------------------------------
// Properties.
private String ControlNameSuffix { get; }
// Address properties.
public String Id { get; set; }
public String Line1 { get; set; }
public String Line2 { get; set; }
public String Line3 { get; set; }
public String Town { get; set; }
public String Province { get; set; }
public String RegionIdProvince { get; set; }
public String Country { get; set; }
public String PostalCode { get; set; }
//-------------------------------------------------------------------
// Utilities.
/// <summary>Have any address values been supplied by the form.</summary>
public bool IsSpecified()
{
if (Id != null || Line1 != null || Town != null || Province != null || Country != null || PostalCode != null)
return true;
return false;
}
//-------------------------------------------------------------------
// Validation.
//-------------------------------------------------------------------
// Address.
public bool ValidateAddressData(SaxController_Base.AjaxResponse_Data responseData)
{
// Address Line 1 - optional.
if (Line1 != null)
{
responseData.SetControlValue(ControlNameSuffix + "Line1", Line1);
if (StringUtil.GetLength(Line1) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1))
responseData.SetControlError(ControlNameSuffix + "Line1", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1)]);
}
// Address Line 2 - optional.
if (Line2 != null)
{
responseData.SetControlValue(ControlNameSuffix + "Line2", Line2);
if (!StringUtil.IsEmpty(Line2))
{
if (StringUtil.GetLength(Line2) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2))
responseData.SetControlError(ControlNameSuffix + "Line2", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2)]);
}
}
// Address Line 3 - optional.
if (Line3 != null)
{
responseData.SetControlValue(ControlNameSuffix + "Line3", Line3);
if (!StringUtil.IsEmpty(Line3))
{
if (StringUtil.GetLength(Line3) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3))
responseData.SetControlError(ControlNameSuffix + "Line3", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3)]);
}
}
// Address Town - mandatory.
if (Town != null)
{
responseData.SetControlValue(ControlNameSuffix + "Town", Town);
if (StringUtil.IsEmpty(Town))
responseData.SetControlError(ControlNameSuffix + "Town", Model.Localiser["msg.validation.mandatory.value"]);
else if (StringUtil.GetLength(Town) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town))
responseData.SetControlError(ControlNameSuffix + "Town", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town)]);
}
// Address Province - optional.
if (Province != null)
{
responseData.SetControlValue(ControlNameSuffix + "Province", Province);
if (!StringUtil.IsEmpty(Province))
{
if (StringUtil.GetLength(Province) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province))
responseData.SetControlError(ControlNameSuffix + "Province", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province)]);
}
}
// Address Country - optional.
if (Country != null)
{
responseData.SetControlValue(ControlNameSuffix + "Country", Country);
if (!StringUtil.IsEmpty(Country))
{
if (StringUtil.GetLength(Country) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Country))
responseData.SetControlError(ControlNameSuffix + "Country", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Country)]);
}
}
// Address PostalCode - optional.
if (PostalCode != null)
{
responseData.SetControlValue(ControlNameSuffix + "PostalCode", PostalCode);
if (!StringUtil.IsEmpty(PostalCode))
{
if (StringUtil.GetLength(PostalCode) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode))
responseData.SetControlError(ControlNameSuffix + "PostalCode", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode)]);
}
}
return !responseData.HasControlErrors();
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,38 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Helpers;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Base.App;
using Saxonite.Net.Core.Web.Base.App;
using Saxonite.Net.Core.Web.Base.Controllers;
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.Models
{
//=======================================================================
/// <summary>
/// Online model data.
/// </summary>
public class ModelData_Admin
{
//-------------------------------------------------------------------
// Construction.
public ModelData_Admin(SaxModel_Admin model)
{
this.Model = model;
}
//-------------------------------------------------------------------
// Properties.
public SaxModel_Admin Model { get; }
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,28 @@
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_ContactMethod : SaxModel_Admin
{
//-------------------------------------------------------------------
// Construction.
public Model_ContactMethod(SaxLocaliser localiser) :
base(localiser)
{
}
//-------------------------------------------------------------------
// Form properties.
public String ContactMethod { get; set; }
public String ContactValue { get; set; }
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -6,13 +6,11 @@ using Sarand.Net.Standard.Base.Utils;
using Saxonite.Base.App;
using Saxonite.Net.Core.Web.Base.App;
using Saxonite.Net.Core.Web.Base.Controllers;
using Saxonite.Net.Core.Web.Base.Models;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using Saxonite.Net.Standard.Base.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Saxonite.Net.Core.Web.Admin.Models
{
@@ -25,6 +23,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
base(localiser)
{
AdditionalFiles_JS.Add("js/sax-org.js");
Address = new ModelData_Address(this, "Address");
}
//-------------------------------------------------------------------
@@ -83,6 +82,15 @@ namespace Saxonite.Net.Core.Web.Admin.Models
public String OrganisationNotes { get; set; }
public String OrganisationStatusCode { get; set; }
public SaStatus OrganisationStatus { get { return SacsSystem.GetStatusForCode(OrganisationStatusCode); } }
// Contact Methods.
/// <summary>Placeholder field value to indicate the number of Contact Methods in form (even if none are populated).</summary>
public String ContactMethods { get; set; }
public String[] ContactMethod { get; set; }
public String[] ContactValue { get; set; }
/// <summary>Contact methods to be populated during validation.</summary>
public SaxContactData ContactData { get; set; }
// Address.
public ModelData_Address Address { get; }
// Utilities.
public bool IsSportMandatory()
@@ -96,6 +104,8 @@ namespace Saxonite.Net.Core.Web.Admin.Models
// Organisation validation.
public bool ValidateOrganisationData(SaxController_Base.AjaxResponse_Data responseData)
{
String fn = this.GetType().Name + ".ValidateOrganisationData";
// Organisation name.
if (OrganisationName != null)
{
@@ -174,6 +184,29 @@ namespace Saxonite.Net.Core.Web.Admin.Models
responseData.SetControlError(nameof(OrganisationFacilities), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Facilities)]);
}
// Contact Methods.
if (ContactMethods != null)
{
ContactData = new SaxContactData("");
ContactMethod = ContactMethod ?? new String[0];
ContactValue = ContactValue ?? new String[0];
for (int idx = 0; idx < ContactMethod.Length && idx < ContactValue.Length; idx++)
{
String methodValue = ContactMethod[idx];
String value = ContactValue[idx];
if (methodValue == null & value == null) continue;
Sax.ContactMethod method = EnumUtil.ParseEnum(methodValue, Sax.ContactMethod.Unknown);
if (method > 0 && !value.IsEmpty() && SaxContactMethodHelper.IsValidContactMethodValue(method, value))
ContactData.SetContactMethodValue(method, value);
else SaLogger.Warn(fn + " Invalid Contact Method data. Method: " + methodValue + ". Value: " + value);
}
if (ContactData.Methods.Count != ContactMethods.ToInt())
{
SaLogger.Warn(fn + " Inconsistent Contact Methods received. Expected: " + ContactMethods + ". Received: " + ContactData.Methods.Count);
responseData.SetMessage("caption.contact.method", "System error");
}
}
// Organisation notes.
if (OrganisationNotes != null)
{
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="caption.contact.method" xml:space="preserve">
<value>Contact Method</value>
</data>
<data name="company.name" xml:space="preserve">
<value>Sportierre</value>
</data>
@@ -201,6 +204,9 @@
<data name="label.columns" xml:space="preserve">
<value>Columns</value>
</data>
<data name="label.contact" xml:space="preserve">
<value>Contact</value>
</data>
<data name="label.country" xml:space="preserve">
<value>Country</value>
</data>
@@ -285,6 +291,9 @@
<data name="label.members.awaiting.activation" xml:space="preserve">
<value>Members awaiting activation</value>
</data>
<data name="label.method" xml:space="preserve">
<value>Method</value>
</data>
<data name="label.name" xml:space="preserve">
<value>Name</value>
</data>
@@ -423,6 +432,9 @@
<data name="label.users.online" xml:space="preserve">
<value>Users online</value>
</data>
<data name="label.value" xml:space="preserve">
<value>Value</value>
</data>
<data name="label.yes" xml:space="preserve">
<value>Yes</value>
</data>
@@ -0,0 +1,50 @@
@model SaxModel_Admin
@inject SaxLocaliser Localiser
@if (!Model.RegisterView("Views/Common/ContactMethods")) return;
<script src="~/js/sax-cnt-mth.js?@Model.HrefVersion"></script>
<script type="text/javascript">
</script>
<div id="dlgContactMethod" class="sax-dialog sax-form" title="@Localiser["caption.contact.method"]">
<div class="spacer4"></div>
@* Method *@
<div class="sax-form-control ContactMethod">
<div class="row">
<div class="col-sm-3">
<div class="sax-label">
<label for=""><span>@Localiser["label.method"]</span></label>
</div>
</div>
<div class="col-sm">
<div class="sax-control">
<select name="ContactMethod" class="ContactMethod sax-select" style="max-width:240px;" ></select>
</div>
<div class="sax-message"></div>
</div>
</div>
</div>
<div class="spacer"></div>
@* Value *@
<div class="sax-form-control ContactValue">
<div class="row">
<div class="col-sm-3">
<div class="sax-label">
<label for=""><span>@Localiser["label.value"]</span></label>
</div>
</div>
<div class="col-sm">
<div class="sax-control">
<input type="text" name="ContactValue" class="ContactValue sax-input" />
</div>
<div class="sax-message"></div>
</div>
</div>
</div>
<div class="spacer"></div>
</div>
@@ -0,0 +1,75 @@
@* Contact Methods controls *@
@model SaxModel_Admin
@inject SaxLocaliser Localiser
@if (!Model.RegisterView("Views/Common/Controls-ItemContactMethods")) return;
<style>
.ItemContactMethods .ContactMethods
{
min-height: 32px;
max-height: 64px;
background-color: #fff;
border: 1px solid #808080;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
overflow-y: scroll;
}
.ItemContactMethods .ContactMethods table.sax-data tr:hover
{
background-color: #f0f0f0;
}
.ItemContactMethods .ContactMethods table.sax-data .sax-label
{
margin:0;
padding:0 8px 0 0;
}
</style>
@* Contact Methods *@
<div class="sax-form-control ItemContactMethods">
<input type="hidden" name="ContactMethods" value="0" />
<div class="row">
<div class="col-sm-3 row">
<div class="col">
<div class="sax-label">
<label for=""><span>@Localiser["label.contact"]</span></label>
</div>
</div>
<div class="fixed">
@* Action to add new contact method. *@
<div class="sax-actions">
<div class="sax-action sax-add pr4"><img src="~/img/action/add24.png" alt="@(Localiser["label.add"])" title="@(Localiser["label.add"])" /></div>
</div>
</div>
</div>
<div class="col-sm">
<div class="sax-control row">
<div class="col">
@* List of existing contact methods with actions to edit/remove. *@
<div class="ContactMethods">
<table class="sax-data"></table>
</div>
<table class="sax-panel-item-template">
<tr class="ContactMethod">
<td style="width:20px;"><div class="sax-label nowrap"></div></td>
<td class="sax-value " style="width:70%;word-break: break-all;"></td>
<td class="sax-actions right nowrap" style="width:10px;">
<input type="hidden" name="ContactMethod" />
<input type="hidden" name="ContactValue" />
<div class="nowrap">
<div class="inlineb sax-action sax-edit"><img src="~/img/action/edit16.png" alt="@(Localiser["label.edit"])" title="@(Localiser["label.edit"])" /></div>
<div class="inlineb sax-action sax-remove"><img src="~/img/action/delete16.png" alt="@(Localiser["label.remove"])" title="@(Localiser["label.remove"])" /></div>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="sax-message"></div>
</div>
</div>
</div>
<partial name="~/Views/Common/ContactMethods.cshtml" />
@@ -1,6 +1,8 @@
@model SaxModel_Admin
@inject SaxLocaliser Localiser
@if (!Model.RegisterView("Views/Common/SelectCode")) return;
<link rel="stylesheet" href="~/css/sax-selectCode.css?@Model.HrefVersion" />
<script src="~/js/sax-sel-cod.js?@Model.HrefVersion"></script>
<script type="text/javascript">
@@ -1,6 +1,8 @@
@model SaxModel_Admin
@inject SaxLocaliser Localiser
@if (!Model.RegisterView("Views/Common/SelectItem")) return;
<link rel="stylesheet" href="~/css/sax-selectItem.css?@Model.HrefVersion" />
<div id="dlgSelectItem" class="sax-dialog sax-form">
@@ -1,6 +1,8 @@
@model SaxModel_Admin
@inject SaxLocaliser Localiser
@if (!Model.RegisterView("Views/Common/SelectOrganisation")) return;
<link rel="stylesheet" href="~/css/sax-selectOrganisation.css?@Model.HrefVersion" />
<script src="~/js/sax-sel-org.js?@Model.HrefVersion"></script>
<script type="text/javascript">
@@ -147,6 +147,9 @@
</div>
</div>
@* Contact Methods *@
<partial name="..\Common\Controls-ItemContactMethods.cshtml" />
@* Organisation Notes *@
<div class="sax-form-control OrganisationNotes">
<div class="row">
@@ -155,15 +155,17 @@
overflow-y: scroll;
}
.sax-form .sax-input:read-only, .sax-form .sax-textarea:read-only
.sax-form .sax-input:read-only, .sax-form .sax-textarea:read-only, .sax-form .sax-select:disabled
{
color: #202020;
opacity: 1;
background-color: #f8f8f8;
}
.sax-form .sax-form-control.sax-error .sax-input, .sax-form .sax-form-control.sax-error .sax-textarea, .sax-form .sax-form-control.sax-error .sax-select
{
color: #DC143C;
border-color: #DC143C;
color: #606060; /*#DC143C;*/
border-color: #606060; /*#DC143C;*/
}
/* Control messages */
Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

@@ -0,0 +1,69 @@
/*
* Contact Methods script.
*/
(function (win, doc, undef)
{
"use strict";
let cm = sax.mdl.contactMethods = { fn: {}, data: {}, ajax: {} };
let $dlg = cm.$dlg = {};
//--------------------------------------------------------------
/*
* Config:
* fnCallback Method to call to apply changes.
* methods Full list of methods.
* methodsUsed List of methods already in use.
* method Current selected method (if updating).
* value Current value.
*/
sax.editContactMethod = cm.fn.edit = function (cfg)
{
cm.fn.init();
cm.data.cfg = cfg || {};
cm.$mth.empty();
for (let mth of cfg.methods || [])
{
if (mth.code && mth.code == cfg.method || !(cfg.methodsUsed || []).includes(mth.code))
cm.$mth.append($('<option>').prop('value', mth.code).text(mth.desc));
}
cm.$mth.val(cfg.method).attr('disabled', cfg.method && cm.$mth.val() == cfg.method ? true : null);
cm.$val.val(cfg.value);
sax.openDialog($dlg.conMth, 600, 240);
}
//--------------------------------------------------------------
cm.fn.applyChanges = function ()
{
cm.ajax.applyChanges = cm.ajax.applyChanges || { url: sax.url.base + 'Reference/Ajax/ValidateContactMethod', callbackFn: cm.fn.onApplyChanges };
cm.ajax.applyChanges.formData = new FormData();
cm.ajax.applyChanges.formData.append("__RequestVerificationToken", $('#frmNavigate input[name="__RequestVerificationToken"]').val());
cm.ajax.applyChanges.formData.append("ContactMethod", $('select[name="ContactMethod"]', $dlg.conMth).val());
cm.ajax.applyChanges.formData.append("ContactValue", $('input[name="ContactValue"]', $dlg.conMth).val());
sax.doAjaxRequest(cm.ajax.applyChanges, 50);
}
cm.fn.onApplyChanges = function (response)
{
if (!response) return;
sax.refreshControlValues(response.controlValues, $dlg.conMth);
if (!response.success) return;
$dlg.conMth.dialog('close');
if (cm.data.cfg.fnCallback) cm.data.cfg.fnCallback(cm.$mth.val(), $('option:selected', cm.$mth).text(), cm.$val.val());
}
//--------------------------------------------------------------
cm.fn.init = function ()
{
if ($dlg.conMth) return;
var opt = sax.dlgOpts();
opt.buttons[sax.dlg.btn.ok] = function () { cm.fn.applyChanges(); };
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
$dlg.conMth = $('#dlgContactMethod').dialog(opt);
cm.$mth = $('.sax-select.ContactMethod', $dlg.conMth);
cm.$val = $('.sax-input.ContactValue', $dlg.conMth);
}
//--------------------------------------------------------------
}(window, window.document));
/* The End */
@@ -206,8 +206,8 @@
if (!response || !response.success || !response.user) return;
$mbrName.val(response.user.displayName);
}
om.ajax.userByEmail = om.ajax.userByEmail || { url: sax.url.base + 'User/Ajax/GetUserByEmail', formId: 'frmUserEmail', callbackFn: fn };
sax.doAjaxRequest(om.ajax.userByEmail, 100);
om.ajax.userByEmail = om.ajax.userByEmail || { url: sax.url.base + 'User/Ajax/GetUserByEmail', formId: 'frmUserEmail', callbackFn: fn, noWaitIcon: true };
sax.doAjaxRequest(om.ajax.userByEmail, 500);
}
//--------------------------------------------------------------
@@ -243,9 +243,8 @@
}
om.onRemoveItem = function (response)
{
sax.debug('onRemoveItem', response);
//sax.debug('onRemoveItem', response);
if (!response.success) return;
var item = response.member;
$('#' + om.itemIdPrefix + item.id).remove();
}
@@ -265,7 +264,7 @@
$frm.mbr = $('#frmMember');
$frm.mbr.on('input', '.sax-input', function () { sax.clearControlError(this); });
$frm.mbr.on('change', '.sax-select', function () { sax.clearControlError(this); });
$frm.mbr.on('change', '#ifMemberUserEmailAddress', function () { om.onChangeEmail(); });
$frm.mbr.on('input', '#ifMemberUserEmailAddress', function () { om.onChangeEmail(); });
$frm.mbr.on('dblclick', '#ifMemberRoles', om.selectMemberRoles);
$frm.mbr.on('click', '#pbMemberRolesSelect', om.selectMemberRoles);
+85 -10
View File
@@ -30,8 +30,9 @@
var $items = $('.sax-panel-item-list', $pnl.results).hide().empty();
sax.refreshPaging(response, '#frmOrganisationFilter', op.refreshResults);
if (!response.success) return;
// Reference data - Statuses.
if (response.defaultStatusCode) sax.data.defaultStatusCode = response.defaultStatusCode;
// Reference data.
op.data.contactMethods = response.contactMethods;
if (response.defaultStatusCode) op.data.defaultStatusCode = response.defaultStatusCode;
if (response.statuses)
sax.populateSelectCodeDesc('#cbOrganisationStatus', response.statuses);
// Menu.
@@ -241,7 +242,7 @@
{
let frm = $frm.org;
$('.OrganisationId,.OrganisationSportId,.OrganisationRegionIdCountry,input[type="text"],textarea,select', frm).val('');
$('.OrganisationStatus', frm).val(sax.data.defaultStatusCode);
$('.OrganisationStatus', frm).val(op.data.defaultStatusCode);
sax.clearControlErrors();
}
sax.openOrgDialog = function ()
@@ -279,11 +280,83 @@
$('.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();
// 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();
$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="Organisation.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 ()
{
@@ -336,7 +409,6 @@
let $orgMbrs = $('.OrganisationMembers', $dlg.activate).empty();
let $mbrTmpl = $('.sax-panel-item-template tr.sax-item.Member');
let members = response.members;
//sax.debug(members, $orgMbrs, $mbrTmpl);
for (let idx = 0; idx < members.length; idx++)
{
let item = members[idx];
@@ -346,7 +418,6 @@
$('.MemberEmail', $item).text(item.emailAddress);
$('.MemberName', $item).text(item.displayName);
$orgMbrs.append($item);
//sax.debug($item);
}
$('.MembersAwaitingActivation', $dlg.activate).toggle(!!members.length);
sax.openDialog($dlg.activate, 480, 420);
@@ -387,11 +458,6 @@
$('.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');
$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', '.OrganisationRegionCaptionCountry', op.selectOrgRegion).on('click', '#pbSelectRegion', op.selectOrgRegion);
var opt = sax.dlgOpts();
opt.open = sax.onOpenOrgDialog;
@@ -399,6 +465,15 @@
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);
$frm.org.on('dblclick', '.OrganisationRegionCaptionCountry', op.selectOrgRegion).on('click', '#pbSelectRegion', 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);
var opt = sax.dlgOpts();
opt.buttons[sax.dlg.btn.ok] = function () { op.activateOrganisation(); };
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };