1.2.11.10 Golf Courses
This commit is contained in:
@@ -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