This commit is contained in:
2021-10-17 13:12:05 +01:00
parent 7417981a34
commit 057b75462e
20 changed files with 326 additions and 155 deletions
+80 -63
View File
@@ -41,30 +41,39 @@ namespace Saxonite.Net.Core.Web.Base.App
/// <summary>Retrieve localised text.</summary>
public LocalizedString GetText(string key)
{
return GetText(key, new object[] { });
return GetText(key, null);
}
/// <summary>Retrieve localised text.</summary>
public LocalizedString GetText(string key, bool logMissingKey = true)
{
return GetText(key, null, logMissingKey);
}
/// <summary>Retrieve localised text.</summary>
public LocalizedString GetText(string key, object param)
{
return GetText(key, new object[] { param });
}
/// <summary>Retrieve localised text.</summary>
public LocalizedString GetText(string key, object param1, object param2)
{
return GetText(key, new object[] { param1, param2 });
}
public LocalizedString GetText(string key, object[] parameters)
/// <summary>Retrieve localised text.</summary>
public LocalizedString GetText(string key, object[] parameters, bool logMissingKey = true)
{
LocalizedString text = MainProperties.GetString(key, parameters);
LocalizedString text = parameters == null || parameters.IsEmpty() ? MainProperties.GetString(key) : MainProperties.GetString(key, parameters);
if (text.ResourceNotFound)
{
SaLogger.Debug(GetType().Name + ".GetText Key not found: " + key);
// Look up key in alternative property files.
foreach (IStringLocalizer properties in AlternativeProperties ?? new List<IStringLocalizer>())
{
text = properties.GetString(key, parameters);
text = parameters == null || parameters.IsEmpty() ? properties.GetString(key) : properties.GetString(key, parameters);
if (!text.ResourceNotFound)
break;
}
}
if (text.ResourceNotFound && logMissingKey)
SaLogger.Debug(GetType().Name + ".GetText Key not found: " + key);
return text;
}
@@ -135,19 +144,21 @@ namespace Saxonite.Net.Core.Web.Base.App
//-------------------------------------------------------------------
// Specific phrase translation.
//-------------------------------------------------------------------
private class CodeCache
private class CodesCache
{
public List<TypeCodeDesc> genderCodes;
public List<TypeCodeDesc> sportParticipationCodes;
public List<TypeCodeDesc> sportOfficiatingCodes;
public List<TypeCodeDesc> regionTypeCodes;
public List<TypeCodeDesc> userRoleCodes;
public List<TypeCodeDesc> organisationTypeCodes;
public List<TypeCodeDesc> organisationCategoryCodes;
public List<TypeCodeDesc> organisationRoleCodes;
public List<TypeCodeDesc> opportunityTypeCodes;
private Dictionary<Sax.CodeType, List<TypeCodeDesc>> codeTypeCache { get; } = new Dictionary<Sax.CodeType, List<TypeCodeDesc>>();
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
{
List<TypeCodeDesc> codes = codeTypeCache.GetValue(codeType, null);
if (codes == null)
{
codes = SaxSystem.GetCodesOfType(codeType);
codeTypeCache.Add(codeType, codes);
}
return codes;
}
}
private CodeCache codes = new CodeCache();
private CodesCache codesCache = new CodesCache();
// Status.
public String GetStatusCaption(SaStatus status)
@@ -156,94 +167,100 @@ namespace Saxonite.Net.Core.Web.Base.App
return SacsSystem.GetStatusDesc(status);
}
// Generic code type.
private String GetCodeTypeCaption<T>(Sax.CodeType codeType, T type) where T : struct, IConvertible
{
if (!(type is Enum))
throw new ArgumentException(GetType().Name + ".GetCodeTypeCaption Type parameter must be an enumerated type. Type supplied: " + type.GetType().Name);
return GetCodeTypeCaption(codeType, (int)(type as IConvertible), type.ToString());
}
private String GetCodeTypeCaption(Sax.CodeType codeType, int type, String typeName)
{
if (type < 1) return "";
List<TypeCodeDesc> codes = this.codesCache.GetCodesOfType(codeType);
TypeCodeDesc code = codes.GetEntryForType(type);
if (code != null)
{
// Code Type localisation.
String codeTypeKey = "codeType." + codeType.ToString() + "." + typeName;
String typeDesc = GetText(codeTypeKey, false);
if (typeDesc.EqualsCI(codeTypeKey))
typeDesc = "";
return StringUtil.OnEmpty(typeDesc, code.Desc);
}
return "";
}
// Yes/No.
public String GetYesNoCaption(Sax.YesNo yesNo)
{
return GetCodeTypeCaption(Sax.CodeType.YesNo, yesNo);
}
// Data item type.
public String GetItemDataTypeCaption(Sax.DataItemType itemType)
{
return GetCodeTypeCaption(Sax.CodeType.DataItemType, itemType);
}
// Gender.
public String GetGenderCaption(Sax.Gender gender)
{
if ((int)gender < 1) return "";
if (codes.genderCodes == null)
codes.genderCodes = SaxSystem.GetCodesOfType(Sax.CodeType.Gender);
// ToDo Opportunity Type localisation.
return codes.genderCodes.GetDescForType(gender);
return GetCodeTypeCaption(Sax.CodeType.Gender, gender);
}
// Sport Speciality label.
public String GetSportSpecialityLabelCaption(Sax.SportSpecialityLabel specialityLabel)
{
return GetCodeTypeCaption(Sax.CodeType.SportSpecialityLabel, specialityLabel);
}
// Sport Participation.
public String GetSportParticipationTypeCaption(Sax.SportParticipation participation)
public String GetSportParticipationCaption(Sax.SportParticipation participation)
{
if ((int)participation < 1) return "";
if (codes.sportParticipationCodes == null)
codes.sportParticipationCodes = SaxSystem.GetCodesOfType(Sax.CodeType.SportParticipation);
// ToDo Sport Participation localisation.
return codes.sportParticipationCodes.GetDescForType(participation);
return GetCodeTypeCaption(Sax.CodeType.SportParticipation, participation);
}
// Sport Officiating.
public String GetSportOfficiatingTypeCaption(Sax.SportOfficiating participation)
public String GetSportOfficiatingCaption(Sax.SportOfficiating participation)
{
if ((int)participation < 1) return "";
if (codes.sportOfficiatingCodes == null)
codes.sportOfficiatingCodes = SaxSystem.GetCodesOfType(Sax.CodeType.SportOfficiating);
// ToDo Sport Officiating localisation.
return codes.sportOfficiatingCodes.GetDescForType(participation);
return GetCodeTypeCaption(Sax.CodeType.SportOfficiating, participation);
}
// Region type.
public String GetRegionTypeCaption(Sax.RegionType regionType)
{
if ((int)regionType < 1) return "";
if (codes.regionTypeCodes == null)
codes.regionTypeCodes = SaxSystem.GetCodesOfType(Sax.CodeType.RegionType);
// ToDo Region type localisation.
return codes.regionTypeCodes.GetDescForType(regionType);
return GetCodeTypeCaption(Sax.CodeType.RegionType, regionType);
}
// User role.
public String GetUserRoleCaption(Sax.UserRole userRole)
{
if ((int)userRole < 1) return "";
if (codes.userRoleCodes == null)
codes.userRoleCodes = SaxSystem.GetCodesOfType(Sax.CodeType.UserRole);
// ToDo User Role localisation.
return codes.userRoleCodes.GetDescForType(userRole);
return GetCodeTypeCaption(Sax.CodeType.UserRole, userRole);
}
// Organisation type.
public String GetOrganisationTypeCaption(Sax.OrganisationType organisationType)
{
if ((int)organisationType < 1) return "";
if (codes.organisationTypeCodes == null)
codes.organisationTypeCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationType);
// ToDo Organisation Type localisation.
return codes.organisationTypeCodes.GetDescForType(organisationType);
return GetCodeTypeCaption(Sax.CodeType.OrganisationType, organisationType);
}
// Organisation category.
public String GetOrganisationCategoryCaption(Sax.OrganisationCategory organisationCategory)
{
if ((int)organisationCategory < 1) return "";
if (codes.organisationCategoryCodes == null)
codes.organisationCategoryCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationCategory);
// ToDo Organisation Category localisation.
return codes.organisationCategoryCodes.GetDescForType(organisationCategory);
return GetCodeTypeCaption(Sax.CodeType.OrganisationCategory, organisationCategory);
}
// Organisation role.
public String GetOrganisationRoleCaption(Sax.OrganisationRole organisationRole)
{
if ((int)organisationRole < 1) return "";
if (codes.organisationRoleCodes == null)
codes.organisationRoleCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationRole);
// ToDo Organisation Role localisation.
return codes.organisationRoleCodes.GetDescForType(organisationRole);
return GetCodeTypeCaption(Sax.CodeType.OrganisationRole, organisationRole);
}
// Opportunity type.
public String GetOpportunityTypeCaption(Sax.OpportunityType opportunityType)
{
if ((int)opportunityType < 1) return "";
if (codes.opportunityTypeCodes == null)
codes.opportunityTypeCodes = SaxSystem.GetCodesOfType(Sax.CodeType.OpportunityType);
// ToDo Opportunity Type localisation.
return codes.opportunityTypeCodes.GetDescForType(opportunityType);
return GetCodeTypeCaption(Sax.CodeType.OpportunityType, opportunityType);
}
//-------------------------------------------------------------------
+42 -25
View File
@@ -288,8 +288,8 @@ namespace Saxonite.Net.Core.Web.Base.Models
get
{
List<SelectListItem> values = new List<SelectListItem>();
foreach (TypeCodeDesc yesNo in SaxSystem.GetCodesOfType(Sax.CodeType.YesNo))
values.Add(new SelectListItem(yesNo.Code, GetYesNoCaption((Sax.YesNo)yesNo.Type)));
foreach (TypeCodeDesc yesNo in YesNoCodes)
values.Add(new SelectListItem(yesNo.Code, Localiser.GetYesNoCaption((Sax.YesNo)yesNo.Type)));
return values;
}
}
@@ -299,29 +299,48 @@ namespace Saxonite.Net.Core.Web.Base.Models
{
get
{
List<SelectListItem> codes = new List<SelectListItem>();
codes.Add(new SelectListItem("Default", ""));
codes.AddRange(new SelectList(SportSpecialityLabelCodes, "Code", "Desc"));
return codes;
List<SelectListItem> values = new List<SelectListItem>();
values.Add(new SelectListItem("Default", ""));
foreach (TypeCodeDesc sportSpecialityLabel in SportSpecialityLabelCodes)
values.Add(new SelectListItem(sportSpecialityLabel.Code, Localiser.GetSportSpecialityLabelCaption((Sax.SportSpecialityLabel)sportSpecialityLabel.Type)));
return values;
}
}
/// <summary>List of Sport Participation options for dropdown.</summary>
public IEnumerable<SelectListItem> SportParticipationCodesForSelect
{
get { return new SelectList(SportParticipationCodes, "Code", "Desc"); }
get
{
List<SelectListItem> values = new List<SelectListItem>();
foreach (TypeCodeDesc sportParticipation in SportParticipationCodes)
values.Add(new SelectListItem(sportParticipation.Code, Localiser.GetSportParticipationCaption((Sax.SportParticipation)sportParticipation.Type)));
return values;
}
}
/// <summary>List of Sport Officiating options for dropdown.</summary>
public IEnumerable<SelectListItem> SportOfficiatingCodesForSelect
{
get { return new SelectList(SportOfficiatingCodes, "Code", "Desc"); }
get
{
List<SelectListItem> values = new List<SelectListItem>();
foreach (TypeCodeDesc sportOfficiating in SportOfficiatingCodes)
values.Add(new SelectListItem(sportOfficiating.Code, Localiser.GetSportOfficiatingCaption((Sax.SportOfficiating)sportOfficiating.Type)));
return values;
}
}
/// <summary>List of Region Types for dropdown.</summary>
public IEnumerable<SelectListItem> RegionTypesForSelect
{
get { return new SelectList(RegionTypeCodes.FindAll(item => item.Type != (int)Sax.RegionType.Universe && item.Type != (int)Sax.RegionType.Galaxy), "Code", "Desc"); }
get
{
List<SelectListItem> values = new List<SelectListItem>();
foreach (TypeCodeDesc organisationType in RegionTypeCodes.FindAll(item => item.Type != (int)Sax.RegionType.Universe && item.Type != (int)Sax.RegionType.Galaxy))
values.Add(new SelectListItem(organisationType.Code, Localiser.GetRegionTypeCaption((Sax.RegionType)organisationType.Type)));
return values;
}
}
/// <summary>List of titles for dropdown.</summary>
@@ -333,27 +352,25 @@ namespace Saxonite.Net.Core.Web.Base.Models
/// <summary>List of Organisation Types for dropdown.</summary>
public IEnumerable<SelectListItem> OrganisationTypesForSelect
{
get { return new SelectList(OrganisationTypeCodes, "Code", "Desc"); }
get
{
List<SelectListItem> values = new List<SelectListItem>();
foreach (TypeCodeDesc organisationType in OrganisationTypeCodes)
values.Add(new SelectListItem(organisationType.Code, Localiser.GetOrganisationTypeCaption((Sax.OrganisationType)organisationType.Type)));
return values;
}
}
/// <summary>List of Organisation Categories for dropdown.</summary>
public IEnumerable<SelectListItem> OrganisationCategoriesForSelect
{
get { return new SelectList(OrganisationCategoryCodes, "Code", "Desc"); }
}
//-------------------------------------------------------------------
// Localisation.
//-------------------------------------------------------------------
public String GetItemDataTypeCaption(Sax.DataItemType itemType)
{
// Default - return code description.
return DataItemTypeCodes.GetDescForType(itemType);
}
public String GetYesNoCaption(Sax.YesNo yesNo)
{
// Default - return code description.
return YesNoCodes.GetDescForType(yesNo);
get
{
List<SelectListItem> values = new List<SelectListItem>();
foreach (TypeCodeDesc organisationCategory in OrganisationCategoryCodes)
values.Add(new SelectListItem(organisationCategory.Code, Localiser.GetOrganisationCategoryCaption((Sax.OrganisationCategory)organisationCategory.Type)));
return values;
}
}
//-------------------------------------------------------------------
@@ -135,8 +135,6 @@
margin: 6px auto;
border: solid 1px #979797;
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
overflow: hidden;
}
@@ -13,8 +13,6 @@
border: solid 1px #979797;
border-color: var(--color-primary);
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
overflow: hidden;
}
@@ -161,8 +159,6 @@
background-color: #fff;
border: 1px solid #595959;
border-radius: 2px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
outline: none;
}
@@ -252,6 +252,9 @@
<data name="label.characters.one" xml:space="preserve">
<value>1 character</value>
</data>
<data name="label.clear" xml:space="preserve">
<value>Clear</value>
</data>
<data name="label.close" xml:space="preserve">
<value>Close</value>
</data>
@@ -309,6 +312,9 @@
<data name="label.experience" xml:space="preserve">
<value>Experience</value>
</data>
<data name="label.first" xml:space="preserve">
<value>First</value>
</data>
<data name="label.first.name" xml:space="preserve">
<value>First name</value>
</data>
@@ -336,6 +342,9 @@
<data name="label.keep.signed.in" xml:space="preserve">
<value>Remember Me</value>
</data>
<data name="label.last" xml:space="preserve">
<value>Last</value>
</data>
<data name="label.last.name" xml:space="preserve">
<value>Last name</value>
</data>
@@ -357,6 +366,9 @@
<data name="label.name" xml:space="preserve">
<value>Name</value>
</data>
<data name="label.next" xml:space="preserve">
<value>Next</value>
</data>
<data name="label.no" xml:space="preserve">
<value>No</value>
</data>
@@ -414,6 +426,9 @@
<data name="label.postalCode" xml:space="preserve">
<value>Postal code</value>
</data>
<data name="label.previous" xml:space="preserve">
<value>Previous</value>
</data>
<data name="label.province" xml:space="preserve">
<value>Province</value>
</data>
@@ -47,9 +47,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
data.SportSpecialityLabel = model.GetSportSpecialityLabel(userSport.SportId);
data.SportAbout = userSport.About;
data.SportParticipationCode = SportParticipationCodes.GetCodeForType(userSport.Participation);
data.SportParticipation = Localiser.GetSportParticipationTypeCaption(userSport.Participation);
data.SportParticipation = Localiser.GetSportParticipationCaption(userSport.Participation);
data.SportOfficiatingCode = SportOfficiatingCodes.GetCodeForType(userSport.Officiating);
data.SportOfficiating = Localiser.GetSportOfficiatingTypeCaption(userSport.Officiating);
data.SportOfficiating = Localiser.GetSportOfficiatingCaption(userSport.Officiating);
data.CreatedOnFmt = DateUtil.Format(userSport.CreateStamp.On, "d-MMM-yyyy");
data.StatusCode = userSport.StatusCode;
data.StatusDesc = userSport.StatusDesc;
@@ -117,8 +117,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
SportId = model.GetEncryptedSportId(sportId),
SportName = values.GetString(colSportName.DataName),
SportSpecialityLabel = model.GetSportSpecialityLabel(sportId),
SportParticipation = Localiser.GetSportParticipationTypeCaption((Sax.SportParticipation)values.GetLong(colParticipation.DataName)),
SportOfficiating = Localiser.GetSportOfficiatingTypeCaption((Sax.SportOfficiating)values.GetLong(colOfficiating.DataName)),
SportParticipation = Localiser.GetSportParticipationCaption((Sax.SportParticipation)values.GetLong(colParticipation.DataName)),
SportOfficiating = Localiser.GetSportOfficiatingCaption((Sax.SportOfficiating)values.GetLong(colOfficiating.DataName)),
StatusCode = values.GetString(colStatus.DataName),
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
};
@@ -14,6 +14,7 @@ using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Saxonite.Net.Standard.Base.App;
namespace Saxonite.Net.Core.Web.Online.Controllers
{
@@ -29,10 +30,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
public String Id { get; set; }
public String Name { get; set; }
public String CategoryDesc { get; set; }
public String SportId { get; set; }
public String SportName { get; set; }
public String RegionId { get; set; }
public String RegionName { get; set; }
public String Location { get; set; }
}
private class AjaxResponse_Search_Organisations : AjaxResponse_Data
{
@@ -75,13 +78,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
// Item columns.
ColumnDfn colId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Id);
ColumnDfn colName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Name);
ColumnDfn colCategory = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.OrganisationCategory_Desc);
ColumnDfn colSportId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.SportId);
ColumnDfn colSportName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Sport_Name);
ColumnDfn colRegionId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.RegionId);
ColumnDfn colRegionName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Region_Name);
List<ColumnDfn> columns = new List<ColumnDfn>()
{
colId, colName,
colId, colName, colCategory,
colSportId, colSportName,
colRegionId, colRegionName,
};
@@ -96,14 +100,16 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
{
NamedValue.Map values = resultSet.GetRecordValues();
Sax.OrganisationCategory category = (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(values.GetString(colCategory.DataName));
OrganisationListData organisationData = new OrganisationListData()
{
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
Name = values.GetString(colName.DataName),
SportId = model.GetEncryptedSportId(new SysId(values.GetLong(colSportId.DataName))),
CategoryDesc = Localiser.GetOrganisationCategoryCaption(category),
//SportId = model.GetEncryptedSportId(new SysId(values.GetLong(colSportId.DataName))),
SportName = values.GetString(colSportName.DataName),
RegionId = model.GetEncryptedRegionId(new SysId(values.GetLong(colRegionId.DataName))),
RegionName = values.GetString(colRegionName.DataName),
//RegionId = model.GetEncryptedRegionId(new SysId(values.GetLong(colRegionId.DataName))),
Location = values.GetString(colRegionName.DataName),
};
responseData.Organisations.Add(organisationData);
}
@@ -123,10 +129,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
public String Id { get; set; }
public String Name { get; set; }
public String SportId { get; set; }
public String SportName { get; set; }
public String RegionId { get; set; }
public String RegionName { get; set; }
public String Category { get; set; }
public String Sport { get; set; }
public String Location { get; set; }
public String Address { get; set; }
public String PostalCode { get; set; }
public String Phone { get; set; }
}
private class AjaxResponse_Search_Organisation : AjaxResponse_Data
{
@@ -143,7 +151,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
String fn = GetType().Name + ".GetProfileOrganisation";
AjaxResponse_Search_Organisation responseData = new AjaxResponse_Search_Organisation(model);
String messageTitle = Localiser["label.organisations"];
String messageTitle = Localiser["label.organisation"];
// Validate session and referrer.
if (!ValidReferer) return Forbid();
@@ -175,13 +183,21 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
{
Id = model.EncryptId(organisation.Id),
Name = organisation.Name,
SportId = model.GetEncryptedSportId(organisation.SportIdPrimary),
SportName = model.GetSportCaption(organisation.SportIdPrimary),
RegionId = model.GetEncryptedRegionId(organisation.RegionIdPrimary),
RegionName = model.GetRegionCaption(organisation.RegionIdPrimary),
Category = Localiser.GetOrganisationCategoryCaption(organisation.OrganisationCategory),
Sport = model.GetSportCaption(organisation.SportIdPrimary),
Location = model.GetRegionCaption(organisation.RegionIdPrimary),
};
responseData.Organisation = organisationData;
// Organisation address.
SaxItemAddress address = ItemDataMgr.GetFirstItemAddressByItemAndType(organisation.GetItemId());
if (address != null)
{
String addressLines = (new List<string>() { address.Line1, address.Line2, address.Line3 }).Concat(", ", "", "", true, true);
String addressTownProvince = (new List<string>() { address.Town, address.Province }).Concat(", ", "", "", true, true);
organisationData.Address = (new List<String>() { addressLines, addressTownProvince }).Concat("\n", "", "", true, true);
organisationData.PostalCode = address.PostalCode;
}
}
// Complete response.
@@ -4,7 +4,7 @@
ViewData["Title"] = "Search Organisations";
}
<div class="sax-panel Organisations">
<div class="sax-panel Organisations sax-alpha">
<script type="text/javascript">
sax.lbl.view = '@(Localiser.GetJavascriptText("label.view"))';
@@ -122,6 +122,9 @@
@* Organisation caption *@
<div class="sax-caption"><div class="sax-action"><span class="OrganisationName"></span></div></div>
</div>
<div class="fixed">
<div class="OrganisationCategory"></div>
</div>
<div class="fixed sax-actions">
@* Burger menu *@
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
@@ -133,10 +136,6 @@
</div>
</div>
<div class="sax-content">
<div class="row">
<div class="col-sm-6"><div class="OrganisationCategory"></div></div>
<div class="col-sm-6 text-sm-right"><div class="OrganisationLocation"></div></div>
</div>
<div class="row">
<div class="col-sm-6"><div class="OrganisationSport"></div></div>
<div class="col-sm-6 text-sm-right"><div class="OrganisationLocation"></div></div>
@@ -13,10 +13,29 @@
}
<div id="dlgOrganisation" class="sax-dialog" title="">
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisation", @class = "sax-form", @onSubmit = "return false;" }))
{
<div class="spacer"></div>
<div class="row OrganisationCategory">
<div class="col-sm-5"><div class="sax-label text-sm-right">@Localiser["label.type"]</div></div>
<div class="col-sm"><div class="sax-value"></div></div>
</div>
<div class="row OrganisationSport">
<div class="col-sm-5"><div class="sax-label text-sm-right">@Localiser["label.sport"]</div></div>
<div class="col-sm"><div class="sax-value"></div></div>
</div>
<div class="row OrganisationLocation">
<div class="col-sm-5"><div class="sax-label text-sm-right">@Localiser["label.location"]</div></div>
<div class="col-sm"><div class="sax-value"></div></div>
</div>
<div class="row OrganisationAddress">
<div class="col-sm-5"><div class="sax-label text-sm-right">@Localiser["label.address"]</div></div>
<div class="col-sm"><div class="sax-value"></div></div>
</div>
<div class="row OrganisationPostalCode">
<div class="col-sm-5"><div class="sax-label text-sm-right">@Localiser["label.postal.code"]</div></div>
<div class="col-sm"><div class="sax-value"></div></div>
</div>
}
<div class="spacer"></div>
</div>
@@ -16,7 +16,7 @@ body
div, button, input, select, textarea, table, tr, td
{
font-family: inherit;
font-size: 1rem;
font-size: inherit;
}
:focus, input:focus, textarea:focus, select:focus, button:focus
+50 -17
View File
@@ -10,8 +10,6 @@
background-color: #f8f8f8;
border: solid 1px var(--color-primary);
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
}
@media (min-width: 576px)
@@ -21,6 +19,8 @@
}
}
/* Filter */
.sax-panel-filter > .sax-header
{
padding: 2px 8px;
@@ -32,7 +32,7 @@
.sax-panel-filter > .sax-header .sax-caption
{
margin-top: 4px;
margin: 4px 0 2px 0;
font-size: 1.2rem;
font-weight: bold;
}
@@ -218,8 +218,6 @@
background-color: #f8f8f8;
border: solid 1px #979797;
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
overflow: hidden;
}
@@ -233,11 +231,51 @@
.sax-panel-item > .sax-header .sax-caption
{
margin-top: 4px;
margin: 4px 0;
font-size: 1.2rem;
font-weight: bold;
}
.sax-panel-item > .sax-content
{
margin: 4px 8px;
padding: 4px 4px;
}
.sax-panel-item .sax-note
{
font-size: 0.8rem;
}
/* Item - Alpha */
.sax-alpha .sax-panel-item
{
background-color: #fff;
border-radius: 0;
border-radius: 3px;
border-bottom-right-radius: 8px;
}
.sax-alpha .sax-panel-item > .sax-header
{
margin: 0 8px;
padding: 4px 0;
background-color: #fff;
}
.sax-alpha .sax-panel-item > .sax-header .sax-caption
{
}
.sax-alpha .sax-panel-item > .sax-content
{
background-color: #fff;
}
.sax-alpha .sax-panel-item .sax-note
{
}
/* Actions */
.sax-panel-item > .sax-header .sax-action
@@ -261,17 +299,6 @@
box-shadow: 0 0 4px 2px #c0c0c080;
}
.sax-panel-item > .sax-content
{
margin: 4px 8px;
padding: 4px 4px;
}
.sax-panel-item .sax-note
{
font-size: 0.8rem;
}
/* Profile Sports */
.sax-panel-item.ProfileSport,
@@ -288,6 +315,12 @@
border-color: var(--color-alt3);
}
.sax-alpha .sax-panel-item.Organisation,
.sax-alpha .sax-panel-item.Organisation > .sax-header
{
border-color: #b0b0b0;
}
/* Members */
.sax-panel-item.Member,
@@ -13,8 +13,6 @@
border: solid 2px #606060;
border-color: var(--color-primary);
border-radius: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
overflow: hidden;
}
+21 -1
View File
@@ -39,7 +39,7 @@ html
{
html
{
font-size: 16px;
font-size: 14px;
}
}
@@ -376,6 +376,26 @@ a:focus
opacity: 0.25;
}
/* Labels, values, notes */
.ui-dialog .sax-label, .ui-dialog .sax-value
{
margin-bottom: 6px;
font-size: 1rem;
}
.ui-dialog .sax-label
{
padding-right: 16px;
font-weight: bold;
color: #808080;
}
.ui-dialog .sax-value
{
}
/* Date Picker */
.ui-datepicker
{
@@ -307,7 +307,7 @@
$('.sax-input', $frm.member).on('input', function () { sax.clearControlError(this); });
var opt = sax.dlgOpts();
opt.buttons[sax.dlg.btn.ok] = function () { sax.storeItem()onUpdateItem; };
opt.buttons[sax.dlg.btn.ok] = function () { sax.storeItem(); };
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
$dlg.member = $('#dlgMember').dialog(opt);
+12 -10
View File
@@ -24,7 +24,7 @@
}
so.doRefreshResults = function (response)
{
sax.debug('doRefreshResults', response);
//sax.debug('doRefreshResults', response);
delete sax.awaitingRefreshResponse;
sax.refreshControlValues(response.controlValues);
var $msgs = $('.sax-panel-messages', $pnl.results).hide().empty();
@@ -49,7 +49,9 @@
if (!item) return;
$('.sax-panel-messages', $pnl.results).hide().empty();
$('.OrganisationName', $item).text(item.name);
$('.OrganisationEmail', $item).text(item.emailAddress);
$('.OrganisationCategory', $item).text(item.categoryDesc);
$('.OrganisationSport', $item).text(item.sportName);
$('.OrganisationLocation', $item).text(item.location);
let $bgr = $('.sax-burger', $item);
let $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
{
@@ -91,13 +93,11 @@
//--------------------------------------------------------------
so.selectFilterSport = function ()
{
sax.debug('selectFilterSport');
let excludeIds = [];
sax.mdl.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('.FilterSportId', $frm.filter).val(), excludeIds: excludeIds, fnCallback: so.onFilterSportSelected })
}
so.onFilterSportSelected = function (spt)
{
sax.debug('onFilterSportSelected', spt)
$('.FilterSportId', $frm.filter).val(spt ? spt.id : '');
$('.FilterSportCaption', $frm.filter).val(spt ? spt.name : '');
so.refreshResults();
@@ -111,13 +111,11 @@
//--------------------------------------------------------------
so.selectFilterRegion = function ()
{
sax.debug('selectFilterRegion');
let excludeIds = [];
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.FilterRegionId', $frm.filter).val(), excludeIds: excludeIds, fnCallback: so.onFilterRegionSelected })
}
so.onFilterRegionSelected = function (rgn)
{
sax.debug('onFilterRegionSelected', rgn)
$('.FilterRegionId', $frm.filter).val(rgn ? rgn.id : '');
$('.FilterRegionCaption', $frm.filter).val(rgn ? rgn.name : '');
so.refreshResults();
@@ -139,11 +137,16 @@
{
sax.debug('onViewItem', response);
if (!response.success) return;
let frm = $frm.org;
let dlg = $dlg.org;
let item = so.data.organisation = response.organisation;
$('.OrganisationName', frm).toggle(!item.awaiting).val(item.name);
$('.OrganisationName', dlg).val(item.name);
$('.OrganisationCategory', dlg).toggle(!!item.category).find('.sax-value').text(item.category);
$('.OrganisationSport', dlg).toggle(!!item.sport).find('.sax-value').text(item.sport);
$('.OrganisationLocation', dlg).toggle(!!item.location).find('.sax-value').text(item.location);
$('.OrganisationAddress', dlg).toggle(!!item.address).find('.sax-value').html(item.address ? item.address.replace('\n', '<br/>') : '');
$('.OrganisationPostalCode', dlg).toggle(!!item.postalCode).find('.sax-value').text(item.postalCode);
sax.clearControlErrors();
$dlg.org.dialog('option', 'title', sax.dlg.title.organisation);
$dlg.org.dialog('option', 'title', item.name || sax.dlg.title.organisation);
sax.openDialog($dlg.org, 600, 600);
}
@@ -165,7 +168,6 @@
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
$dlg.org = $('#dlgOrganisation').dialog(opt);
$frm.orgId = $('#frmOrganisationId');
$frm.org = $('#frmOrganisation', $dlg.org);
setTimeout(so.refreshResults, 250);
});
+1 -1
View File
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "1.1.6.1";
private static String version { get; } = "1.1.7.1";
// Retrieve version.
public static String GetFullVersion () { return version; }
public static String GetAppVersion ()
@@ -454,8 +454,9 @@ namespace Saxonite.Net.Standard.Base.Bus
// List filtering.
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
public Sax.AddressType AddressType = Sax.AddressType.Unknown;
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
public String AddressPartial { get; set; }
public String AddressSearch { get; set; }
// Common properties.
public String NotesPartial { get; set; }
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
@@ -48,6 +48,17 @@ namespace Saxonite.Net.Standard.Base.Mgr
prmItemAddress.StatusCat = SaxItemAddress.StatusCat.Any;
return GetItemAddress(prmItemAddress);
}
public SaxItemAddress GetFirstItemAddressByItemAndType(ItemId itemId, Sax.AddressType addressType = Sax.AddressType.Unknown)
{
ClearErrorState();
if (!ItemId.IsValid(itemId)) return null;
SaxItemAddress.Params prmItemAddress = new SaxItemAddress.Params();
prmItemAddress.AddressType = addressType;
prmItemAddress.ItemIdsIncluded.Add(itemId);
prmItemAddress.StatusCat = SaxItemAddress.StatusCat.Any;
List<SaxItemAddress> addresses = GetItemAddressList(prmItemAddress);
return addresses.Count > 0 ? addresses[0] : null;
}
//-------------------------------------------------------------------
// Validate item data.
@@ -408,15 +408,17 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
if (!StringUtil.IsEmpty(prm.OrganisationFilter))
{
// Split filter into words.
List<String> filterWords = prm.OrganisationFilter.Split((char[])null).ToList();
List<String> searchFilter = new List<String>();
List<String> filterWords = prm.OrganisationFilter.Split((char[])null, StringSplitOptions.RemoveEmptyEntries).ToList();
filterWords.RemoveDuplicatesCI();
filterWords.RemoveBlanks();
foreach (String filterWord in filterWords)
{
List<String> organisationFilter = new List<String>();
organisationFilter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Name, aliasOrganisation) + " Like '%" + DbQuery.FormatForLike(filterWord, true) + "%'");
filter.Add(organisationFilter.Concat(" OR ", "(", ")"));
searchFilter.Add(organisationFilter.Concat(" OR ", "(", ")"));
}
filter.Add(searchFilter.Concat(" AND ", "(", ")"));
}
// Sport Ids.
@@ -13,6 +13,7 @@ using System.Data.Common;
using System.Text;
using Saxonite.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Utils;
using System.Linq;
namespace Saxonite.Net.Standard.Dbas.Mgr
{
@@ -420,6 +421,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
if (!idsExcluded.IsEmpty())
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Id, aliasItemAddress) + " NOT IN (" + idsExcluded + ")");
// Address type.
if (prm.AddressType > 0)
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_AddressType, aliasItemAddress) + "=" + ((int)prm.AddressType).ToString());
// Item Ids.
if (!prm.ItemIdsIncluded.IsEmpty())
{
@@ -436,6 +441,28 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
filter.Add(itemIdFilters.Concat(" OR ", "(", ")"));
}
// Address search.
if (!StringUtil.IsEmpty(prm.AddressSearch))
{
// Split filter into words.
List<String> searchFilter = new List<String>();
List<String> filterWords = prm.AddressSearch.Split((char[])null, StringSplitOptions.RemoveEmptyEntries).ToList();
filterWords.RemoveDuplicatesCI();
filterWords.RemoveBlanks();
foreach (String filterWord in filterWords)
{
List<String> organisationFilter = new List<String>();
organisationFilter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1, aliasItemAddress) + " LIKE '%" + DbQuery.FormatForLike(filterWord) + "%'");
organisationFilter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2, aliasItemAddress) + " LIKE '%" + DbQuery.FormatForLike(filterWord) + "%'");
organisationFilter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3, aliasItemAddress) + " LIKE '%" + DbQuery.FormatForLike(filterWord) + "%'");
organisationFilter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town, aliasItemAddress) + " LIKE '%" + DbQuery.FormatForLike(filterWord) + "%'");
organisationFilter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province, aliasItemAddress) + " LIKE '%" + DbQuery.FormatForLike(filterWord) + "%'");
organisationFilter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode, aliasItemAddress) + " LIKE '%" + DbQuery.FormatForLike(filterWord) + "%'");
searchFilter.Add(organisationFilter.Concat(" OR ", "(", ")"));
}
filter.Add(searchFilter.Concat(" AND ", "(", ")"));
}
// Notes.
if (!StringUtil.IsEmpty(prm.NotesPartial))
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Notes, aliasItemAddress) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");