v1.1.5.1
This commit is contained in:
@@ -153,6 +153,9 @@
|
||||
<data name="account.caption.profile.sports" xml:space="preserve">
|
||||
<value>My Sports</value>
|
||||
</data>
|
||||
<data name="account.caption.profile.sports.experience" xml:space="preserve">
|
||||
<value>Sport Experience</value>
|
||||
</data>
|
||||
<data name="activity.caption.activities" xml:space="preserve">
|
||||
<value>Activities</value>
|
||||
</data>
|
||||
@@ -243,6 +246,9 @@
|
||||
<data name="label.close" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="label.club" xml:space="preserve">
|
||||
<value>Club</value>
|
||||
</data>
|
||||
<data name="label.comment" xml:space="preserve">
|
||||
<value>Comment</value>
|
||||
</data>
|
||||
@@ -267,6 +273,9 @@
|
||||
<data name="label.delete" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="label.discipline" xml:space="preserve">
|
||||
<value>Discipline</value>
|
||||
</data>
|
||||
<data name="label.edit" xml:space="preserve">
|
||||
<value>Edit</value>
|
||||
</data>
|
||||
@@ -282,12 +291,18 @@
|
||||
<data name="label.excellent" xml:space="preserve">
|
||||
<value>Excellent</value>
|
||||
</data>
|
||||
<data name="label.experience" xml:space="preserve">
|
||||
<value>Experience</value>
|
||||
</data>
|
||||
<data name="label.first.name" xml:space="preserve">
|
||||
<value>First name</value>
|
||||
</data>
|
||||
<data name="label.forgotten.password" xml:space="preserve">
|
||||
<value>Forgotten password?</value>
|
||||
</data>
|
||||
<data name="label.from" xml:space="preserve">
|
||||
<value>From</value>
|
||||
</data>
|
||||
<data name="label.gender" xml:space="preserve">
|
||||
<value>Gender</value>
|
||||
</data>
|
||||
@@ -306,6 +321,9 @@
|
||||
<data name="label.last.name" xml:space="preserve">
|
||||
<value>Last name</value>
|
||||
</data>
|
||||
<data name="label.league" xml:space="preserve">
|
||||
<value>League</value>
|
||||
</data>
|
||||
<data name="label.location" xml:space="preserve">
|
||||
<value>Location</value>
|
||||
</data>
|
||||
@@ -366,6 +384,9 @@
|
||||
<data name="label.password.current" xml:space="preserve">
|
||||
<value>Current password</value>
|
||||
</data>
|
||||
<data name="label.period" xml:space="preserve">
|
||||
<value>Period</value>
|
||||
</data>
|
||||
<data name="label.phone" xml:space="preserve">
|
||||
<value>Phone</value>
|
||||
</data>
|
||||
@@ -426,6 +447,9 @@
|
||||
<data name="label.selected.none" xml:space="preserve">
|
||||
<value>none selected</value>
|
||||
</data>
|
||||
<data name="label.speciality" xml:space="preserve">
|
||||
<value>Speciality</value>
|
||||
</data>
|
||||
<data name="label.sport" xml:space="preserve">
|
||||
<value>Sport</value>
|
||||
</data>
|
||||
@@ -441,9 +465,15 @@
|
||||
<data name="label.summary" xml:space="preserve">
|
||||
<value>Summary</value>
|
||||
</data>
|
||||
<data name="label.team" xml:space="preserve">
|
||||
<value>Team</value>
|
||||
</data>
|
||||
<data name="label.title" xml:space="preserve">
|
||||
<value>Title</value>
|
||||
</data>
|
||||
<data name="label.to" xml:space="preserve">
|
||||
<value>To</value>
|
||||
</data>
|
||||
<data name="label.town" xml:space="preserve">
|
||||
<value>Town</value>
|
||||
</data>
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
if (userAccount == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve user account for Id: " + SysId.ToString(SessionData.User.UserAccountId));
|
||||
return Json(responseData.SetGoHome(messageTitle, @Localiser.GetJavascriptText("msg.something.gone.wrong")));
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
}
|
||||
|
||||
// Logically delete any previous 'Uploaded' Avatar image.
|
||||
@@ -264,12 +264,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
if (userAccount == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve user account for Id: " + SysId.ToString(SessionData.User.UserAccountId));
|
||||
return Json(responseData.SetGoHome(messageTitle, @Localiser.GetJavascriptText("msg.something.gone.wrong")));
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
}
|
||||
if (!userAccount.EmailAddress.EqualsCI(SessionData.User.EmailAddress))
|
||||
{
|
||||
SaLogger.Warn(fn + " Unable to update user account '" + userAccount.EmailAddress + ". Email doesn't match session: " + SessionData.User.EmailAddress);
|
||||
return Json(responseData.SetGoHome(messageTitle, @Localiser.GetJavascriptText("msg.something.gone.wrong")));
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
}
|
||||
|
||||
// Populate user properties.
|
||||
@@ -303,9 +303,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
// Regions.
|
||||
if (model.AccountRegionIdCountry != null)
|
||||
userAccount.RegionIdCountry = model.AccountRegionIdCountry.ToSysId();
|
||||
userAccount.RegionIdCountry = model.ExtractSysId(model.AccountRegionIdCountry);
|
||||
if (model.AccountRegionIdProvince != null)
|
||||
userAccount.RegionIdProvince = model.AccountRegionIdProvince.ToSysId();
|
||||
userAccount.RegionIdProvince = model.ExtractSysId(model.AccountRegionIdProvince);
|
||||
|
||||
// Update User Account.
|
||||
if (userAccount.Changed) SaLogger.Info(fn + " Updating user account '" + userAccount.EmailAddress + "'. Id: " + SysId.ToString(userAccount.Id), true);
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
RefreshModel(model);
|
||||
|
||||
// Identify item.
|
||||
SysId userSportId = model.UserSportId.ToSysId();
|
||||
SysId userSportId = model.ExtractSysId(model.UserSportId);
|
||||
if (!SysId.IsValid(userSportId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Validate Profile Sport Id against 'Exists' flag.
|
||||
SysId userSportId = model.UserSportId.ToSysId();
|
||||
SysId userSportId = model.ExtractSysId(model.UserSportId);
|
||||
bool profileSportExists = StringUtil.ToBool(model.ProfileSportExists);
|
||||
if (profileSportExists && !SysId.IsValid(userSportId))
|
||||
{
|
||||
@@ -219,7 +219,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Retrieve the sport.
|
||||
SysId sportId = model.ProfileSportId.ToSysId();
|
||||
SysId sportId = model.ExtractSysId(model.ProfileSportId);
|
||||
SaxSport sport = ReferenceMgr.GetSportById(sportId);
|
||||
if (sport == null)
|
||||
{
|
||||
|
||||
+351
@@ -0,0 +1,351 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Saxonite.Net.Core.Web.Online.Models;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Sarand.Net.Standard.Base.Helpers;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Account Controller - User Sport Experience - Ajax actions.
|
||||
//=======================================================================
|
||||
partial class AccountController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Common response data.
|
||||
private class SportExperienceResponseData_List
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String UserSportId { get; set; }
|
||||
public String Period { get; set; }
|
||||
public String PeriodFrom { get; set; }
|
||||
public String PeriodTo { get; set; }
|
||||
public String OrganisationName { get; set; }
|
||||
public String Summary { get; set; }
|
||||
public String Team { get; set; }
|
||||
public String League { get; set; }
|
||||
public String Speciality { get; set; }
|
||||
// Regions.
|
||||
public String RegionCaptionNation { get; set; }
|
||||
public String RegionCaptionProvince { get; set; }
|
||||
public string RegionRepresentation { get; set; }
|
||||
}
|
||||
private class SportExperienceResponseData_Detail : SportExperienceResponseData_List
|
||||
{
|
||||
public String PeriodFrom_YMD { get; set; }
|
||||
public String PeriodTo_YMD { get; set; }
|
||||
public String OrganisationId { get; set; }
|
||||
public String RegionIdNation { get; set; }
|
||||
public String RegionIdProvince { get; set; }
|
||||
}
|
||||
private void PopulateSportExperienceResponseData(Model_UserSportExperience model, SportExperienceResponseData_Detail data, SaxUserSportExperience userSportExperience)
|
||||
{
|
||||
data.Id = model.EncryptId(userSportExperience.Id);
|
||||
data.UserSportId = model.EncryptId(userSportExperience.UserSportId);
|
||||
data.PeriodFrom_YMD = DateUtil.FormatDateForJavascript(userSportExperience.PeriodFrom);
|
||||
data.PeriodFrom = model.FormatDateForForm(userSportExperience.PeriodFrom);
|
||||
data.PeriodTo_YMD = DateUtil.FormatDateForJavascript(userSportExperience.PeriodTo);
|
||||
data.PeriodTo = model.FormatDateForForm(userSportExperience.PeriodTo);
|
||||
data.Period = data.PeriodFrom + " - " + data.PeriodTo;
|
||||
data.OrganisationId = model.EncryptId(userSportExperience.OrganisationId);
|
||||
data.OrganisationName = userSportExperience.OrganisationName;
|
||||
data.Summary = userSportExperience.Summary;
|
||||
data.Team = userSportExperience.Team;
|
||||
data.League = userSportExperience.League;
|
||||
data.Speciality = userSportExperience.Speciality;
|
||||
// Regions.
|
||||
data.RegionIdNation = model.EncryptId(userSportExperience.RegionIdNation);
|
||||
data.RegionIdProvince = model.EncryptId(userSportExperience.RegionIdProvince);
|
||||
using (SaxRegion regionNation = Internals.GetRegion(userSportExperience.RegionIdNation))
|
||||
using (SaxRegion regionProvince = Internals.GetRegion(userSportExperience.RegionIdProvince))
|
||||
{
|
||||
data.RegionCaptionNation = Localiser.GetRegionName(regionNation);
|
||||
data.RegionCaptionProvince = Localiser.GetRegionName(regionProvince);
|
||||
List<String> locations = new List<string>() { data.RegionCaptionProvince, data.RegionCaptionNation };
|
||||
data.RegionRepresentation = locations.Concat(", ", "", "", true, true);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilites.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User Sport - Get Experience list.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_UserSportExperienceList : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_UserSportExperienceList(SaxModel_Online model) : base(model) { }
|
||||
// Contact details.
|
||||
public List<SportExperienceResponseData_List> Experiences { get; } = new List<SportExperienceResponseData_List>();
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
[Route("UserSport/Ajax/GetExperienceList")]
|
||||
public IActionResult GetUserSportExperienceList(Model_UserSportExperience model)
|
||||
{
|
||||
String fn = GetType().Name + ".GetUserSportExperienceList";
|
||||
AjaxResponse_UserSportExperienceList responseData = new AjaxResponse_UserSportExperienceList(model);
|
||||
String messageTitle = Localiser["account.caption.profile.sports"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
// Validate User Sport Id against user account.
|
||||
SysId userSportId = model.ExtractSysId(model.UserSportId);
|
||||
SaxUserSport userSport = AccountMgr.GetUserSportById(userSportId);
|
||||
disposableItems.Add(userSport);
|
||||
if (userSport == null || !userSport.UserAccountId.Equals(SessionData.User.UserAccountId))
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
|
||||
// Columns.
|
||||
ColumnDfn colId = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.Id);
|
||||
ColumnDfn colUserSportId = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.UserSportId);
|
||||
ColumnDfn colPeriodFrom = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.PeriodFrom);
|
||||
ColumnDfn colPeriodTo = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.PeriodTo);
|
||||
ColumnDfn colOrganisationId = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.OrganisationId);
|
||||
ColumnDfn colOrganisationName = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.Organisation_Name);
|
||||
ColumnDfn colSummary = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.Summary);
|
||||
ColumnDfn colTeam = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.Team);
|
||||
ColumnDfn colLeague = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.League);
|
||||
ColumnDfn colSpeciality = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.Speciality);
|
||||
ColumnDfn colNotes = AccountMgr.GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.Notes);
|
||||
List<ColumnDfn> columnsToQuery = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colUserSportId, colPeriodFrom, colPeriodTo,
|
||||
colOrganisationId, colOrganisationName,
|
||||
colSummary, colTeam, colLeague, colSpeciality, colNotes
|
||||
};
|
||||
|
||||
// Filter.
|
||||
SaxUserSportExperience.Params prmUserSportExperience = new SaxUserSportExperience.Params();
|
||||
prmUserSportExperience.UserSportIdsIncluded.Add(model.ExtractSysId(model.UserSportId));
|
||||
prmUserSportExperience.StatusCat = SaxUserSportExperience.StatusCat.NotDeleted;
|
||||
|
||||
// Sort columns.
|
||||
colPeriodFrom.SortAscending = false;
|
||||
prmUserSportExperience.SortColumns.Add(colPeriodFrom);
|
||||
|
||||
// Query items.
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteUserSportExperienceQuery(columnsToQuery, prmUserSportExperience))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
SportExperienceResponseData_List itemData = new SportExperienceResponseData_List()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
|
||||
UserSportId = model.EncryptId(new SysId(values.GetLong(colUserSportId.DataName))),
|
||||
PeriodFrom = model.FormatDateForForm(values.GetDate(colPeriodFrom.DataName)),
|
||||
PeriodTo = model.FormatDateForForm(values.GetDate(colPeriodTo.DataName)),
|
||||
OrganisationName = AccountMgr.GetUserSportExperienceDataValue(colOrganisationName, values).AsString(),
|
||||
Summary = values.GetString(colSummary.DataName),
|
||||
Team = values.GetString(colTeam.DataName),
|
||||
League = values.GetString(colLeague.DataName),
|
||||
Speciality = values.GetString(colSpeciality.DataName),
|
||||
};
|
||||
itemData.Period = itemData.PeriodFrom + " - " + itemData.PeriodTo;
|
||||
responseData.Experiences.Add(itemData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User Sport - Get Experience.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_UserSportExperienceData : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_UserSportExperienceData(SaxModel_Online model) : base(model) { }
|
||||
// Contact details.
|
||||
public SportExperienceResponseData_Detail Experience { get; set; }
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
[Route("UserSport/Ajax/GetExperience")]
|
||||
public IActionResult GetUserSportExperience(Model_UserSportExperience model)
|
||||
{
|
||||
String fn = GetType().Name + ".GetUserSportExperience";
|
||||
AjaxResponse_UserSportExperienceData responseData = new AjaxResponse_UserSportExperienceData(model);
|
||||
String messageTitle = Localiser["account.caption.profile.sports"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
// Validate User Sport Experience Id against user account.
|
||||
SysId userSportExperienceId = model.ExtractSysId(model.UserSportExperienceId);
|
||||
SaxUserSportExperience userSportExperience = AccountMgr.GetUserSportExperienceById(userSportExperienceId);
|
||||
disposableItems.Add(userSportExperience);
|
||||
SaxUserSport userSport = AccountMgr.GetUserSportById(userSportExperience?.UserSportId ?? null);
|
||||
disposableItems.Add(userSport);
|
||||
if (userSportExperience == null || userSport == null || !userSport.UserAccountId.Equals(SessionData.User.UserAccountId))
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
|
||||
// Populate data to response.
|
||||
responseData.Experience = new SportExperienceResponseData_Detail();
|
||||
PopulateSportExperienceResponseData(model, responseData.Experience, userSportExperience);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Store User Sport Experience.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_StoreUserSportExperience : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_StoreUserSportExperience(SaxModel_Online model) : base(model) { }
|
||||
// Contact details.
|
||||
public SportExperienceResponseData_Detail Experience { get; set; }
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
[Route("UserSport/Ajax/StoreExperience")]
|
||||
public IActionResult StoreUserSportExperience(Model_UserSportExperience model)
|
||||
{
|
||||
String fn = GetType().Name + ".StoreUserSportExperience";
|
||||
AjaxResponse_StoreUserSportExperience responseData = new AjaxResponse_StoreUserSportExperience(model);
|
||||
String messageTitle = Localiser["account.caption.profile.sports"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
// Validate data.
|
||||
model.ValidateProfileSportData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Validate User Sport Experience Id.
|
||||
SysId userSportExperienceId = model.ExtractSysId(model.UserSportExperienceId);
|
||||
if (SysId.IsValid(userSportExperienceId) != StringUtil.ToBool(model.UserSportExperienceExists))
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
|
||||
// Retrieve User Sport Experience.
|
||||
SaxUserSportExperience userSportExperience = null;
|
||||
SaxUserSport userSport = null;
|
||||
if (SysId.IsValid(userSportExperienceId))
|
||||
{
|
||||
userSportExperience = AccountMgr.GetUserSportExperienceById(userSportExperienceId);
|
||||
disposableItems.Add(userSportExperience);
|
||||
userSport = AccountMgr.GetUserSportById(userSportExperience?.UserSportId ?? null);
|
||||
disposableItems.Add(userSport);
|
||||
if (userSportExperience == null || userSport == null || !userSport.UserAccountId.Equals(SessionData.User.UserAccountId))
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Creating new User Sport Experience.
|
||||
// Retrieve User Sport and validate.
|
||||
SysId userSportId = model.ExtractSysId(model.UserSportId);
|
||||
userSport = AccountMgr.GetUserSportById(userSportId);
|
||||
disposableItems.Add(userSport);
|
||||
if (userSport == null || !userSport.UserAccountId.Equals(SessionData.User.UserAccountId))
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
// Create User Sport Experience.
|
||||
userSportExperience = AccountMgr.CreateUserSportExperience(userSport.Id);
|
||||
disposableItems.Add(userSportExperience);
|
||||
}
|
||||
|
||||
// Populate properties.
|
||||
userSportExperience.Changed = false;
|
||||
if (model.ExperiencePeriodFrom != null)
|
||||
userSportExperience.PeriodFrom = model.ParseDateFromForm(model.ExperiencePeriodFrom);
|
||||
if (model.ExperiencePeriodTo != null)
|
||||
userSportExperience.PeriodTo = model.ParseDateFromForm(model.ExperiencePeriodTo);
|
||||
if (model.ExperienceOrganisationId != null)
|
||||
userSportExperience.OrganisationId = model.ExtractSysId(model.ExperienceOrganisationId);
|
||||
if (model.ExperienceOrganisationName != null)
|
||||
userSportExperience.OrganisationName = model.ExperienceOrganisationName;
|
||||
if (model.ExperienceSummary != null)
|
||||
userSportExperience.Summary = model.ExperienceSummary;
|
||||
if (model.ExperienceTeam != null)
|
||||
userSportExperience.Team = model.ExperienceTeam;
|
||||
if (model.ExperienceLeague != null)
|
||||
userSportExperience.League = model.ExperienceLeague;
|
||||
if (model.ExperienceSpeciality != null)
|
||||
userSportExperience.Speciality = model.ExperienceSpeciality;
|
||||
// Regions.
|
||||
if (model.ExperienceRegionIdNation != null)
|
||||
userSportExperience.RegionIdNation = model.ExtractSysId(model.ExperienceRegionIdNation);
|
||||
if (model.ExperienceRegionIdProvince != null)
|
||||
userSportExperience.RegionIdProvince = model.ExtractSysId(model.ExperienceRegionIdProvince);
|
||||
|
||||
// Store Experience.
|
||||
if (!SysId.IsValid(userSportExperience.Id))
|
||||
{
|
||||
if (AccountMgr.InsertUserSportExperience(userSportExperience, DbUpdateInfo))
|
||||
{
|
||||
responseData.SetNotification(messageTitle, Localiser["msg.item.created"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert user sport experience: " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AccountMgr.UpdateUserSportExperience(userSportExperience, DbUpdateInfo))
|
||||
{
|
||||
responseData.SetNotification(messageTitle, Localiser["msg.item.updated"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update user sport experience: " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
}
|
||||
|
||||
// Populate data to response.
|
||||
responseData.Experience = new SportExperienceResponseData_Detail();
|
||||
PopulateSportExperienceResponseData(model, responseData.Experience, userSportExperience);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -220,7 +220,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
|
||||
// Identify activity.
|
||||
Sax.DataItemType itemType = (Sax.DataItemType)StringUtil.ToShort(model.ActivityType);
|
||||
SysId itemId = model.ActivityIdx.ToSysId();
|
||||
SysId itemId = model.ExtractSysId(model.ActivityIdx);
|
||||
if (itemType <= 0 || !SysId.IsValid(itemId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Activity type/Id inncorrectly specified." + GetLogSuffix());
|
||||
@@ -288,7 +288,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
|
||||
// Identify activity.
|
||||
Sax.DataItemType itemType = (Sax.DataItemType)StringUtil.ToShort(model.ActivityType);
|
||||
SysId itemId = model.ActivityIdx.ToSysId();
|
||||
SysId itemId = model.ExtractSysId(model.ActivityIdx);
|
||||
if (itemType <= 0 || !SysId.IsValid(itemId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Activity type/Id inncorrectly specified." + GetLogSuffix());
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
RefreshModel(model);
|
||||
|
||||
// Identify item.
|
||||
SysId articleId = model.ArticleId.ToSysId();
|
||||
SysId articleId = model.ExtractSysId(model.ArticleId);
|
||||
if (!SysId.IsValid(articleId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
@@ -351,7 +351,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
|
||||
// Image belongs to the article.
|
||||
// If the article doesn't yet exist, it will need to be uploaded to the user first and later transferred.
|
||||
SysId articleId = model.ArticleId.ToSysId();
|
||||
SysId articleId = model.ExtractSysId(model.ArticleId);
|
||||
ItemId articleItemId = new ItemId((short)Sax.DataItemType.Article, articleId);
|
||||
ItemId userItemId = new ItemId((short)Sax.DataItemType.UserAccount, sessionData.User.UserAccountId);
|
||||
ItemId imageItemId = SysId.IsValid(articleId) ? articleItemId : userItemId;
|
||||
@@ -467,7 +467,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Validate item Id against 'Exists' flag.
|
||||
SysId articleId = model.ArticleId.ToSysId();
|
||||
SysId articleId = model.ExtractSysId(model.ArticleId);
|
||||
bool articleExists = StringUtil.ToBool(model.ArticleExists);
|
||||
if (articleExists && !SysId.IsValid(articleId))
|
||||
{
|
||||
@@ -508,9 +508,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
|
||||
// Populate item properties.
|
||||
if (model.ArticleRegionId != null)
|
||||
article.RegionIdPrimary = model.ArticleRegionId.ToSysId();
|
||||
article.RegionIdPrimary = model.ExtractSysId(model.ArticleRegionId);
|
||||
if (model.ArticleSportId != null)
|
||||
article.SportIdPrimary = model.ArticleSportId.ToSysId();
|
||||
article.SportIdPrimary = model.ExtractSysId(model.ArticleSportId);
|
||||
if (model.ArticleHeadline != null)
|
||||
article.Headline = model.ArticleHeadline;
|
||||
if (model.ArticleSummary != null)
|
||||
@@ -558,7 +558,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
else if (!StringUtil.IsEmpty(segmentItemImageId) || !StringUtil.IsEmpty(segmentImageIdx))
|
||||
{
|
||||
SysId itemImageId = segmentItemImageId.ToSysId();
|
||||
SysId itemImageId = model.ExtractSysId(segmentItemImageId);
|
||||
int imageIdx = StringUtil.ToInt(segmentImageIdx);
|
||||
|
||||
// Check for new image first.
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
RefreshModel(model);
|
||||
|
||||
// Organisation.
|
||||
SysId organisationId = model.Filter.OrganisationId.ToSysId();
|
||||
SysId organisationId = model.ExtractSysId(model.Filter.OrganisationId);
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
if (organisation == null || !organisation.IsStatusActive)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
StatusCode = values.GetString(colUserStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colUserStatus.DataName))
|
||||
};
|
||||
if (memberData.UserAccountId.ToSysId().Equals(SessionData.User.UserAccountId)) memberData.CurrentUser = true;
|
||||
if (model.ExtractSysId(memberData.UserAccountId).Equals(SessionData.User.UserAccountId)) memberData.CurrentUser = true;
|
||||
String memberRoleCodes = values.GetString(colOrganisationRoleCodes.DataName);
|
||||
foreach (String memberRoleCode in StringListUtil.Split(memberRoleCodes, SaxUserOrganisation.UserOrgnisationRoleDelim))
|
||||
{
|
||||
@@ -226,7 +226,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
RefreshModel(model);
|
||||
|
||||
// Identify item.
|
||||
SysId memberId = model.MemberId.ToSysId();
|
||||
SysId memberId = model.ExtractSysId(model.MemberId);
|
||||
if (!SysId.IsValid(memberId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
//---------------------------------------------------------------
|
||||
|
||||
// Validate Member against Id against 'Exists' flag.
|
||||
SysId memberId = model.MemberId.ToSysId();
|
||||
SysId memberId = model.ExtractSysId(model.MemberId);
|
||||
bool memberExists = StringUtil.ToBool(model.MemberExists);
|
||||
if (memberExists && !SysId.IsValid(memberId))
|
||||
{
|
||||
@@ -341,7 +341,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Validate the Organisation.
|
||||
SysId organisationId = userOrganisation != null ? userOrganisation.OrganisationId : model.MemberOrganisationId.ToSysId();
|
||||
SysId organisationId = userOrganisation != null ? userOrganisation.OrganisationId : model.ExtractSysId(model.MemberOrganisationId);
|
||||
if (!SysId.IsValid(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Organisation Id not specified for Member.");
|
||||
@@ -529,7 +529,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
|
||||
// Retrieve User Organisation [MemberId).
|
||||
SysId userOrganisationId = model.MemberId.ToSysId();
|
||||
SysId userOrganisationId = model.ExtractSysId(model.MemberId);
|
||||
SaxUserOrganisation userOrganisation = AccountMgr.GetUserOrganisationById(userOrganisationId);
|
||||
disposableItems.Add(userOrganisation);
|
||||
if (userOrganisation == null || !userOrganisation.IsStatusActive)
|
||||
@@ -645,7 +645,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
|
||||
// Retrieve User Organisation [MemberId).
|
||||
SysId userOrganisationId = model.MemberId.ToSysId();
|
||||
SysId userOrganisationId = model.ExtractSysId(model.MemberId);
|
||||
SaxUserOrganisation userOrganisation = AccountMgr.GetUserOrganisationById(userOrganisationId);
|
||||
disposableItems.Add(userOrganisation);
|
||||
if (userOrganisation == null || !userOrganisation.IsStatusActive)
|
||||
|
||||
+9
-9
@@ -32,7 +32,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String PublishedOnFmt { get; set; }
|
||||
public String ExpiresOnFmt { get; set; }
|
||||
}
|
||||
private class OpportunityData_Full : OpportunityData_List
|
||||
private class OpportunityData_Detail : OpportunityData_List
|
||||
{
|
||||
public String RegionIdPrimary { get; set; }
|
||||
public String SportIdPrimary { get; set; }
|
||||
@@ -54,7 +54,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.StatusCode = opportunity.StatusCode;
|
||||
data.StatusDesc = opportunity.StatusDesc;
|
||||
}
|
||||
private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_Full data)
|
||||
private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_Detail data)
|
||||
{
|
||||
PopulateOpportunityResponseData(model, opportunity, data as OpportunityData_List);
|
||||
data.RegionIdPrimary = SysId.ToString(opportunity.RegionIdPrimary);
|
||||
@@ -97,7 +97,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
RefreshModel(model);
|
||||
|
||||
// Organisation.
|
||||
SysId organisationId = model.Filter.OrganisationId.ToSysId();
|
||||
SysId organisationId = model.ExtractSysId(model.Filter.OrganisationId);
|
||||
using (SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId))
|
||||
{
|
||||
if (organisation == null || !organisation.IsStatusActive)
|
||||
@@ -205,7 +205,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_Opportunity(SaxModel_Online model) : base(model) { }
|
||||
// Opportunity details.
|
||||
public OpportunityData_Full Opportunity { get; } = new OpportunityData_Full();
|
||||
public OpportunityData_Detail Opportunity { get; } = new OpportunityData_Detail();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -222,7 +222,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
RefreshModel(model);
|
||||
|
||||
// Identify item.
|
||||
SysId opportunityId = model.OpportunityId.ToSysId();
|
||||
SysId opportunityId = model.ExtractSysId(model.OpportunityId);
|
||||
if (!SysId.IsValid(opportunityId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Validate Opportunity against Id against 'Exists' flag.
|
||||
SysId opportunityId = model.OpportunityId.ToSysId();
|
||||
SysId opportunityId = model.ExtractSysId(model.OpportunityId);
|
||||
bool opportunityExists = StringUtil.ToBool(model.OpportunityExists);
|
||||
if (opportunityExists && !SysId.IsValid(opportunityId))
|
||||
{
|
||||
@@ -306,7 +306,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Validate the Organisation.
|
||||
SysId organisationId = model.OpportunityOrganisationId.ToSysId();
|
||||
SysId organisationId = model.ExtractSysId(model.OpportunityOrganisationId);
|
||||
if (!SysId.IsValid(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Organisation Id not specified for Opportunity.");
|
||||
@@ -341,9 +341,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
|
||||
// Populate item properties.
|
||||
if (model.OpportunityRegionId != null)
|
||||
opportunity.RegionIdPrimary = model.OpportunityRegionId.ToSysId();
|
||||
opportunity.RegionIdPrimary = model.ExtractSysId(model.OpportunityRegionId);
|
||||
if (model.OpportunitySportId != null)
|
||||
opportunity.SportIdPrimary = model.OpportunitySportId.ToSysId();
|
||||
opportunity.SportIdPrimary = model.ExtractSysId(model.OpportunitySportId);
|
||||
if (model.OpportunityTypeCode != null)
|
||||
opportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypeCodes.GetTypeForCode(model.OpportunityTypeCode);
|
||||
if (model.OpportunityPosition != null)
|
||||
|
||||
@@ -48,14 +48,16 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Check Regions.
|
||||
SaxRegion regionCountry = Internals.GetRegion(model.OrganisationRegionIdCountry.ToSysId());
|
||||
if (SysId.IsValid(model.OrganisationRegionIdCountry.ToSysId()) && regionCountry == null)
|
||||
SysId regionIdCountry = model.ExtractSysId(model.OrganisationRegionIdCountry);
|
||||
SaxRegion regionCountry = Internals.GetRegion(regionIdCountry);
|
||||
if (SysId.IsValid(regionIdCountry) && regionCountry == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Country region not found. Id: " + model.OrganisationRegionIdCountry + ". " + GetLogSuffix());
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
SaxRegion regionProvince = Internals.GetRegion(model.OrganisationAddressRegionIdProvince.ToSysId());
|
||||
if (SysId.IsValid(model.OrganisationAddressRegionIdProvince.ToSysId()) && regionProvince == null)
|
||||
SysId regionIdAddressProvince= model.ExtractSysId(model.OrganisationAddressRegionIdProvince);
|
||||
SaxRegion regionProvince = Internals.GetRegion(regionIdAddressProvince);
|
||||
if (SysId.IsValid(regionIdAddressProvince) && regionProvince == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Province region not found. Id: " + model.OrganisationAddressRegionIdProvince + ". " + GetLogSuffix());
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
@@ -102,17 +104,18 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
if (SysId.IsValid(model.OrganisationSportId.ToSysId()))
|
||||
SysId organisationSportId = model.ExtractSysId(model.OrganisationSportId);
|
||||
if (SysId.IsValid(organisationSportId))
|
||||
{
|
||||
// Add User Sport if not already present.
|
||||
// NB This will also reactivate an inactive or deleted User Sport.
|
||||
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||
prmUserSport.UserAccountIdsIncluded.Add(userAccount.Id);
|
||||
prmUserSport.SportIdsIncluded.Add(model.OrganisationSportId.ToSysId());
|
||||
prmUserSport.SportIdsIncluded.Add(organisationSportId);
|
||||
prmUserSport.StatusCat = SaxUserSport.StatusCat.Any;
|
||||
SaxUserSport userSport = AccountMgr.GetUserSport(prmUserSport);
|
||||
if (userSport == null)
|
||||
userSport = AccountMgr.CreateUserSport(userAccount.Id, model.OrganisationSportId.ToSysId());
|
||||
userSport = AccountMgr.CreateUserSport(userAccount.Id, organisationSportId);
|
||||
userSport.Status = SaxUserSport.DefaultStatus;
|
||||
if (!SysId.IsValid(userSport.Id))
|
||||
{
|
||||
@@ -137,8 +140,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
organisation.Name = model.OrganisationName;
|
||||
organisation.OrganisationType = model.GetOrganisationType();
|
||||
organisation.OrganisationCategory = model.GetOrganisationCategory();
|
||||
organisation.SportIdPrimary = model.OrganisationSportId.ToSysId();
|
||||
organisation.RegionIdPrimary = model.OrganisationRegionIdCountry.ToSysId();
|
||||
organisation.SportIdPrimary = organisationSportId;
|
||||
organisation.RegionIdPrimary = model.ExtractSysId(model.OrganisationRegionIdCountry);
|
||||
organisation.PhoneMain = model.OrganisationPhoneMain;
|
||||
organisation.Status = SaStatus.Awaiting;
|
||||
if (!AccountMgr.InsertOrganisation(organisation, DbUpdateInfo))
|
||||
@@ -163,7 +166,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
organisationAddress.Line3 = model.OrganisationAddressLine3;
|
||||
organisationAddress.Town = model.OrganisationAddressTown;
|
||||
organisationAddress.Province = model.OrganisationAddressProvince;
|
||||
organisationAddress.RegionIdProvince = model.OrganisationAddressRegionIdProvince.ToSysId();
|
||||
organisationAddress.RegionIdProvince = model.ExtractSysId(model.OrganisationAddressRegionIdProvince);
|
||||
if (SysId.IsValid(regionCountry.Id))
|
||||
{
|
||||
organisationAddress.Country = regionCountry.Name;
|
||||
|
||||
@@ -73,8 +73,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Organisation filter.
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
prmOrganisation.OrganisationFilter = model.Filter.Organisation;
|
||||
prmOrganisation.RegionIdsIncluded.AddId(model.Filter.RegionId.ToSysId());
|
||||
prmOrganisation.SportIdsIncluded.AddId(model.Filter.SportId.ToSysId());
|
||||
prmOrganisation.RegionIdsIncluded.AddId(model.ExtractSysId(model.Filter.RegionId));
|
||||
prmOrganisation.SportIdsIncluded.AddId(model.ExtractSysId(model.Filter.SportId));
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.ActiveOnly;
|
||||
prmOrganisation.SortColumns.Add(colOrganisationName);
|
||||
model.Paging.ItemTotal = (ulong)AccountMgr.GetOrganisationCount(prmOrganisation);
|
||||
|
||||
@@ -25,6 +25,10 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
{
|
||||
AdditionalFiles_CSS.Add("css/sax-account.css");
|
||||
AdditionalFiles_JS.Add("js/sax-account.js");
|
||||
AdditionalFiles_JS.Add("js/sax-usr-pro.js");
|
||||
AdditionalFiles_JS.Add("js/sax-usr-spt.js");
|
||||
AdditionalFiles_JS.Add("js/sax-usr-spt-exp.js");
|
||||
AdditionalFiles_JS.Add("js/sax-usr-org.js");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -128,9 +132,10 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Country Region.
|
||||
if (AccountRegionIdCountry != null && SysId.IsValid(AccountRegionIdCountry.ToSysId()))
|
||||
SysId regionIdCountry = ExtractSysId(AccountRegionIdCountry);
|
||||
if (AccountRegionIdCountry != null && SysId.IsValid(regionIdCountry))
|
||||
{
|
||||
SaxRegion regionCountry = Internals.GetRegion(AccountRegionIdCountry.ToSysId());
|
||||
SaxRegion regionCountry = Internals.GetRegion(regionIdCountry);
|
||||
if (regionCountry == null)
|
||||
responseData.SetControlError(nameof(AccountRegionIdCountry), Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
@@ -138,7 +143,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Province Region.
|
||||
if (AccountRegionIdProvince != null)
|
||||
{
|
||||
SaxRegion regionProvince = Internals.GetRegion(AccountRegionIdProvince.ToSysId());
|
||||
SysId regionIdProvince = ExtractSysId(AccountRegionIdProvince);
|
||||
SaxRegion regionProvince = Internals.GetRegion(regionIdProvince);
|
||||
if (regionProvince == null)
|
||||
responseData.SetControlError(nameof(AccountRegionIdProvince), Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
@@ -152,7 +158,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Sport.
|
||||
if (ProfileSportId != null)
|
||||
{
|
||||
SysId profileSportId = ProfileSportId.ToSysId();
|
||||
SysId profileSportId = ExtractSysId(ProfileSportId);
|
||||
if (!SysId.IsValid(profileSportId))
|
||||
responseData.SetControlError(nameof(ProfileSportId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Article sport.
|
||||
if (ArticleSportId != null)
|
||||
{
|
||||
SysId articleSportId = ArticleSportId.ToSysId();
|
||||
SysId articleSportId = ExtractSysId(ArticleSportId);
|
||||
if (!SysId.IsValid(articleSportId))
|
||||
responseData.SetControlError(nameof(ArticleSportId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Article region.
|
||||
if (ArticleRegionId != null)
|
||||
{
|
||||
SysId articleRegionId = ArticleRegionId.ToSysId();
|
||||
SysId articleRegionId = ExtractSysId(ArticleRegionId);
|
||||
if (!SysId.IsValid(articleRegionId))
|
||||
responseData.SetControlError(nameof(ArticleRegionId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
@@ -107,12 +107,12 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlError(nameof(OrganisationName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(OrganisationName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name))
|
||||
responseData.SetControlError(nameof(OrganisationName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)]);
|
||||
else if (SysId.IsValid(OrganisationRegionIdCountry.ToSysId()))
|
||||
else if (SysId.IsValid(ExtractSysId(OrganisationRegionIdCountry)))
|
||||
{
|
||||
// Ensure that the organisation name is unique within the country.
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
prmOrganisation.NameFull = OrganisationName;
|
||||
prmOrganisation.RegionIdsIncluded.Add(OrganisationRegionIdCountry.ToSysId());
|
||||
prmOrganisation.RegionIdsIncluded.Add(ExtractSysId(OrganisationRegionIdCountry));
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.Any;
|
||||
if (AccountMgr.GetOrganisationCount(prmOrganisation) > 0)
|
||||
responseData.SetControlError(nameof(OrganisationName), Localiser["msg.validation.duplicate.value"]);
|
||||
@@ -129,13 +129,13 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Organisation Sport - mandatory for certain organisation categories.
|
||||
if (StringUtil.IsEmpty(OrganisationSportId) && SaxOrganisation.IsSportMandatory(GetOrganisationCategory()))
|
||||
responseData.SetControlError(nameof(OrganisationSportId), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!StringUtil.IsEmpty(OrganisationSportId) && !SysId.IsValid(OrganisationSportId.ToSysId()))
|
||||
else if (!StringUtil.IsEmpty(OrganisationSportId) && !SysId.IsValid(ExtractSysId(OrganisationSportId)))
|
||||
responseData.SetControlError(nameof(OrganisationSportId), Localiser["msg.validation.invalid.value"]);
|
||||
|
||||
// Organisation Region Country - mandatory.
|
||||
if (StringUtil.IsEmpty(OrganisationRegionIdCountry))
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdCountry), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!SysId.IsValid(OrganisationRegionIdCountry.ToSysId()))
|
||||
else if (!SysId.IsValid(ExtractSysId(OrganisationRegionIdCountry)))
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdCountry), Localiser["msg.validation.invalid.value"]);
|
||||
|
||||
// Organisation Address Line 1 - mandatory.
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Opportunity sport.
|
||||
if (OpportunitySportId != null)
|
||||
{
|
||||
SysId articleSportId = OpportunitySportId.ToSysId();
|
||||
SysId articleSportId = ExtractSysId(OpportunitySportId);
|
||||
if (!SysId.IsValid(articleSportId))
|
||||
responseData.SetControlError(nameof(OpportunitySportId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Opportunity region.
|
||||
if (OpportunityRegionId != null)
|
||||
{
|
||||
SysId articleRegionId = OpportunityRegionId.ToSysId();
|
||||
SysId articleRegionId = ExtractSysId(OpportunityRegionId);
|
||||
if (!SysId.IsValid(articleRegionId))
|
||||
responseData.SetControlError(nameof(OpportunityRegionId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Models
|
||||
{
|
||||
//=======================================================================
|
||||
public class Model_UserSportExperience : SaxModel_Online
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public Model_UserSportExperience(SaxLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User Sports Experience Properties.
|
||||
public String UserSportExperienceId { get; set; }
|
||||
public String UserSportExperienceExists { get; set; }
|
||||
public String UserSportId { get; set; }
|
||||
public String ExperiencePeriodFrom { get; set; }
|
||||
public String ExperiencePeriodTo { get; set; }
|
||||
public String ExperienceOrganisationId { get; set; }
|
||||
public String ExperienceOrganisationName { get; set; }
|
||||
public String ExperienceSummary { get; set; }
|
||||
public String ExperienceTeam { get; set; }
|
||||
public String ExperienceLeague { get; set; }
|
||||
public String ExperienceSpeciality { get; set; }
|
||||
// Regions.
|
||||
public String ExperienceRegionIdNation { get; set; }
|
||||
public String ExperienceRegionIdProvince { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate User Sport Experience data.
|
||||
public bool ValidateProfileSportData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Period dates.
|
||||
DateTime periodFrom = ParseDateFromForm(ExperiencePeriodFrom);
|
||||
DateTime periodTo = ParseDateFromForm(ExperiencePeriodTo);
|
||||
|
||||
// Period From.
|
||||
if (ExperiencePeriodFrom != null)
|
||||
{
|
||||
// Period from date is mandatory.
|
||||
if (!DateUtil.IsValid(periodFrom))
|
||||
responseData.SetControlError(nameof(ExperiencePeriodFrom), Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
// Period To.
|
||||
if (ExperiencePeriodTo != null)
|
||||
{
|
||||
// Period to date is optional must not be before the from date.
|
||||
if (DateUtil.IsValid(periodTo) && DateUtil.IsValid(periodFrom) && periodTo.CompareTo(periodFrom) < 0)
|
||||
responseData.SetControlError(nameof(ExperiencePeriodTo), Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
// Organisation name.
|
||||
if (ExperienceOrganisationName != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(ExperienceOrganisationName), ExperienceOrganisationName);
|
||||
if (StringUtil.GetLength(ExperienceOrganisationName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_OrganisationName))
|
||||
responseData.SetControlError(nameof(ExperienceOrganisationName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_OrganisationName)]);
|
||||
}
|
||||
|
||||
// Summary.
|
||||
if (ExperienceSummary != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(ExperienceSummary), ExperienceSummary);
|
||||
if (StringUtil.IsEmpty(ExperienceSummary))
|
||||
responseData.SetControlError(nameof(ExperienceSummary), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(ExperienceSummary) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Summary))
|
||||
responseData.SetControlError(nameof(ExperienceSummary), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Summary)]);
|
||||
}
|
||||
|
||||
// Team.
|
||||
if (ExperienceTeam != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(ExperienceTeam), ExperienceTeam);
|
||||
if (StringUtil.GetLength(ExperienceTeam) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Team))
|
||||
responseData.SetControlError(nameof(ExperienceTeam), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Team)]);
|
||||
}
|
||||
|
||||
// League.
|
||||
if (ExperienceLeague != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(ExperienceLeague), ExperienceLeague);
|
||||
if (StringUtil.GetLength(ExperienceLeague) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_League))
|
||||
responseData.SetControlError(nameof(ExperienceLeague), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_League)]);
|
||||
}
|
||||
|
||||
// Speciality.
|
||||
if (ExperienceSpeciality != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(ExperienceSpeciality), ExperienceSpeciality);
|
||||
if (StringUtil.GetLength(ExperienceSpeciality) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Speciality))
|
||||
responseData.SetControlError(nameof(ExperienceSpeciality), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Speciality)]);
|
||||
}
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -131,9 +131,11 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
idObfuscationParams.Add(ParamName_IdObfuscation_Id, SysId.ToString(id));
|
||||
return SaxController_Base.EncryptParameters(idObfuscationParams, Base64IV_IdObfuscation, Base64Key_IdObfuscation);
|
||||
}
|
||||
public SysId DecryptId(String encryptedParams)
|
||||
public SysId DecryptId(String encryptedId)
|
||||
{
|
||||
NameValueCollection idObfuscationParams = SaxController_Base.DecryptParameters(encryptedParams, Base64IV_IdObfuscation, Base64Key_IdObfuscation);
|
||||
if (StringUtil.IsNumeric(encryptedId))
|
||||
return encryptedId.ToSysId();
|
||||
NameValueCollection idObfuscationParams = SaxController_Base.DecryptParameters(encryptedId, Base64IV_IdObfuscation, Base64Key_IdObfuscation);
|
||||
return idObfuscationParams.Get(ParamName_IdObfuscation_Id).ToSysId();
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
<div class="spacer2"></div>
|
||||
<div class="row">
|
||||
<div class="col-6 text-left"><button type="button" class="sax-button" value="" onclick="sax.refreshProfileContactInfo();">@Localiser["label.cancel"]</button></div>
|
||||
<div class="col-6 text-right"><button type="button" class="sax-button" value="" onclick="sax.doStoreProfileContact();">@Localiser["label.save"]</button></div>
|
||||
<div class="col-6 text-right"><button type="button" class="sax-button" value="" onclick="sax.storeProfileContact();">@Localiser["label.save"]</button></div>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
@* Sport Experience panel - list experience for sport *@
|
||||
<div class="sax-panel sax-panel-info ProfileSportExperience hidden">
|
||||
|
||||
<div class="sax-header">
|
||||
<div class="row">
|
||||
<div class="col"><div class="sax-caption"><span>@Localiser["account.caption.profile.sports.experience"] - </span><span class="SportName"></span></div></div>
|
||||
<div class="fixed">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu">
|
||||
<li class="sax-dropdown-item sax-action" onclick="sax.addSportExperience()"><div class="sax-label">@(Localiser["label.add"])</div></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@* Filter item templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* Filter Burger dropdown template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu ProfileSports">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">...</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-content" style="max-height:none;">
|
||||
|
||||
<div class="sax-panel-results ProfileSportExperiences" style="min-height:400px;">
|
||||
<div class="sax-panel-messages"></div>
|
||||
<div class="sax-panel-item-list"></div>
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item SportExperience">
|
||||
<div class="sax-header row">
|
||||
<div class="col">
|
||||
<div class="sax-caption"><div class="sax-action ExperiencePeriod"></div></div>
|
||||
</div>
|
||||
<div class="fixed sax-actions">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu"></ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12"><div class="ExperienceSummary"></div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4"><div class="sax-note"><span class="ExperienceTeam"></span></div></div>
|
||||
<div class="col-sm-4 justify-content-sm-center"><div class="sax-note"><span class="ExperienceLeague"></span></div></div>
|
||||
<div class="col-sm-4 justify-content-sm-end"><div class="ax-note"><span class="ExperienceSpeciality"></span></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Filter Burger dropdown template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu SportExperience">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">...</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Action buttons *@
|
||||
<div class="spacer2"></div>
|
||||
<div class="row">
|
||||
<div class="col-6 text-right"><button type="button" class="sax-button" value="" onclick="sax.closeProfileSportExperience();">@Localiser["label.close"]</button></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmSportExperienceId", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<input type="hidden" name="UserSportExperienceId" class="UserSportExperienceId" />
|
||||
}
|
||||
|
||||
<div id="dlgSportExperience" class="sax-dialog">
|
||||
|
||||
<div class="spacer2"></div>
|
||||
|
||||
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmSportExperience", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<input type="hidden" class="UserSportId" name="UserSportId" />
|
||||
<input type="hidden" class="UserSportExperienceId" name="UserSportExperienceId" />
|
||||
<input type="hidden" class="UserSportExperienceExists" name="UserSportExperienceExists" />
|
||||
|
||||
@* Period *@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label pb12">
|
||||
<label for=""><span>@Localiser["label.period"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-9">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
@* Period From *@
|
||||
<div class="sax-form-control ExperiencePeriodFrom">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.from"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<input type="text" name="ExperiencePeriodFrom" class="ExperiencePeriodFrom sax-input sax-calendar" readonly="readonly" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
@* Period To *@
|
||||
<div class="sax-form-control ExperiencePeriodTo">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.to"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<input type="text" name="ExperiencePeriodTo" class="ExperiencePeriodTo sax-input sax-calendar" readonly="readonly" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@* Summary *@
|
||||
<div class="sax-form-control ExperienceSummary">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.summary"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="sax-control">
|
||||
<textarea name="ExperienceSummary" class="ExperienceSummary sax-textarea" rows="4" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Summary)"></textarea>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Organisation *@
|
||||
<div class="sax-form-control ExperienceOrganisation">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.club"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="sax-control">
|
||||
<input type="text" name="ExperienceOrganisationName" class="ExperienceOrganisationName sax-input" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_OrganisationName)" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Speciality *@
|
||||
<div class="sax-form-control ExperienceSpeciality">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.speciality"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="sax-control">
|
||||
<input type="text" name="ExperienceSpeciality" class="ExperienceSpeciality sax-input" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Speciality)" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Team *@
|
||||
<div class="sax-form-control ExperienceTeam">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.team"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="sax-control">
|
||||
<input type="text" name="ExperienceTeam" class="ExperienceTeam sax-input" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Team)" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* League *@
|
||||
<div class="sax-form-control ExperienceLeague">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.league"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="sax-control">
|
||||
<input type="text" name="ExperienceLeague" class="ExperienceLeague sax-input" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserSportExperience_League)" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
<div class="spacer2"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.lbl.sportExperience = '@Localiser.GetJavascriptText("account.caption.profile.sports.experience")';
|
||||
</script>
|
||||
@@ -20,7 +20,7 @@
|
||||
</ul>
|
||||
@* Filter item templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* Burger dropdown item template - ul is ignored *@
|
||||
@* Filter Burger dropdown template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu ProfileSports">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">...</div></li>
|
||||
</ul>
|
||||
@@ -34,7 +34,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Item templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* Sport template *@
|
||||
<div class="sax-panel-item ProfileSport">
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="SportName"></div></div>
|
||||
@@ -45,6 +47,7 @@
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu">
|
||||
<li class="sax-dropdown-item sax-action sax-edit"><div class="sax-label">@(Localiser["label.update"])</div></li>
|
||||
<li class="sax-dropdown-item sax-action sax-experience"><div class="sax-label">@(Localiser["label.experience"])</div></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -57,14 +60,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Sport Burger dropdown template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu ProfileSport">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">...</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmProfileSportId", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.UserSportId, new { @id = "", @class = "UserSportId" })
|
||||
}
|
||||
</div>
|
||||
|
||||
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmProfileSportId", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.UserSportId, new { @id = "", @class = "UserSportId" })
|
||||
}
|
||||
|
||||
<div id="dlgProfileSport" class="sax-dialog">
|
||||
|
||||
@@ -111,5 +120,3 @@
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -16,23 +16,27 @@
|
||||
|
||||
<partial name="~/Views/Account/Profile-Sports.cshtml" />
|
||||
|
||||
<partial name="~/Views/Account/Profile-SportExperiences.cshtml" />
|
||||
|
||||
<partial name="~/Views/Account/Profile-Organisations.cshtml" />
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.lbl.edit = '@(Localiser.GetJavascriptText("label.edit"))';
|
||||
sax.lbl.remove = '@(Localiser.GetJavascriptText("label.remove"))';
|
||||
sax.dlg.title.selectRegionCountry = '@Localiser.GetJavascriptText("reference.caption.country.select")';
|
||||
sax.dlg.title.selectRegionProvince = '@Localiser.GetJavascriptText("reference.caption.province.select")';
|
||||
sax.dlg.title.imageUpload = '@Localiser.GetJavascriptText("account.caption.image.upload")';
|
||||
sax.dlg.title.addUserSport = '@Localiser.GetJavascriptText("account.caption.profile.sport.add")';
|
||||
sax.dlg.title.updateUserSport = '@Localiser.GetJavascriptText("account.caption.profile.sport.update")';
|
||||
sax.dlg.title.selectRegion = '@Localiser.GetJavascriptText("reference.caption.region.select")';
|
||||
sax.dlg.title.selectSport = '@Localiser.GetJavascriptText("reference.caption.sport.select")';
|
||||
sax.msg.uploadFileSelect = '@Localiser.GetJavascriptText("msg.upload.file.select")';
|
||||
sax.msg.uploadImageSingle = '@Localiser.GetJavascriptText("msg.upload.image.single")';
|
||||
sax.msg.uploadFileSizeMax = '@Localiser.GetJavascriptText("msg.upload.file.size.max","{0}")';
|
||||
sax.msg.uploadFileTypeInvalid = '@Localiser.GetJavascriptText("msg.upload.file.type.invalid","{0}")';
|
||||
sax.msg.uploadingFile = '@Localiser.GetJavascriptText("msg.upload.file.uploading","{0}")';
|
||||
sax.dlg.title.addUserSport = '@Localiser.GetJavascriptText("account.caption.profile.sport.add")';
|
||||
sax.dlg.title.updateUserSport = '@Localiser.GetJavascriptText("account.caption.profile.sport.update")';
|
||||
sax.dlg.title.selectRegion = '@Localiser.GetJavascriptText("reference.caption.region.select")';
|
||||
sax.dlg.title.selectSport = '@Localiser.GetJavascriptText("reference.caption.sport.select")';
|
||||
</script>
|
||||
|
||||
<partial name="~/Views/Common/RegionSelect.cshtml" />
|
||||
|
||||
@@ -154,6 +154,11 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sax-panel-item > .sax-header ul.nav.sax-burger
|
||||
{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sax-panel-item > .sax-header .dropdown-menu
|
||||
{
|
||||
padding: 4px 8px;
|
||||
|
||||
@@ -178,6 +178,7 @@
|
||||
|
||||
.sax-form .sax-input.sax-calendar
|
||||
{
|
||||
width:80%;
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,339 +17,6 @@
|
||||
setTimeout(sax.refreshProfileOrganisationsInfo, 50);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshProfileContactInfo = function ()
|
||||
{
|
||||
var $section = $('.sax-panel-section.ProfileContact');
|
||||
$section.removeClass('sax-edit').addClass('sax-populating');
|
||||
$('.sax-property', $section).hide();
|
||||
sax.showDataRefreshingMsg($section);
|
||||
sax.refreshProfileContact(sax.onRefreshProfileContactInfo);
|
||||
}
|
||||
sax.refreshProfileContactForm = function ()
|
||||
{
|
||||
if (!sax.closeEditPanels()) return;
|
||||
sax.refreshProfileContact(sax.onRefreshProfileContactForm);
|
||||
}
|
||||
sax.refreshProfileContact = function (callbackFn)
|
||||
{
|
||||
delete sax.page.profileContactChanged;
|
||||
sax.ajax.profileContact = sax.ajax.profileContact || { url: sax.url.base + 'Account/Ajax/GetProfileContact', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajax.profileContact.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajax.profileContact, 50);
|
||||
}
|
||||
sax.onRefreshProfileContactInfo = function (response)
|
||||
{
|
||||
sax.debug('onRefreshProfileContactInfo', response);
|
||||
if (!response || !response.success || !response.contact) return;
|
||||
$('.sax-panel-section').show();
|
||||
var $section = $('.sax-panel-section.ProfileContact');
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
$('.sax-value', $section).empty();
|
||||
sax.refreshInfo($section, 'AccountEmailAddress', response.contact.emailAddress);
|
||||
sax.refreshInfo($section, 'AccountName', response.contact.displayName);
|
||||
sax.refreshInfo($section, 'AccountLocation', response.contact.locationCaption);
|
||||
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
sax.showNoInfoMsg($section);
|
||||
$section.removeClass('sax-populating');
|
||||
}
|
||||
sax.onRefreshProfileContactForm = function (response)
|
||||
{
|
||||
//sax.debug('onRefreshProfileContactForm', response);
|
||||
if (!response || !response.success) return;
|
||||
sax.data.genders = response.genders;
|
||||
sax.data.months = response.months;
|
||||
$('.sax-panel-section').hide();
|
||||
var $section = $('.sax-panel-section.ProfileContact').show();
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
sax.refreshInput($section, 'AccountEmailAddress', response.contact.emailAddress);
|
||||
sax.refreshSelect($section, 'AccountTitle', response.contact.title);
|
||||
sax.refreshInput($section, 'AccountFirstName', response.contact.firstName);
|
||||
sax.refreshInput($section, 'AccountLastName', response.contact.lastName);
|
||||
let $selGender = $('#cbAccountGender');
|
||||
if (response.genders && response.genders.length)
|
||||
sax.populateSelectCodeDesc($('#cbAccountGender'), response.genders);
|
||||
sax.refreshSelect($section, 'AccountGender', response.contact.gender || '');
|
||||
sax.refreshDob();
|
||||
sax.refreshSelect($section, 'AccountDobYear', response.contact.dobYear);
|
||||
sax.refreshDob();
|
||||
sax.refreshSelect($section, 'AccountDobMonth', response.contact.dobMonth);
|
||||
sax.refreshDob();
|
||||
sax.refreshSelect($section, 'AccountDobDay', response.contact.dobDay);
|
||||
sax.refreshInput($section, 'AccountRegionIdCountry', response.contact.regionIdCountry);
|
||||
sax.refreshInput($section, 'AccountRegionCaptionCountry', response.contact.regionCaptionCountry);
|
||||
sax.refreshInput($section, 'AccountRegionIdProvince', response.contact.regionIdProvince);
|
||||
sax.refreshInput($section, 'AccountRegionCaptionProvince', response.contact.regionCaptionProvince);
|
||||
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
$section.addClass('sax-edit');
|
||||
}
|
||||
sax.doStoreProfileContact = function ()
|
||||
{
|
||||
sax.clearControlErrors();
|
||||
sax.ajax.storeProfileContact = sax.ajax.storeProfileContact || { url: sax.url.base + 'Account/Ajax/StoreProfileContact', formId: 'frmProfileContact', callbackFn: sax.onStoreProfileContact };
|
||||
sax.doAjaxRequest(sax.ajax.storeProfileContact, 50);
|
||||
}
|
||||
sax.onStoreProfileContact = function (response)
|
||||
{
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response || !response.success)
|
||||
return;
|
||||
sax.refreshProfileContactInfo();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshDob = function ()
|
||||
{
|
||||
//sax.debug('refreshDob', $('#cbAccountDobYear').val(), $('#cbAccountDobMonth').val(), $('#cbAccountDobDay').val());
|
||||
let now = new Date();
|
||||
let $selDobYear = $('#cbAccountDobYear');
|
||||
if (!$('option', $selDobYear).length)
|
||||
{
|
||||
$selDobYear.append($('<option>'));
|
||||
for (let y = now.getFullYear(); y >= now.getFullYear() - 110 - now.getFullYear() % 10; y--)
|
||||
$selDobYear.append($('<option>').prop('value', y).text(y));
|
||||
}
|
||||
let yearVal = $selDobYear.val();
|
||||
let $selDobMonth = $('#cbAccountDobMonth');
|
||||
if (!$('option', $selDobMonth).length)
|
||||
{
|
||||
$selDobMonth.append($('<option>'));
|
||||
for (let m = 1; m <= sax.data.months.length; m++)
|
||||
$selDobMonth.append($('<option>').prop('value', m).text(sax.data.months[m - 1].desc));
|
||||
}
|
||||
if (!yearVal)
|
||||
$selDobMonth.val('');
|
||||
$selDobMonth.prop('disabled', !yearVal);
|
||||
let monthVal = $selDobMonth.val();
|
||||
let $selDobDay = $('#cbAccountDobDay');
|
||||
let dayVal = $selDobDay.val();
|
||||
$selDobDay.empty();
|
||||
if (!!yearVal && !!monthVal)
|
||||
{
|
||||
$selDobDay.append($('<option>'));
|
||||
for (let dt = new Date(yearVal, monthVal - 1, 1); dt.getMonth() == monthVal - 1; dt.setDate(dt.getDate() + 1))
|
||||
$selDobDay.append($('<option>').prop('value', dt.getDate()).text(dt.getDate()));
|
||||
$selDobDay.val(dayVal);
|
||||
}
|
||||
if (!monthVal)
|
||||
$selDobDay.val('');
|
||||
$selDobDay.prop('disabled', !monthVal);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectRegionCountry = function ()
|
||||
{
|
||||
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegionCountry, regionId: $('#ifAccountRegionIdCountry').val(), fnCallback: sax.onSelectRegionCountry })
|
||||
}
|
||||
sax.onSelectRegionCountry = function (region)
|
||||
{
|
||||
//sax.debug(region);
|
||||
sax.clearControlError($('#ifAccountRegionIdCountry').val(region.id));
|
||||
$('#ifAccountRegionCaptionCountry').val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.onDropContactImage = function (evt)
|
||||
{
|
||||
//sax.debug('onDropContactImage', evt);
|
||||
let files = evt.originalEvent.dataTransfer.files;
|
||||
if (files.length < 1) return;
|
||||
if (files.length > 1) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadImageSingle);
|
||||
sax.onDropContactImageFile(files[0], $('#frmProfileContact'));
|
||||
}
|
||||
sax.onDropContactImageFile = function (file, context)
|
||||
{
|
||||
//sax.debug('onDropContactImageFile', file, context);
|
||||
if (file.size > sax.maxProfileImageSize) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileSizeMax.format(sax.formatFileSize(sax.maxProfileImageSize)));
|
||||
if (file.type != 'image/jpg' && file.type != 'image/jpeg' && file.type != 'image/png') return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileTypeInvalid.format(sax.getFileType(file)));
|
||||
$(".UploadMessage", context).text(sax.msg.uploadingFile.format(file.name));
|
||||
$('img.ContactImageUploadProgress', context).fadeIn(200);
|
||||
sax.clearControlError(sax.$pnl.contactImageDrag);
|
||||
sax.data.contactImageUploadContext = context;
|
||||
|
||||
sax.ajax.uploadContactImage = sax.ajax.uploadContactImage || { url: sax.url.base + 'Account/Ajax/UploadContactImage', callbackFn: sax.handleContactImageUploadResponse, noWaitIcon: true };
|
||||
sax.ajax.uploadContactImage.formData = new FormData();
|
||||
sax.ajax.uploadContactImage.formData.append("__RequestVerificationToken", $('#frmNavigate input[name="__RequestVerificationToken"]').val());
|
||||
sax.ajax.uploadContactImage.formData.append("AccountContactImage", file);
|
||||
sax.doAjaxRequest(sax.ajax.uploadContactImage, 50);
|
||||
}
|
||||
sax.handleContactImageUploadResponse = function (response)
|
||||
{
|
||||
let context = sax.data.contactImageUploadContext;
|
||||
//sax.debug('handleContactImageUploadResponse', response, context);
|
||||
if (!response) return;
|
||||
var $section = $('.sax-panel-section.ProfileContact');
|
||||
sax.refreshControlValues(response.controlValues, context);
|
||||
$(".UploadMessage", context).empty();
|
||||
$('img.ContactImageUploadProgress', context).hide();
|
||||
if (response.success)
|
||||
{
|
||||
$dlg.selectContactImage.dialog('close');
|
||||
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
}
|
||||
}
|
||||
sax.selectContactImage = function ()
|
||||
{
|
||||
let $dlg = $dlg.selectContactImage.dialog('option', { title: sax.dlg.title.imageUpload });
|
||||
$('#ifContactImage', $dlg).val('');
|
||||
sax.openDialog($dlg, 560, 240);
|
||||
}
|
||||
sax.uploadContactImage = function ()
|
||||
{
|
||||
let $dlg = $dlg.selectContactImage;
|
||||
let $fileCtrl = $('#ifContactImage', $dlg);
|
||||
if (!$fileCtrl.length || !$fileCtrl[0].files.length)
|
||||
return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileSelect);
|
||||
let file = $fileCtrl[0].files[0];
|
||||
sax.onDropContactImageFile(file, $dlg);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshProfileSportsInfo = function (delay)
|
||||
{
|
||||
var $section = $('.sax-panel-section.ProfileSports');
|
||||
$section.removeClass('sax-edit').addClass('sax-populating');
|
||||
$('.sax-property', $section).hide();
|
||||
sax.showDataRefreshingMsg($section);
|
||||
sax.refreshProfileSports(sax.onRefreshProfileSportsInfo);
|
||||
}
|
||||
sax.refreshProfileSports = function (callbackFn)
|
||||
{
|
||||
//sax.debug('refreshProfileSports');
|
||||
delete sax.page.profileSportsChanged;
|
||||
sax.ajax.profileSports = sax.ajax.profileSports || { url: sax.url.base + 'Account/Ajax/GetProfileSports', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajax.profileSports.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajax.profileSports, 50);
|
||||
}
|
||||
sax.onRefreshProfileSportsInfo = function (response)
|
||||
{
|
||||
//sax.debug('onRefreshProfileSportsInfo', response);
|
||||
if (!response || !response.success) return;
|
||||
var $section = $('.sax-panel-section.ProfileSports');
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
sax.profile.sports.Ids = [];
|
||||
let items = response.sports;
|
||||
if (!items) return;
|
||||
let $items = $('.sax-panel-results.ProfileSports', $section).empty();
|
||||
let $tmpl = $('.sax-panel-item-template .sax-panel-item.ProfileSport', $section);
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
sax.profile.sports.Ids.push(item.sportId);
|
||||
let $item = $tmpl.clone().prop('id', 'ProSpt_' + item.id);
|
||||
$('.sax-header .sax-action.sax-edit', $item).on('click', function (evt) { sax.updateProfileSport(item.id); });
|
||||
$('.SportName', $item).text(item.sportName);
|
||||
$('.SportParticipationValue', $item).text(item.sportParticipation);
|
||||
$('.SportParticipation', $item).toggle(!!item.sportParticipation);
|
||||
$('.SportOfficiatingValue', $item).text(item.sportOfficiating);
|
||||
$('.SportOfficiating', $item).toggle(!!item.sportOfficiating);
|
||||
$items.append($item);
|
||||
}
|
||||
$items.show();
|
||||
sax.showNoInfoMsg($section);
|
||||
$section.removeClass('sax-populating');
|
||||
}
|
||||
sax.addProfileSport = function ()
|
||||
{
|
||||
//sax.debug('addProfileSport');
|
||||
let $dlg = $dlg.profileSport;
|
||||
$('.UserSportId,.ProfileSportExists,#ifProfileSportId,input.sax-input,select.sax-select', $dlg).val('');
|
||||
$('.SelectSport', $dlg).show();
|
||||
$dlg.dialog('option', 'title', sax.dlg.title.addUserSport);
|
||||
sax.openDialog($dlg, 480, 400);
|
||||
}
|
||||
sax.updateProfileSport = function (id)
|
||||
{
|
||||
//sax.debug('updateProfileSport', id);
|
||||
$('#frmProfileSportId .UserSportId').val(id);
|
||||
sax.ajax.profileSport = sax.ajax.profileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport };
|
||||
sax.doAjaxRequest(sax.ajax.profileSport, 50);
|
||||
}
|
||||
sax.doUpdateProfileSport = function (response)
|
||||
{
|
||||
//sax.debug('doUpdateProfileSport', response);
|
||||
let $dlg = $dlg.profileSport;
|
||||
let item = response.sport;
|
||||
$('.UserSportId', $dlg).val(item.id);
|
||||
$('.ProfileSportExists', $dlg).val(1);
|
||||
$('#ifProfileSportId', $dlg).val(item.sportId);
|
||||
$('#ifProfileSport', $dlg).val(item.sportName);
|
||||
$('#cbProfileSportParticipation', $dlg).val(item.sportParticipationCode);
|
||||
$('#cbProfileSportOfficiating', $dlg).val(item.sportOfficiatingCode);
|
||||
$('.SelectSport', $dlg).hide();
|
||||
$dlg.dialog('option', 'title', sax.dlg.title.updateUserSport);
|
||||
sax.openDialog($dlg, 480, 400);
|
||||
}
|
||||
sax.selectUserSport = function (sport)
|
||||
{
|
||||
//sax.debug('selectUserSport');
|
||||
let excludeIds = $.grep(sax.profile.sports.Ids, function (value) { return !sport || value != sport.id; });
|
||||
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#frmProfileSport #ifProfileSportId').val(), excludeIds: excludeIds, fnCallback: sax.onSelectUserSport })
|
||||
}
|
||||
sax.onSelectUserSport = function (sport)
|
||||
{
|
||||
sax.clearControlError($('#ifProfileSportId').val(sport ? sport.id : ''));
|
||||
$('#ifProfileSport').val(sport ? sport.name : '');
|
||||
}
|
||||
sax.storeProfileSport = function ()
|
||||
{
|
||||
//sax.debug('storeProfileSport');
|
||||
sax.clearControlErrors();
|
||||
sax.ajax.storeProfileSport = sax.ajax.storeProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport };
|
||||
sax.doAjaxRequest(sax.ajax.storeProfileSport, 50);
|
||||
}
|
||||
sax.onStoreProfileSport = function (response)
|
||||
{
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response || !response.success) return;
|
||||
$dlg.profileSport.dialog('close');
|
||||
sax.refreshProfileSportsInfo();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshProfileOrganisationsInfo = function (delay)
|
||||
{
|
||||
var $section = $('.sax-panel-section.ProfileOrganisations');
|
||||
$section.removeClass('sax-edit').addClass('sax-populating');
|
||||
$('.sax-property', $section).hide();
|
||||
sax.showDataRefreshingMsg($section);
|
||||
sax.refreshProfileOrganisations(sax.onRefreshProfileOrganisationsInfo);
|
||||
}
|
||||
sax.refreshProfileOrganisations = function (callbackFn)
|
||||
{
|
||||
//sax.debug('refreshProfileOrganisations');
|
||||
delete sax.page.profileOrganisationsChanged;
|
||||
sax.ajax.profileOrganisations = sax.ajax.profileOrganisations || { url: sax.url.base + 'Account/Ajax/GetProfileOrganisations', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajax.profileOrganisations.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajax.profileOrganisations, 50);
|
||||
}
|
||||
sax.onRefreshProfileOrganisationsInfo = function (response)
|
||||
{
|
||||
//sax.debug('onRefreshProfileOrganisationsInfo', response);
|
||||
if (!response || !response.success) return;
|
||||
var $section = $('.sax-panel-section.ProfileOrganisations');
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
|
||||
let items = response.organisations;
|
||||
if (!items) return;
|
||||
let $items = $('.sax-panel-results.Organisations', $section).empty();
|
||||
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', $section);
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
let $item = $tmpl.clone().prop('id', 'ProOrg_' + item.id);
|
||||
$('.OrganisationName', $item).text(item.name);
|
||||
$('.OrganisationSport', $item).text(item.sportName);
|
||||
$('.OrganisationRegion', $item).text(item.regionName);
|
||||
$('.OrganisationMemberCount', $item).toggle(!!item.memberCount).find('.MemberCount').text(item.memberCount);
|
||||
$('.OrganisationOpportunityCount', $item).toggle(!!item.opportunityCount).find('.MemberCount').text(item.opportunityCount);
|
||||
$items.append($item);
|
||||
}
|
||||
$items.show();
|
||||
sax.showNoInfoMsg($section);
|
||||
$section.removeClass('sax-populating');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.showDataRefreshingMsg = function ($section)
|
||||
{
|
||||
@@ -392,28 +59,11 @@
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
$('.sax-panel-section.ProfileContact .sax-action.sax-edit').on('click', function (evt) { sax.refreshProfileContactForm(); });
|
||||
$('input,textarea,select', '.sax-panel-section.ProfileContact').on('change', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
|
||||
|
||||
sax.$pnl.contactImageDrag = $('#pnlContactImageDrop')
|
||||
.on("dragenter", function (evt) { sax.haltEvent(evt); })
|
||||
.on("dragover", function (evt) { sax.haltEvent(evt); if (!sax.$pnl.contactImageDrag.hasClass(sax.classFileDrag)) sax.$pnl.contactImageDrag.addClass(sax.classFileDrag); })
|
||||
.on("dragleave", function (evt) { sax.haltEvent(evt); sax.$pnl.contactImageDrag.removeClass(sax.classFileDrag); })
|
||||
.on("drop", function (evt) { sax.haltEvent(evt); sax.$pnl.contactImageDrag.removeClass(sax.classFileDrag); sax.onDropContactImage(evt); });
|
||||
|
||||
$('.sax-panel-section.ProfileSports .sax-action.sax-add').on('click', function (evt) { sax.addProfileSport(); });
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sax.storeProfileSport(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.profileSport = $('#dlgProfileSport').dialog(opt);
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sax.uploadContactImage(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.selectContactImage = $('#dlgSelectContactImage').dialog(opt);
|
||||
|
||||
setTimeout(sax.refreshProfile, 200);
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
sax.populateItem = function ($item, item)
|
||||
{
|
||||
sax.debug('populateItem', item);
|
||||
//sax.debug('populateItem', item);
|
||||
if (!item) return;
|
||||
$item.prop('id', sax.itemIdPrefix + item.itemIdx).addClass(item.itemTypeClass).toggleClass('sax-activity-reaction-' + item.reaction, !!item.reaction);
|
||||
$('.ActivityOrganisation', $item).text(item.organisation);
|
||||
|
||||
@@ -119,9 +119,19 @@
|
||||
var sel = $(':selected', $sel).length;
|
||||
$('.sax-select-items-selected', $sel.closest('.sax-form-control')).text(sel == 0 ? sax.lbl.noneSelected : sax.lbl.numberSelected.replace(/\{0\}/g, sel));
|
||||
}
|
||||
sax.initCalendars = function (sel)
|
||||
sax.initCalendars = function (sel, opt)
|
||||
{
|
||||
return $(sel).datepicker();
|
||||
return $(sel).datepicker(opt || {});
|
||||
}
|
||||
sax.allowClearCalendar = function(sel)
|
||||
{
|
||||
$(sel).datepicker().on('keyup', function (e)
|
||||
{
|
||||
if (e.keyCode == 8 || e.keyCode == 46)
|
||||
{
|
||||
$(this).datepicker('setDate', null);
|
||||
}
|
||||
});
|
||||
}
|
||||
sax.refreshPaging = function (response, context, refreshFn)
|
||||
{
|
||||
@@ -207,7 +217,7 @@
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
||||
sax.$dlg.alert = $('<div id="dlgAlert"><div id="dlgAlertMsg"></div></div>').dialog(opt);
|
||||
}
|
||||
$('#dlgAlertMsg', sax.$dlg.alert).html(msg);
|
||||
$('#dlgAlertMsg', sax.$dlg.alert).html(msg.replace(/\\n/g, '<br>'));
|
||||
sax.$dlg.alert.dialog('option', { title: title || sax.dlg.title.alert });
|
||||
sax.openDialog(sax.$dlg.alert);
|
||||
}
|
||||
@@ -227,7 +237,7 @@
|
||||
buttons[sax.dlg.btn.yes] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
||||
buttons[sax.dlg.btn.no] = function () { $(this).dialog('close'); if (onCancel) onCancel(); };
|
||||
sax.$dlg.confirm.dialog('option', { title: title || sax.dlg.title.confirm, 'buttons': buttons });
|
||||
$('#dlgConfirmMsg').html(msg);
|
||||
$('#dlgConfirmMsg').html(msg.replace(/\\n/g, '<br>'));
|
||||
sax.openDialog(sax.$dlg.confirm);
|
||||
}
|
||||
sax.confirmItemRemove = function (fn)
|
||||
@@ -249,7 +259,7 @@
|
||||
opt.hide = { effect: 'fade', duration: 200 };
|
||||
sax.$dlg.progress = $('<div id="dlgProgress"><div id="dlgProgressMsg"></div></div>').dialog(opt);
|
||||
}
|
||||
$('#dlgProgressMsg').html(msg);
|
||||
$('#dlgProgressMsg').html(msg.replace(/\\n/g, '<br>'));
|
||||
sax.$dlg.progress.dialog('option', { title: title || sax.dlg.title.progress });
|
||||
if (delay > 0) sax.toShowProgress = setTimeout(function () { sax.$dlg.progress.dialog('open'); }, delay);
|
||||
else sax.$dlg.progress.dialog('open');
|
||||
@@ -274,7 +284,7 @@
|
||||
}
|
||||
var $hdr = $('.heading', $not).css({ 'background-color': 'rgba(247,217,0,0.7)' });
|
||||
$('.title', $not).html(title);
|
||||
$('.message', $not).html(msg);
|
||||
$('.message', $not).html(msg.replace(/\\n/g, '<br>'));
|
||||
var $bdy = $('#sax-page-body');
|
||||
//sax.debug(sax.topMargin($bdy));
|
||||
var fbr = $bdy[0].getBoundingClientRect();
|
||||
@@ -521,7 +531,7 @@
|
||||
buttonImage: '../img/action/calendar32.png',
|
||||
buttonText: sax.lbl.calendar,
|
||||
dateFormat: sax.form.calendarDateFormat,
|
||||
changeMonth: true,
|
||||
changeMonth: false,
|
||||
changeYear: false,
|
||||
yearRange: '-14:+01',
|
||||
firstDay: 1,
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Account page scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let $pnl = sax.$pnl, $dlg = sax.$dlg, $frm = sax.$frm;
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshProfileOrganisationsInfo = function (delay)
|
||||
{
|
||||
var $section = $('.sax-panel-section.ProfileOrganisations');
|
||||
$section.removeClass('sax-edit').addClass('sax-populating');
|
||||
$('.sax-property', $section).hide();
|
||||
sax.showDataRefreshingMsg($section);
|
||||
sax.refreshProfileOrganisations(sax.onRefreshProfileOrganisationsInfo);
|
||||
}
|
||||
sax.refreshProfileOrganisations = function (callbackFn)
|
||||
{
|
||||
//sax.debug('refreshProfileOrganisations');
|
||||
delete sax.page.profileOrganisationsChanged;
|
||||
sax.ajax.profileOrganisations = sax.ajax.profileOrganisations || { url: sax.url.base + 'Account/Ajax/GetProfileOrganisations', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajax.profileOrganisations.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajax.profileOrganisations, 50);
|
||||
}
|
||||
sax.onRefreshProfileOrganisationsInfo = function (response)
|
||||
{
|
||||
//sax.debug('onRefreshProfileOrganisationsInfo', response);
|
||||
if (!response || !response.success) return;
|
||||
var $section = $('.sax-panel-section.ProfileOrganisations');
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
|
||||
let items = response.organisations;
|
||||
if (!items) return;
|
||||
let $items = $('.sax-panel-results.Organisations', $section).empty();
|
||||
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', $section);
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
let $item = $tmpl.clone().prop('id', 'ProOrg_' + item.id);
|
||||
$('.OrganisationName', $item).text(item.name);
|
||||
$('.OrganisationSport', $item).text(item.sportName);
|
||||
$('.OrganisationRegion', $item).text(item.regionName);
|
||||
$('.OrganisationMemberCount', $item).toggle(!!item.memberCount).find('.MemberCount').text(item.memberCount);
|
||||
$('.OrganisationOpportunityCount', $item).toggle(!!item.opportunityCount).find('.MemberCount').text(item.opportunityCount);
|
||||
$items.append($item);
|
||||
}
|
||||
$items.show();
|
||||
sax.showNoInfoMsg($section);
|
||||
$section.removeClass('sax-populating');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Account page scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let $pnl = sax.$pnl, $dlg = sax.$dlg, $frm = sax.$frm;
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshProfileContactInfo = function ()
|
||||
{
|
||||
var $section = $('.sax-panel-section.ProfileContact');
|
||||
$section.removeClass('sax-edit').addClass('sax-populating');
|
||||
$('.sax-property', $section).hide();
|
||||
sax.showDataRefreshingMsg($section);
|
||||
sax.refreshProfileContact(sax.onRefreshProfileContactInfo);
|
||||
}
|
||||
sax.refreshProfileContactForm = function ()
|
||||
{
|
||||
if (!sax.closeEditPanels()) return;
|
||||
sax.refreshProfileContact(sax.onRefreshProfileContactForm);
|
||||
}
|
||||
sax.refreshProfileContact = function (callbackFn)
|
||||
{
|
||||
delete sax.page.profileContactChanged;
|
||||
sax.ajax.profileContact = sax.ajax.profileContact || { url: sax.url.base + 'Account/Ajax/GetProfileContact', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajax.profileContact.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajax.profileContact, 50);
|
||||
}
|
||||
sax.onRefreshProfileContactInfo = function (response)
|
||||
{
|
||||
//sax.debug('onRefreshProfileContactInfo', response);
|
||||
if (!response || !response.success || !response.contact) return;
|
||||
$('.sax-panel-section').show();
|
||||
var $section = $('.sax-panel-section.ProfileContact');
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
$('.sax-value', $section).empty();
|
||||
sax.refreshInfo($section, 'AccountEmailAddress', response.contact.emailAddress);
|
||||
sax.refreshInfo($section, 'AccountName', response.contact.displayName);
|
||||
sax.refreshInfo($section, 'AccountLocation', response.contact.locationCaption);
|
||||
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
sax.showNoInfoMsg($section);
|
||||
$section.removeClass('sax-populating');
|
||||
}
|
||||
sax.onRefreshProfileContactForm = function (response)
|
||||
{
|
||||
//sax.debug('onRefreshProfileContactForm', response);
|
||||
if (!response || !response.success) return;
|
||||
sax.data.genders = response.genders;
|
||||
sax.data.months = response.months;
|
||||
$('.sax-panel-section').hide();
|
||||
var $section = $('.sax-panel-section.ProfileContact').show();
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
sax.refreshInput($section, 'AccountEmailAddress', response.contact.emailAddress);
|
||||
sax.refreshSelect($section, 'AccountTitle', response.contact.title);
|
||||
sax.refreshInput($section, 'AccountFirstName', response.contact.firstName);
|
||||
sax.refreshInput($section, 'AccountLastName', response.contact.lastName);
|
||||
let $selGender = $('#cbAccountGender');
|
||||
if (response.genders && response.genders.length)
|
||||
sax.populateSelectCodeDesc($('#cbAccountGender'), response.genders);
|
||||
sax.refreshSelect($section, 'AccountGender', response.contact.gender || '');
|
||||
sax.refreshDob();
|
||||
sax.refreshSelect($section, 'AccountDobYear', response.contact.dobYear);
|
||||
sax.refreshDob();
|
||||
sax.refreshSelect($section, 'AccountDobMonth', response.contact.dobMonth);
|
||||
sax.refreshDob();
|
||||
sax.refreshSelect($section, 'AccountDobDay', response.contact.dobDay);
|
||||
sax.refreshInput($section, 'AccountRegionIdCountry', response.contact.regionIdCountry);
|
||||
sax.refreshInput($section, 'AccountRegionCaptionCountry', response.contact.regionCaptionCountry);
|
||||
sax.refreshInput($section, 'AccountRegionIdProvince', response.contact.regionIdProvince);
|
||||
sax.refreshInput($section, 'AccountRegionCaptionProvince', response.contact.regionCaptionProvince);
|
||||
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
$section.addClass('sax-edit');
|
||||
}
|
||||
sax.storeProfileContact = function ()
|
||||
{
|
||||
sax.clearControlErrors();
|
||||
sax.ajax.storeProfileContact = sax.ajax.storeProfileContact || { url: sax.url.base + 'Account/Ajax/StoreProfileContact', formId: 'frmProfileContact', callbackFn: sax.onStoreProfileContact };
|
||||
sax.doAjaxRequest(sax.ajax.storeProfileContact, 50);
|
||||
}
|
||||
sax.onStoreProfileContact = function (response)
|
||||
{
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response.success) return;
|
||||
sax.refreshProfileContactInfo();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshDob = function ()
|
||||
{
|
||||
//sax.debug('refreshDob', $('#cbAccountDobYear').val(), $('#cbAccountDobMonth').val(), $('#cbAccountDobDay').val());
|
||||
let now = new Date();
|
||||
let $selDobYear = $('#cbAccountDobYear');
|
||||
if (!$('option', $selDobYear).length)
|
||||
{
|
||||
$selDobYear.append($('<option>'));
|
||||
for (let y = now.getFullYear(); y >= now.getFullYear() - 110 - now.getFullYear() % 10; y--)
|
||||
$selDobYear.append($('<option>').prop('value', y).text(y));
|
||||
}
|
||||
let yearVal = $selDobYear.val();
|
||||
let $selDobMonth = $('#cbAccountDobMonth');
|
||||
if (!$('option', $selDobMonth).length)
|
||||
{
|
||||
$selDobMonth.append($('<option>'));
|
||||
for (let m = 1; m <= sax.data.months.length; m++)
|
||||
$selDobMonth.append($('<option>').prop('value', m).text(sax.data.months[m - 1].desc));
|
||||
}
|
||||
if (!yearVal)
|
||||
$selDobMonth.val('');
|
||||
$selDobMonth.prop('disabled', !yearVal);
|
||||
let monthVal = $selDobMonth.val();
|
||||
let $selDobDay = $('#cbAccountDobDay');
|
||||
let dayVal = $selDobDay.val();
|
||||
$selDobDay.empty();
|
||||
if (!!yearVal && !!monthVal)
|
||||
{
|
||||
$selDobDay.append($('<option>'));
|
||||
for (let dt = new Date(yearVal, monthVal - 1, 1); dt.getMonth() == monthVal - 1; dt.setDate(dt.getDate() + 1))
|
||||
$selDobDay.append($('<option>').prop('value', dt.getDate()).text(dt.getDate()));
|
||||
$selDobDay.val(dayVal);
|
||||
}
|
||||
if (!monthVal)
|
||||
$selDobDay.val('');
|
||||
$selDobDay.prop('disabled', !monthVal);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectRegionCountry = function ()
|
||||
{
|
||||
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegionCountry, regionId: $('#ifAccountRegionIdCountry').val(), fnCallback: sax.onSelectRegionCountry })
|
||||
}
|
||||
sax.onSelectRegionCountry = function (region)
|
||||
{
|
||||
//sax.debug(region);
|
||||
sax.clearControlError($('#ifAccountRegionIdCountry').val(region.id));
|
||||
$('#ifAccountRegionCaptionCountry').val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.onDropContactImage = function (evt)
|
||||
{
|
||||
//sax.debug('onDropContactImage', evt);
|
||||
let files = evt.originalEvent.dataTransfer.files;
|
||||
if (files.length < 1) return;
|
||||
if (files.length > 1) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadImageSingle);
|
||||
sax.onDropContactImageFile(files[0], $('#frmProfileContact'));
|
||||
}
|
||||
sax.onDropContactImageFile = function (file, context)
|
||||
{
|
||||
//sax.debug('onDropContactImageFile', file, context);
|
||||
if (file.size > sax.maxProfileImageSize) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileSizeMax.format(sax.formatFileSize(sax.maxProfileImageSize)));
|
||||
if (file.type != 'image/jpg' && file.type != 'image/jpeg' && file.type != 'image/png') return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileTypeInvalid.format(sax.getFileType(file)));
|
||||
$(".UploadMessage", context).text(sax.msg.uploadingFile.format(file.name));
|
||||
$('img.ContactImageUploadProgress', context).fadeIn(200);
|
||||
sax.clearControlError(sax.$pnl.contactImageDrag);
|
||||
sax.data.contactImageUploadContext = context;
|
||||
|
||||
sax.ajax.uploadContactImage = sax.ajax.uploadContactImage || { url: sax.url.base + 'Account/Ajax/UploadContactImage', callbackFn: sax.handleContactImageUploadResponse, noWaitIcon: true };
|
||||
sax.ajax.uploadContactImage.formData = new FormData();
|
||||
sax.ajax.uploadContactImage.formData.append("__RequestVerificationToken", $('#frmNavigate input[name="__RequestVerificationToken"]').val());
|
||||
sax.ajax.uploadContactImage.formData.append("AccountContactImage", file);
|
||||
sax.doAjaxRequest(sax.ajax.uploadContactImage, 50);
|
||||
}
|
||||
sax.handleContactImageUploadResponse = function (response)
|
||||
{
|
||||
let context = sax.data.contactImageUploadContext;
|
||||
//sax.debug('handleContactImageUploadResponse', response, context);
|
||||
if (!response) return;
|
||||
var $section = $('.sax-panel-section.ProfileContact');
|
||||
sax.refreshControlValues(response.controlValues, context);
|
||||
$(".UploadMessage", context).empty();
|
||||
$('img.ContactImageUploadProgress', context).hide();
|
||||
if (response.success)
|
||||
{
|
||||
$dlg.selectContactImage.dialog('close');
|
||||
$('img.AccountContact', $section).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
}
|
||||
}
|
||||
sax.selectContactImage = function ()
|
||||
{
|
||||
let dlg = $dlg.selectContactImage.dialog('option', { title: sax.dlg.title.imageUpload });
|
||||
$('#ifContactImage', dlg).val('');
|
||||
sax.openDialog(dlg, 560, 240);
|
||||
}
|
||||
sax.uploadContactImage = function ()
|
||||
{
|
||||
let dlg = $dlg.selectContactImage;
|
||||
let $fileCtrl = $('#ifContactImage', dlg);
|
||||
if (!$fileCtrl.length || !$fileCtrl[0].files.length)
|
||||
return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileSelect);
|
||||
let file = $fileCtrl[0].files[0];
|
||||
sax.onDropContactImageFile(file, dlg);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
sax.$pnl.proCon = $('.sax-panel-section.ProfileContact');
|
||||
$('.sax-action.sax-edit', sax.$pnl.proCon).on('click', function (evt) { sax.refreshProfileContactForm(); });
|
||||
$('input,textarea', sax.$pnl.proCon).on('input', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
|
||||
$('select', sax.$pnl.proCon).on('change', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
|
||||
|
||||
sax.$pnl.contactImageDrag = $('#pnlContactImageDrop')
|
||||
.on("dragenter", function (evt) { sax.haltEvent(evt); })
|
||||
.on("dragover", function (evt) { sax.haltEvent(evt); if (!sax.$pnl.contactImageDrag.hasClass(sax.classFileDrag)) sax.$pnl.contactImageDrag.addClass(sax.classFileDrag); })
|
||||
.on("dragleave", function (evt) { sax.haltEvent(evt); sax.$pnl.contactImageDrag.removeClass(sax.classFileDrag); })
|
||||
.on("drop", function (evt) { sax.haltEvent(evt); sax.$pnl.contactImageDrag.removeClass(sax.classFileDrag); sax.onDropContactImage(evt); });
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sax.uploadContactImage(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.selectContactImage = $('#dlgSelectContactImage').dialog(opt);
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Account page scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let se = sax.sportExperience = { fn: {}, $pnl: {}, $frm: {}, $dlg: {} };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.showSportExperience = function (usrSpt)
|
||||
{
|
||||
sax.debug('showSportExperience', usrSpt);
|
||||
$('.sax-header .SportName', se.$pnl.sportExp).text(usrSpt.sportName);
|
||||
$('.sax-panel-section').slideUp(750, function () { se.$pnl.sportExp.slideDown(750); });
|
||||
se.$dlg.sportExp.dialog('option', { 'title': sax.lbl.sportExperience + ' - ' + usrSpt.sportName });
|
||||
let frm = $('#frmProfileSportId');
|
||||
$('.UserSportId', frm).val(usrSpt.id);
|
||||
$('.UserSportId', se.$frm.sportExp).val(usrSpt.id);
|
||||
se.fn.refreshResults();
|
||||
}
|
||||
se.fn.refreshResults = function()
|
||||
{
|
||||
let frm = $('#frmProfileSportId');
|
||||
sax.ajax.sportExperiences = sax.ajax.sportExperiences || { url: sax.url.base + 'UserSport/Ajax/GetExperienceList', formId: frm.prop('id'), callbackFn: se.fn.handleSportExperiencesResponse };
|
||||
sax.doAjaxRequest(sax.ajax.sportExperiences, 50);
|
||||
}
|
||||
se.fn.handleSportExperiencesResponse = function (response)
|
||||
{
|
||||
sax.debug('handleSportExperiencesResponse', response);
|
||||
let $results = se.$pnl.results;
|
||||
let $msgs = $('.sax-panel-messages', $results).empty();
|
||||
let $list = $('.sax-panel-item-list', $results).hide().empty();
|
||||
let items = response.experiences;
|
||||
se.idx = 0;
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
item.idx = ++se.idx;
|
||||
let $item = se.fn.getItemTemplate(item.idx);
|
||||
sax.debug(item, $item);
|
||||
$('.ExperiencePeriod', $item).text(item.period);
|
||||
$('.ExperienceSummary', $item).text(item.summary);
|
||||
$('.ExperienceTeam', $item).text(item.team);
|
||||
$('.ExperienceLeague', $item).text(item.league);
|
||||
$('.ExperienceSpeciality', $item).text(item.speciality);
|
||||
let $mnu = $('.sax-burger .sax-dropdown-menu', $item).empty();
|
||||
$mnu.append(se.fn.getMenuOption(se.fn.getItemActionTemplate(), sax.lbl.edit, function () { se.fn.updateSportExperience(item, $item); }));
|
||||
$('.sax-header .sax-caption', $item).on('click', function () { se.fn.updateSportExperience(item, $item); });
|
||||
$('.sax-content', $item).on('dblclick', function () { se.fn.updateSportExperience(item, $item); });
|
||||
$list.append($item);
|
||||
}
|
||||
$list.show();
|
||||
}
|
||||
se.fn.getItemId = function (idx)
|
||||
{
|
||||
return 'SptExp_' + idx;
|
||||
}
|
||||
se.fn.getItemActionTemplate = function ()
|
||||
{
|
||||
return $('.sax-panel-item-template ul.sax-dropdown-menu.SportExperience li', se.$pnl.results).clone();
|
||||
}
|
||||
se.fn.getItemTemplate = function (idx)
|
||||
{
|
||||
return $('.sax-panel-item-template .sax-panel-item.SportExperience', se.$pnl.results).clone().prop('id', se.fn.getItemId(idx));
|
||||
}
|
||||
se.fn.getMenuOption = function ($opt, lbl, fn)
|
||||
{
|
||||
return $opt.find('div.sax-label').text(lbl).end().on('click', fn);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.addSportExperience = function ()
|
||||
{
|
||||
sax.debug('addSportExperience')
|
||||
se.fn.clearSportExperience();
|
||||
sax.openDialog(se.$dlg.sportExp, 560, 600);
|
||||
}
|
||||
se.fn.clearSportExperience = function ()
|
||||
{
|
||||
let frm = se.$frm.sportExp;
|
||||
$('.sax-input,.sax-textarea,.sax-select,.UserSportExperienceId,.UserSportExperienceExists', frm).val('').prop('autofocus', null);
|
||||
}
|
||||
se.fn.updateSportExperience = function (item, $item)
|
||||
{
|
||||
sax.debug('updateSportExperience', item);
|
||||
let frm = se.$frm.sportExpId;
|
||||
$('.UserSportExperienceId', se.$frm.sportExpId).val(item.id);
|
||||
sax.ajax.sportExp = sax.ajax.sportExp || { url: sax.url.base + 'UserSport/Ajax/GetExperience', formId: frm.prop('id'), callbackFn: se.fn.doUpdateSportExperience };
|
||||
sax.doAjaxRequest(sax.ajax.sportExp, 50);
|
||||
}
|
||||
se.fn.doUpdateSportExperience = function (response)
|
||||
{
|
||||
sax.debug('doUpdateSportExperience', response);
|
||||
if (!response.success) return;
|
||||
let item = response.experience;
|
||||
let frm = se.$frm.sportExp;
|
||||
se.fn.clearSportExperience();
|
||||
$('input.UserSportExperienceId', frm).val(item.id);
|
||||
$('input.UserSportExperienceExists', frm).val(1);
|
||||
sax.debug(Date.parse(item.periodFrom_YMD));
|
||||
$('.sax-input.ExperiencePeriodFrom', frm).datepicker('setDate', new Date(item.periodFrom_YMD));
|
||||
$('.sax-input.ExperiencePeriodTo', frm).datepicker('setDate', item.periodTo_YMD ? new Date(item.periodTo_YMD) : null);
|
||||
$('.sax-textarea.ExperienceSummary', frm).val(item.summary).prop('autofocus', true);
|
||||
$('.sax-input.ExperienceOrganisationName', frm).val(item.organisationName);
|
||||
$('.sax-input.ExperienceTeam', frm).val(item.team);
|
||||
$('.sax-input.ExperienceLeague', frm).val(item.league);
|
||||
$('.sax-input.ExperienceSpeciality', frm).val(item.speciality);
|
||||
sax.openDialog(se.$dlg.sportExp, 560, 600);
|
||||
}
|
||||
se.fn.storeSportExperience = function ()
|
||||
{
|
||||
sax.debug('storeSportExperience');
|
||||
let frm = se.$frm.sportExp;
|
||||
sax.ajax.storeSportExp = sax.ajax.storeSportExp || { url: sax.url.base + 'UserSport/Ajax/StoreExperience', formId: frm.prop('id'), callbackFn: se.fn.onStoreSportExperience };
|
||||
sax.doAjaxRequest(sax.ajax.storeSportExp, 50);
|
||||
}
|
||||
se.fn.onStoreSportExperience = function (response)
|
||||
{
|
||||
sax.debug('onStoreSportExperience', response);
|
||||
sax.refreshControlValues(response.controlValues, se.$dlg.sprExp);
|
||||
if (!response.success) return;
|
||||
se.$dlg.sportExp.dialog('close');
|
||||
se.fn.refreshResults();
|
||||
}
|
||||
sax.closeProfileSportExperience = function ()
|
||||
{
|
||||
se.$pnl.sportExp.slideUp(750, function () { $('.sax-panel-section').slideDown(750); });
|
||||
sax.refreshProfileSportsInfo(50);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
se.$pnl.sportExp = $('.sax-panel.ProfileSportExperience');
|
||||
se.$pnl.hdr = $('.sax-header', se.$pnl.sportExp);
|
||||
se.$pnl.results = $('.sax-panel-results.ProfileSportExperiences', se.$pnl.sportExp);
|
||||
sax.initCalendars('#dlgSportExperience .sax-calendar', { changeMonth: true, changeYear: true, yearRange: '-99:+00' });
|
||||
se.$dpPeriodFrom = $('#dlgSportExperience .sax-calendar.ExperiencePeriodFrom');
|
||||
se.$dpPeriodTo = $('#dlgSportExperience .sax-calendar.ExperiencePeriodTo');
|
||||
se.$dpPeriodFrom.datepicker({ onSelect: function () { $(this).change(); } });
|
||||
sax.allowClearCalendar('#dlgSportExperience .sax-calendar.ExperiencePeriodTo');
|
||||
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { se.fn.storeSportExperience(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
se.$dlg.sportExp = $('#dlgSportExperience').dialog(opt);
|
||||
se.$frm.sportExpId = $('#frmSportExperienceId');
|
||||
se.$frm.sportExp = $('#frmSportExperience', se.$dlg.sportExp);
|
||||
$('input,textarea', se.$frm.sportExp).on('input', function () { sax.clearControlError(this); }).on('change', function () { sax.clearControlError(this); });
|
||||
$('select', se.$frm.sportExp).on('change', function () { sax.clearControlError(this); });
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Account page scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let $pnl = sax.$pnl, $dlg = sax.$dlg, $frm = sax.$frm;
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshProfileSportsInfo = function (delay)
|
||||
{
|
||||
var $section = $('.sax-panel-section.ProfileSports');
|
||||
$section.removeClass('sax-edit').addClass('sax-populating');
|
||||
$('.sax-property', $section).hide();
|
||||
sax.showDataRefreshingMsg($section);
|
||||
sax.refreshProfileSports(sax.onRefreshProfileSportsInfo);
|
||||
}
|
||||
sax.refreshProfileSports = function (callbackFn)
|
||||
{
|
||||
//sax.debug('refreshProfileSports');
|
||||
delete sax.page.profileSportsChanged;
|
||||
sax.ajax.profileSports = sax.ajax.profileSports || { url: sax.url.base + 'Account/Ajax/GetProfileSports', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajax.profileSports.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajax.profileSports, 50);
|
||||
}
|
||||
sax.onRefreshProfileSportsInfo = function (response)
|
||||
{
|
||||
//sax.debug('onRefreshProfileSportsInfo', response);
|
||||
if (!response || !response.success) return;
|
||||
var $section = $('.sax-panel-section.ProfileSports');
|
||||
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||
sax.profile.sports.Ids = [];
|
||||
let items = response.sports;
|
||||
if (!items) return;
|
||||
let $items = $('.sax-panel-results.ProfileSports', $section).empty();
|
||||
let $tmpl = $('.sax-panel-item-template .sax-panel-item.ProfileSport', $section);
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
sax.profile.sports.Ids.push(item.sportId);
|
||||
let $item = $tmpl.clone().prop('id', 'ProSpt_' + item.id);
|
||||
$('.sax-header .sax-action.sax-edit', $item).on('click', function (evt) { sax.updateProfileSport(item.id); });
|
||||
$('.sax-header .sax-action.sax-experience', $item).on('click', function (evt) { sax.showSportExperience(item); });
|
||||
$('.SportName', $item).text(item.sportName);
|
||||
$('.SportParticipationValue', $item).text(item.sportParticipation);
|
||||
$('.SportParticipation', $item).toggle(!!item.sportParticipation);
|
||||
$('.SportOfficiatingValue', $item).text(item.sportOfficiating);
|
||||
$('.SportOfficiating', $item).toggle(!!item.sportOfficiating);
|
||||
$items.append($item);
|
||||
}
|
||||
$items.show();
|
||||
sax.showNoInfoMsg($section);
|
||||
$section.removeClass('sax-populating');
|
||||
}
|
||||
sax.addProfileSport = function ()
|
||||
{
|
||||
//sax.debug('addProfileSport');
|
||||
let dlg = $dlg.profileSport;
|
||||
$('.UserSportId,.ProfileSportExists,#ifProfileSportId,input.sax-input,select.sax-select', dlg).val('');
|
||||
$('.SelectSport', dlg).show();
|
||||
dlg.dialog('option', 'title', sax.dlg.title.addUserSport);
|
||||
sax.openDialog(dlg, 480, 400);
|
||||
}
|
||||
sax.updateProfileSport = function (id)
|
||||
{
|
||||
//sax.debug('updateProfileSport', id);
|
||||
$('#frmProfileSportId .UserSportId').val(id);
|
||||
sax.ajax.profileSport = sax.ajax.profileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport };
|
||||
sax.doAjaxRequest(sax.ajax.profileSport, 50);
|
||||
}
|
||||
sax.doUpdateProfileSport = function (response)
|
||||
{
|
||||
//sax.debug('doUpdateProfileSport', response);
|
||||
let dlg = $dlg.profileSport;
|
||||
let item = response.sport;
|
||||
$('.UserSportId', dlg).val(item.id);
|
||||
$('.ProfileSportExists', dlg).val(1);
|
||||
$('#ifProfileSportId', dlg).val(item.sportId);
|
||||
$('#ifProfileSport', dlg).val(item.sportName);
|
||||
$('#cbProfileSportParticipation', dlg).val(item.sportParticipationCode);
|
||||
$('#cbProfileSportOfficiating', dlg).val(item.sportOfficiatingCode);
|
||||
$('.SelectSport', dlg).hide();
|
||||
dlg.dialog('option', 'title', sax.dlg.title.updateUserSport);
|
||||
sax.openDialog(dlg, 480, 400);
|
||||
}
|
||||
sax.selectUserSport = function (sport)
|
||||
{
|
||||
//sax.debug('selectUserSport');
|
||||
let excludeIds = $.grep(sax.profile.sports.Ids, function (value) { return !sport || value != sport.id; });
|
||||
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#frmProfileSport #ifProfileSportId').val(), excludeIds: excludeIds, fnCallback: sax.onSelectUserSport })
|
||||
}
|
||||
sax.onSelectUserSport = function (sport)
|
||||
{
|
||||
sax.clearControlError($('#ifProfileSportId').val(sport ? sport.id : ''));
|
||||
$('#ifProfileSport').val(sport ? sport.name : '');
|
||||
}
|
||||
sax.storeProfileSport = function ()
|
||||
{
|
||||
//sax.debug('storeProfileSport');
|
||||
sax.clearControlErrors();
|
||||
sax.ajax.storeProfileSport = sax.ajax.storeProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport };
|
||||
sax.doAjaxRequest(sax.ajax.storeProfileSport, 50);
|
||||
}
|
||||
sax.onStoreProfileSport = function (response)
|
||||
{
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response || !response.success) return;
|
||||
$dlg.profileSport.dialog('close');
|
||||
sax.refreshProfileSportsInfo();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
$('.sax-panel-section.ProfileSports .sax-action.sax-add').on('click', function (evt) { sax.addProfileSport(); });
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sax.storeProfileSport(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.profileSport = $('#dlgProfileSport').dialog(opt);
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
Reference in New Issue
Block a user