diff --git a/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs b/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs index 56a4bee..901aac5 100644 --- a/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs +++ b/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs @@ -261,6 +261,18 @@ namespace Saxonite.Net.Core.Web.Base.App return GetCodeTypeCaption(Sax.CodeType.OrganisationRole, organisationRole); } + // Address types. + public String GetAddressTypeCaption(Sax.AddressType addressType) + { + return GetCodeTypeCaption(Sax.CodeType.AddressType, addressType); + } + + // Contact Method. + public String GetContactMethodCaption(Sax.ContactMethod contactMethod) + { + return GetCodeTypeCaption(Sax.CodeType.ContactMethod, contactMethod); + } + // Event type. public String GetEventTypeCaption(Sax.EventType eventType) { diff --git a/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs b/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs index 639baf8..d543dd7 100644 --- a/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs +++ b/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs @@ -122,6 +122,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers public List OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } } public List OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } } public List AddressTypeCodes { get { return Internals.AddressTypeCodes; } } + public List ContactMethodCodes { get { return Internals.ContactMethodCodes; } } public List EventTypeCodes { get { return Internals.EventTypeCodes; } } public List OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } } public List ActivityReactionCodes { get { return Internals.ActivityReactionCodes; } } @@ -486,6 +487,25 @@ namespace Saxonite.Net.Core.Web.Base.Controllers /// Updated on date - formatted per locale public String UpdatedOnFmt { get; set; } } + /// Contact Method properties. + public class ContactMethodData + { + public String Method { get; set; } + public String MethodCaption { get; set; } + public String Value { get; set; } + } + /// Address properties. + public class AddressData : ItemData_Base + { + 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; } + } /// /// Item data with label and value. /// diff --git a/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs b/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs index 96c0f8f..68fa520 100644 --- a/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs +++ b/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.Rendering; +using Sarand.Net.Standard.Base.App; using Sarand.Net.Standard.Base.Bus; using Sarand.Net.Standard.Base.Core; using Sarand.Net.Standard.Base.Dbas; @@ -58,6 +59,20 @@ namespace Saxonite.Net.Core.Web.Base.Models public String PageCaption { get; set; } public String InstanceVersion { get { return !StringUtil.IsEmpty(App.AppConfig.Instance) ? App.AppConfig.Instance + " v" + Sax.Version.GetFullVersion() : "v" + Sax.Version.GetAppVersion(); } } public bool IncludeGoogleAnalytics { get; set; } = false; + // Views can be registered to avoid multiple inclusions in a page. + private HashSet registeredViews = new HashSet(StringComparer.OrdinalIgnoreCase); + /// + /// Views can be registered to avoid multiple inclusions in a page. + /// Only generate view content if this method returns true. + /// + public bool RegisterView (String viewName) + { +#if DEBUG + if (registeredViews.Contains(viewName)) + SaLogger.Warn(this.GetType().Name + ".RegisterView View already registered: " + viewName); +#endif + return registeredViews.Add(viewName); + } //------------------------------------------------------------------- // Business components. @@ -83,6 +98,7 @@ namespace Saxonite.Net.Core.Web.Base.Models public List OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } } public List OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } } public List AddressTypeCodes { get { return Internals.AddressTypeCodes; } } + public List ContactMethodCodes { get { return Internals.ContactMethodCodes; } } public List EventTypeCodes { get { return Internals.EventTypeCodes; } } public List OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } } public List ActivityReactionCodes { get { return Internals.ActivityReactionCodes; } } diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Activation-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Activation-Ajax.cs index 56a4ac2..5e6d998 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Activation-Ajax.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Activation-Ajax.cs @@ -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 Members { get; } = new 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 organisationMembersToActivate = new List(); 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. diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Ajax.cs index a8be7f4..5c0cd4f 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Ajax.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/OrganisationController-Ajax.cs @@ -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 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(); + 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 Organisations { get; } = new List(); + public List Organisations { get; } = new List(); // Reference data. + public List ContactMethods { get; } = new List(); public List Statuses { get; } = new List(); 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 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 disposableItems = new DisposableCollection()) { - 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 disposableItems = new DisposableCollection()) { - 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); } diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax-ContactMethods.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax-ContactMethods.cs new file mode 100644 index 0000000..df7562b --- /dev/null +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax-ContactMethods.cs @@ -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); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax.cs new file mode 100644 index 0000000..b4d6647 --- /dev/null +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax.cs @@ -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 logger) : + base(localiser, logger) + {} + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaxoniteCoreWebAdmin/Admin/Models/ModelData_Address.cs b/SaxoniteCoreWebAdmin/Admin/Models/ModelData_Address.cs new file mode 100644 index 0000000..6c46bcc --- /dev/null +++ b/SaxoniteCoreWebAdmin/Admin/Models/ModelData_Address.cs @@ -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 +{ + //======================================================================= + /// + /// Address model data properties. + /// + 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. + /// Have any address values been supplied by the form. + 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(); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaxoniteCoreWebAdmin/Admin/Models/ModelData_Online.cs b/SaxoniteCoreWebAdmin/Admin/Models/ModelData_Online.cs new file mode 100644 index 0000000..733c682 --- /dev/null +++ b/SaxoniteCoreWebAdmin/Admin/Models/ModelData_Online.cs @@ -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 +{ + //======================================================================= + /// + /// Online model data. + /// + public class ModelData_Admin + { + //------------------------------------------------------------------- + // Construction. + public ModelData_Admin(SaxModel_Admin model) + { + this.Model = model; + } + + //------------------------------------------------------------------- + // Properties. + public SaxModel_Admin Model { get; } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaxoniteCoreWebAdmin/Admin/Models/Model_ContactMethod.cs b/SaxoniteCoreWebAdmin/Admin/Models/Model_ContactMethod.cs new file mode 100644 index 0000000..9adfeb9 --- /dev/null +++ b/SaxoniteCoreWebAdmin/Admin/Models/Model_ContactMethod.cs @@ -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; } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaxoniteCoreWebAdmin/Admin/Models/Model_Organisation.cs b/SaxoniteCoreWebAdmin/Admin/Models/Model_Organisation.cs index d56d30b..446bbf5 100644 --- a/SaxoniteCoreWebAdmin/Admin/Models/Model_Organisation.cs +++ b/SaxoniteCoreWebAdmin/Admin/Models/Model_Organisation.cs @@ -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. + /// Placeholder field value to indicate the number of Contact Methods in form (even if none are populated). + public String ContactMethods { get; set; } + public String[] ContactMethod { get; set; } + public String[] ContactValue { get; set; } + /// Contact methods to be populated during validation. + 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) { diff --git a/SaxoniteCoreWebAdmin/Localisation/SaxAdminProperties.resx b/SaxoniteCoreWebAdmin/Localisation/SaxAdminProperties.resx index 69d92cd..720ff5b 100644 --- a/SaxoniteCoreWebAdmin/Localisation/SaxAdminProperties.resx +++ b/SaxoniteCoreWebAdmin/Localisation/SaxAdminProperties.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Contact Method + Sportierre @@ -201,6 +204,9 @@ Columns + + Contact + Country @@ -285,6 +291,9 @@ Members awaiting activation + + Method + Name @@ -423,6 +432,9 @@ Users online + + Value + Yes diff --git a/SaxoniteCoreWebAdmin/Views/Common/ContactMethods.cshtml b/SaxoniteCoreWebAdmin/Views/Common/ContactMethods.cshtml new file mode 100644 index 0000000..57e0227 --- /dev/null +++ b/SaxoniteCoreWebAdmin/Views/Common/ContactMethods.cshtml @@ -0,0 +1,50 @@ +@model SaxModel_Admin +@inject SaxLocaliser Localiser + +@if (!Model.RegisterView("Views/Common/ContactMethods")) return; + + + + +
+
+ + @* Method *@ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ + @* Value *@ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+ diff --git a/SaxoniteCoreWebAdmin/Views/Common/Controls-ItemContactMethods.cshtml b/SaxoniteCoreWebAdmin/Views/Common/Controls-ItemContactMethods.cshtml new file mode 100644 index 0000000..06e39d0 --- /dev/null +++ b/SaxoniteCoreWebAdmin/Views/Common/Controls-ItemContactMethods.cshtml @@ -0,0 +1,75 @@ +@* Contact Methods controls *@ +@model SaxModel_Admin +@inject SaxLocaliser Localiser + +@if (!Model.RegisterView("Views/Common/Controls-ItemContactMethods")) return; + + +@* Contact Methods *@ +
+ +
+
+
+
+ +
+
+
+ @* Action to add new contact method. *@ +
+
@(Localiser[
+
+
+
+
+
+
+ @* List of existing contact methods with actions to edit/remove. *@ +
+
+
+ + + + + + +
+ + +
+
@(Localiser[
+
@(Localiser[
+
+
+
+
+
+
+
+
+ + diff --git a/SaxoniteCoreWebAdmin/Views/Common/SelectCode.cshtml b/SaxoniteCoreWebAdmin/Views/Common/SelectCode.cshtml index bb17642..c201668 100644 --- a/SaxoniteCoreWebAdmin/Views/Common/SelectCode.cshtml +++ b/SaxoniteCoreWebAdmin/Views/Common/SelectCode.cshtml @@ -1,6 +1,8 @@ @model SaxModel_Admin @inject SaxLocaliser Localiser +@if (!Model.RegisterView("Views/Common/SelectCode")) return; + - +@if (!Model.RegisterView("Views/Common/CodeSelect")) return; -
+ + + - @* Filter *@ -
+
-
+ @* Filter *@ +
- @* Available codes *@ -
+
-
+ @* Available codes *@ +
-
+
- @* Code selection *@ -
+
-
+ @* Code selection *@ +
-
- -
- -
- -
+
+
+
-
- - @* Selected codes *@ -
- -
- +
+
+
-
-
-
+ @* Selected codes *@ +
+ +
+
+ +
+
+
+
+
+ +
diff --git a/SaxoniteCoreWebOnline/Views/Common/ContactMethods.cshtml b/SaxoniteCoreWebOnline/Views/Common/ContactMethods.cshtml new file mode 100644 index 0000000..08f5659 --- /dev/null +++ b/SaxoniteCoreWebOnline/Views/Common/ContactMethods.cshtml @@ -0,0 +1,50 @@ +@model SaxModel_Online +@inject SaxLocaliser Localiser + +@if (!Model.RegisterView("Views/Common/ContactMethods")) return; + + + + +
+
+ + @* Method *@ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ + @* Value *@ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+ diff --git a/SaxoniteCoreWebOnline/Views/Common/OrganisationControls-Address.cshtml b/SaxoniteCoreWebOnline/Views/Common/OrganisationControls-Address.cshtml new file mode 100644 index 0000000..b9fd5d9 --- /dev/null +++ b/SaxoniteCoreWebOnline/Views/Common/OrganisationControls-Address.cshtml @@ -0,0 +1,99 @@ +@* Organisation controls - Address *@ +@model SaxModel_Online +@inject SaxLocaliser Localiser + +@if (!Model.RegisterView("Views/Common/OrganisationControls-Address")) return; + +@* Organisation address - Line 1 *@ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ +@* Organisation address - Line 2 *@ +
+
+
+
+
+
+
+
+
+
+
+ +@* Organisation address - Line 3 *@ +
+
+
+
+
+
+
+
+
+
+
+ +@* Organisation address - Town *@ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ +@* Organisation address - Province *@ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ +@* Organisation address - PostalCode *@ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
diff --git a/SaxoniteCoreWebOnline/Views/Common/OrganisationControls-Contact.cshtml b/SaxoniteCoreWebOnline/Views/Common/OrganisationControls-Contact.cshtml new file mode 100644 index 0000000..56994f4 --- /dev/null +++ b/SaxoniteCoreWebOnline/Views/Common/OrganisationControls-Contact.cshtml @@ -0,0 +1,75 @@ +@* Organisation controls - Contact *@ +@model SaxModel_Online +@inject SaxLocaliser Localiser + +@if (!Model.RegisterView("Views/Common/OrganisationControls-Contact")) return; + + +@* Organisation Contact Methods *@ +
+ +
+
+
+
+ +
+
+
+ @* Action to add new contact method. *@ +
+
@(Localiser[
+
+
+
+
+
+
+ @* List of existing contact methods with actions to edit/remove. *@ +
+
+
+ + + + + + +
+ + +
+
@(Localiser[
+
@(Localiser[
+
+
+
+
+
+
+
+
+ + diff --git a/SaxoniteCoreWebOnline/Views/Common/OrganisationControls-Core.cshtml b/SaxoniteCoreWebOnline/Views/Common/OrganisationControls-Core.cshtml new file mode 100644 index 0000000..f236a68 --- /dev/null +++ b/SaxoniteCoreWebOnline/Views/Common/OrganisationControls-Core.cshtml @@ -0,0 +1,94 @@ +@* Organisation controls - Core *@ +@model SaxModel_Online +@inject SaxLocaliser Localiser + +@if (!Model.RegisterView("Views/Common/OrganisationControls-Core")) return; + +@* Organisation name *@ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+
+ + @* Organisation category *@ +
+
+
+ +
+
+ @Html.DropDownList("", Model.OrganisationCategoriesForSelect, Localiser["label.select"] + ":", new { @id = "", @name = "Organisation.Category", @class = "OrganisationCategory sax-select" }) +
+
+
+
+ + @* Organisation type *@ +
+
+
+ +
+
+ @Html.DropDownList("", Model.OrganisationTypesForSelect, Localiser["label.select"] + ":", new { @id = "", @name = "Organisation.Type", @class = "OrganisationType sax-select" }) +
+
+
+
+ +
+
+ +@* Organisation sport *@ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+ +@* Organisation primary region *@ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+ diff --git a/SaxoniteCoreWebOnline/Views/Common/OrganisationControls.cshtml b/SaxoniteCoreWebOnline/Views/Common/OrganisationControls.cshtml deleted file mode 100644 index 59d00a7..0000000 --- a/SaxoniteCoreWebOnline/Views/Common/OrganisationControls.cshtml +++ /dev/null @@ -1,208 +0,0 @@ -@model SaxModel_Online -@inject SaxLocaliser Localiser - -
-
- -
-
- -@* Organisation name *@ -
-
-
-
- -
-
-
-
- -
-
-
-
-
- -
-
-
- - @* Organisation category *@ -
-
-
- -
-
- @Html.DropDownList("", Model.OrganisationCategoriesForSelect, Localiser["label.select"] + ":", new { @id = "", @name = "Organisation.Category", @class = "OrganisationCategory sax-select" }) -
-
-
-
- - @* Organisation type *@ -
-
-
- -
-
- @Html.DropDownList("", Model.OrganisationTypesForSelect, Localiser["label.select"] + ":", new { @id = "", @name = "Organisation.Type", @class = "OrganisationType sax-select" }) -
-
-
-
- -
-
- -@* Organisation sport *@ -
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
- -@* Organisation country *@ -
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
- -@* Organisation PhoneMain *@ -
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -@* Organisation address - Line 1 *@ -
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -@* Organisation address - Line 2 *@ -
-
-
-
-
-
-
-
-
-
-
- -@* Organisation address - Line 3 *@ -
-
-
-
-
-
-
-
-
-
-
- -@* Organisation address - Town *@ -
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -@* Organisation address - Province *@ -
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -@* Organisation address - PostalCode *@ -
-
-
-
- -
-
-
-
-
-
-
-
-
-
- diff --git a/SaxoniteCoreWebOnline/Views/Common/OrganisationRequest.cshtml b/SaxoniteCoreWebOnline/Views/Common/OrganisationRequest.cshtml index 8ad5be8..081ddcd 100644 --- a/SaxoniteCoreWebOnline/Views/Common/OrganisationRequest.cshtml +++ b/SaxoniteCoreWebOnline/Views/Common/OrganisationRequest.cshtml @@ -1,5 +1,8 @@ @model SaxModel_Online @inject SaxLocaliser Localiser + +@if (!Model.RegisterView("Views/Common/OrganisationRequest")) return; + @{ Microsoft.AspNetCore.Html.HtmlString regionIdCountry = new Microsoft.AspNetCore.Html.HtmlString(Model.ValidUserSession ? Model.GetEncryptedRegionId(Model.SessionData.User.RegionIdCountry) : ""); String regionNameCountry = Model.ValidUserSession ? Localiser.EscapeJavascriptText(Model.GetRegionCaption(Model.SessionData.User.RegionIdCountry)) : ""; @@ -29,7 +32,7 @@ @* Contact Email Address *@
-
+
@@ -44,7 +47,7 @@
-
@* No label. *@
+
@* No label. *@
@* Contact First Name *@ @@ -78,7 +81,16 @@ } - + @* Organisation core details - name, category, sport, region etc *@ +
+
+ +
+
+ + + @* Organisation Address *@ + } diff --git a/SaxoniteCoreWebOnline/Views/Common/OrganisationSelect.cshtml b/SaxoniteCoreWebOnline/Views/Common/OrganisationSelect.cshtml index 8ac8f19..c6cf994 100644 --- a/SaxoniteCoreWebOnline/Views/Common/OrganisationSelect.cshtml +++ b/SaxoniteCoreWebOnline/Views/Common/OrganisationSelect.cshtml @@ -1,6 +1,8 @@ @model SaxModel_Online @inject SaxLocaliser Localiser +@if (!Model.RegisterView("Views/Common/OrganisationSelect")) return; + diff --git a/SaxoniteCoreWebOnline/Views/Common/SportSelect.cshtml b/SaxoniteCoreWebOnline/Views/Common/SportSelect.cshtml index cb55b73..c908da5 100644 --- a/SaxoniteCoreWebOnline/Views/Common/SportSelect.cshtml +++ b/SaxoniteCoreWebOnline/Views/Common/SportSelect.cshtml @@ -1,6 +1,8 @@ @model SaxModel_Online @inject SaxLocaliser Localiser +@if (!Model.RegisterView("Views/Common/SportSelect")) return; + diff --git a/SaxoniteCoreWebOnline/Views/Search/Panel-OrganisationDialog.cshtml b/SaxoniteCoreWebOnline/Views/Search/Panel-OrganisationDialog.cshtml index 92fe9ea..9e014bc 100644 --- a/SaxoniteCoreWebOnline/Views/Search/Panel-OrganisationDialog.cshtml +++ b/SaxoniteCoreWebOnline/Views/Search/Panel-OrganisationDialog.cshtml @@ -4,6 +4,22 @@ /* Organisation dialog panel */ } + @@ -13,7 +29,7 @@ }
-
+
"
@Localiser["label.type"]
@@ -29,11 +45,15 @@
@Localiser["label.about"]
-
+
@Localiser["label.facilities"]
-
+
+
+
+
@Localiser["label.contact"]
+
@Localiser["label.address"]
diff --git a/SaxoniteCoreWebOnline/wwwroot/css/sax-data.css b/SaxoniteCoreWebOnline/wwwroot/css/sax-data.css index 95e8f6e..cc69775 100644 --- a/SaxoniteCoreWebOnline/wwwroot/css/sax-data.css +++ b/SaxoniteCoreWebOnline/wwwroot/css/sax-data.css @@ -238,8 +238,8 @@ .sax-panel-item > .sax-content { - margin: 4px 8px; - padding: 4px 4px; + margin: 4px 8px 2px 8px; + padding: 2px 2px; } .sax-panel-item .sax-note diff --git a/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css b/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css index 61ea338..a1de06b 100644 --- a/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css +++ b/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css @@ -182,7 +182,7 @@ .sax-form .sax-input.sax-calendar { - width:80%; + width: 80%; max-width: 180px; } @@ -193,8 +193,10 @@ 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; } @@ -220,7 +222,7 @@ .sax-form .sax-form-control.sax-error .sax-message { - min-height:16px; + min-height: 16px; display: block; color: #e3120b; background-image: url("../img/icon/error-16.png"); diff --git a/SaxoniteCoreWebOnline/wwwroot/img/action/edit16.png b/SaxoniteCoreWebOnline/wwwroot/img/action/edit16.png new file mode 100644 index 0000000..1b4afbe Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/action/edit16.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/facebook-16.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/facebook-16.png new file mode 100644 index 0000000..1657af8 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/facebook-16.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/facebook-24.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/facebook-24.png new file mode 100644 index 0000000..6475212 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/facebook-24.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/facebook-32.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/facebook-32.png new file mode 100644 index 0000000..797ed1b Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/facebook-32.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/instagram-16.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/instagram-16.png new file mode 100644 index 0000000..b352317 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/instagram-16.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/instagram-24.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/instagram-24.png new file mode 100644 index 0000000..df33bdf Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/instagram-24.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/instagram-32.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/instagram-32.png new file mode 100644 index 0000000..949bee5 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/instagram-32.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/linkedin-16.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/linkedin-16.png new file mode 100644 index 0000000..3835c92 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/linkedin-16.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/linkedin-24.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/linkedin-24.png new file mode 100644 index 0000000..052bbe3 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/linkedin-24.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/linkedin-32.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/linkedin-32.png new file mode 100644 index 0000000..955b48a Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/linkedin-32.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/mobile-16.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/mobile-16.png new file mode 100644 index 0000000..9d9c62f Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/mobile-16.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/mobile-24.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/mobile-24.png new file mode 100644 index 0000000..330fbdc Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/mobile-24.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/mobile-32.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/mobile-32.png new file mode 100644 index 0000000..e8a5cd5 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/mobile-32.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/phone-16.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/phone-16.png new file mode 100644 index 0000000..dfadfb1 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/phone-16.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/phone-24.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/phone-24.png new file mode 100644 index 0000000..28e78ae Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/phone-24.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/phone-32.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/phone-32.png new file mode 100644 index 0000000..df4830d6 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/phone-32.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/twitter-16.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/twitter-16.png new file mode 100644 index 0000000..b2468da Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/twitter-16.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/twitter-24.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/twitter-24.png new file mode 100644 index 0000000..b8fa1ea Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/twitter-24.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/twitter-32.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/twitter-32.png new file mode 100644 index 0000000..2572857 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/twitter-32.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/wikipedia-16.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/wikipedia-16.png new file mode 100644 index 0000000..6e18531 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/wikipedia-16.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/wikipedia-24.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/wikipedia-24.png new file mode 100644 index 0000000..ef9f60c Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/wikipedia-24.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/wikipedia-32.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/wikipedia-32.png new file mode 100644 index 0000000..e9c0464 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/wikipedia-32.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/www-16.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/www-16.png new file mode 100644 index 0000000..6865945 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/www-16.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/www-24.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/www-24.png new file mode 100644 index 0000000..b3c94ce Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/www-24.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/www-32.png b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/www-32.png new file mode 100644 index 0000000..b918344 Binary files /dev/null and b/SaxoniteCoreWebOnline/wwwroot/img/icon/contact/www-32.png differ diff --git a/SaxoniteCoreWebOnline/wwwroot/js/sax-cnt-mth.js b/SaxoniteCoreWebOnline/wwwroot/js/sax-cnt-mth.js new file mode 100644 index 0000000..9ceb376 --- /dev/null +++ b/SaxoniteCoreWebOnline/wwwroot/js/sax-cnt-mth.js @@ -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($('