Commit f67b3596 by Mac Stephens

Update map markers, agency-based unit grouping, list search, and disabled map…

Update map markers, agency-based unit grouping, list search, and disabled map buttons for unmapped units
parent 6ff4c10a
...@@ -139,6 +139,7 @@ object ApiDatabaseModule: TApiDatabaseModule ...@@ -139,6 +139,7 @@ object ApiDatabaseModule: TApiDatabaseModule
'SELECT' 'SELECT'
' ag.AGENCYID AS AGENCY,' ' ag.AGENCYID AS AGENCY,'
' ag.AGENCYNAME AS AGENCY_NAME,' ' ag.AGENCYNAME AS AGENCY_NAME,'
' ag.AGENCYTYPE AS AGENCYTYPE,'
' dua.UNITID,' ' dua.UNITID,'
' dua.UNITNAME,' ' dua.UNITNAME,'
' cun.CODE_DESC AS CARNUMBER_DESC,' ' cun.CODE_DESC AS CARNUMBER_DESC,'
...@@ -307,6 +308,11 @@ object ApiDatabaseModule: TApiDatabaseModule ...@@ -307,6 +308,11 @@ object ApiDatabaseModule: TApiDatabaseModule
FieldName = 'gps_longitude' FieldName = 'gps_longitude'
ReadOnly = True ReadOnly = True
end end
object uqUnitListagencytype: TStringField
FieldName = 'agencytype'
ReadOnly = True
Size = 10
end
end end
object uqComplaintUnits: TUniQuery object uqComplaintUnits: TUniQuery
Connection = ucENTCAD Connection = ucENTCAD
......
...@@ -201,6 +201,7 @@ type ...@@ -201,6 +201,7 @@ type
uqMapComplaintscomplaintStatusKey: TStringField; uqMapComplaintscomplaintStatusKey: TStringField;
uqMapComplaintspngName: TStringField; uqMapComplaintspngName: TStringField;
uqMapUnitsagencytype: TStringField; uqMapUnitsagencytype: TStringField;
uqUnitListagencytype: TStringField;
procedure uqComplaintListCalcFields(DataSet: TDataSet); procedure uqComplaintListCalcFields(DataSet: TDataSet);
procedure uqMapComplaintsCalcFields(DataSet: TDataSet); procedure uqMapComplaintsCalcFields(DataSet: TDataSet);
procedure DataModuleCreate(Sender: TObject); procedure DataModuleCreate(Sender: TObject);
......
...@@ -367,7 +367,7 @@ end; ...@@ -367,7 +367,7 @@ end;
function TApiService.GetUnitList: TJSONObject; function TApiService.GetUnitList: TJSONObject;
var var
data: TJSONArray; data: TJSONArray;
lastDistrict: string; lastAgency: string;
begin begin
Logger.Log(3, '---TApiService.GetUnitList initiated'); Logger.Log(3, '---TApiService.GetUnitList initiated');
...@@ -376,7 +376,7 @@ begin ...@@ -376,7 +376,7 @@ begin
data := TJSONArray.Create; data := TJSONArray.Create;
try try
lastDistrict := ''; lastAgency := '';
with ApiDB.uqUnitList do with ApiDB.uqUnitList do
begin begin
Open; Open;
...@@ -386,22 +386,51 @@ begin ...@@ -386,22 +386,51 @@ begin
var item := TJSONObject.Create; var item := TJSONObject.Create;
// Group header: show once when district changes // Group header: show once when agency changes
var curDistrict := ApiDB.uqUnitListDISTRICT_DESC.AsString; var curAgency := Trim(ApiDB.uqUnitListAGENCY_NAME.AsString);
var header := IfThen(curDistrict <> '', curDistrict + ' District', ''); if curAgency = '' then
if (header <> '') and not SameText(header, lastDistrict) then curAgency := Trim(ApiDB.uqUnitListAGENCY.AsString);
item.AddPair('DistrictHeader', header); if curAgency = '' then
lastDistrict := header; curAgency := 'Unknown Agency';
if not SameText(curAgency, lastAgency) then
begin
item.AddPair('AgencyHeader', curAgency);
lastAgency := curAgency;
end
else
item.AddPair('AgencyHeader', '');
// Core unit identity // Core unit identity
item.AddPair('UnitId', ApiDB.uqUnitListUNITID.AsString); item.AddPair('UnitId', ApiDB.uqUnitListUNITID.AsString);
item.AddPair('UnitName', ApiDB.uqUnitListUNITNAME.AsString); item.AddPair('UnitName', ApiDB.uqUnitListUNITNAME.AsString);
item.AddPair('Agency', ApiDB.uqUnitListAGENCY.AsString);
item.AddPair('AgencyName', ApiDB.uqUnitListAGENCY_NAME.AsString);
item.AddPair('AgencyType', ApiDB.uqUnitListAGENCYTYPE.AsString);
item.AddPair('CarNumberDesc', ApiDB.uqUnitListCARNUMBER_DESC.AsString); item.AddPair('CarNumberDesc', ApiDB.uqUnitListCARNUMBER_DESC.AsString);
item.AddPair('District', curDistrict); item.AddPair('District', ApiDB.uqUnitListDISTRICT_DESC.AsString);
item.AddPair('Sector', ApiDB.uqUnitListSECTOR_DESC.AsString); item.AddPair('Sector', ApiDB.uqUnitListSECTOR_DESC.AsString);
item.AddPair('CallType', ApiDB.uqUnitListCALL_TYPE.AsString); item.AddPair('CallType', ApiDB.uqUnitListCALL_TYPE.AsString);
var canShowMap := False;
if (not ApiDB.uqUnitListGPS_LATITUDE.IsNull) and
(not ApiDB.uqUnitListGPS_LONGITUDE.IsNull) then
begin
var mapLat := ApiDB.uqUnitListGPS_LATITUDE.AsFloat;
var mapLng := ApiDB.uqUnitListGPS_LONGITUDE.AsFloat;
canShowMap :=
((mapLat <> 0) or (mapLng <> 0)) and
(Abs(mapLat) <= 90) and
(Abs(mapLng) <= 180);
end;
item.AddPair('CanShowMap', IfThen(canShowMap, 'true', 'false'));
item.AddPair('MapButtonClass', IfThen(canShowMap, 'btn-primary', 'btn-secondary disabled'));
item.AddPair('MapButtonDisabled', IfThen(canShowMap, '', 'disabled="disabled" aria-disabled="true"'));
item.AddPair('MapButtonTitle', IfThen(canShowMap, 'Show on map', 'No map location available'));
// Current assignment (if any) // Current assignment (if any)
item.AddPair('Location', ApiDB.uqUnitListLOCATION.AsString); item.AddPair('Location', ApiDB.uqUnitListLOCATION.AsString);
......
[Settings] [Settings]
LogFileNum=712 LogFileNum=719
webClientVersion=0.1.0 webClientVersion=0.1.0
[Database] [Database]
......
...@@ -8,7 +8,7 @@ uses ...@@ -8,7 +8,7 @@ uses
WEBLib.ExtCtrls, DB, WEBLib.WebCtrls, WEBLib.REST, VCL.TMSFNCTypes, VCL.TMSFNCUtils, WEBLib.ExtCtrls, DB, WEBLib.WebCtrls, WEBLib.REST, VCL.TMSFNCTypes, VCL.TMSFNCUtils,
VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCCustomControl, VCL.TMSFNCWebBrowser, VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCCustomControl, VCL.TMSFNCWebBrowser,
VCL.TMSFNCMaps, VCL.TMSFNCLeaflet, VCL.TMSFNCMapsCommonTypes, System.StrUtils, XData.Web.Client, VCL.TMSFNCMaps, VCL.TMSFNCLeaflet, VCL.TMSFNCMapsCommonTypes, System.StrUtils, XData.Web.Client,
XData.Web.Connection, ConnectionModule, Utils, uMapFilters, JS, Web; XData.Web.Connection, ConnectionModule, Utils, uMapFilters, JS, Web, uMapMarkerJs;
type type
TFViewMap = class(TWebForm) TFViewMap = class(TWebForm)
...@@ -21,8 +21,7 @@ type ...@@ -21,8 +21,7 @@ type
procedure lfMapMapInitialized(Sender: TObject); procedure lfMapMapInitialized(Sender: TObject);
[async] procedure httpReqGeoJsonResponse(Sender: TObject; AResponse: string); [async] procedure httpReqGeoJsonResponse(Sender: TObject; AResponse: string);
procedure lfMapCustomizeMarker(Sender: TObject; procedure lfMapCustomizeMarker(Sender: TObject; var ACustomizeMarker: string);
var ACustomizeMarker: string);
procedure lfMapCustomizeCSS(Sender: TObject; var ACustomizeCSS: string); procedure lfMapCustomizeCSS(Sender: TObject; var ACustomizeCSS: string);
procedure btnFindLocationClick(Sender: TObject); procedure btnFindLocationClick(Sender: TObject);
procedure tmrLocateTimer(Sender: TObject); procedure tmrLocateTimer(Sender: TObject);
...@@ -41,7 +40,6 @@ type ...@@ -41,7 +40,6 @@ type
FGeoJsonLoadStep: Integer; FGeoJsonLoadStep: Integer;
[async] procedure LoadPointsAsync(showBusy: Boolean); [async] procedure LoadPointsAsync(showBusy: Boolean);
function CarIconForAgency(const AgencyId: string): string;
procedure UpdateDeviceLocation(lat, lng: Double); procedure UpdateDeviceLocation(lat, lng: Double);
procedure StartDeviceLocation; procedure StartDeviceLocation;
procedure ApplyPendingUnitFocus; procedure ApplyPendingUnitFocus;
...@@ -65,6 +63,7 @@ implementation ...@@ -65,6 +63,7 @@ implementation
procedure TFViewMap.lfMapMapInitialized(Sender: TObject); procedure TFViewMap.lfMapMapInitialized(Sender: TObject);
begin begin
RegisterMapMarkerJs;
ShowSpinner('spinner'); ShowSpinner('spinner');
FUnitsLoaded := False; FUnitsLoaded := False;
FComplaintsLoaded := False; FComplaintsLoaded := False;
...@@ -231,11 +230,6 @@ begin ...@@ -231,11 +230,6 @@ begin
end; end;
end; end;
function TFViewMap.CarIconForAgency(const AgencyId: string): string;
begin
Result := 'assets/markers/car_default.png';
end;
function TFViewMap.GetJsonString(obj: TJSObject; name: string): string; function TFViewMap.GetJsonString(obj: TJSObject; name: string): string;
begin begin
...@@ -422,10 +416,12 @@ begin ...@@ -422,10 +416,12 @@ begin
m.Latitude := lat; m.Latitude := lat;
m.Longitude := lng; m.Longitude := lng;
m.Title := m.Title :=
'<span class="emi-marker-meta" data-marker-type="unit" data-unit-badge="' + '<span class="emi-marker-meta" data-marker-type="unit" data-unit-badge="' +
HtmlAttrEncode(unitBadge) + HtmlAttrEncode(unitBadge) +
'" style="display:none"></span>' + '" data-picker-label="' +
HtmlAttrEncode('Unit ' + unitBadge) +
'" style="display:none"></span>' +
'<div class="d-flex flex-column gap-1 px-1 py-1" style="width:260px;">' + '<div class="d-flex flex-column gap-1 px-1 py-1" style="width:260px;">' +
'<div class="fw-semibold small">' + '<div class="fw-semibold small">' +
'<span class="fw-bold">Unit:</span> ' + uName + '<span class="fw-bold">Unit:</span> ' + uName +
...@@ -543,6 +539,8 @@ begin ...@@ -543,6 +539,8 @@ begin
HtmlAttrEncode(priorityBadge) + HtmlAttrEncode(priorityBadge) +
'" data-complaint-status="' + '" data-complaint-status="' +
HtmlAttrEncode(complaintStatusKey) + HtmlAttrEncode(complaintStatusKey) +
'" data-picker-label="' +
HtmlAttrEncode('Complaint ' + complaintId + IfThen(Trim(codeDesc) <> '', ' - ' + codeDesc, '')) +
'" style="display:none"></span>' + '" style="display:none"></span>' +
'<div class="d-flex flex-column gap-1 px-1 py-1" style="width:260px;">' + '<div class="d-flex flex-column gap-1 px-1 py-1" style="width:260px;">' +
'<div class="fw-semibold small">' + '<div class="fw-semibold small">' +
...@@ -610,80 +608,7 @@ end; ...@@ -610,80 +608,7 @@ end;
procedure TFViewMap.lfMapCustomizeMarker(Sender: TObject; var ACustomizeMarker: string); procedure TFViewMap.lfMapCustomizeMarker(Sender: TObject; var ACustomizeMarker: string);
begin begin
ACustomizeMarker := ACustomizeMarker :=
'var m=' + MARKERVAR + ', o=m.options||{};' + #13#10 + 'if (window.emiCustomizeMarker) window.emiCustomizeMarker(' + MARKERVAR + ');';
'var rawTitle = (o && o.title) ? o.title : "";' + #13#10 +
'var ds = (o && o.datastring) ? o.datastring : "";' + #13#10 +
'if (ds === "device") {' + #13#10 +
' try { if (m.unbindTooltip) m.unbindTooltip(); } catch(e) {}' + #13#10 +
' try { if (m.unbindPopup) m.unbindPopup(); } catch(e) {}' + #13#10 +
' return;' + #13#10 +
'}' + #13#10 +
'o.tooltipHtml = rawTitle;' + #13#10 +
'o.title = "";' + #13#10 +
'var t = o.tooltipHtml || "";' + #13#10 +
'var u = (o.icon && o.icon.options && o.icon.options.iconUrl) ? o.icon.options.iconUrl : null;' + #13#10 +
'var markerType = "";' + #13#10 +
'var unitBadgeText = "";' + #13#10 +
'var complaintBadgeText = "";' + #13#10 +
'var complaintStatus = "";' + #13#10 +
'try {' + #13#10 +
' var temp = document.createElement("div");' + #13#10 +
' temp.innerHTML = t;' + #13#10 +
' var meta = temp.querySelector(".emi-marker-meta");' + #13#10 +
' if (meta) {' + #13#10 +
' complaintBadgeText = meta.getAttribute("data-priority-badge") || "";' + #13#10 +
' markerType = meta.getAttribute("data-marker-type") || "";' + #13#10 +
' unitBadgeText = meta.getAttribute("data-unit-badge") || "";' + #13#10 +
' complaintStatus = meta.getAttribute("data-complaint-status") || "";' + #13#10 +
' }' + #13#10 +
'} catch(e) {}' + #13#10 +
'var isUnit = markerType === "unit";' + #13#10 +
'var isComplaint = markerType === "complaint";' + #13#10 +
'var unitBadgeColor = "#2563EB";' + #13#10 +
'if (u && u.indexOf("car_fire") >= 0) unitBadgeColor = "#DC2626";' + #13#10 +
'else if (u && u.indexOf("car_ems") >= 0) unitBadgeColor = "#16A34A";' + #13#10 +
'else if (u && u.indexOf("car_police") >= 0) unitBadgeColor = "#2563EB";' + #13#10 +
'var complaintBadgeColor = "#FF8080";' + #13#10 +
'var complaintBadgeTextColor = "#FFFFFF";' + #13#10 +
'if (complaintStatus === "onscene") {' + #13#10 +
' complaintBadgeColor = "#22C55E";' + #13#10 +
' complaintBadgeTextColor = "#FFFFFF";' + #13#10 +
'} else if (complaintStatus === "attached") {' + #13#10 +
' complaintBadgeColor = "#FFFF00";' + #13#10 +
' complaintBadgeTextColor = "#111827";' + #13#10 +
'}' + #13#10 +
'try { if (m.unbindTooltip) m.unbindTooltip(); } catch(e) {}' + #13#10 +
'try { if (m.unbindPopup) m.unbindPopup(); } catch(e) {}' + #13#10 +
'if (u) {' + #13#10 +
' var wrapClass = isUnit ? "emi-marker-wrap emi-marker-wrap-unit" : (isComplaint ? "emi-marker-wrap emi-marker-wrap-complaint" : "emi-marker-wrap");' + #13#10 +
' var html = ''<div class="'' + wrapClass + ''"><img src="'' + u + ''" class="emi-marker-img">'';' + #13#10 +
' if (isUnit && unitBadgeText) {' + #13#10 +
' html += ''<div class="emi-unit-badge" style="background:'' + unitBadgeColor + '';">'' + unitBadgeText + ''</div>'';' + #13#10 +
' } else if (isComplaint && complaintBadgeText) {' + #13#10 +
' html += ''<div class="emi-complaint-badge" style="background:'' + complaintBadgeColor + '';color:'' + complaintBadgeTextColor + '';">'' + complaintBadgeText + ''</div>'';' + #13#10 +
' }' + #13#10 +
' html += ''</div>'';' + #13#10 +
' m.setIcon(L.divIcon({' + #13#10 +
' html: html,' + #13#10 +
' iconSize: [32,40],' + #13#10 +
' iconAnchor: [16,32],' + #13#10 +
' popupAnchor: [0,-24],' + #13#10 +
' className: ""' + #13#10 +
' }));' + #13#10 +
' try { if (m._icon) m._icon.removeAttribute("title"); } catch(e) {}' + #13#10 +
'}' + #13#10 +
'm.bindPopup(t, {' + #13#10 +
' className: "emi-tip",' + #13#10 +
' maxWidth: 260,' + #13#10 +
' closeButton: false,' + #13#10 +
' autoPan: true' + #13#10 +
'});';
end; end;
...@@ -702,6 +627,10 @@ begin ...@@ -702,6 +627,10 @@ begin
'width:auto;' + 'width:auto;' +
'max-width:260px;' + 'max-width:260px;' +
'}' + #13#10 + '}' + #13#10 +
'.emi-marker-picker .btn{font-size:12px;line-height:1.2;border:1px solid rgba(0,0,0,.15);}'+#13#10+
'.emi-marker-picker .btn:hover{background:#e9ecef;}'+#13#10+
'.emi-marker-picker-section{font-size:11px;font-weight:700;color:#6c757d;margin:.15rem 0 .25rem;}'+#13#10+
'.emi-marker-picker-divider{border-top:1px solid rgba(0,0,0,.18);margin:.35rem 0 .45rem;}'+#13#10+
// --- Media Query: on very small screens, lets it grow almost full width ------ // --- Media Query: on very small screens, lets it grow almost full width ------
'@media (max-width:480px){' + '@media (max-width:480px){' +
'.emi-tip .leaflet-popup-content{' + '.emi-tip .leaflet-popup-content{' +
......
...@@ -40,20 +40,22 @@ object FViewUnits: TFViewUnits ...@@ -40,20 +40,22 @@ object FViewUnits: TFViewUnits
DataSource = wdsUnits DataSource = wdsUnits
ItemTemplate = ItemTemplate =
'<div class="list-section-header small fw-semibold bg-body-second' + '<div class="list-section-header small fw-semibold bg-body-second' +
'ary text-dark rounded-1 px-2 mb-1">(%DistrictHeader%)</div><div ' + 'ary text-dark rounded-1 px-2 mb-1">(%AgencyHeader%)</div><div cl' +
'class="card border shadow-sm"> <div class="card-body py-2 px-3 ' + 'ass="card border shadow-sm"> <div class="card-body py-2 px-3 d-' +
'd-flex gap-2"> <div class="flex-grow-1"> <div class="fw-' + 'flex gap-2"> <div class="flex-grow-1"> <div class="fw-bo' +
'bold text-uppercase small">(%UnitName%)&nbsp;-&nbsp;(%Status%)</' + 'ld text-uppercase small">(%UnitName%)&nbsp;-&nbsp;(%Status%)</di' +
'div> <div class="small text-body-secondary mb-1">(%Location' + 'v> <div class="small text-body-secondary mb-1">(%Location%)' +
'%)</div> <div class="small">(%CallType%)</div> <hr cla' + '</div> <div class="small">(%CallType%)</div> <hr class' +
'ss="unit-divider my-1" style="width: 80px; margin-left: 0" /> ' + '="unit-divider my-1" style="width: 80px; margin-left: 0" /> ' +
' <div class="small officer1">(%Officer1%)</div> <div clas' + ' <div class="small officer1">(%Officer1%)</div> <div class=' +
's="small officer2">(%Officer2%)</div> </div> <div class="d' + '"small officer2">(%Officer2%)</div> </div> <div class="d-f' +
'-flex flex-column justify-content-center gap-1"> <button ty' + 'lex flex-column justify-content-center gap-1"> <button type' +
'pe="button" class="btn btn-primary btn-sm btn-unit-details" data' + '="button" class="btn btn-primary btn-sm btn-unit-details" data-u' +
'-unitid="(%UnitId%)">Details</button> <button type="button"' + 'nitid="(%UnitId%)">Details</button> <button type="button" ' +
' class="btn btn-primary btn-sm btn-unit-map" data-unitid="(%Unit' + ' class="btn btn-sm btn-unit-map (%MapButtonClass%)" ' +
'Id%)">Map</button> </div> </div></div>' 'data-unitid="(%UnitId%)" data-canmap="(%CanShowMap%)" ' +
' title="(%MapButtonTitle%)" (%MapButtonDisabled%)> Ma' +
'p</button> </div> </div></div>'
ListSource = wdsUnits ListSource = wdsUnits
end end
object wdsUnits: TWebDataSource object wdsUnits: TWebDataSource
...@@ -66,8 +68,8 @@ object FViewUnits: TFViewUnits ...@@ -66,8 +68,8 @@ object FViewUnits: TFViewUnits
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 260 Left = 260
Top = 412 Top = 412
object xdwdsUnitsDistrictHeader: TStringField object xdwdsUnitsAgencyHeader: TStringField
FieldName = 'DistrictHeader' FieldName = 'AgencyHeader'
end end
object xdwdsUnitsUnitId: TStringField object xdwdsUnitsUnitId: TStringField
FieldName = 'UnitId' FieldName = 'UnitId'
...@@ -90,6 +92,29 @@ object FViewUnits: TFViewUnits ...@@ -90,6 +92,29 @@ object FViewUnits: TFViewUnits
object xdwdsUnitsCallType: TStringField object xdwdsUnitsCallType: TStringField
FieldName = 'CallType' FieldName = 'CallType'
end end
object xdwdsUnitsAgency: TStringField
FieldName = 'Agency'
Size = 80
end
object xdwdsUnitsAgencyName: TStringField
FieldName = 'AgencyName'
Size = 80
end
object xdwdsUnitsAgencyType: TStringField
FieldName = 'AgencyType'
end
object xdwdsUnitsCanShowMap: TStringField
FieldName = 'CanShowMap'
end
object xdwdsUnitsMapButtonClass: TStringField
FieldName = 'MapButtonClass'
end
object xdwdsUnitsMapButtonDisabled: TStringField
FieldName = 'MapButtonDisabled'
end
object xdwdsUnitsMapButtonTitle: TStringField
FieldName = 'MapButtonTitle'
end
end end
object xdwcUnits: TXDataWebClient object xdwcUnits: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
......
...@@ -17,7 +17,7 @@ type ...@@ -17,7 +17,7 @@ type
xdwdsUnits: TXDataWebDataSet; xdwdsUnits: TXDataWebDataSet;
xdwcUnits: TXDataWebClient; xdwcUnits: TXDataWebClient;
lblEntries: TWebLabel; lblEntries: TWebLabel;
xdwdsUnitsDistrictHeader: TStringField; xdwdsUnitsAgencyHeader: TStringField;
xdwdsUnitsUnitId: TStringField; xdwdsUnitsUnitId: TStringField;
xdwdsUnitsUnitName: TStringField; xdwdsUnitsUnitName: TStringField;
xdwdsUnitsLocation: TStringField; xdwdsUnitsLocation: TStringField;
...@@ -25,6 +25,13 @@ type ...@@ -25,6 +25,13 @@ type
xdwdsUnitsOfficer1: TStringField; xdwdsUnitsOfficer1: TStringField;
xdwdsUnitsOfficer2: TStringField; xdwdsUnitsOfficer2: TStringField;
xdwdsUnitsCallType: TStringField; xdwdsUnitsCallType: TStringField;
xdwdsUnitsAgency: TStringField;
xdwdsUnitsAgencyName: TStringField;
xdwdsUnitsAgencyType: TStringField;
xdwdsUnitsCanShowMap: TStringField;
xdwdsUnitsMapButtonClass: TStringField;
xdwdsUnitsMapButtonDisabled: TStringField;
xdwdsUnitsMapButtonTitle: TStringField;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
private private
FLoading: Boolean; FLoading: Boolean;
...@@ -65,6 +72,7 @@ var ...@@ -65,6 +72,7 @@ var
el: TJSElement; el: TJSElement;
btn: TJSElement; btn: TJSElement;
unitId: string; unitId: string;
canShowMap: string;
begin begin
btn := nil; btn := nil;
el := TJSElement(e.target); el := TJSElement(e.target);
...@@ -93,10 +101,16 @@ begin ...@@ -93,10 +101,16 @@ begin
if (btn <> nil) and (btn is TJSHtmlElement) then if (btn <> nil) and (btn is TJSHtmlElement) then
begin begin
unitId := string(TJSHtmlElement(btn).getAttribute('data-unitid')); canShowMap := string(TJSHtmlElement(btn).getAttribute('data-canmap'));
e.preventDefault; e.preventDefault;
e.stopPropagation; e.stopPropagation;
if not SameText(canShowMap, 'true') then
Exit;
unitId := string(TJSHtmlElement(btn).getAttribute('data-unitid'));
asm asm
pas['View.Main'].FViewMain.ShowMapFocusUnit(unitId); pas['View.Main'].FViewMain.ShowMapFocusUnit(unitId);
end; end;
......
...@@ -24,7 +24,8 @@ uses ...@@ -24,7 +24,8 @@ uses
View.ComplaintDetails in 'View.ComplaintDetails.pas' {FViewComplaintDetails: TWebForm} {*.html}, View.ComplaintDetails in 'View.ComplaintDetails.pas' {FViewComplaintDetails: TWebForm} {*.html},
View.UnitDetails in 'View.UnitDetails.pas' {FViewUnitDetails: TWebForm} {*.html}, View.UnitDetails in 'View.UnitDetails.pas' {FViewUnitDetails: TWebForm} {*.html},
uMapFilters in 'uMapFilters.pas', uMapFilters in 'uMapFilters.pas',
View.ComplaintArchive in 'View.ComplaintArchive.pas' {FViewComplaintArchive: TWebForm} {*.html}; View.ComplaintArchive in 'View.ComplaintArchive.pas' {FViewComplaintArchive: TWebForm} {*.html},
uMapMarkerJs in 'uMapMarkerJs.pas';
{$R *.res} {$R *.res}
......
...@@ -193,6 +193,7 @@ ...@@ -193,6 +193,7 @@
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="uMapMarkerJs.pas"/>
<None Include="index.html"/> <None Include="index.html"/>
<None Include="css\app.css"/> <None Include="css\app.css"/>
<None Include="css\spinner.css"/> <None Include="css\spinner.css"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment