1.2.11.10 Golf Courses
This commit is contained in:
@@ -26,11 +26,13 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
|
||||
{
|
||||
public String Code { get; set; }
|
||||
public String Name { get; set; }
|
||||
public bool? PriorityProvincePopulate { get; set; }
|
||||
public bool? PriorityPopulate { get; set; }
|
||||
public long? ProvinceCount { get; set; }
|
||||
public long? ProvinceCountActive { get; set; }
|
||||
public long? FacilityCount { get; set; }
|
||||
public long? FacilityCountActive { get; set; }
|
||||
public decimal? CoursesPercent { get; set; }
|
||||
public String? CoursesPercentFmt { get { return (CoursesPercent ?? 0.0m) > 0 ? $"{((decimal)CoursesPercent).ToString("N0")}%" : ""; } }
|
||||
}
|
||||
private class UsgaCountryItemData : UsgaCountryListData
|
||||
{
|
||||
@@ -54,11 +56,13 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
|
||||
{
|
||||
public String Code { get; set; }
|
||||
public String Name { get; set; }
|
||||
public bool? PriorityProvincePopulate { get; set; }
|
||||
public bool? PriorityPopulate { get; set; }
|
||||
public long? FacilityCount { get; set; }
|
||||
public long? FacilityCountActive { get; set; }
|
||||
public long? CourseCount { get; set; }
|
||||
public long? CourseCountActive { get; set; }
|
||||
public decimal? MarkersPercent { get; set; }
|
||||
public String? MarkersPercentFmt { get { return (MarkersPercent ?? 0.0m) > 0 ? $"{((decimal)MarkersPercent).ToString("N0")}%" : ""; } }
|
||||
}
|
||||
private class UsgaProvinceItemData : UsgaProvinceListData
|
||||
{
|
||||
@@ -76,6 +80,41 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
|
||||
PopulateUsgaProvinceResponseListData(province, data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// USGA Course data.
|
||||
private class UsgaCourseListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public long? UsgaCourseId { get; set; }
|
||||
public String Caption { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String FullName { get; set; }
|
||||
public String Address1 { get; set; }
|
||||
public String Address2 { get; set; }
|
||||
public String City { get; set; }
|
||||
public bool? PriorityPopulate { get; set; }
|
||||
public long? MarkerCount { get; set; }
|
||||
public long? MarkerCountActive { get; set; }
|
||||
}
|
||||
private class UsgaCourseItemData : UsgaCourseListData
|
||||
{
|
||||
}
|
||||
private void PopulateUsgaCourseResponseListData(SaxGolfUsgaCourse course, UsgaCourseListData data)
|
||||
{
|
||||
data.Id = SysId.ToString(course.Id);
|
||||
data.Caption = course.Caption;
|
||||
data.Name = course.CourseName;
|
||||
data.FullName = course.FullName;
|
||||
data.Address1 = course.Address1;
|
||||
data.Address2 = course.Address2;
|
||||
data.City = course.City;
|
||||
data.StatusCode = course.StatusCode;
|
||||
data.StatusDesc = course.StatusDesc;
|
||||
}
|
||||
private void PopulateUsgaCourseResponseItemData(SaxGolfUsgaCourse course, UsgaCourseItemData data)
|
||||
{
|
||||
PopulateUsgaCourseResponseListData(course, data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Country List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
@@ -110,11 +149,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
|
||||
ColumnDfn colProvinceCount_Active = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.ProvinceCount_Active);
|
||||
ColumnDfn colFacilityCount_All = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.FacilityCount_All);
|
||||
ColumnDfn colFacilityCount_Active = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.FacilityCount_Active);
|
||||
ColumnDfn colCoursesPercent = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.FacilityPercent);
|
||||
ColumnDfn colFlags = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.Flags);
|
||||
ColumnDfn colStatus = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colCode, colName, colProvinceCount_All, colProvinceCount_Active, colFacilityCount_All, colFacilityCount_Active, colFlags, colStatus
|
||||
colId, colCode, colName, colProvinceCount_All, colProvinceCount_Active, colFacilityCount_All, colFacilityCount_Active, colCoursesPercent, colFlags, colStatus
|
||||
};
|
||||
|
||||
// Item filter.
|
||||
@@ -139,11 +179,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
|
||||
Id = values.GetString(colId.DataName),
|
||||
Code = values.GetString(colCode.DataName),
|
||||
Name = values.GetString(colName.DataName),
|
||||
PriorityProvincePopulate = SacsHierarchyItem.GetFlag(flags, SaxGolfUsgaCountry.Flag_Priority),
|
||||
PriorityPopulate = SacsHierarchyItem.GetFlag(flags, SaxGolfUsgaCountry.Flag_Priority),
|
||||
ProvinceCount = values.GetLong(colProvinceCount_All.DataName),
|
||||
ProvinceCountActive = values.GetLong(colProvinceCount_Active.DataName),
|
||||
FacilityCount = values.GetLong(colFacilityCount_All.DataName),
|
||||
FacilityCountActive = values.GetLong(colFacilityCount_Active.DataName),
|
||||
CoursesPercent = values.GetDecimal(colCoursesPercent.DataName),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
@@ -193,11 +234,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
|
||||
ColumnDfn colFacilityCount_Active = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.FacilityCount_Active);
|
||||
ColumnDfn colCourseCount_All = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.CourseCount_All);
|
||||
ColumnDfn colCourseCount_Active = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.CourseCount_Active);
|
||||
ColumnDfn colMarkersPercent = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.MarkerPercent);
|
||||
ColumnDfn colFlags = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.Flags);
|
||||
ColumnDfn colStatus = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colCode, colName, colFacilityCount_All, colFacilityCount_Active, colCourseCount_All, colCourseCount_Active, colFlags, colStatus
|
||||
colId, colCode, colName, colFacilityCount_All, colFacilityCount_Active, colCourseCount_All, colCourseCount_Active, colMarkersPercent, colFlags, colStatus
|
||||
};
|
||||
|
||||
// Item filter.
|
||||
@@ -224,11 +266,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
|
||||
Id = values.GetString(colId.DataName),
|
||||
Code = values.GetString(colCode.DataName),
|
||||
Name = values.GetString(colName.DataName),
|
||||
PriorityProvincePopulate = SacsHierarchyItem.GetFlag(flags, SaxGolfUsgaProvince.Flag_Priority),
|
||||
PriorityPopulate = SacsHierarchyItem.GetFlag(flags, SaxGolfUsgaProvince.Flag_Priority),
|
||||
FacilityCount = values.GetLong(colFacilityCount_All.DataName),
|
||||
FacilityCountActive = values.GetLong(colFacilityCount_Active.DataName),
|
||||
CourseCount = values.GetLong(colCourseCount_All.DataName),
|
||||
CourseCountActive = values.GetLong(colCourseCount_Active.DataName),
|
||||
MarkersPercent = values.GetDecimal(colMarkersPercent.DataName),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
@@ -244,6 +287,103 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Course List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_ReferenceGolf_CourseList : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_ReferenceGolf_CourseList(SaxModel_Admin model) : base(model) { }
|
||||
// Course list.
|
||||
public List<UsgaCourseListData> Courses { get; } = new List<UsgaCourseListData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Reference/Golf/Ajax/GetUsgaCourseList")]
|
||||
[Route("Reference/Golf/Ajax/GetUsgaCourses")]
|
||||
[Route("Reference/Golf/Ajax/GetCourseList")]
|
||||
[Route("Reference/Golf/Ajax/GetCourses")]
|
||||
public IActionResult Ajax_GetCourseList(Model_ReferenceGolf model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetCourseList";
|
||||
String messageTitle = Localiser["caption.reference.golf"];
|
||||
AjaxResponse_ReferenceGolf_CourseList responseData = new AjaxResponse_ReferenceGolf_CourseList(model);
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Item columns.
|
||||
ColumnDfn colId = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.Id);
|
||||
ColumnDfn colUsgaCourseId = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.UsgaCourseId);
|
||||
ColumnDfn colCaption = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.Caption);
|
||||
ColumnDfn colCourseName = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.CourseName);
|
||||
ColumnDfn colFullName = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.FullName);
|
||||
ColumnDfn colAddress1 = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.Address1);
|
||||
ColumnDfn colAddress2 = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.Address2);
|
||||
ColumnDfn colCity = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.City);
|
||||
ColumnDfn colMarkerCount_All = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.MarkerCount_All);
|
||||
ColumnDfn colMarkerCount_Active = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.MarkerCount_Active);
|
||||
ColumnDfn colFlags = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.Flags);
|
||||
ColumnDfn colStatus = ReferenceGolfMgr.GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colUsgaCourseId, colCaption, colCourseName, colFullName, colAddress1, colAddress2, colCity, colMarkerCount_All, colMarkerCount_Active, colFlags, colStatus
|
||||
};
|
||||
|
||||
// Item filter.
|
||||
SaxGolfUsgaCourse.Params prmUsgaCourse = new SaxGolfUsgaCourse.Params();
|
||||
if (StringUtil.ToLong(model.Filter.ProvinceId) > 0)
|
||||
prmUsgaCourse.ProvinceIdsIncluded.Add(StringUtil.ToSysId(model.Filter.ProvinceId));
|
||||
prmUsgaCourse.CourseFilter = model.Filter.CourseSearch;
|
||||
prmUsgaCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.Any;
|
||||
model.Paging.ItemTotal = (ulong)ReferenceGolfMgr.GetUsgaCourseCount(prmUsgaCourse);
|
||||
model.PopulatePagingTo(prmUsgaCourse.ResultsPaging);
|
||||
// Restrict results is not paged.
|
||||
if (!prmUsgaCourse.ResultsPaging.Paged)
|
||||
{
|
||||
prmUsgaCourse.ResultsPaging.PageNo = 1;
|
||||
prmUsgaCourse.ResultsPaging.PageLength = 200;
|
||||
}
|
||||
|
||||
// Sort order.
|
||||
prmUsgaCourse.SortColumns.Add(colCaption);
|
||||
|
||||
// Query items.
|
||||
using (DbResultSet resultSet = ReferenceGolfMgr.ExecuteUsgaCourseQuery(columns, prmUsgaCourse))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
ushort flags = (ushort)values.GetLong(colFlags.DataName);
|
||||
UsgaCourseListData courseData = new UsgaCourseListData()
|
||||
{
|
||||
Id = values.GetString(colId.DataName),
|
||||
UsgaCourseId = values.GetLong(colUsgaCourseId.DataName),
|
||||
Caption = values.GetString(colCaption.DataName),
|
||||
Name = values.GetString(colCourseName.DataName),
|
||||
FullName = values.GetString(colFullName.DataName),
|
||||
Address1 = values.GetString(colAddress1.DataName),
|
||||
Address2 = values.GetString(colAddress2.DataName),
|
||||
City = values.GetString(colCity.DataName),
|
||||
PriorityPopulate = SacsHierarchyItem.GetFlag(flags, SaxGolfUsgaCourse.Flag_Priority),
|
||||
MarkerCount = values.GetLong(colMarkerCount_All.DataName),
|
||||
MarkerCountActive = values.GetLong(colMarkerCount_Active.DataName),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
responseData.Courses.Add(courseData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Courses.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -261,6 +261,9 @@
|
||||
<data name="label.cancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="label.caption" xml:space="preserve">
|
||||
<value>Caption</value>
|
||||
</data>
|
||||
<data name="label.category" xml:space="preserve">
|
||||
<value>Category</value>
|
||||
</data>
|
||||
@@ -297,6 +300,12 @@
|
||||
<data name="label.county" xml:space="preserve">
|
||||
<value>County</value>
|
||||
</data>
|
||||
<data name="label.course" xml:space="preserve">
|
||||
<value>Course</value>
|
||||
</data>
|
||||
<data name="label.course.id" xml:space="preserve">
|
||||
<value>Course Id</value>
|
||||
</data>
|
||||
<data name="label.courses" xml:space="preserve">
|
||||
<value>Courses</value>
|
||||
</data>
|
||||
@@ -354,6 +363,9 @@
|
||||
<data name="label.forgotten.password" xml:space="preserve">
|
||||
<value>Forgotten password?</value>
|
||||
</data>
|
||||
<data name="label.full.name" xml:space="preserve">
|
||||
<value>Full name</value>
|
||||
</data>
|
||||
<data name="label.header.row" xml:space="preserve">
|
||||
<value>Header row</value>
|
||||
</data>
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content" style="min-height:48px;max-height:240px;margin:0px;padding:0px;">
|
||||
<div style="min-height:48px;max-height:240px;overflow-y:auto;">
|
||||
<div class="sax-panel-messages"></div>
|
||||
<table class="sax-item-list">
|
||||
<thead>
|
||||
@@ -98,6 +98,7 @@
|
||||
<th class="center">@Localiser["label.priority"]</th>
|
||||
<th class="center">@Localiser["label.provinces"]</th>
|
||||
<th class="center">@Localiser["label.clubs"]</th>
|
||||
<th class="center">@Localiser["label.clubs"]%</th>
|
||||
<th class="center">@Localiser["label.status"]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -111,6 +112,7 @@
|
||||
<td><div class="CountryPriority center"></div></td>
|
||||
<td><div class="CountryProvinces center"></div></td>
|
||||
<td><div class="CountryClubs center"></div></td>
|
||||
<td><div class="CountryClubsPercent center"></div></td>
|
||||
<td><div class="CountryStatus center"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -132,7 +134,7 @@
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content" style="min-height:48px;max-height:240px;margin:0px;padding:0px;">
|
||||
<div style="min-height:48px;max-height:240px;overflow-y:auto;">
|
||||
<div class="sax-panel-messages"></div>
|
||||
<table class="sax-item-list">
|
||||
<thead>
|
||||
@@ -142,6 +144,7 @@
|
||||
<th class="center">@Localiser["label.priority"]</th>
|
||||
<th class="center">@Localiser["label.clubs"]</th>
|
||||
<th class="center">@Localiser["label.courses"]</th>
|
||||
<th class="center">@Localiser["label.markers"]</th>
|
||||
<th class="center">@Localiser["label.status"]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -155,6 +158,7 @@
|
||||
<td><div class="ProvincePriority center"></div></td>
|
||||
<td><div class="ProvinceClubs center"></div></td>
|
||||
<td><div class="ProvinceCourses center"></div></td>
|
||||
<td><div class="ProvinceMarkers center"></div></td>
|
||||
<td><div class="ProvinceStatus center"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -162,11 +166,48 @@
|
||||
}
|
||||
|
||||
@* Reference - Golf - Courses *@
|
||||
<div class="sax-panel-info Courses">
|
||||
<div class="sax-header">
|
||||
<div class="sax-caption">@Localiser["label.courses"]</div>
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmCourses", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.HiddenFor(Model => Model.Filter.ProvinceId, new { @class = "FilterProvinceId" })
|
||||
<div class="sax-panel-info Courses">
|
||||
<div class="sax-header">
|
||||
<div class="row">
|
||||
<div class="col left">
|
||||
<span class="sax-label">@Localiser["label.search"]</span>
|
||||
<span><input type="search" name="Filter.CourseSearch" class="FilterCourseSearch" maxlength="16" style="width:33%;" /></span>
|
||||
</div>
|
||||
<div class="fixed"><div class="sax-caption">@Localiser["label.courses"]</div></div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="min-height:48px;max-height:240px;overflow-y:auto;">
|
||||
<div class="sax-panel-messages"></div>
|
||||
<table class="sax-item-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="center">@Localiser["label.course.id"]</th>
|
||||
<th class="">@Localiser["label.caption"]</th>
|
||||
<th class="center">@Localiser["label.location"]</th>
|
||||
<th class="center">@Localiser["label.priority"]</th>
|
||||
<th class="center">@Localiser["label.markers"]</th>
|
||||
<th class="center">@Localiser["label.status"]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<table class="sax-panel-item-template">
|
||||
<tr class="sax-item GolfCourse">
|
||||
<td><div class="CourseId center"></div></td>
|
||||
<td><div class="CourseCaption"></div></td>
|
||||
<td><div class="CourseLocation center"></div></td>
|
||||
<td><div class="CoursePriority center"></div></td>
|
||||
<td><div class="CourseMarkers center"></div></td>
|
||||
<td><div class="CourseStatus center"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@* Icons. *@
|
||||
<div class="sax-panel-item-template">
|
||||
|
||||
@@ -283,17 +283,22 @@ table.sax-item-list
|
||||
{
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
border-collapse: separate;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
table.sax-item-list thead tr
|
||||
{
|
||||
}
|
||||
|
||||
table.sax-item-list thead th
|
||||
{
|
||||
position: sticky;
|
||||
top: 0;
|
||||
padding:4px 2px 2px 2px;
|
||||
padding: 4px 2px 2px 2px;
|
||||
z-index: 1;
|
||||
background-color: #f8f8f8;
|
||||
border-bottom:1px solid #d0d0d0;
|
||||
}
|
||||
|
||||
table.sax-item-list tbody th
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.sax-panel-info, .sax-panel-form
|
||||
{
|
||||
max-width: 720px;
|
||||
margin: 24px auto;
|
||||
margin: 16px auto;
|
||||
padding: 0;
|
||||
background-color: #fff;
|
||||
border: solid 1px #979797;
|
||||
|
||||
@@ -90,7 +90,8 @@
|
||||
$('.CountryName', $item).text(item.name);
|
||||
if (item.provinceCountActive) $('.CountryProvinces', $item).text(item.provinceCountActive);
|
||||
if (item.facilityCountActive) $('.CountryClubs', $item).text(item.facilityCountActive);
|
||||
if (item.priorityProvincePopulate) $('.CountryPriority', $item).append(rg.fn.getTickIcon());
|
||||
$('.CountryClubsPercent', $item).text(item.coursesPercentFmt);
|
||||
if (item.priorityPopulate) $('.CountryPriority', $item).append(rg.fn.getTickIcon());
|
||||
$('.CountryStatus', $item).append(rg.fn.getStatusIcon(item.statusCode.toLowerCase()));
|
||||
return $item;
|
||||
}
|
||||
@@ -110,8 +111,10 @@
|
||||
/* Reference - Golf - Provinces. */
|
||||
rg.fn.clearProvinces = function ()
|
||||
{
|
||||
rg.fn.clearCourses();
|
||||
rg.$pnl.provincesMsgs.empty();
|
||||
rg.$pnl.provincesList.find('tbody tr').remove();
|
||||
$('.FilterCourseSearch', rg.$frm.courses).val('');
|
||||
}
|
||||
rg.fn.refreshProvinces = function (delay)
|
||||
{
|
||||
@@ -143,7 +146,8 @@
|
||||
$('.ProvinceName', $item).text(item.name);
|
||||
if (item.facilityCountActive) $('.ProvinceClubs', $item).text(item.facilityCountActive);
|
||||
if (item.courseCountActive) $('.ProvinceCourses', $item).text(item.courseCountActive);
|
||||
if (item.priorityClubPopulate) $('.ProvincePriority', $item).append(rg.fn.getTickIcon());
|
||||
$('.ProvinceMarkers', $item).text(item.markersPercentFmt);
|
||||
if (item.priorityPopulate) $('.ProvincePriority', $item).append(rg.fn.getTickIcon());
|
||||
$('.ProvinceStatus', $item).append(rg.fn.getStatusIcon(item.statusCode.toLowerCase()));
|
||||
return $item;
|
||||
}
|
||||
@@ -156,13 +160,60 @@
|
||||
//sax.debug('selectProvince', $item, item)
|
||||
$('table.sax-item-list tbody tr', rg.$pnl.provinces).removeClass(rg.class_sel);
|
||||
$item.addClass(rg.class_sel);
|
||||
setTimeout(rg.fn.refreshClubs(500), 100);
|
||||
setTimeout(rg.fn.refreshCourses(500), 100);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
/* Reference - Golf - Clubs. */
|
||||
rg.fn.refreshClubs = function (delay)
|
||||
/* Reference - Golf - Courses. */
|
||||
rg.fn.clearCourses = function ()
|
||||
{
|
||||
rg.$pnl.coursesMsgs.empty();
|
||||
rg.$pnl.coursesList.find('tbody tr').remove();
|
||||
}
|
||||
rg.fn.refreshCourses = function (delay)
|
||||
{
|
||||
rg.fn.clearCourses();
|
||||
let provinceId = rg.$pnl.provincesList.find('tbody tr.' + rg.class_sel).attr(rg.attr_id);
|
||||
if (!provinceId)
|
||||
{
|
||||
rg.$pnl.coursesMsgs.empty().text('Province must be selected.');
|
||||
return;
|
||||
}
|
||||
$('.FilterProvinceId', rg.$frm.courses).val(provinceId);
|
||||
rg.ajaxGolfCourses = rg.ajaxGolfCourses || { url: sax.url.base + 'Reference/Golf/Ajax/GetCourses', formId: rg.$frm.courses.prop('id'), callbackFn: rg.fn.doRefreshCourses };
|
||||
sax.doAjaxRequest(rg.ajaxGolfCourses, delay || 50);
|
||||
}
|
||||
rg.fn.doRefreshCourses = function (response)
|
||||
{
|
||||
//sax.debug('doRefreshCourses', response);
|
||||
rg.fn.clearCourses();
|
||||
if (!response.success) return;
|
||||
let $list = rg.$pnl.coursesList;
|
||||
$('tbody tr', $list).remove()
|
||||
for (let courseIdx = 0; courseIdx < (response.courses || []).length; courseIdx++)
|
||||
$list.append(rg.fn.populateCourse(rg.fn.getCourseTemplate(), response.courses[courseIdx]));
|
||||
}
|
||||
rg.fn.populateCourse = function ($item, item)
|
||||
{
|
||||
$item.attr(rg.attr_id, item.id).on('click', function () { rg.fn.selectCourse($item, item); })
|
||||
$('.CourseId', $item).text(item.usgaCourseId);
|
||||
$('.CourseCaption', $item).text(item.caption);
|
||||
$('.CourseLocation', $item).text(item.city||item.address2||item.address1);
|
||||
if (item.markerCountActive) $('.CourseMarkers', $item).text(item.markerCountActive);
|
||||
if (item.priorityPopulate) $('.CoursePriority', $item).append(rg.fn.getTickIcon());
|
||||
$('.CourseStatus', $item).append(rg.fn.getStatusIcon(item.statusCode.toLowerCase()));
|
||||
return $item;
|
||||
}
|
||||
rg.fn.getCourseTemplate = function ()
|
||||
{
|
||||
return $('table.sax-panel-item-template tr.GolfCourse', rg.$pnl.courses).clone();
|
||||
}
|
||||
rg.fn.selectCourse = function ($item, item)
|
||||
{
|
||||
//sax.debug('selectCourse', $item, item)
|
||||
$('table.sax-item-list tbody tr', rg.$pnl.courses).removeClass(rg.class_sel);
|
||||
$item.addClass(rg.class_sel);
|
||||
//setTimeout(rg.fn.refreshMarkers(500), 100);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -208,6 +259,11 @@
|
||||
$('.FilterProvinceSearch', rg.$frm.provinces).on('input', function () { setTimeout(rg.fn.refreshProvinces(500), 100); });
|
||||
|
||||
// Courses.
|
||||
rg.$pnl.courses = $('.sax-panel-info.Courses', rg.$pnl.golf);
|
||||
rg.$pnl.coursesMsgs = $('.sax-panel-messages', rg.$pnl.courses);
|
||||
rg.$pnl.coursesList = $('table.sax-item-list', rg.$pnl.courses);
|
||||
rg.$frm.courses = $('#frmCourses', rg.$pnl.golf);
|
||||
$('.FilterCourseSearch', rg.$frm.courses).on('input', function () { setTimeout(rg.fn.refreshCourses(500), 100); });
|
||||
//$('.PagingPageNo', rg.$dlg).val(1);
|
||||
//$('.PagingPageLength', rg.$dlg).val(16);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user