Commit db85c9d8 by Mac Stephens

Add markers for directed patrol, missing person, and agency assist; update view…

Add markers for directed patrol, missing person, and agency assist; update view on map button text to map, add new panels for complaints, units, and map, functionality for loading and displaying them, add zoom for locate button
parent 0b3cc8d2
...@@ -21,3 +21,7 @@ emiMobileServer/Source/__recovery/ ...@@ -21,3 +21,7 @@ emiMobileServer/Source/__recovery/
*.tvsconfig *.tvsconfig
*.dxsettings *.dxsettings
*.zip *.zip
*.log
*.dll
[Settings] [Settings]
LogFileNum=616 LogFileNum=622
webClientVersion=0.1.0 webClientVersion=0.1.0
object FViewComplaintDetails: TFViewComplaintDetails object FViewComplaintDetails: TFViewComplaintDetails
Width = 800 Width = 800
Height = 672 Height = 672
Caption = 'tbl_logs'
CSSLibrary = cssBootstrap CSSLibrary = cssBootstrap
ElementFont = efCSS ElementFont = efCSS
object btnHistory: TWebButton object btnHistory: TWebButton
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
type="button" type="button"
class="btn btn-primary btn-sm shadow position-fixed" class="btn btn-primary btn-sm shadow position-fixed"
style="right: 12px; bottom: 72px; z-index: 1040;"> style="right: 12px; bottom: 72px; z-index: 1040;">
View On Map Map
</button> </button>
</div> </div>
...@@ -57,7 +57,6 @@ implementation ...@@ -57,7 +57,6 @@ implementation
procedure TFViewComplaints.WebFormCreate(Sender: TObject); procedure TFViewComplaints.WebFormCreate(Sender: TObject);
begin begin
Document.addEventListener('click', @HandleListClick); Document.addEventListener('click', @HandleListClick);
ShowSpinner('spinner');
tmrRefresh.Enabled := False; tmrRefresh.Enabled := False;
GetComplaints; GetComplaints;
tmrRefresh.Enabled := True; tmrRefresh.Enabled := True;
...@@ -161,7 +160,6 @@ begin ...@@ -161,7 +160,6 @@ begin
Exit; Exit;
FLoading := True; FLoading := True;
ShowSpinner('spinner');
try try
try try
xdcResponse := await(xdwcComplaints.RawInvokeAsync('IApiService.GetComplaintList', [])); xdcResponse := await(xdwcComplaints.RawInvokeAsync('IApiService.GetComplaintList', []));
...@@ -182,7 +180,6 @@ begin ...@@ -182,7 +180,6 @@ begin
Utils.ShowErrorModal(E.Message); Utils.ShowErrorModal(E.Message);
end; end;
finally finally
HideSpinner('spinner');
FLoading := False; FLoading := False;
end; end;
end; end;
......
...@@ -76,7 +76,6 @@ procedure TFViewEditUser.btnCancelClick(Sender: TObject); ...@@ -76,7 +76,6 @@ procedure TFViewEditUser.btnCancelClick(Sender: TObject);
// Cancels the edit or addition // Cancels the edit or addition
begin begin
Info := 'Failure:Changes discarded!'; Info := 'Failure:Changes discarded!';
FViewMain.ShowUserForm(Info);
end; end;
procedure TFViewEditUser.btnCloseNotificationClick(Sender: TObject); procedure TFViewEditUser.btnCloseNotificationClick(Sender: TObject);
...@@ -222,7 +221,6 @@ begin ...@@ -222,7 +221,6 @@ begin
if (not Info.Contains('Failure')) then if (not Info.Contains('Failure')) then
begin begin
console.log('Navigating back to user list...'); console.log('Navigating back to user list...');
FViewMain.ShowUserForm(Info);
end end
else else
begin begin
......
object FViewMain: TFViewMain object FViewMain: TFViewMain
Width = 640 Width = 1208
Height = 586 Height = 810
CSSLibrary = cssBootstrap CSSLibrary = cssBootstrap
ElementFont = efCSS ElementFont = efCSS
OnCreate = WebFormCreate OnCreate = WebFormCreate
...@@ -16,18 +16,6 @@ object FViewMain: TFViewMain ...@@ -16,18 +16,6 @@ object FViewMain: TFViewMain
Visible = False Visible = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object wllblUserProfile: TWebLinkLabel
Left = 529
Top = 21
Width = 63
Height = 15
ElementID = 'dropdown.menu.userprofile'
Visible = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = wllblUserProfileClick
Caption = ' User Profile'
end
object wllblLogout: TWebLinkLabel object wllblLogout: TWebLinkLabel
Left = 551 Left = 551
Top = 85 Top = 85
...@@ -61,7 +49,6 @@ object FViewMain: TFViewMain ...@@ -61,7 +49,6 @@ object FViewMain: TFViewMain
Visible = False Visible = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = lblCallsListClick
Caption = 'Calls' Caption = 'Calls'
end end
object lblUsers: TWebLinkLabel object lblUsers: TWebLinkLabel
...@@ -74,7 +61,6 @@ object FViewMain: TFViewMain ...@@ -74,7 +61,6 @@ object FViewMain: TFViewMain
Visible = False Visible = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = lblUsersClick
Caption = 'Users' Caption = 'Users'
end end
object lblMainTitle: TWebLabel object lblMainTitle: TWebLabel
...@@ -88,12 +74,12 @@ object FViewMain: TFViewMain ...@@ -88,12 +74,12 @@ object FViewMain: TFViewMain
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebPanel1: TWebPanel object pnlMain: TWebPanel
Left = 136 Left = 136
Top = 110 Top = 110
Width = 471 Width = 471
Height = 369 Height = 369
ElementID = 'main.webpanel' ElementID = 'pnl_main'
ChildOrder = 3 ChildOrder = 3
TabOrder = 0 TabOrder = 0
end end
...@@ -108,7 +94,7 @@ object FViewMain: TFViewMain ...@@ -108,7 +94,7 @@ object FViewMain: TFViewMain
end end
object WebMemo1: TWebMemo object WebMemo1: TWebMemo
Left = 136 Left = 136
Top = 467 Top = 469
Width = 471 Width = 471
Height = 83 Height = 83
ElementID = 'main.debugmemo' ElementID = 'main.debugmemo'
...@@ -162,6 +148,33 @@ object FViewMain: TFViewMain ...@@ -162,6 +148,33 @@ object FViewMain: TFViewMain
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnUnitsClick OnClick = btnUnitsClick
end end
object pnlMap: TWebPanel
Left = 660
Top = 337
Width = 335
Height = 221
ElementID = 'pnl_map'
ChildOrder = 3
TabOrder = 6
end
object pnlUnits: TWebPanel
Left = 660
Top = 110
Width = 335
Height = 221
ElementID = 'pnl_units'
ChildOrder = 3
TabOrder = 7
end
object pnlComplaints: TWebPanel
Left = 660
Top = 574
Width = 335
Height = 221
ElementID = 'pnl_complaints'
ChildOrder = 3
TabOrder = 8
end
object xdwcBadgeCounts: TXDataWebClient object xdwcBadgeCounts: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 44 Left = 44
......
...@@ -17,9 +17,10 @@ ...@@ -17,9 +17,10 @@
</nav> </nav>
<!-- Main content: fills space between navbars --> <!-- Main content: fills space between navbars -->
<main id="main.webpanel" class="flex-grow-1 position-relative p-0 overflow-hidden" style="min-height:0;"> <div id="pnl_main" class="flex-grow-1 position-relative p-0 overflow-hidden d-none" style="min-height:0;"></div>
<!-- TWebPanel content gets injected here --> <div id="pnl_map" class="flex-grow-1 position-relative p-0 overflow-hidden" style="min-height:0;"></div>
</main> <div id="pnl_units" class="flex-grow-1 position-relative p-0 overflow-hidden d-none" style="min-height:0;"></div>
<div id="pnl_complaints" class="flex-grow-1 position-relative p-0 overflow-hidden d-none" style="min-height:0;"></div>
<!-- Bottom Nav --> <!-- Bottom Nav -->
<nav class="navbar navbar-dark bg-primary py-2 flex-shrink-0"> <nav class="navbar navbar-dark bg-primary py-2 flex-shrink-0">
......
...@@ -6,14 +6,13 @@ uses ...@@ -6,14 +6,13 @@ uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls, System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.ExtCtrls, Vcl.Controls, Vcl.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, WEBLib.ExtCtrls, Vcl.Controls, Vcl.StdCtrls,
WEBLib.StdCtrls, Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.StdCtrls, Data.DB, XData.Web.JsonDataset, XData.Web.Dataset,
App.Types, ConnectionModule, XData.Web.Client; App.Types, ConnectionModule, XData.Web.Client, View.Map, View.Units, View.Complaints;
type type
TFViewMain = class(TWebForm) TFViewMain = class(TWebForm)
lblUsername: TWebLabel; lblUsername: TWebLabel;
wllblUserProfile: TWebLinkLabel;
wllblLogout: TWebLinkLabel; wllblLogout: TWebLinkLabel;
WebPanel1: TWebPanel; pnlMain: TWebPanel;
WebMessageDlg1: TWebMessageDlg; WebMessageDlg1: TWebMessageDlg;
lblAppTitle: TWebLabel; lblAppTitle: TWebLabel;
WebMemo1: TWebMemo; WebMemo1: TWebMemo;
...@@ -25,12 +24,12 @@ type ...@@ -25,12 +24,12 @@ type
btnUnits: TWebButton; btnUnits: TWebButton;
tmrBadgeCounts: TWebTimer; tmrBadgeCounts: TWebTimer;
lblMainTitle: TWebLabel; lblMainTitle: TWebLabel;
pnlMap: TWebPanel;
pnlUnits: TWebPanel;
pnlComplaints: TWebPanel;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure mnuLogoutClick(Sender: TObject); procedure mnuLogoutClick(Sender: TObject);
procedure wllblUserProfileClick(Sender: TObject);
procedure wllblLogoutClick(Sender: TObject); procedure wllblLogoutClick(Sender: TObject);
procedure lblCallsListClick(Sender: TObject);
procedure lblUsersClick(Sender: TObject);
procedure btnUnitsClick(Sender: TObject); procedure btnUnitsClick(Sender: TObject);
procedure btnComplaintsClick(Sender: TObject); procedure btnComplaintsClick(Sender: TObject);
procedure btnMapClick(Sender: TObject); procedure btnMapClick(Sender: TObject);
...@@ -38,13 +37,11 @@ type ...@@ -38,13 +37,11 @@ type
private private
{ Private declarations } { Private declarations }
FUserInfo: string; FUserInfo: string;
FSearchSettings: string;
FChildForm: TWebForm; FChildForm: TWebForm;
FMapForm: TFViewMap;
FUnitsForm: TFViewUnits;
FComplaintsForm: TFViewComplaints;
FLogoutProc: TLogoutProc; FLogoutProc: TLogoutProc;
FSearchProc: TSearchProc;
procedure ShowCrudForm( AFormClass: TWebFormClass );
//procedure EditUser( AParam, BParam, CParam, DParam, EParam: string);
function GetUserInfo: string;
[async] procedure RefreshBadgesAsync; [async] procedure RefreshBadgesAsync;
procedure ShowUnitDetails(UnitId: string); procedure ShowUnitDetails(UnitId: string);
procedure SetHeaderTitle(const title: string); procedure SetHeaderTitle(const title: string);
...@@ -52,12 +49,12 @@ type ...@@ -52,12 +49,12 @@ type
{ Public declarations } { Public declarations }
class procedure Display(LogoutProc: TLogoutProc); class procedure Display(LogoutProc: TLogoutProc);
procedure ShowForm( AFormClass: TWebFormClass ); procedure ShowForm( AFormClass: TWebFormClass );
procedure EditUser( Mode, FullName, Username, Phone, Email: string; admin, active: boolean);
procedure ShowUserForm(Info: string);
procedure ShowComplaintDetails(ComplaintId: string); procedure ShowComplaintDetails(ComplaintId: string);
procedure SetActiveNavButton(const BtnId: string); procedure SetActiveNavButton(const BtnId: string);
procedure ShowMapFocusUnit(const unitId: string); procedure ShowMapFocusUnit(const unitId: string);
procedure ShowMapFocusComplaint(const complaintId: string); procedure ShowMapFocusComplaint(const complaintId: string);
procedure HidePanel(aPanel: TWebPanel);
procedure ShowPanel(aPanel: TWebPanel);
end; end;
var var
...@@ -69,10 +66,7 @@ uses ...@@ -69,10 +66,7 @@ uses
Auth.Service, Auth.Service,
View.Login, View.Login,
View.UserProfile, View.UserProfile,
View.Map,
View.Complaints,
View.ComplaintDetails, View.ComplaintDetails,
View.Units,
View.Admin, View.Admin,
View.Users, View.Users,
View.EditUser, View.EditUser,
...@@ -85,7 +79,6 @@ procedure TFViewMain.WebFormCreate(Sender: TObject); ...@@ -85,7 +79,6 @@ procedure TFViewMain.WebFormCreate(Sender: TObject);
var var
userName: string; userName: string;
begin begin
FUserInfo := GetUserInfo;
userName := JS.toString(AuthService.TokenPayload.Properties['user_name']); userName := JS.toString(AuthService.TokenPayload.Properties['user_name']);
lblUsername.Caption := ' ' + userName.ToLower + ' '; lblUsername.Caption := ' ' + userName.ToLower + ' ';
FChildForm := nil; FChildForm := nil;
...@@ -93,7 +86,6 @@ begin ...@@ -93,7 +86,6 @@ begin
lblUsers.Visible := false; lblUsers.Visible := false;
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
ShowForm(TFViewMap); ShowForm(TFViewMap);
SetHeaderTitle('Map');
RefreshBadgesAsync; RefreshBadgesAsync;
end; end;
...@@ -108,16 +100,6 @@ begin ...@@ -108,16 +100,6 @@ begin
end; end;
procedure TFViewMain.lblUsersClick(Sender: TObject);
begin
ShowForm(TFViewUsers);
end;
procedure TFViewMain.lblCallsListClick(Sender: TObject);
begin
ShowForm(TFViewComplaints);
end;
procedure TFViewMain.mnuLogoutClick(Sender: TObject); procedure TFViewMain.mnuLogoutClick(Sender: TObject);
begin begin
FLogoutProc; FLogoutProc;
...@@ -130,55 +112,24 @@ begin ...@@ -130,55 +112,24 @@ begin
end; end;
procedure TFViewMain.wllblUserProfileClick(Sender: TObject);
begin
ShowCrudForm(TFViewUserProfile);
end;
function TFViewMain.GetUserInfo: string;
var
userStr: string;
begin
userStr := '?username=' + JS.toString(AuthService.TokenPayload.Properties['user_name']);
userStr := userStr + '&fullname=' + JS.toString(AuthService.TokenPayload.Properties['user_fullname']);
userStr := userStr + '&agency=' + JS.toString(AuthService.TokenPayload.Properties['user_agency']);
userStr := userStr + '&badge=' + JS.toString(AuthService.TokenPayload.Properties['user_badge']);
userStr := userStr + '&userid=' + JS.toString(AuthService.TokenPayload.Properties['user_id']);
userStr := userStr + '&personnelid=' + JS.toString(AuthService.TokenPayload.Properties['user_personnelid']);
Result := userStr;
end;
procedure TFViewMain.btnComplaintsClick(Sender: TObject); procedure TFViewMain.btnComplaintsClick(Sender: TObject);
begin begin
SetHeaderTitle('Complaints');
SetActiveNavButton('view.main.btncomplaints');
ShowForm(TFViewComplaints); ShowForm(TFViewComplaints);
if (FChildForm is TFViewComplaints) then
TFViewComplaints(FChildForm).OnShowDetails :=
procedure(AComplaintId: string)
begin
ShowComplaintDetails(AComplaintId);
end;
end; end;
procedure TFViewMain.btnMapClick(Sender: TObject); procedure TFViewMain.btnMapClick(Sender: TObject);
begin begin
SetHeaderTitle('Map');
SetActiveNavButton('view.main.btnmap');
ShowForm(TFViewMap); ShowForm(TFViewMap);
end; end;
procedure TFViewMain.btnUnitsClick(Sender: TObject); procedure TFViewMain.btnUnitsClick(Sender: TObject);
begin begin
SetHeaderTitle('Units');
SetActiveNavButton('view.main.btnunits');
ShowForm(TFViewUnits); ShowForm(TFViewUnits);
end; end;
class procedure TFViewMain.Display(LogoutProc: TLogoutProc); class procedure TFViewMain.Display(LogoutProc: TLogoutProc);
begin begin
if Assigned(FViewMain) then if Assigned(FViewMain) then
...@@ -188,47 +139,122 @@ begin ...@@ -188,47 +139,122 @@ begin
end; end;
procedure TFViewMain.ShowCrudForm(AFormClass: TWebFormClass); procedure TFViewMain.ShowForm(AFormClass: TWebFormClass);
begin begin
ShowForm(AFormClass); // Map (cached in pnlMapHost -> ElementID = 'pnl_map')
end; if AFormClass = TFViewMap then
begin
HidePanel(pnlMain);
HidePanel(pnlUnits);
HidePanel(pnlComplaints);
ShowPanel(pnlMap);
SetHeaderTitle('Map');
SetActiveNavButton('view.main.btnmap');
procedure TFViewMain.ShowForm(AFormClass: TWebFormClass); if not Assigned(FMapForm) then
begin Application.CreateForm(TFViewMap, pnlMap.ElementID, TWebForm(FMapForm));
if Assigned(FChildForm) then
FChildForm := FMapForm;
Exit;
end;
if AFormClass = TFViewUnits then
begin
HidePanel(pnlMain);
HidePanel(pnlMap);
HidePanel(pnlComplaints);
ShowPanel(pnlUnits);
SetHeaderTitle('Units');
SetActiveNavButton('view.main.btnunits');
if not Assigned(FUnitsForm) then
Application.CreateForm(TFViewUnits, pnlUnits.ElementID, TWebForm(FUnitsForm));
FChildForm := FUnitsForm;
Exit;
end;
if AFormClass = TFViewComplaints then
begin
HidePanel(pnlMain);
HidePanel(pnlMap);
HidePanel(pnlUnits);
ShowPanel(pnlComplaints);
SetHeaderTitle('Complaints');
SetActiveNavButton('view.main.btncomplaints');
if not Assigned(FComplaintsForm) then
Application.CreateForm(TFViewComplaints, pnlComplaints.ElementID, TWebForm(FComplaintsForm));
FChildForm := FComplaintsForm;
Exit;
end;
// Everything else: use pnlMain
HidePanel(pnlMap);
HidePanel(pnlUnits);
HidePanel(pnlComplaints);
ShowPanel(pnlMain);
if Assigned(FChildForm) and (FChildForm <> FMapForm) and (FChildForm <> FUnitsForm) and (FChildForm <> FComplaintsForm) then
FChildForm.Free; FChildForm.Free;
Application.CreateForm(AFormClass, WebPanel1.ElementID, FChildForm);
Application.CreateForm(AFormClass, pnlMain.ElementID, FChildForm);
end; end;
procedure TFViewMain.EditUser( Mode, FullName, Username, Phone, Email: string; Admin, Active: boolean); procedure TFViewMain.HidePanel(aPanel: TWebPanel);
var
el: TJSHTMLElement;
begin begin
if Assigned(FChildForm) then if (aPanel = nil) or (aPanel.ElementHandle = nil) then
FChildForm.Free; Exit;
FChildForm := TFViewEditUser.CreateForm(WebPanel1.ElementID, Mode, FullName, Username, Phone, Email, Admin, Active);
el := TJSHTMLElement(aPanel.ElementHandle);
el.classList.add('d-none');
end; end;
procedure TFViewMain.ShowUserForm(Info: string); procedure TFViewMain.ShowPanel(aPanel: TWebPanel);
var
el: TJSHTMLElement;
begin begin
if Assigned(FChildForm) then if (aPanel = nil) or (aPanel.ElementHandle = nil) then
FChildForm.Free; Exit;
FChildForm := TFViewUsers.CreateForm(WebPanel1.ElementID, Info);
el := TJSHTMLElement(aPanel.ElementHandle);
el.classList.remove('d-none');
end; end;
procedure TFViewMain.ShowComplaintDetails(ComplaintId: string); procedure TFViewMain.ShowComplaintDetails(ComplaintId: string);
begin begin
SetHeaderTitle('Complaint Details'); SetHeaderTitle('Complaint Details');
if Assigned(FChildForm) then
HidePanel(pnlMap);
HidePanel(pnlUnits);
HidePanel(pnlComplaints);
ShowPanel(pnlMain);
if Assigned(FChildForm) and (FChildForm <> FMapForm) and (FChildForm <> FUnitsForm) and (FChildForm <> FComplaintsForm) then
FChildForm.Free; FChildForm.Free;
FChildForm := TFViewComplaintDetails.CreateForm(WebPanel1.ElementID, ComplaintId);
FChildForm := TFViewComplaintDetails.CreateForm(pnlMain.ElementID, ComplaintId);
end; end;
procedure TFViewMain.ShowUnitDetails(UnitId: string); procedure TFViewMain.ShowUnitDetails(UnitId: string);
begin begin
SetHeaderTitle('Unit Details'); SetHeaderTitle('Unit Details');
if Assigned(FChildForm) then
HidePanel(pnlMap);
HidePanel(pnlUnits);
HidePanel(pnlComplaints);
ShowPanel(pnlMain);
if Assigned(FChildForm) and (FChildForm <> FMapForm) and (FChildForm <> FUnitsForm) and (FChildForm <> FComplaintsForm) then
FChildForm.Free; FChildForm.Free;
FChildForm := TFViewUnitDetails.CreateForm(WebPanel1.ElementID, UnitId);
FChildForm := TFViewUnitDetails.CreateForm(pnlMain.ElementID, UnitId);
end; end;
...@@ -296,8 +322,6 @@ procedure TFViewMain.ShowMapFocusUnit(const unitId: string); ...@@ -296,8 +322,6 @@ procedure TFViewMain.ShowMapFocusUnit(const unitId: string);
var var
pendingUnitId: string; pendingUnitId: string;
begin begin
SetHeaderTitle('Map');
SetActiveNavButton('view.main.btnmap');
ShowForm(TFViewMap); ShowForm(TFViewMap);
pendingUnitId := unitId; pendingUnitId := unitId;
...@@ -314,8 +338,6 @@ procedure TFViewMain.ShowMapFocusComplaint(const complaintId: string); ...@@ -314,8 +338,6 @@ procedure TFViewMain.ShowMapFocusComplaint(const complaintId: string);
var var
pendingComplaintId: string; pendingComplaintId: string;
begin begin
SetHeaderTitle('Map');
SetActiveNavButton('view.main.btnmap');
ShowForm(TFViewMap); ShowForm(TFViewMap);
pendingComplaintId := complaintId; pendingComplaintId := complaintId;
......
...@@ -70,20 +70,16 @@ begin ...@@ -70,20 +70,16 @@ begin
httpReqGeoJson.Execute; httpReqGeoJson.Execute;
asm asm
window.showComplaintDetails = function (id) { window.showComplaintDetails = function (id) {
console.log('JS bridge showComplaintDetails called, id=', id);
try { try {
pas['View.Main'].FViewMain.ShowComplaintDetails(id); pas['View.Main'].FViewMain.ShowComplaintDetails(id);
} catch (e) { } catch (e) {
console.log('Error in TFViewMain.ShowComplaintDetails', e);
} }
}; };
window.showUnitDetails = function (id) { window.showUnitDetails = function (id) {
console.log('JS bridge showUnitDetails called, id=', id);
try { try {
pas['View.Main'].FViewMain.ShowUnitDetails(id); pas['View.Main'].FViewMain.ShowUnitDetails(id);
} catch (e) { } catch (e) {
console.log('Error in TFViewMain.ShowUnitDetails', e);
} }
}; };
end; end;
...@@ -155,9 +151,7 @@ begin ...@@ -155,9 +151,7 @@ begin
try try
lfMap.Polygons.Clear; lfMap.Polygons.Clear;
Console.Log('GeoJSON len=' + AResponse.Length.ToString);
lfMap.LoadGeoJSONFromText(AResponse, True, Trim(FPendingUnitId) = ''); lfMap.LoadGeoJSONFromText(AResponse, True, Trim(FPendingUnitId) = '');
Console.Log('Loaded polygons count=' + lfMap.Polygons.Count.ToString);
for i := 0 to lfMap.Polygons.Count - 1 do for i := 0 to lfMap.Polygons.Count - 1 do
begin begin
...@@ -404,7 +398,6 @@ begin ...@@ -404,7 +398,6 @@ begin
'</div>'; '</div>';
m.DataString := 'unit|' + unitId; m.DataString := 'unit|' + unitId;
console.log('Unit marker ds=' + m.DataString);
m.IconURL := CarIconForDistrict(dist); m.IconURL := CarIconForDistrict(dist);
end; end;
end; end;
...@@ -662,6 +655,13 @@ begin ...@@ -662,6 +655,13 @@ begin
coord := CreateCoordinate(userLocationMarker.Latitude, userLocationMarker.Longitude); coord := CreateCoordinate(userLocationMarker.Latitude, userLocationMarker.Longitude);
lfMap.SetCenterCoordinate(coord); lfMap.SetCenterCoordinate(coord);
FPendingFocusCoord := coord;
FPendingFocusZoom := 17;
FDoFocusZoom := True;
tmrLocate.Interval := 250;
tmrLocate.Enabled := True;
end; end;
......
...@@ -132,7 +132,6 @@ begin ...@@ -132,7 +132,6 @@ begin
FLoading := True; FLoading := True;
console.log('GetUnits: Invoking API...'); console.log('GetUnits: Invoking API...');
Utils.ShowSpinner('spinner');
try try
try try
xdcResponse := await(xdwcUnits.RawInvokeAsync('IApiService.GetUnitList', [])); xdcResponse := await(xdwcUnits.RawInvokeAsync('IApiService.GetUnitList', []));
...@@ -141,27 +140,21 @@ begin ...@@ -141,27 +140,21 @@ begin
respObj := TJSObject(xdcResponse.Result); respObj := TJSObject(xdcResponse.Result);
xdwdsUnits.Close; xdwdsUnits.Close;
console.log('Units dataset closed');
xdwdsUnits.SetJsonData(respObj['data']); xdwdsUnits.SetJsonData(respObj['data']);
console.log('JsonData set on units dataset:', respObj['data']);
xdwdsUnits.Open; xdwdsUnits.Open;
console.log('Units dataset opened. Record count:', xdwdsUnits.RecordCount);
unitCount := Integer(respObj['count']); unitCount := Integer(respObj['count']);
lblEntries.Caption := Format('%d units', [unitCount]); lblEntries.Caption := Format('%d units', [unitCount]);
console.log('Units label updated:', lblEntries.Caption);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
begin begin
console.log('XData exception (units):', E.ErrorResult.ErrorMessage);
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end; end;
end; end;
finally finally
FLoading := False; FLoading := False;
Utils.HideSpinner('spinner');
console.log('GetUnits complete'); console.log('GetUnits complete');
end; end;
end; end;
......
...@@ -150,7 +150,6 @@ begin ...@@ -150,7 +150,6 @@ begin
isActive := false isActive := false
else else
isActive := true; isActive := true;
FViewMain.EditUser('Edit', Username.innerText, FullName.innerText, PhoneNum.innerText, Email.innerText, isAdmin, isActive);
end; end;
...@@ -483,8 +482,7 @@ end; ...@@ -483,8 +482,7 @@ end;
procedure TFViewUsers.btnAddUserClick(Sender: TObject); procedure TFViewUsers.btnAddUserClick(Sender: TObject);
begin begin
//Info := ''; //Info := '';mm
FViewMain.EditUser('Add', '', '', '', '', false, true);
end; end;
procedure TFViewUsers.btnCloseNotificationClick(Sender: TObject); procedure TFViewUsers.btnCloseNotificationClick(Sender: TObject);
......
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