v1.0.4.0
This commit is contained in:
@@ -126,6 +126,15 @@
|
||||
<data name="account.caption.profile.organisations" xml:space="preserve">
|
||||
<value>My Organisations</value>
|
||||
</data>
|
||||
<data name="account.caption.profile.sport" xml:space="preserve">
|
||||
<value>My Sport</value>
|
||||
</data>
|
||||
<data name="account.caption.profile.sport.add" xml:space="preserve">
|
||||
<value>Add Sport</value>
|
||||
</data>
|
||||
<data name="account.caption.profile.sport.update" xml:space="preserve">
|
||||
<value>My Sport</value>
|
||||
</data>
|
||||
<data name="account.caption.profile.sports" xml:space="preserve">
|
||||
<value>My Sports</value>
|
||||
</data>
|
||||
@@ -171,6 +180,9 @@
|
||||
<data name="label.account" xml:space="preserve">
|
||||
<value>My Account</value>
|
||||
</data>
|
||||
<data name="label.add" xml:space="preserve">
|
||||
<value>Add</value>
|
||||
</data>
|
||||
<data name="label.article" xml:space="preserve">
|
||||
<value>Article</value>
|
||||
</data>
|
||||
@@ -225,6 +237,18 @@
|
||||
<data name="label.ok" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="label.opportunities" xml:space="preserve">
|
||||
<value>Opportunities</value>
|
||||
</data>
|
||||
<data name="label.opportunity" xml:space="preserve">
|
||||
<value>Opportunity</value>
|
||||
</data>
|
||||
<data name="label.organisation" xml:space="preserve">
|
||||
<value>Organisation</value>
|
||||
</data>
|
||||
<data name="label.outline" xml:space="preserve">
|
||||
<value>Outline</value>
|
||||
</data>
|
||||
<data name="label.password" xml:space="preserve">
|
||||
<value>Password</value>
|
||||
</data>
|
||||
@@ -234,6 +258,9 @@
|
||||
<data name="label.password.current" xml:space="preserve">
|
||||
<value>Current password</value>
|
||||
</data>
|
||||
<data name="label.position" xml:space="preserve">
|
||||
<value>Position</value>
|
||||
</data>
|
||||
<data name="label.published" xml:space="preserve">
|
||||
<value>Published</value>
|
||||
</data>
|
||||
@@ -345,6 +372,24 @@
|
||||
<data name="msg.validation.maximum.length" xml:space="preserve">
|
||||
<value>Value must not exceed {0} characters</value>
|
||||
</data>
|
||||
<data name="organisation.caption.opportunities" xml:space="preserve">
|
||||
<value>Organisation Opportunities</value>
|
||||
</data>
|
||||
<data name="organisation.caption.opportunity" xml:space="preserve">
|
||||
<value>Organisation Opportunity</value>
|
||||
</data>
|
||||
<data name="organisation.caption.opportunity.create" xml:space="preserve">
|
||||
<value>Create Opportunity</value>
|
||||
</data>
|
||||
<data name="organisation.caption.opportunity.update" xml:space="preserve">
|
||||
<value>Update Opportunity</value>
|
||||
</data>
|
||||
<data name="organisation.caption.organisations" xml:space="preserve">
|
||||
<value>Organisations</value>
|
||||
</data>
|
||||
<data name="organisation.caption.select.organisation" xml:space="preserve">
|
||||
<value>Select Organisation</value>
|
||||
</data>
|
||||
<data name="policies.caption.privacy" xml:space="preserve">
|
||||
<value>Privacy</value>
|
||||
</data>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
@@ -27,10 +28,25 @@ namespace Saxonite.Net.Core.Web.Online.App
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
// Security.
|
||||
/// <summary>User - JSON deserialisation route.</summary>
|
||||
public new UserData User { get { return base.User; } set { SetUser(value); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Filter properties.
|
||||
public class FilterData
|
||||
{
|
||||
/// <summary>Id for currently selected Organisation.</summary>
|
||||
public SysId OrganisationId { get; set; }
|
||||
/// <summary>Display text for currently selected Organisation.</summary>
|
||||
public String OrganisationCaption { get; set; }
|
||||
/// <summary>Id for currently selected Organisation of which the user is a member.</summary>
|
||||
public SysId OrganisationIdMember { get; set; }
|
||||
/// <summary>Display text for currently selected Organisation of which the user is a member.</summary>
|
||||
public String OrganisationCaptionMember { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -16,7 +16,7 @@ using Sarand.Net.Standard.Base.Utils;
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Account Controller - Ajax actions.
|
||||
// Online Account Controller - Contact - Ajax actions.
|
||||
//=======================================================================
|
||||
partial class AccountController
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ using Sarand.Net.Standard.Base.Utils;
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Account Controller - Ajax actions.
|
||||
// Online Account Controller - Organisations - Ajax actions.
|
||||
//=======================================================================
|
||||
partial class AccountController
|
||||
{
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
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 Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Account Controller - Sports - Ajax actions.
|
||||
//=======================================================================
|
||||
partial class AccountController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data definitions.
|
||||
public class ProfileSportResponseData_List
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long SportId { get; set; }
|
||||
public String SportName { get; set; }
|
||||
public String StatusCode { get; set; }
|
||||
public String StatusDesc { get; set; }
|
||||
}
|
||||
public class ProfileSportResponseData_Item : ProfileSportResponseData_List
|
||||
{
|
||||
public String CreatedOnFmt { get; set; }
|
||||
}
|
||||
private void PopulateProfileSportResponseData(Model_Account model, SaxUserSport userSport, SaxSport sport, ProfileSportResponseData_Item data)
|
||||
{
|
||||
data.Id = SysId.ToLong(userSport.Id);
|
||||
data.SportId = SysId.ToLong(userSport.SportId);
|
||||
data.SportName = sport.Name;
|
||||
data.CreatedOnFmt = DateUtil.Format(userSport.CreateStamp.On, "d-MMM-yyyy");
|
||||
data.StatusCode = userSport.StatusCode;
|
||||
data.StatusDesc = userSport.StatusDesc;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Get Profile Sports.
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_ProfileSportsData : AjaxResponse_Data
|
||||
{
|
||||
public List<ProfileSportResponseData_List> Sports { get; } = new List<ProfileSportResponseData_List>();
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
[Route("Account/Ajax/GetProfileSports")]
|
||||
public IActionResult GetProfileSports(Model_Account model)
|
||||
{
|
||||
String fn = GetType().Name + ".GetProfileSports";
|
||||
AjaxResponse_ProfileSportsData responseData = new AjaxResponse_ProfileSportsData();
|
||||
String messageTitle = Localiser["account.caption.profile.sports"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Item filter.
|
||||
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||
prmUserSport.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||
prmUserSport.StatusCat = SaxUserSport.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)AccountMgr.GetUserSportCount(prmUserSport);
|
||||
model.PopulatePagingTo(prmUserSport.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
ColumnDfn colId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Id);
|
||||
ColumnDfn colSportId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportId);
|
||||
ColumnDfn colSportName = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Sport_Name);
|
||||
ColumnDfn colStatus = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId,
|
||||
colSportId, colSportName,
|
||||
colStatus,
|
||||
};
|
||||
|
||||
// Sort columns.
|
||||
prmUserSport.SortColumns.Add(colSportName);
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteUserSportQuery(columns, prmUserSport))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
ProfileSportResponseData_List userSportData = new ProfileSportResponseData_List()
|
||||
{
|
||||
Id = values.GetLong(colId.DataName),
|
||||
SportId = values.GetLong(colSportId.DataName),
|
||||
SportName = values.GetString(colSportName.DataName),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
responseData.Sports.Add(userSportData);
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Profile Sport ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_ProfileSport : AjaxResponse_Data
|
||||
{
|
||||
public ProfileSportResponseData_Item Sport { get; } = new ProfileSportResponseData_Item();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Account/Ajax/GetProfileSport")]
|
||||
public IActionResult Ajax_GetProfileSport(Model_Account model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetProfileSport";
|
||||
String messageTitle = Localiser["account.caption.profile.sport"];
|
||||
AjaxResponse_ProfileSport responseData = new AjaxResponse_ProfileSport();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Identify item.
|
||||
SysId userSportId = model.UserSportId.ToSysId();
|
||||
if (!SysId.IsValid(userSportId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
// Retrieve item.
|
||||
SaxUserSport userSport = AccountMgr.GetUserSportById(userSportId);
|
||||
if (userSport == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve User Sport for Id: '" + model.UserSportId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Retrieve sport.
|
||||
SaxSport sport = ReferenceMgr.GetSportById(userSport.SportId);
|
||||
if (sport == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve Sport for Id: '" + userSport.SportId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateProfileSportResponseData(model, userSport, sport, responseData.Sport);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Store ProfileSport ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Account/Ajax/StoreProfileSport")]
|
||||
public IActionResult Ajax_StoreProfileSport(Model_Account model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_StoreProfileSport";
|
||||
String messageTitle = Localiser["account.caption.profile.sport"];
|
||||
AjaxResponse_ProfileSport responseData = new AjaxResponse_ProfileSport();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Validate item properties.
|
||||
model.ValidateProfileSportData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Validate Profile Sport Id against 'Exists' flag.
|
||||
SysId userSportId = model.UserSportId.ToSysId();
|
||||
bool profileSportExists = StringUtil.ToBool(model.ProfileSportExists);
|
||||
if (profileSportExists && !SysId.IsValid(userSportId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Id not specified for existing Profile Sport.");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
if (!profileSportExists && SysId.IsValid(userSportId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Id specified for new Profile Sport: '" + model.UserSportId + "'");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Retrieve the sport.
|
||||
SysId sportId = model.ProfileSportId.ToSysId();
|
||||
SaxSport sport = ReferenceMgr.GetSportById(sportId);
|
||||
if (sport == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve Sport for Id: " + sportId);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Retrieve existing item.
|
||||
SaxUserSport userSport = AccountMgr.GetUserSportById(userSportId);
|
||||
if (userSport == null && SysId.IsValid(userSportId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve User Sport for Id: '" + model.UserSportId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
// Validate user sport properties.
|
||||
if (userSport != null)
|
||||
{
|
||||
if (!userSport.SportId.Equals(sportId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent Sport Id specified for User Sport. Expected: " + userSport.SportId + ". Found: " + sportId);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
}
|
||||
|
||||
// Create new item if required.
|
||||
if (userSport == null)
|
||||
userSport = AccountMgr.CreateUserSport(SessionData.User.UserAccountId, sportId);
|
||||
|
||||
// Populate item properties.
|
||||
|
||||
// Store item.
|
||||
if (!SysId.IsValid(userSport.Id))
|
||||
{
|
||||
if (!AccountMgr.InsertUserSport(userSport, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert user sport: " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + AccountMgr.ErrorStateMessage));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AccountMgr.UpdateUserSport(userSport, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update user sport [Id:" + SysId.ToString(userSport.Id) + "]: " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + AccountMgr.ErrorStateMessage));
|
||||
}
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateProfileSportResponseData(model, userSport, sport, responseData.Sport);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -192,7 +192,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Store Article ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("JOurnalist/Ajax/StoreArticle")]
|
||||
[Route("Journalist/Ajax/StoreArticle")]
|
||||
public IActionResult Ajax_StoreArticle(Model_Journalist model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_StoreArticle";
|
||||
|
||||
+342
@@ -0,0 +1,342 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Online.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.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Organisation Controller - Opportunities - Ajax actions.
|
||||
//=======================================================================
|
||||
partial class OrganisationController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation Opportunity data.
|
||||
public class OpportunityData_List
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String TypeCode { get; set; }
|
||||
public String TypeDesc { get; set; }
|
||||
public String Position { get; set; }
|
||||
public String Outline { get; set; }
|
||||
public String RegionCaption { get; set; }
|
||||
public String SportCaption { get; set; }
|
||||
public String PublishedOnFmt { get; set; }
|
||||
public String ExpiresOnFmt { get; set; }
|
||||
public String CreatedOnFmt { get; set; }
|
||||
public String StatusCode { get; set; }
|
||||
public String StatusDesc { get; set; }
|
||||
}
|
||||
public class OpportunityData_Full : OpportunityData_List
|
||||
{
|
||||
public String RegionIdPrimary { get; set; }
|
||||
public String SportIdPrimary { get; set; }
|
||||
public String PublishedOn_YYYYMMDD { get; set; }
|
||||
public String ExpiresOn_YYYYMMDD { get; set; }
|
||||
}
|
||||
private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_List data)
|
||||
{
|
||||
data.Id = SysId.ToString(opportunity.Id);
|
||||
data.TypeCode = OpportunityTypes.GetCodeForType(opportunity.OpportunityType);
|
||||
data.TypeDesc = Localiser.GetOpportunityTypeCaption(opportunity.OpportunityType);
|
||||
data.Position = opportunity.Position;
|
||||
data.Outline = opportunity.Outline;
|
||||
data.RegionCaption = model.GetRegionCaption(opportunity.RegionIdPrimary);
|
||||
data.SportCaption = model.GetSportCaption(opportunity.SportIdPrimary);
|
||||
data.CreatedOnFmt = DateUtil.Format(opportunity.CreateStamp.On, "d-MMM-yyyy");
|
||||
data.PublishedOnFmt = DateUtil.Format(opportunity.PublishedAt, "d-MMM-yyyy");
|
||||
data.ExpiresOnFmt = DateUtil.Format(opportunity.ExpiresAt, "d-MMM-yyyy");
|
||||
data.StatusCode = opportunity.StatusCode;
|
||||
data.StatusDesc = opportunity.StatusDesc;
|
||||
}
|
||||
private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_Full data)
|
||||
{
|
||||
PopulateOpportunityResponseData(model, opportunity, data as OpportunityData_List);
|
||||
data.RegionIdPrimary = SysId.ToString(opportunity.RegionIdPrimary);
|
||||
data.SportIdPrimary = SysId.ToString(opportunity.SportIdPrimary);
|
||||
data.PublishedOn_YYYYMMDD = DateUtil.Format(opportunity.PublishedAt, "yyyyMMdd");
|
||||
data.ExpiresOn_YYYYMMDD = DateUtil.Format(opportunity.ExpiresAt, "yyyyMMdd");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Opportunity List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_OpportunityList : AjaxResponse_Data
|
||||
{
|
||||
public List<OpportunityData_List> Opportunities { get; } = new List<OpportunityData_List>();
|
||||
// User profile.
|
||||
public class UserData
|
||||
{
|
||||
public bool CanManage { get; set; }
|
||||
}
|
||||
public UserData User { get; } = new UserData();
|
||||
// Reference data.
|
||||
public List<CodeDesc> OpportunityTypes { get; } = new List<CodeDesc>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/GetOpportunityList")]
|
||||
[Route("Organisation/Ajax/GetOpportunities")]
|
||||
public IActionResult Ajax_GetOpportunityList(Model_Organisation_Opportunities model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetOpportunityList";
|
||||
String messageTitle = Localiser["organisation.caption.opportunities"];
|
||||
AjaxResponse_OpportunityList responseData = new AjaxResponse_OpportunityList();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Organisation.
|
||||
SysId organisationId = model.Filter.OrganisationId.ToSysId();
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
|
||||
if (organisation != null)
|
||||
{
|
||||
// Store filter data.
|
||||
SessionData_Online.Filter.OrganisationIdMember = organisation.Id;
|
||||
SessionData_Online.Filter.OrganisationCaptionMember = organisation.Name;
|
||||
|
||||
// Reference data - opportunity types.
|
||||
foreach (TypeCodeDesc opportunityType in OpportunityTypes)
|
||||
responseData.OpportunityTypes.Add(opportunityType.Code, Localiser.GetOpportunityTypeCaption((Sax.OpportunityType)opportunityType.Type));
|
||||
|
||||
// User organisation.
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||
prmUserOrganisation.OrganisationIdsIncluded.Add(organisationId);
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||
SaxUserOrganisation userOrganisation = AccountMgr.GetUserOrganisation(prmUserOrganisation);
|
||||
|
||||
// User details.
|
||||
responseData.User.CanManage = userOrganisation?.OrganisationRoles.Contains(Sax.OrganisationRole.OpportunityAdmin) ?? false;
|
||||
|
||||
// Item filter.
|
||||
SaxOrganisationOpportunity.Params prmOpportunity = new SaxOrganisationOpportunity.Params();
|
||||
prmOpportunity.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||
prmOpportunity.OrganisationIdsIncluded.Add(organisationId);
|
||||
prmOpportunity.OpportunityFilter = model.Filter.Opportunity;
|
||||
prmOpportunity.StatusCat = SaxOrganisationOpportunity.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)ActivityMgr.GetOrganisationOpportunityCount(prmOpportunity);
|
||||
model.PopulatePagingTo(prmOpportunity.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
ColumnDfn colId = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Id);
|
||||
ColumnDfn colOpportunityTypeCode = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.OpportunityTypeCode);
|
||||
ColumnDfn colPosition = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Position);
|
||||
ColumnDfn colOutline = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Outline);
|
||||
ColumnDfn colRegionId = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.RegionIdPrimary);
|
||||
ColumnDfn colRegionName = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Region_Name);
|
||||
ColumnDfn colSportId = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.SportIdPrimary);
|
||||
ColumnDfn colSportName = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Sport_Name);
|
||||
ColumnDfn colPublishedOn = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.PublishedAt_Date);
|
||||
ColumnDfn colExpiresOn = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.ExpiresAt_Date);
|
||||
ColumnDfn colStatus = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Status);
|
||||
ColumnDfn colCreatedOn = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.CreateOn_Date);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colOpportunityTypeCode, colPosition, colOutline,
|
||||
colRegionId, colRegionName, colSportId, colSportName,
|
||||
colPublishedOn, colExpiresOn,
|
||||
colStatus, colCreatedOn
|
||||
};
|
||||
|
||||
// Sort columns.
|
||||
colCreatedOn.SortAscending = false;
|
||||
prmOpportunity.SortColumns.Add(colCreatedOn);
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = ActivityMgr.ExecuteOrganisationOpportunityQuery(columns, prmOpportunity))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OpportunityData_List opportunityData = new OpportunityData_List()
|
||||
{
|
||||
Id = values.GetString(colId.DataName),
|
||||
TypeCode = values.GetString(colOpportunityTypeCode.DataName),
|
||||
TypeDesc = Localiser.GetOpportunityTypeCaption((Sax.OpportunityType)OpportunityTypes.GetTypeForCode(values.GetString(colOpportunityTypeCode.DataName))),
|
||||
Position = values.GetString(colPosition.DataName),
|
||||
Outline = values.GetString(colOutline.DataName),
|
||||
RegionCaption = model.GetRegionCaption(values.GetString(colRegionName.DataName).ToSysId()),
|
||||
SportCaption = model.GetSportCaption(values.GetString(colSportName.DataName).ToSysId()),
|
||||
CreatedOnFmt = DateUtil.Format(values.GetDateTime(colCreatedOn.DataName), "d-MMM-yyyy"),
|
||||
PublishedOnFmt = DateUtil.Format(values.GetDateTime(colPublishedOn.DataName), "d-MMM-yyyy"),
|
||||
ExpiresOnFmt = DateUtil.Format(values.GetDateTime(colExpiresOn.DataName), "d-MMM-yyyy"),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
responseData.Opportunities.Add(opportunityData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Opportunity ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_Opportunity : AjaxResponse_Data
|
||||
{
|
||||
public OpportunityData_Full Opportunity { get; } = new OpportunityData_Full();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/GetOpportunity")]
|
||||
public IActionResult Ajax_GetOpportunity(Model_Organisation_Opportunities model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetOpportunity";
|
||||
String messageTitle = Localiser["organisation.caption.opportunity"];
|
||||
AjaxResponse_Opportunity responseData = new AjaxResponse_Opportunity();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Identify item.
|
||||
SysId opportunityId = model.OpportunityId.ToSysId();
|
||||
if (!SysId.IsValid(opportunityId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
// Retrieve item.
|
||||
SaxOrganisationOpportunity opportunity = ActivityMgr.GetOrganisationOpportunityById(opportunityId);
|
||||
if (opportunity == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve Organisation Opportunity for Id: '" + model.OpportunityId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateOpportunityResponseData(model, opportunity, responseData.Opportunity);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Store Opportunity ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/StoreOpportunity")]
|
||||
public IActionResult Ajax_StoreOpportunity(Model_Organisation_Opportunities model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_StoreOpportunity";
|
||||
String messageTitle = Localiser["organisation.caption.opportunity"];
|
||||
AjaxResponse_Opportunity responseData = new AjaxResponse_Opportunity();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Validate item properties.
|
||||
model.ValidateOpportunityData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Validate Opportunity against Id against 'Exists' flag.
|
||||
SysId opportunityId = model.OpportunityId.ToSysId();
|
||||
bool opportunityExists = StringUtil.ToBool(model.OpportunityExists);
|
||||
if (opportunityExists && !SysId.IsValid(opportunityId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Id not specified for existing Opportunity.");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
if (!opportunityExists && SysId.IsValid(opportunityId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Id specified for new Opportunity: '" + model.OpportunityId + "'");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Retrieve existing item.
|
||||
SaxOrganisationOpportunity opportunity = ActivityMgr.GetOrganisationOpportunityById(opportunityId);
|
||||
if (opportunity == null && SysId.IsValid(opportunityId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve opportunity for Id: '" + model.OpportunityId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Validate the Organisation Id.
|
||||
SysId organisationId = model.OpportunityOrganisationId.ToSysId();
|
||||
if (!SysId.IsValid(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Organisation Id not specified for Opportunity.");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
if (opportunity != null && !opportunity.OrganisationId.Equals(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent Organisation Id specified for Opportunity. Expected: " + opportunity.OrganisationId + ". Found: " + organisationId);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Create new item if required.
|
||||
if (opportunity == null)
|
||||
opportunity = ActivityMgr.CreateOrganisationOpportunity(organisationId);
|
||||
|
||||
// Populate item properties.
|
||||
if (model.OpportunityRegionId != null)
|
||||
opportunity.RegionIdPrimary = model.OpportunityRegionId.ToSysId();
|
||||
if (model.OpportunitySportId != null)
|
||||
opportunity.SportIdPrimary = model.OpportunitySportId.ToSysId();
|
||||
if (model.OpportunityTypeCode != null)
|
||||
opportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypes.GetTypeForCode(model.OpportunityTypeCode);
|
||||
if (model.OpportunityPosition != null)
|
||||
opportunity.Position = model.OpportunityPosition;
|
||||
if (model.OpportunityOutline != null)
|
||||
opportunity.Outline = model.OpportunityOutline;
|
||||
if (model.OpportunityStatusCode != null)
|
||||
opportunity.Status = model.OpportunityStatus;
|
||||
|
||||
// Store item.
|
||||
if (!SysId.IsValid(opportunity.Id))
|
||||
{
|
||||
if (!ActivityMgr.InsertOrganisationOpportunity(opportunity, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert opportunity: " + ActivityMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ActivityMgr.ErrorStateMessage));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ActivityMgr.UpdateOrganisationOpportunity(opportunity, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update opportunity [Id:" + SysId.ToString(opportunity.Id) + "]: " + ActivityMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ActivityMgr.ErrorStateMessage));
|
||||
}
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateOpportunityResponseData(model, opportunity, responseData.Opportunity);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Online.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.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Organisation Controller - Ajax actions.
|
||||
//=======================================================================
|
||||
partial class OrganisationController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation data.
|
||||
public class OrganisationResponseData
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public String Name { get; set; }
|
||||
public long RegionId { get; set; }
|
||||
public String RegionName { get; set; }
|
||||
public long SportId { get; set; }
|
||||
public String SportName { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Organisation List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_OrganisationList : AjaxResponse_Data
|
||||
{
|
||||
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/GetOrganisationList")]
|
||||
public IActionResult Ajax_GetOrganisationList(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetOrganisationList";
|
||||
String messageTitle = Localiser["organisation.caption.organisations"];
|
||||
AjaxResponse_OrganisationList responseData = new AjaxResponse_OrganisationList();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Query columns.
|
||||
ColumnDfn colOrganisationId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Id);
|
||||
ColumnDfn colOrganisationName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Name);
|
||||
ColumnDfn colRegionId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.RegionId);
|
||||
ColumnDfn colRegionName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Region_Name);
|
||||
ColumnDfn colSportId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.SportId);
|
||||
ColumnDfn colSportName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Sport_Name);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colOrganisationId, colOrganisationName,
|
||||
colRegionId, colRegionName,
|
||||
colSportId, colSportName
|
||||
};
|
||||
|
||||
// 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.StatusCat = SaxOrganisation.StatusCat.ActiveOnly;
|
||||
prmOrganisation.SortColumns.Add(colOrganisationName);
|
||||
model.DataItemTotal = (ulong)AccountMgr.GetOrganisationCount(prmOrganisation);
|
||||
model.PopulatePagingTo(prmOrganisation.ResultsPaging);
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteOrganisationQuery(columns, prmOrganisation))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OrganisationResponseData organisationData = new OrganisationResponseData()
|
||||
{
|
||||
Id = values.GetLong(colOrganisationId.DataName),
|
||||
Name = values.GetString(colOrganisationName.DataName),
|
||||
RegionId = values.GetLong(colRegionId.DataName),
|
||||
RegionName = values.GetString(colRegionName.DataName),
|
||||
SportId = values.GetLong(colSportId.DataName),
|
||||
SportName = values.GetString(colSportName.DataName),
|
||||
};
|
||||
responseData.Organisations.Add(organisationData);
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Member Organisation List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_MemberOrganisationList : AjaxResponse_Data
|
||||
{
|
||||
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/GetMemberOrganisationList")]
|
||||
public IActionResult Ajax_GetMemberOrganisationList(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetMemberOrganisationList";
|
||||
String messageTitle = Localiser["organisation.caption.organisations"];
|
||||
AjaxResponse_MemberOrganisationList responseData = new AjaxResponse_MemberOrganisationList();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Query columns.
|
||||
ColumnDfn colOrganisationId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
|
||||
ColumnDfn colOrganisationName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
|
||||
ColumnDfn colRegionId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_RegionId);
|
||||
ColumnDfn colRegionName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Region_Name);
|
||||
ColumnDfn colSportId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_SportId);
|
||||
ColumnDfn colSportName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Sport_Name);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colOrganisationId, colOrganisationName,
|
||||
colRegionId, colRegionName,
|
||||
colSportId, colSportName
|
||||
};
|
||||
|
||||
// Organisation filter
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||
prmUserOrganisation.SortColumns.Add(colOrganisationName);
|
||||
model.DataItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmUserOrganisation);
|
||||
model.PopulatePagingTo(prmUserOrganisation.ResultsPaging);
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteUserOrganisationQuery(columns, prmUserOrganisation))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OrganisationResponseData organisationData = new OrganisationResponseData()
|
||||
{
|
||||
Id = values.GetLong(colOrganisationId.DataName),
|
||||
Name = values.GetString(colOrganisationName.DataName),
|
||||
RegionId = values.GetLong(colRegionId.DataName),
|
||||
RegionName = values.GetString(colRegionName.DataName),
|
||||
SportId = values.GetLong(colSportId.DataName),
|
||||
SportName = values.GetString(colSportName.DataName),
|
||||
};
|
||||
responseData.Organisations.Add(organisationData);
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Online.Models;
|
||||
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.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Organisation Controller.
|
||||
//=======================================================================
|
||||
public partial class OrganisationController : SaxController_Online
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public OrganisationController(SaxLocaliser localiser, ILogger<HomeController> logger) :
|
||||
base(localiser, logger)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
[HttpGet]
|
||||
public IActionResult Index()
|
||||
{
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// No 'Index' view as yet - default to 'Opportunities' view.
|
||||
return RedirectToAction("Opportunities", "Organisation");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
[HttpGet]
|
||||
public IActionResult Opportunities()
|
||||
{
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Check that user is associated with organisations.
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||
if (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) < 1)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Model.
|
||||
Model_Organisation_Opportunities model = new Model_Organisation_Opportunities(Localiser);
|
||||
|
||||
// Filter organisation.
|
||||
model.Filter.OrganisationId = SysId.ToString(SessionData_Online.Filter.OrganisationIdMember);
|
||||
model.Filter.OrganisationCaption = SessionData_Online.Filter.OrganisationCaptionMember;
|
||||
if (StringUtil.IsEmpty(model.Filter.OrganisationId))
|
||||
{
|
||||
// Pick the first Organisation that the user is a member of.
|
||||
ColumnDfn colOrganisationId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
|
||||
ColumnDfn colOrganisationName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
|
||||
prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||
prmUserOrganisation.SortColumns.Add(colOrganisationName);
|
||||
prmUserOrganisation.ResultsPaging.PageLength = 1;
|
||||
prmUserOrganisation.ResultsPaging.PageNo = 1;
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteUserOrganisationQuery(new List<ColumnDfn>() { colOrganisationId, colOrganisationName }, prmUserOrganisation))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
model.Filter.OrganisationId = SysId.ToString(new SysId(values.GetLong(colOrganisationId.DataName)));
|
||||
if (!StringUtil.IsEmpty(model.Filter.OrganisationId))
|
||||
{
|
||||
model.Filter.OrganisationCaption = values.GetString(colOrganisationName.DataName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SysId.IsValid(model.Filter.OrganisationId.ToSysId()) && StringUtil.IsEmpty(model.Filter.OrganisationCaption))
|
||||
{
|
||||
// Organisation has been identified but no caption available as yet.
|
||||
using (SaxOrganisation organisation = AccountMgr.GetOrganisationById(model.Filter.OrganisationId.ToSysId()))
|
||||
{
|
||||
if (organisation != null)
|
||||
model.Filter.OrganisationCaption = organisation.Name;
|
||||
}
|
||||
}
|
||||
// Make a note of the filter values.
|
||||
SessionData_Online.Filter.OrganisationIdMember = model.Filter.OrganisationId.ToSysId();
|
||||
SessionData_Online.Filter.OrganisationCaptionMember = model.Filter.OrganisationCaption;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -24,12 +24,18 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
// Contact Properties.
|
||||
public String AccountEmailAddress { get; set; }
|
||||
public String AccountTitle { get; set; }
|
||||
public String AccountFirstName { get; set; }
|
||||
public String AccountLastName { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Sport properties.
|
||||
public String UserSportId { get; set; }
|
||||
public String ProfileSportId { get; set; }
|
||||
public String ProfileSportExists { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public bool ValidateContactDetails(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
@@ -66,6 +72,20 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public bool ValidateProfileSportData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Sport.
|
||||
if (ProfileSportId != null)
|
||||
{
|
||||
SysId profileSportId = ProfileSportId.ToSysId();
|
||||
if (!SysId.IsValid(profileSportId))
|
||||
responseData.SetControlError(nameof(ProfileSportId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
public Model_Journalist(SaxLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
//AdditionalFiles_CSS.Add("css/sax-journalist.css");
|
||||
AdditionalFiles_JS.Add("js/sax-journalist.js");
|
||||
//AdditionalFiles_CSS.Add("css/sax-jrn-art.css");
|
||||
AdditionalFiles_JS.Add("js/sax-jrn-art.js");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Models
|
||||
{
|
||||
//=======================================================================
|
||||
public class Model_Organisation : SaxModel_Online
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public Model_Organisation(SaxLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
//AdditionalFiles_CSS.Add("css/sax-org.css");
|
||||
AdditionalFiles_JS.Add("js/sax-org.js");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// List configuration.
|
||||
public class OrganisationFilterData
|
||||
{
|
||||
public String Organisation { get; set; }
|
||||
public String RegionId { get; set; }
|
||||
public String SportId { get; set; }
|
||||
}
|
||||
public OrganisationFilterData Filter { get; } = new OrganisationFilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation properties.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validation.
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation.
|
||||
public bool ValidateOrganisationData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Models
|
||||
{
|
||||
//=======================================================================
|
||||
public class Model_Organisation_Opportunities : SaxModel_Online
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public Model_Organisation_Opportunities(SaxLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
//AdditionalFiles_CSS.Add("css/sax-org-opp.css");
|
||||
AdditionalFiles_JS.Add("js/sax-org-opp.js");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// List configuration.
|
||||
public class OpportunityFilterData
|
||||
{
|
||||
public String OrganisationId { get; set; }
|
||||
public String OrganisationCaption { get; set; }
|
||||
public String Opportunity { get; set; }
|
||||
}
|
||||
public OpportunityFilterData Filter { get; } = new OpportunityFilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Opportunity properties.
|
||||
public String OpportunityId { get; set; }
|
||||
public String OpportunityExists { get; set; }
|
||||
// Opportunity properties.
|
||||
public String OpportunityOrganisationId { get; set; }
|
||||
// Region.
|
||||
public String OpportunityRegionId { get; set; }
|
||||
// Sport.
|
||||
public String OpportunitySportId { get; set; }
|
||||
// Opportunity Content.
|
||||
public String OpportunityTypeCode { get; set; }
|
||||
public String OpportunityPosition { get; set; }
|
||||
public String OpportunityOutline { get; set; }
|
||||
public String OpportunityStatusCode { get; set; }
|
||||
public SaStatus OpportunityStatus { get { return SacsSystem.GetStatusForCode(OpportunityStatusCode); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validation.
|
||||
//-------------------------------------------------------------------
|
||||
// Opportunity.
|
||||
public bool ValidateOpportunityData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Opportunity type.
|
||||
if (OpportunityTypeCode != null)
|
||||
{
|
||||
if (StringUtil.IsEmpty(OpportunityTypeCode))
|
||||
responseData.SetControlError(nameof(OpportunityTypeCode), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// Opportunity position.
|
||||
if (OpportunityPosition != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(OpportunityPosition), OpportunityPosition);
|
||||
if (StringUtil.IsEmpty(OpportunityPosition))
|
||||
responseData.SetControlError(nameof(OpportunityPosition), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(OpportunityPosition) > GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position))
|
||||
responseData.SetControlError(nameof(OpportunityPosition), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position)]);
|
||||
}
|
||||
|
||||
// Opportunity outline.
|
||||
if (OpportunityOutline != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(OpportunityOutline), OpportunityOutline);
|
||||
if (StringUtil.IsEmpty(OpportunityOutline))
|
||||
responseData.SetControlError(nameof(OpportunityOutline), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(OpportunityOutline) > GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline))
|
||||
responseData.SetControlError(nameof(OpportunityOutline), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline)]);
|
||||
}
|
||||
|
||||
// Opportunity region.
|
||||
if (OpportunityRegionId != null)
|
||||
{
|
||||
SysId articleRegionId = OpportunityRegionId.ToSysId();
|
||||
if (!SysId.IsValid(articleRegionId))
|
||||
responseData.SetControlError(nameof(OpportunityRegionId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// Opportunity sport.
|
||||
if (OpportunitySportId != null)
|
||||
{
|
||||
SysId articleSportId = OpportunitySportId.ToSysId();
|
||||
if (!SysId.IsValid(articleSportId))
|
||||
responseData.SetControlError(nameof(OpportunitySportId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// Opportunity status.
|
||||
if (OpportunityStatusCode != null)
|
||||
{
|
||||
if (StringUtil.IsEmpty(OpportunityStatusCode))
|
||||
responseData.SetControlError(nameof(OpportunityStatusCode), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!SaxOrganisationOpportunity.ValidStatuses.Contains(OpportunityStatus))
|
||||
responseData.SetControlError(nameof(OpportunityStatusCode), Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -14,6 +14,11 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
//=======================================================================
|
||||
public class SaxModel_Online : SaxModel_Base
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private bool userCanManageOrganisationOpportunities = false;
|
||||
private bool userCanManageOrganisationOpportunitiesChecked = false;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Protected construction.
|
||||
protected SaxModel_Online(SaxLocaliser localiser) :
|
||||
@@ -26,6 +31,23 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
public SaxSessionData_Online SessionData_Online { get { return SessionData as SaxSessionData_Online; } }
|
||||
// Security profile.
|
||||
public bool UserIsJournalist { get { return SessionData != null && SessionData.User != null && SessionData.User.IsJournalist; } }
|
||||
public bool UserCanManageOrganisationOpportunities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!userCanManageOrganisationOpportunitiesChecked && ValidUserSession)
|
||||
{
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||
prmUserOrganisation.OrganisationRoles.Add(Sax.OrganisationRole.OpportunityAdmin);
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||
userCanManageOrganisationOpportunities = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
|
||||
userCanManageOrganisationOpportunitiesChecked = true;
|
||||
}
|
||||
return userCanManageOrganisationOpportunities;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reference Data.
|
||||
|
||||
@@ -15,11 +15,8 @@
|
||||
</div>
|
||||
|
||||
<div class="sax-content">
|
||||
|
||||
<div class="sax-panel-results Organisations">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-item-template">
|
||||
|
||||
@@ -9,37 +9,71 @@
|
||||
<div class="row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["account.caption.profile.sports"]</div></div>
|
||||
<div class="fixed">
|
||||
<div class="sax-action sax-edit"><img src="~/img/action/edit24.png" alt="@(Localiser["label.update"])" title="@(Localiser["label.update"])" /></div>
|
||||
<div class="sax-action sax-add"><img src="~/img/action/add24.png" alt="@(Localiser["label.add"])" title="@(Localiser["label.add"])" /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-content">
|
||||
|
||||
|
||||
<div class="sax-panel-results ProfileSports">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-form">
|
||||
|
||||
<div class="sax-header">
|
||||
<div class="row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["account.caption.profile.sports"]</div></div>
|
||||
<div class="fixed">
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item ProfileSport">
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="SportName"></div></div>
|
||||
<div class="fixed">
|
||||
<div class="sax-action sax-edit"><img src="~/img/action/edit24.png" alt="@(Localiser["label.update"])" title="@(Localiser["label.update"])" /></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-6"><div class=""></div></div>
|
||||
<div class="col-sm-6"><div class=""></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-content">
|
||||
</div>
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmProfileSports", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@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">
|
||||
|
||||
}
|
||||
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmProfileSport", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<input type="hidden" class="UserSportId" name="UserSportId" />
|
||||
<input type="hidden" class="ProfileSportExists" name="ProfileSportExists" />
|
||||
|
||||
</div>
|
||||
@* Sport *@
|
||||
<div class="sax-form-control ProfileSportId">
|
||||
<div class="sax-label">
|
||||
<label for="ifProfileSport"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<input type="hidden" id="ifProfileSportId" class="ProfileSportId" name="ProfileSportId" />
|
||||
<div class="col"><input type="text" id="ifProfileSport" class="ProfileSport sax-input" name="ProfileSport" readonly="readonly" maxlength=128 /></div>
|
||||
<div class="fixed"><button id="pbSelectSport" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectUserSport()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
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/SelectRegion.cshtml" />
|
||||
<partial name="~/Views/Common/SelectSport.cshtml" />
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
<link rel="stylesheet" href="~/css/sax-selectOrganisation.css?@Model.HrefVersion" />
|
||||
<script src="~/js/sax-selectOrganisation.js?@Model.HrefVersion"></script>
|
||||
<script type="text/javascript">
|
||||
sax.selectOrganisation.dlgTitleSelectOrganisation = '@Localiser.GetJavascriptText("organisation.caption.select.organisation")';
|
||||
</script>
|
||||
|
||||
<div id="dlgSelectOrganisation" class="sax-dialog sax-form">
|
||||
|
||||
@* Filter *@
|
||||
<div class="sax-panel-filter">
|
||||
|
||||
<div class="sax-content">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSelectOrganisationFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<input type="hidden" class="FilterRegionId" name="Filter.RegionId" />
|
||||
<input type="hidden" class="FilterSportId" name="Filter.SportId" />
|
||||
<input type="hidden" class="FilterPageLength" name="DataPageLength" value="0" />
|
||||
<input type="hidden" class="FilterPageNo" name="DataPageNo" value="0" />
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.search"]</div>
|
||||
<div class="col-sm-7"><input type="search" id="" class="sax-input FilterOrganisation" name="Filter.Organisation" maxlength="32" /></div>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
|
||||
@* Organisations *@
|
||||
<div class="sax-selection-results Organisations"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item Organisation">
|
||||
<div class="Name"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -10,8 +10,8 @@
|
||||
@* Selected Region *@
|
||||
<div class="SelectedRegion">
|
||||
<div class="row">
|
||||
<div class="col-sm-12"><div class="sax-label">@Localiser["label.region.selected"]:</div></div>
|
||||
<div class="col-sm-12"><div class="SelectedRegionName"></div></div>
|
||||
<div class="col-12"><div class="sax-label">@Localiser["label.region.selected"]:</div></div>
|
||||
<div class="col-12"><div class="SelectedRegionName"></div></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="RegionFilter sax-form">
|
||||
<div class="row">
|
||||
<div class="col right"><div class="sax-label">@Localiser["label.search"]</div></div>
|
||||
<div class="fixed"><input id="ifRegionFilter" class="sax-input" type="text" onkeyup="sax.data.selectRegion.fn.displayRegions();" /></div>
|
||||
<div class="fixed"><input id="ifRegionFilter" class="sax-input" type="search" onkeyup="sax.data.selectRegion.fn.displayRegions();" /></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-12 sax-selectRegion-regions AvailableRegions"></div>
|
||||
<div class="col-12 sax-selectRegion-regions AvailableRegions"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
@* Selected Sport *@
|
||||
<div class="SelectedSport">
|
||||
<div class="row">
|
||||
<div class="col-sm-12"><div class="sax-label">@Localiser["label.sport.selected"]</div></div>
|
||||
<div class="col-sm-12"><div class="SelectedSportName"></div></div>
|
||||
<div class="col-12"><div class="sax-label">@Localiser["label.sport.selected"]</div></div>
|
||||
<div class="col-12"><div class="SelectedSportName"></div></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="SportFilter sax-form">
|
||||
<div class="row">
|
||||
<div class="col right"><div class="sax-label">@Localiser["label.search"]</div></div>
|
||||
<div class="fixed"><input id="ifSportFilter" class="sax-input" type="text" onkeyup="sax.data.selectSport.fn.displaySports();" /></div>
|
||||
<div class="fixed"><input id="ifSportFilter" class="sax-input" type="search" onkeyup="sax.data.selectSport.fn.displaySports();" /></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-12 sax-selectSport-sports AvailableSports"></div>
|
||||
<div class="col-12 sax-selectSport-sports AvailableSports"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@model Model_Journalist
|
||||
@inject SaxLocaliser Localiser
|
||||
@{
|
||||
ViewData["Title"] = "Journalist";
|
||||
ViewData["Title"] = "Journalist - Articles";
|
||||
}
|
||||
|
||||
<div class="">
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
@model Model_Organisation_Opportunities
|
||||
@inject SaxLocaliser Localiser
|
||||
@{
|
||||
ViewData["Title"] = "Organisation - Opportunities";
|
||||
}
|
||||
|
||||
<div id="pnlOpportunities">
|
||||
|
||||
<div class="sax-panel-filter">
|
||||
<div class="sax-header">
|
||||
<div class="floatl sax-caption">@Localiser["organisation.caption.opportunities"]</div>
|
||||
<div class="floatr sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||
<div class="floatr sax-action sax-item-create hidden"><img src="~/img/action/add24.png" alt="@(Localiser["label.create"])" title="@(Localiser["label.create"])" /></div>
|
||||
<div class="clearb"></div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOpportunityFilter", @class = "sax-form", @action = "#", @method = "POST", onsubmit = "return false;" }))
|
||||
{
|
||||
<div class="sax-control row">
|
||||
<div class="col-sm-4"><div class="sax-label text-left text-sm-right">@Localiser["label.organisation"]</div></div>
|
||||
<div class="col-sm-8 row">
|
||||
@Html.HiddenFor(model => model.Filter.OrganisationId, new { @id = "ifFilterOrganisationId", @class = "FilterOrganisationId" })
|
||||
<div class="col"><input type="text" id="ifFilterOrganisation" class="FilterOrganisation sax-input" value="@(Model.Filter.OrganisationCaption)" /></div>
|
||||
<div class="fixed"><button class="sax-button" onclick="sax.selectFilterOrganisation()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<div class="col-sm-4"><div class="sax-label text-left text-sm-right">@Localiser["label.opportunity"]</div></div>
|
||||
<div class="col-sm-8">@Html.TextBoxFor(model => model.Filter.Opportunity, new { @id = "ifOpportunityFilter", @class = "OpportunityFilter sax-input", @maxlength = "64", @onkeypress = "sax.refreshResults(250)" })</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-results">
|
||||
<div class="sax-panel-messages"></div>
|
||||
<div class="sax-panel-item-list"></div>
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item Opportunity">
|
||||
<div class="sax-header">
|
||||
<div class="floatl sax-caption"><span class="OpportunityType"></span> - <span class="OpportunityPosition"></span></div>
|
||||
<div class="floatr sax-action sax-item-update hidden"><img src="~/img/action/edit24.png" alt="@(Localiser["label.update"])" title="@(Localiser["label.update"])" /></div>
|
||||
<div class="clearb"></div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12"><div class="OpportunityOutline"></div></div>
|
||||
<div class="col-sm-6"><div class="OpportunityRegionCaption"></div></div>
|
||||
<div class="col-sm-6 right"><div class="OpportunitySportCaption"></div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4"><div class="">@Localiser["label.created"]: <span class="OpportunityCreatedOn"></span></div></div>
|
||||
<div class="col-sm-4"><div class="OpportunityPublished">@Localiser["label.published"]: <span class="OpportunityPublishedOn"></span></div></div>
|
||||
<div class="col-sm-4 right"><div class="OpportunityStatusDesc"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<partial name="Panel-OpportunityDialog.cshtml" />
|
||||
<partial name="~/Views/Common/SelectOrganisation.cshtml" />
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
@model Model_Organisation_Opportunities
|
||||
@inject SaxLocaliser Localiser
|
||||
@{
|
||||
/* Opportunities - Opportunity dialog panel */
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.dlg.title.createOpportunity = '@Localiser.GetJavascriptText("organisation.caption.opportunity.create")';
|
||||
sax.dlg.title.updateOpportunity = '@Localiser.GetJavascriptText("organisation.caption.opportunity.update")';
|
||||
sax.dlg.title.selectRegion = '@Localiser.GetJavascriptText("reference.caption.region.select")';
|
||||
sax.dlg.title.selectSport = '@Localiser.GetJavascriptText("reference.caption.sport.select")';
|
||||
</script>
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOpportunityId", @class = "sax-form" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.OpportunityId, new { @class = "OpportunityId" })
|
||||
}
|
||||
<div id="dlgOpportunity" class="sax-dialog" title="">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOpportunity", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.OpportunityId, new { @id = "ifOpportunityId", @class = "OpportunityId" })
|
||||
@Html.HiddenFor(model => model.OpportunityExists, new { @id = "ifOpportunityExists", @class = "OpportunityExists" })
|
||||
<input type="hidden" id="ifOpportunityOrganisationId" class="OpportunityOrganisationId" name="OpportunityOrganisationId" value="@(Model.Filter.OrganisationId)" />
|
||||
|
||||
@* Opportunity type *@
|
||||
<div class="sax-form-control OpportunityTypeCode">
|
||||
<div class="sax-label">
|
||||
<label for="ifOpportunityType"><span><span class="required">*</span> @Localiser["label.type"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<select id="cbOpportunityType" class="OpportunityType sax-select" name="OpportunityTypeCode"></select>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Opportunity position *@
|
||||
<div class="sax-form-control OpportunityPosition">
|
||||
<div class="sax-label">
|
||||
<label for="ifOpportunityPosition"><span><span class="required">*</span> @Localiser["label.position"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.TextBoxFor(model => model.OpportunityPosition, new { @id = "ifOpportunityPosition", @class = "OpportunityPosition sax-input", @maxlength = @Model.GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position) })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Opportunity outline *@
|
||||
<div class="sax-form-control OpportunityOutline">
|
||||
<div class="sax-label">
|
||||
<label for="ifOpportunityOutline"><span><span class="required">*</span> @Localiser["label.outline"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.TextAreaFor(model => model.OpportunityOutline, new { @id = "ifOpportunityOutline", @class = "OpportunityOutline sax-input", @maxlength = @Model.GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline) })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Region *@
|
||||
<div class="sax-form-control OpportunityRegionId">
|
||||
<div class="sax-label">
|
||||
<label for="ifOpportunityRegionId"><span><span class="required">*</span> @Localiser["label.region"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
@Html.HiddenFor(model => model.OpportunityRegionId, new { @id = "ifOpportunityRegionId", @class = "OpportunityRegionId" })
|
||||
<div class="col"><input type="text" id="ifOpportunityRegionCaption" class="OpportunityRegionCaption sax-input" readonly="readonly" ondblclick="sax.selectRegion()" /></div>
|
||||
<div class="fixed"><button id="pbSelectRegion" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectRegion()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Sport *@
|
||||
<div class="sax-form-control OpportunitySportId">
|
||||
<div class="sax-label">
|
||||
<label for="ifOpportunitySportId"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
@Html.HiddenFor(model => model.OpportunitySportId, new { @id = "ifOpportunitySportId", @class = "OpportunitySportId" })
|
||||
<div class="col"><input type="text" id="ifOpportunitySportCaption" class="OpportunitySportCaption sax-input" readonly="readonly" ondblclick="sax.selectSport()" /></div>
|
||||
<div class="fixed"><button id="pbSelectSport" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectSport()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
<partial name="~/Views/Common/SelectRegion.cshtml" />
|
||||
<partial name="~/Views/Common/SelectSport.cshtml" />
|
||||
|
||||
</div>
|
||||
@@ -126,6 +126,10 @@
|
||||
{
|
||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Journalist/Articles');">@Localiser["journalist.caption.articles"]</div>
|
||||
}
|
||||
@if (Model.UserCanManageOrganisationOpportunities)
|
||||
{
|
||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Organisation/Opportunities');">@Localiser["label.opportunities"]</div>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
|
||||
.sax-profile > .sax-content
|
||||
{
|
||||
padding: 6px 12px;
|
||||
padding: 6px 6px;
|
||||
background-color:#fff;
|
||||
}
|
||||
|
||||
.sax-profile .sax-panel-info,
|
||||
@@ -58,4 +59,9 @@
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
.sax-profile .sax-panel-item
|
||||
{
|
||||
border-width:1px;
|
||||
}
|
||||
|
||||
/* The End */
|
||||
|
||||
@@ -55,10 +55,14 @@
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
.sax-panel-filter > .sax-content .sax-control
|
||||
{
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.sax-panel-filter > .sax-content .sax-label
|
||||
{
|
||||
padding-top: 2px;
|
||||
padding-right: 12px;
|
||||
padding: 2px 12px 2px 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@@ -66,7 +70,7 @@
|
||||
{
|
||||
min-width: auto;
|
||||
margin-left: 4px;
|
||||
padding: 4px 6px;
|
||||
padding: 4px 6px 2px 6px;
|
||||
}
|
||||
|
||||
/* Data Items panel */
|
||||
@@ -102,12 +106,12 @@
|
||||
.sax-panel-item
|
||||
{
|
||||
margin: 8px auto;
|
||||
background-color:#f8f8f8;
|
||||
background-color: #f8f8f8;
|
||||
border: solid 2px #979797;
|
||||
border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
overflow:hidden;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sax-panel-item > .sax-header
|
||||
@@ -131,6 +135,14 @@
|
||||
padding: 4px 4px;
|
||||
}
|
||||
|
||||
/* Profile Sports */
|
||||
|
||||
.sax-panel-item.ProfileSport,
|
||||
.sax-panel-item.ProfileSport > .sax-header
|
||||
{
|
||||
border-color: var(--color-alt2);
|
||||
}
|
||||
|
||||
/* Organisations */
|
||||
|
||||
.sax-panel-item.Organisation,
|
||||
|
||||
@@ -59,7 +59,8 @@
|
||||
.sax-panel-info > .sax-content,
|
||||
.sax-panel-form > .sax-content
|
||||
{
|
||||
padding: 24px 24px;
|
||||
padding: 12px 12px;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.sax-panel-section.sax-edit .sax-panel-info,
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Admin - Code Selection stylesheet.
|
||||
*/
|
||||
|
||||
/* Panels */
|
||||
|
||||
#dlgSelectOrganisation .sax-panel-filter
|
||||
{
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
#dlgSelectOrganisation .sax-panel-filter .sax-content
|
||||
{
|
||||
margin:4px 8px;
|
||||
padding:2px 4px;
|
||||
}
|
||||
|
||||
#dlgSelectOrganisation .sax-selection-results.Organisations
|
||||
{
|
||||
padding:2px 0;
|
||||
background-color:#f0f0f0;
|
||||
border: 1px solid #b0b0b0;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
#dlgSelectOrganisation.sax-form button.sax-button
|
||||
{
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
.sax-panel-item.Organisation
|
||||
{
|
||||
margin: 2px 4px;
|
||||
padding: 2px 4px;
|
||||
background-color:#fff;
|
||||
border: 2px solid #d8d8ff;
|
||||
border-radius: 4px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.sax-panel-item.Organisation.sel
|
||||
{
|
||||
background-color: #ececff;
|
||||
border-color: #8a8aff;
|
||||
}
|
||||
|
||||
/* The End */
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#dlgSelectRegion .SelectedRegionName
|
||||
{
|
||||
min-height: 1rem;
|
||||
min-height: 26px;
|
||||
padding: 2px 4px;
|
||||
background-color: #f0f0f0;
|
||||
border: 1px solid #b0b0b0;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#dlgSelectSport .SelectedSportName
|
||||
{
|
||||
min-height: 1rem;
|
||||
min-height: 26px;
|
||||
padding: 2px 4px;
|
||||
background-color: #f0f0f0;
|
||||
border: 1px solid #b0b0b0;
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
sax.refreshProfile = function ()
|
||||
{
|
||||
setTimeout(sax.refreshProfileContactInfo, 50);
|
||||
setTimeout(sax.refreshSportsInfo, 50);
|
||||
setTimeout(sax.refreshOrganisationsInfo, 50);
|
||||
setTimeout(sax.refreshProfileSportsInfo, 50);
|
||||
setTimeout(sax.refreshProfileOrganisationsInfo, 50);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -67,20 +67,108 @@
|
||||
sax.onStoreProfileContact = function (response)
|
||||
{
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response.success)
|
||||
{
|
||||
if (!response || !response.success)
|
||||
return;
|
||||
}
|
||||
sax.refreshProfileContactInfo();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshSportsInfo = function ()
|
||||
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.ajaxProfileSports = sax.ajaxProfileSports || { url: sax.url.base + 'Account/Ajax/GetProfileSports', formId: 'frmNavigate', noWaitIcon: true };
|
||||
sax.ajaxProfileSports.callbackFn = callbackFn;
|
||||
sax.doAjaxRequest(sax.ajaxProfileSports, 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();
|
||||
|
||||
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];
|
||||
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);
|
||||
$items.append($item);
|
||||
}
|
||||
$items.show();
|
||||
sax.showNoInfoMsg($section);
|
||||
$section.removeClass('sax-populating');
|
||||
}
|
||||
sax.addProfileSport = function ()
|
||||
{
|
||||
sax.debug('addProfileSport');
|
||||
let $dlg = sax.$dlg.profileSport;
|
||||
$('.UserSportId,.ProfileSportExists,#ifProfileSportId,#ifProfileSport', $dlg).val('');
|
||||
$('#pbSelectSport', $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.ajaxProfileSport = sax.ajaxProfileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport };
|
||||
sax.doAjaxRequest(sax.ajaxProfileSport, 50);
|
||||
}
|
||||
sax.doUpdateProfileSport = function (response)
|
||||
{
|
||||
sax.debug('doUpdateProfileSport', response);
|
||||
let $dlg = sax.$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);
|
||||
$('#pbSelectSport', $dlg).hide();
|
||||
$dlg.dialog('option', 'title', sax.dlg.title.updateUserSport);
|
||||
sax.openDialog($dlg, 480, 400);
|
||||
}
|
||||
sax.selectUserSport = function (sport)
|
||||
{
|
||||
sax.debug('selectUserSport');
|
||||
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#frmProfileSport #ifProfileSportId').val(), 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.ajaxStoreProfileSport = sax.ajaxStoreProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport };
|
||||
sax.doAjaxRequest(sax.ajaxStoreProfileSport, 50);
|
||||
}
|
||||
sax.onStoreProfileSport = function (response)
|
||||
{
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response || !response.success)
|
||||
return;
|
||||
sax.$dlg.profileSport.dialog('close');
|
||||
sax.refreshProfileSportsInfo();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshOrganisationsInfo = function (delay)
|
||||
sax.refreshProfileOrganisationsInfo = function (delay)
|
||||
{
|
||||
var $section = $('.sax-panel-section.ProfileOrganisations');
|
||||
$section.removeClass('sax-edit').addClass('sax-populating');
|
||||
@@ -110,8 +198,7 @@
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
let $item = $tmpl.clone();
|
||||
sax.debug(item, $item);
|
||||
let $item = $tmpl.clone().prop('id', 'ProOrg_' + item.id);
|
||||
$('.OrganisationName', $item).text(item.name);
|
||||
$items.append($item);
|
||||
}
|
||||
@@ -167,6 +254,12 @@
|
||||
$('.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-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'); };
|
||||
sax.$dlg.profileSport = $('#dlgProfileSport').dialog(opt);
|
||||
|
||||
setTimeout(sax.refreshProfile, 200);
|
||||
});
|
||||
|
||||
|
||||
+2
-1
@@ -52,9 +52,10 @@
|
||||
$('.ArticleSportCaption', $item).text(item.sportCaptionPrimary);
|
||||
$('.ArticleCreatedOn', $item).text(item.createdOnFmt);
|
||||
$('.ArticlePublishedOn', $item).text(item.publishedOnFmt);
|
||||
$('.ArticlePublished', $item).toggle(item.publishedOnFmt);
|
||||
$('.ArticlePublished', $item).toggle(!!item.publishedOnFmt);
|
||||
$('.ArticleStatusDesc', $item).text(item.statusDesc);
|
||||
$('.sax-action.sax-item-update', $item).off('click').on('click', function () { sax.updateItem(item.id) })
|
||||
$('.sax-panel-results .sax-panel-messages').hide().empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -38,6 +38,19 @@
|
||||
sax.debug = sax.debugMode ? window.console.log.bind(window.console) : function () { };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.setOddDataRowClass = function (rowSel, cName)
|
||||
{
|
||||
$(rowSel).addClass(function (index, currentClasses)
|
||||
{
|
||||
return index % 2 == 1 ? (cName || "other") : "";
|
||||
});
|
||||
}
|
||||
sax.populateSelectCodeDesc = function ($sel, values)
|
||||
{
|
||||
$sel = $($sel).empty();
|
||||
for (const value of values)
|
||||
$sel.append($('<option>').prop('value', value.code).text(value.desc));
|
||||
}
|
||||
sax.checkTextAreaMaxLength = function (ctrl, len)
|
||||
{
|
||||
if (ctrl == null || ctrl.value == null) return;
|
||||
@@ -58,13 +71,6 @@
|
||||
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.setOddDataRowClass = function (rowSel, cName)
|
||||
{
|
||||
$(rowSel).addClass(function (index, currentClasses)
|
||||
{
|
||||
return index % 2 == 1 ? (cName || "other") : "";
|
||||
});
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Page navigation.
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* Organisation - Opportunities page scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
sax.itemIdPrefix = 'Itm_';
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshResults = function (delay)
|
||||
{
|
||||
var $results = $('.sax-panel-results');
|
||||
sax.data.userCanManageOpportunities = false;
|
||||
if (!sax.awaitingRefreshResponse)
|
||||
{
|
||||
var $items = $('.sax-panel-item-list', $results).fadeOut(200).empty();
|
||||
var $msgs = $('.sax-panel-messages', $results).hide().empty().append($('<div class="sax-message">' + sax.msg.dataQuerying + '</div>')).fadeIn(200);
|
||||
}
|
||||
sax.ajaxRefreshResults = sax.ajaxRefreshResults || { url: sax.url.base + 'Organisation/Ajax/GetOpportunityList', formId: 'frmOpportunityFilter', callbackFn: sax.doRefreshResults };
|
||||
sax.doAjaxRequest(sax.ajaxRefreshResults, delay || 50);
|
||||
sax.awaitingRefreshResponse = true;
|
||||
}
|
||||
sax.doRefreshResults = function (response)
|
||||
{
|
||||
sax.debug('doRefreshResults', response);
|
||||
delete sax.awaitingRefreshResponse;
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
var $panel = $('#pnlOpportunities');
|
||||
$('.sax-action.sax-item-create', $panel).hide();
|
||||
var $results = $('.sax-panel-results', $panel);
|
||||
var $msgs = $('.sax-panel-messages', $results).hide().empty();
|
||||
var $items = $('.sax-panel-item-list', $results).hide().empty();
|
||||
var $templ = $('.sax-panel-item-template .sax-panel-item', $results);
|
||||
if (!response.success) return;
|
||||
// Reference data - Opportunity types.
|
||||
if (response.opportunityTypes)
|
||||
sax.populateSelectCodeDesc('#cbOpportunityType', response.opportunityTypes);
|
||||
// Items.
|
||||
sax.data.userCanManageOpportunities = (response.user && response.user.canManage);
|
||||
$('#pnlOpportunities .sax-panel-filter .sax-action.sax-item-create').toggle(sax.data.userCanManageOpportunities);
|
||||
var items = response.opportunities;
|
||||
if (!items.length)
|
||||
return $msgs.append($('<div class="sax-message">' + sax.msg.dataNoneFound + '</div>')).fadeIn(500);
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
let $item = $templ.clone();
|
||||
sax.populateItem($item, item);
|
||||
$items.append($item);
|
||||
}
|
||||
$('.sax-action.sax-item-update', $items).toggle(sax.data.userCanManageOpportunities);
|
||||
$items.fadeIn(50);
|
||||
}
|
||||
sax.populateItem = function ($item, item)
|
||||
{
|
||||
if (!item) return;
|
||||
$item.prop('id', sax.itemIdPrefix + item.id);
|
||||
$('.OpportunityType', $item).text(item.typeDesc);
|
||||
$('.OpportunityPosition', $item).text(item.position);
|
||||
$('.OpportunityOutline', $item).text(item.outline);
|
||||
$('.OpportunityRegionCaption', $item).text(item.regionCaption);
|
||||
$('.OpportunitySportCaption', $item).text(item.sportCaption);
|
||||
$('.OpportunityCreatedOn', $item).text(item.createdOnFmt);
|
||||
$('.OpportunityPublishedOn', $item).text(item.publishedOnFmt);
|
||||
$('.OpportunityPublished', $item).toggle(!!item.publishedOnFmt);
|
||||
$('.OpportunityExpiresOn', $item).text(item.expiresOnFmt);
|
||||
$('.OpportunityExpires', $item).toggle(!!item.expiresOnFmt);
|
||||
$('.OpportunityStatusDesc', $item).text(item.statusDesc);
|
||||
$('.sax-action.sax-item-update', $item).off('click').on('click', function () { sax.updateItem(item.id) });
|
||||
$('.sax-panel-results .sax-panel-messages').hide().empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectFilterOrganisation = function ()
|
||||
{
|
||||
if (!sax.data.memberOrganisations)
|
||||
sax.getMemberOrganisations(sax.showSelectOrganisation);
|
||||
else sax.showSelectOrganisation();
|
||||
}
|
||||
sax.getMemberOrganisations = function (fnCallback)
|
||||
{
|
||||
let handleMemberOrganisationsResponse = function (response)
|
||||
{
|
||||
sax.debug('handleUserOrgsResponse', response);
|
||||
if (!response.success) return;
|
||||
sax.data.memberOrganisations = response.organisations;
|
||||
if (fnCallback) fnCallback();
|
||||
}
|
||||
sax.ajaxUserOrgs = sax.ajaxUserOrgs || { url: sax.url.base + 'Organisation/Ajax/GetMemberOrganisationList', formId: 'frmNavigate', callbackFn: handleMemberOrganisationsResponse };
|
||||
sax.doAjaxRequest(sax.ajaxUserOrgs);
|
||||
}
|
||||
sax.showSelectOrganisation = function ()
|
||||
{
|
||||
//sax.debug('sax.selectFilterOrganisation');
|
||||
sax.selectOrganisation.fn.selectOrganisation({ caption: sax.dlg.title.selectOrganisation, items: sax.data.memberOrganisations, fnCallback: sax.onOrganisationSelected });
|
||||
}
|
||||
sax.onOrganisationSelected = function (id, name)
|
||||
{
|
||||
//sax.debug('sax.onOrganisationSelected', id, name);
|
||||
$('#frmOpportunityFilter #ifFilterOrganisationId, #frmOpportunity #ifOpportunityOrganisationId').val(id);
|
||||
$('#frmOpportunityFilter #ifFilterOrganisation').val(name);
|
||||
sax.refreshResults(50);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectRegion = function ()
|
||||
{
|
||||
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('#ifOpportunityRegionId').val(), fnCallback: sax.onSelectRegion })
|
||||
}
|
||||
sax.onSelectRegion = function (region)
|
||||
{
|
||||
sax.clearControlError($('#ifOpportunityRegionId').val(region.id));
|
||||
$('#ifOpportunityRegionCaption').val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectSport = function ()
|
||||
{
|
||||
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#ifOpportunitySportId').val(), fnCallback: sax.onSelectSport })
|
||||
}
|
||||
sax.onSelectSport = function (sport)
|
||||
{
|
||||
sax.clearControlError($('#ifOpportunitySportId').val(sport.id));
|
||||
$('#ifOpportunitySportCaption').val(sport ? sport.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.createItem = function ()
|
||||
{
|
||||
if (!sax.data.userCanManageOpportunities) return;
|
||||
sax.clearItem();
|
||||
sax.$dlg.opportunity.dialog('option', 'title', sax.dlg.title.createOpportunity);
|
||||
sax.openDialog(sax.$dlg.opportunity, 600, 600);
|
||||
}
|
||||
sax.clearItem = function ()
|
||||
{
|
||||
$('#ifOpportunityId,#ifOpportunityExists,#ifOpportunityRegionId,#ifOpportunitySportId,input[type="text"],textarea,select', sax.$frm.opportunity).val('');
|
||||
sax.clearControlErrors();
|
||||
}
|
||||
sax.doCreateItem = function ()
|
||||
{
|
||||
sax.storeItem();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.updateItem = function (id)
|
||||
{
|
||||
if (!sax.data.userCanManageOpportunities) return;
|
||||
$('.OpportunityId', sax.$frm.opportunityId).val(id);
|
||||
sax.ajaxUpdateItem = sax.ajaxUpdateItem || { url: sax.url.base + 'Organisation/Ajax/GetOpportunity', formId: 'frmOpportunityId', callbackFn: sax.onUpdateItem };
|
||||
sax.doAjaxRequest(sax.ajaxUpdateItem, 50);
|
||||
}
|
||||
sax.onUpdateItem = function (response)
|
||||
{
|
||||
//sax.debug('onUpdateItem', response);
|
||||
sax.clearItem();
|
||||
if (!response.success) return;
|
||||
let $frm = sax.$frm.opportunity;
|
||||
let item = response.opportunity;
|
||||
$('#ifOpportunityId', $frm).val(item.id);
|
||||
$('#ifOpportunityExists', $frm).val(1);
|
||||
$('#cbOpportunityType', $frm).val(item.typeCode);
|
||||
$('#ifOpportunityPosition', $frm).val(item.position);
|
||||
$('#ifOpportunityOutline', $frm).val(item.outline);
|
||||
$('#ifOpportunityRegionId', $frm).val(item.regionIdPrimary);
|
||||
$('#ifOpportunityRegionCaption', $frm).val(item.regionCaption);
|
||||
$('#ifOpportunitySportId', $frm).val(item.sportIdPrimary);
|
||||
$('#ifOpportunitySportCaption', $frm).val(item.sportCaption);
|
||||
$('#cbOpportunityStatusCode', $frm).val(item.statusCode);
|
||||
sax.clearControlErrors();
|
||||
sax.$dlg.opportunity.dialog('option', 'title', sax.dlg.title.updateOpportunity);
|
||||
sax.openDialog(sax.$dlg.opportunity, 600, 600);
|
||||
}
|
||||
sax.doUpdateItem = function ()
|
||||
{
|
||||
sax.storeItem();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.storeItem = function ()
|
||||
{
|
||||
sax.ajaxStoreItem = sax.ajaxStoreItem || { url: sax.url.base + 'Organisation/Ajax/StoreOpportunity', formId: 'frmOpportunity', callbackFn: sax.onStoreItem };
|
||||
sax.doAjaxRequest(sax.ajaxStoreItem, 50);
|
||||
}
|
||||
sax.onStoreItem = function (response)
|
||||
{
|
||||
//sax.debug('onStoreItem', response);
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
if (!response.success) return;
|
||||
sax.$dlg.opportunity.dialog('close');
|
||||
|
||||
var item = response.opportunity;
|
||||
var $item = $('#' + sax.itemIdPrefix + item.id);
|
||||
if (!$item.length)
|
||||
{
|
||||
var $results = $('.sax-panel-results');
|
||||
$item = $('.sax-panel-item-template .sax-panel-item', $results).clone();
|
||||
$('.sax-panel-item-list', $results).prepend($item).show();
|
||||
}
|
||||
sax.populateItem($item, item)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
$('.sax-action.sax-item-create').on('click', function () { sax.createItem(); });
|
||||
$('.sax-action.sax-results-refresh').on('click', function () { sax.refreshResults(); });
|
||||
$('.OpportunityFilter', '#frmOpportunityFilter').keypress(function (event)
|
||||
{
|
||||
if (event.keyCode == 13) setTimeout(sax.refreshResults, 50);
|
||||
});
|
||||
sax.$frm.opportunityId = $('#frmOpportunityId');
|
||||
sax.$frm.opportunity = $('#frmOpportunity');
|
||||
$('.sax-input', sax.$frm.opportunity).on('input', function () { sax.clearControlError(this); });
|
||||
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sax.doCreateItem(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
sax.$dlg.opportunity = $('#dlgOpportunity').dialog(opt);
|
||||
|
||||
setTimeout(sax.refreshResults, 250);
|
||||
});
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Admin - User page scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let so = sax.selectOrganisation = sax.selectOrganisation || { data: {}, fn: {}, $dlg: {}, itemIdPrefix: 'Org_' };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
/*
|
||||
* Organisation selection config:
|
||||
* - caption dialog title.
|
||||
* - items restricted list of organisations.
|
||||
* - width preferred dialog width (default: 400).
|
||||
* - height preferred dialog height (default: 400).
|
||||
* - fnCallback method to call on completion.
|
||||
*/
|
||||
so.fn.selectOrganisation = function (cfg)
|
||||
{
|
||||
//sax.debug('openDialog', cfg);
|
||||
so.fn.init();
|
||||
so.cfg = cfg;
|
||||
sax.openDialog(so.$dlg.dialog('option', { title: cfg.caption || so.dlgTitleSelectOrganisation || 'Select Organisation' }), so.cfg.width || 480, so.cfg.height || 600);
|
||||
}
|
||||
so.fn.refreshResults = function (delay)
|
||||
{
|
||||
//sax.debug('refreshResults');
|
||||
if (so.cfg && so.cfg.items && so.cfg.items.length)
|
||||
{
|
||||
so.fn.displayResults(so.cfg.items);
|
||||
return;
|
||||
}
|
||||
so.$results.empty();
|
||||
so.ajaxSearch = so.ajaxSearch || { url: sax.url.base + 'Organisation/Ajax/GetOrganisationList', formId: 'frmSelectOrganisationFilter', callbackFn: so.fn.doRefreshResults };
|
||||
sax.doAjaxRequest(so.ajaxSearch, delay || 50);
|
||||
}
|
||||
so.fn.doRefreshResults = function (response)
|
||||
{
|
||||
//sax.debug('so.doRefreshResults', response);
|
||||
if (!response.success) return;
|
||||
so.fn.displayResults(response.organisations);
|
||||
}
|
||||
so.fn.displayResults = function (items)
|
||||
{
|
||||
so.$results.empty().hide();
|
||||
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', so.$dlg);
|
||||
if (items)
|
||||
{
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
{
|
||||
let item = items[itemIdx];
|
||||
if (!so.fn.matchesFilter(item)) continue;
|
||||
let $item = $tmpl.clone().prop('id', so.itemIdPrefix + item.id).on('click', function () { so.fn.onClickOrganisation(item); }).on('dblclick', function () { so.fn.onDblClickOrganisation(item); });
|
||||
$('.Name', $item).text(item.name);
|
||||
so.$results.append($item);
|
||||
}
|
||||
so.$results.fadeIn(200);
|
||||
}
|
||||
}
|
||||
so.fn.matchesFilter = function (item)
|
||||
{
|
||||
let filterName = $('.sax-input.FilterOrganisation', so.$filter).val();
|
||||
if (filterName.length)
|
||||
{
|
||||
let reFilterName = new RegExp(sax.escapeRegExp((filterName || '').trim()), 'i');
|
||||
if (!item.name.match(reFilterName)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
so.fn.onClickOrganisation = function (item)
|
||||
{
|
||||
//sax.debug('onClickOrganisation', item);
|
||||
so.data.item = item;
|
||||
$('.sax-panel-item.Organisation', so.$dlg).removeClass('sel');
|
||||
$('.sax-panel-item.Organisation#' + so.itemIdPrefix + item.id, so.$dlg).addClass('sel');
|
||||
}
|
||||
so.fn.onDblClickOrganisation = function (item)
|
||||
{
|
||||
//sax.debug('onDblClickCode', item);
|
||||
so.data.item = item;
|
||||
so.fn.confirmSelection();
|
||||
}
|
||||
so.fn.confirmSelection = function ()
|
||||
{
|
||||
//sax.debug('confirmSelection', so.data.item);
|
||||
if (!so.data.item) return;
|
||||
if (so.cfg.fnCallback) so.cfg.fnCallback(so.data.item.id, so.data.item.name);
|
||||
so.$dlg.dialog('close');
|
||||
so.fn.cleanUp();
|
||||
}
|
||||
so.fn.cleanUp = function ()
|
||||
{
|
||||
//sax.debug('confirmSelection', so.data.item);
|
||||
so.$results.empty();
|
||||
delete so.cfg;
|
||||
delete so.data.item;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
so.fn.init = function ()
|
||||
{
|
||||
if (!so.$dlg) return;
|
||||
var opt = sax.dlgOpts();
|
||||
opt.open = function () { so.fn.refreshResults(200); };
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { so.fn.confirmSelection(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { so.fn.cleanUp(); $(this).dialog('close'); };
|
||||
so.$dlg = $('#dlgSelectOrganisation').dialog(opt);
|
||||
|
||||
so.$results = $('.sax-selection-results.Organisations', so.$dlg);
|
||||
so.$filter = $('.sax-panel-filter', so.$dlg);
|
||||
$('.sax-input.FilterOrganisation', so.$filter).on('input', function () { sax.selectOrganisation.fn.refreshResults(250); });
|
||||
}
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -37,11 +37,11 @@
|
||||
$('.SelectedRegionName', sr.$dlg).text(sr.fn.getRegionName(sr.regionId));
|
||||
$('#ifRegionFilter', sr.$dlg).val('');
|
||||
sr.fn.displayRegions();
|
||||
sax.openDialog(sr.$dlg.dialog('option', { title: sr.cfg.caption || 'Select Region' }), 400, 600);
|
||||
sax.openDialog(sr.$dlg.dialog('option', { title: sr.cfg.caption || 'Select Region' }), sr.cfg.width || 400, sr.cfg.height || 800);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sr.fn.compareRegions=function(a, b)
|
||||
sr.fn.compareRegions = function (a, b)
|
||||
{
|
||||
var comparison = a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
||||
if (comparison === 0)
|
||||
@@ -54,8 +54,8 @@
|
||||
{
|
||||
let filter = $('#ifRegionFilter', sr.$dlg).val();
|
||||
let reFilter = new RegExp(sax.escapeRegExp((filter || '').trim()), 'i');
|
||||
let $regionsAvail = $('.sax-selectRegion-regions.AvailableRegions').empty();
|
||||
let $regionTmpl = $('.sax-panel-item-template .sax-panel-item.Region');
|
||||
let $regionsAvail = $('.sax-selectRegion-regions.AvailableRegions', sr.$dlg).empty();
|
||||
let $regionTmpl = $('.sax-panel-item-template .sax-panel-item.Region', sr.$dlg);
|
||||
let regions = [...sr.regions];
|
||||
regions.sort(sr.fn.compareRegions);
|
||||
for (let rgnIdx = 0; rgnIdx < regions.length; rgnIdx++)
|
||||
@@ -87,8 +87,8 @@
|
||||
sr.fn.onClickRegion = function (id)
|
||||
{
|
||||
$('.SelectedRegionName', sr.$dlg).text(sr.fn.getRegionName(sr.regionId = id));
|
||||
$('.sax-panel-item.Region').removeClass('sel');
|
||||
$('.sax-panel-item.Region#' + sr.itemIdPrefix + id).addClass('sel');
|
||||
$('.sax-panel-item.Region', sr.$dlg).removeClass('sel');
|
||||
$('.sax-panel-item.Region#' + sr.itemIdPrefix + id, sr.$dlg).addClass('sel');
|
||||
}
|
||||
sr.fn.onDblClickRegion = function (id)
|
||||
{
|
||||
@@ -100,10 +100,12 @@
|
||||
if (!sr.regionId) return;
|
||||
let region = sr.fn.getRegion(sr.regionId);
|
||||
if (!region) return;
|
||||
|
||||
if (sr.cfg.fnCallback) sr.cfg.fnCallback(region);
|
||||
|
||||
sr.$dlg.dialog('close');
|
||||
sr.fn.cleanUp();
|
||||
}
|
||||
sr.fn.cleanUp = function ()
|
||||
{
|
||||
delete sr.cfg;
|
||||
delete sr.regionId;
|
||||
}
|
||||
@@ -111,7 +113,7 @@
|
||||
//--------------------------------------------------------------
|
||||
sr.fn.onDlgSize = function ()
|
||||
{
|
||||
let $pnl = $('.sax-selectRegion-regions.AvailableRegions');
|
||||
let $pnl = $('.sax-selectRegion-regions.AvailableRegions', sr.$dlg);
|
||||
$pnl.outerHeight(Math.floor(sr.$dlg.innerHeight() - $pnl.position().top - ($pnl.outerHeight(true) - $pnl.innerHeight())));
|
||||
}
|
||||
|
||||
@@ -123,7 +125,7 @@
|
||||
opt.open = function (evt, ui) { sr.fn.onDlgSize(); };
|
||||
opt.resize = function (evt, ui) { sr.fn.onDlgSize(); };
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sr.fn.storeSelectRegion(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { sr.fn.cleanUp(); $(this).dialog('close'); };
|
||||
sr.$dlg = $('#dlgSelectRegion').dialog(opt);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
}
|
||||
ss.fn.showSelectSport = function ()
|
||||
{
|
||||
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId));
|
||||
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId) || ' ');
|
||||
$('#ifSportFilter', ss.$dlg).val('');
|
||||
ss.fn.displaySports();
|
||||
sax.openDialog(ss.$dlg.dialog('option', { title: ss.cfg.caption || 'Select Sport' }), 400, 600);
|
||||
sax.openDialog(ss.$dlg.dialog('option', { title: ss.cfg.caption || 'Select Sport' }), ss.cfg.width || 400, ss.cfg.height || 800);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
ss.fn.compareSports= function (a, b)
|
||||
ss.fn.compareSports = function (a, b)
|
||||
{
|
||||
var comparison = a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
||||
if (comparison === 0)
|
||||
@@ -54,8 +54,8 @@
|
||||
{
|
||||
let filter = $('#ifSportFilter', ss.$dlg).val();
|
||||
let reFilter = new RegExp(sax.escapeRegExp((filter || '').trim()), 'i');
|
||||
let $sportsAvail = $('.sax-selectSport-sports.AvailableSports').empty();
|
||||
let $sportTmpl = $('.sax-panel-item-template .sax-panel-item.Sport');
|
||||
let $sportsAvail = $('.sax-selectSport-sports.AvailableSports', ss.$dlg).empty();
|
||||
let $sportTmpl = $('.sax-panel-item-template .sax-panel-item.Sport', ss.$dlg);
|
||||
let sports = [...ss.sports];
|
||||
sports.sort(ss.fn.compareSports);
|
||||
for (let rgnIdx = 0; rgnIdx < sports.length; rgnIdx++)
|
||||
@@ -86,9 +86,9 @@
|
||||
//--------------------------------------------------------------
|
||||
ss.fn.onClickSport = function (id)
|
||||
{
|
||||
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId = id));
|
||||
$('.sax-panel-item.Sport').removeClass('sel');
|
||||
$('.sax-panel-item.Sport#' + ss.itemIdPrefix + id).addClass('sel');
|
||||
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId = id) || ' ');
|
||||
$('.sax-panel-item.Sport', ss.$dlg).removeClass('sel');
|
||||
$('.sax-panel-item.Sport#' + ss.itemIdPrefix + id, ss.$dlg).addClass('sel');
|
||||
}
|
||||
ss.fn.onDblClickSport = function (id)
|
||||
{
|
||||
@@ -100,10 +100,12 @@
|
||||
if (!ss.sportId) return;
|
||||
let sport = ss.fn.getSport(ss.sportId);
|
||||
if (!sport) return;
|
||||
|
||||
if (ss.cfg.fnCallback) ss.cfg.fnCallback(sport);
|
||||
|
||||
ss.$dlg.dialog('close');
|
||||
ss.fn.cleanUp();
|
||||
}
|
||||
ss.fn.cleanUp = function ()
|
||||
{
|
||||
delete ss.cfg;
|
||||
delete ss.sportId;
|
||||
}
|
||||
@@ -111,7 +113,7 @@
|
||||
//--------------------------------------------------------------
|
||||
ss.fn.onDlgSize = function ()
|
||||
{
|
||||
let $pnl = $('.sax-selectSport-sports.AvailableSports');
|
||||
let $pnl = $('.sax-selectSport-sports.AvailableSports', ss.$dlg);
|
||||
$pnl.outerHeight(Math.floor(ss.$dlg.innerHeight() - $pnl.position().top - ($pnl.outerHeight(true) - $pnl.innerHeight())));
|
||||
}
|
||||
|
||||
@@ -123,7 +125,7 @@
|
||||
opt.open = function (evt, ui) { ss.fn.onDlgSize(); };
|
||||
opt.resize = function (evt, ui) { ss.fn.onDlgSize(); };
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { ss.fn.storeSelectSport(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { ss.fn.cleanUp(); $(this).dialog('close'); };
|
||||
ss.$dlg = $('#dlgSelectSport').dialog(opt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user