Commit cc6a6599 by Mac Stephens

Align BFD styling and map controls with Lems, remove dispatch district,…

Align BFD styling and map controls with Lems, remove dispatch district, standardize incident labels and map number formatting, and rename the Lems auth connection.
parent c9d0ac73
......@@ -13,7 +13,7 @@ object FViewComplaintArchive: TFViewComplaintArchive
ElementHeaderClassName = 'table-light'
ElementTableClassName =
'table table-sm table-striped table-hover table-bordered mb-0 ali' +
'gn-middle'
'gn-middle small'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
......
......@@ -29,7 +29,7 @@
<div id="cdetails_summary_arc" class="collapse show">
<div class="card border-0 shadow-sm mb-2">
<div class="card-body py-2">
<table class="table table-sm mb-0 w-100">
<table class="table table-sm mb-0 w-100 small">
<tbody>
<tr>
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Response:</th>
......
......@@ -120,7 +120,7 @@ object FViewComplaintDetails: TFViewComplaintDetails
ElementHeaderClassName = 'table-light'
ElementTableClassName =
'table table-sm table-striped table-hover table-bordered mb-0 ali' +
'gn-middle'
'gn-middle small'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
......@@ -169,7 +169,7 @@ object FViewComplaintDetails: TFViewComplaintDetails
ElementHeaderClassName = 'table-light'
ElementTableClassName =
'table table-sm table-striped table-hover table-bordered mb-0 ali' +
'gn-middle'
'gn-middle small'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
......@@ -223,7 +223,7 @@ object FViewComplaintDetails: TFViewComplaintDetails
ElementHeaderClassName = 'table-light'
ElementTableClassName =
'table table-sm table-striped table-hover table-bordered mb-0 ali' +
'gn-middle'
'gn-middle small'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
......@@ -282,7 +282,7 @@ object FViewComplaintDetails: TFViewComplaintDetails
ElementHeaderClassName = 'table-light'
ElementTableClassName =
'table table-sm table-striped table-hover table-bordered mb-0 ali' +
'gn-middle'
'gn-middle small'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
......@@ -352,10 +352,11 @@ object FViewComplaintDetails: TFViewComplaintDetails
Style = lsListGroup
DataSource = wdsWarnings
ItemTemplate =
'<div class="card mb-2"> <div class="card-body py-2"> <div cl' +
'<div class="card mb-2 small"> <div class="card-body py-2"> <' +
'div cl' +
'ass="d-flex justify-content-between gap-2"> <div class="fw-' +
'semibold">(%CodeDesc%)</div> <div class="text-muted small t' +
'ext-end">(%ADDRESS%)</div> </div> <div class="small mt-1">' +
'semibold">(%CodeDesc%)</div> <div class="text-muted text-en' +
'd">(%ADDRESS%)</div> </div> <div class="mt-1">' +
'(%NOTES%)</div> </div></div>'
ListSource = wdsWarnings
end
......
......@@ -31,7 +31,7 @@
<div class="card-body py-2">
<table class="table table-sm mb-0 w-100">
<table class="table table-sm mb-0 w-100 small">
<tbody>
<tr>
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Response:</th>
......@@ -89,18 +89,18 @@
<!-- Buttons -->
<div class="pb-2">
<div class="complaint-detail-tabs d-flex flex-wrap gap-2 justify-content-center">
<button type="button" class="btn btn-success btn-sm px-2 active" id="btn_remarks" aria-pressed="true">Remarks</button>
<button type="button" class="btn btn-success btn-sm px-2" id="btn_history">History</button>
<button type="button" class="btn btn-success btn-sm px-2" id="btn_warnings">Warnings</button>
<button type="button" class="btn btn-success btn-sm px-2" id="btn_contacts">Contacts</button>
<button type="button" class="btn btn-success btn-sm px-3 active" id="btn_remarks" aria-pressed="true">Remarks</button>
<button type="button" class="btn btn-success btn-sm px-3" id="btn_history">History</button>
<button type="button" class="btn btn-success btn-sm px-3" id="btn_warnings">Warnings</button>
<button type="button" class="btn btn-success btn-sm px-3" id="btn_contacts">Contacts</button>
</div>
<!-- Remarks toggle filters (only visible on Remarks tab) -->
<div class="d-flex flex-wrap gap-2 justify-content-center mt-2" id="row_remarks_toggles">
<button type="button" class="btn btn-success btn-sm px-2 active" id="btn_cmp" aria-pressed="true">CMP</button>
<button type="button" class="btn btn-success btn-sm px-2 active" id="btn_e911" aria-pressed="true">E-911</button>
<button type="button" class="btn btn-success btn-sm px-2 active" id="btn_rem" aria-pressed="true">REM</button>
<button type="button" class="btn btn-success btn-sm px-2 active" id="btn_unt" aria-pressed="true">UNT</button>
<button type="button" class="btn btn-success btn-sm px-3 active" id="btn_cmp" aria-pressed="true">CMP</button>
<button type="button" class="btn btn-success btn-sm px-3 active" id="btn_e911" aria-pressed="true">E-911</button>
<button type="button" class="btn btn-success btn-sm px-3 active" id="btn_rem" aria-pressed="true">REM</button>
<button type="button" class="btn btn-success btn-sm px-3 active" id="btn_unt" aria-pressed="true">UNT</button>
</div>
<!-- History action row (only visible on History tab) -->
......
......@@ -42,9 +42,7 @@ object FViewComplaints: TFViewComplaints
Style = lsListGroup
DataSource = wdsComplaints
ItemTemplate =
'<div class="list-section-header small fw-semibold bg-secondary t' +
'ext-white rounded-1 px-2 mb-1">District: (%DispatchDistrict%)</d' +
'iv><div class="card border shadow-sm"><div class="card-body py-2' +
'<div class="card border shadow-sm"><div class="card-body py-2' +
' px-3 d-flex gap-2"><div class="flex-grow-1"><div class="fw-bold' +
' text-uppercase small">Incident: (%Complaint%)</div><div class="' +
'small">Response: (%Priority%) &middot; (%DispatchCodeDesc%)</div' +
......@@ -98,10 +96,6 @@ object FViewComplaints: TFViewComplaints
FieldName = 'Status'
Size = 160
end
object xdwdsComplaintsDispatchDistrict: TStringField
FieldName = 'DispatchDistrict'
Size = 40
end
object xdwdsComplaintsDateReported: TStringField
FieldName = 'DateReported'
Size = 40
......
......@@ -21,7 +21,6 @@ type
xdwdsComplaintsDispatchCodeDesc: TStringField;
xdwdsComplaintsAddress: TStringField;
xdwdsComplaintsStatus: TStringField;
xdwdsComplaintsDispatchDistrict: TStringField;
xdwdsComplaintsDateReported: TStringField;
lblEntries: TWebLabel;
wdsComplaints: TWebDataSource;
......
<div class="d-flex flex-column vh-100 emimobile-main">
<div class="d-flex flex-column vh-100">
<!-- Top Nav -->
<nav id="top_nav" class="navbar navbar-light bg-primary border-light text-light py-2 flex-shrink-0" style="z-index:1020;">
......@@ -87,7 +87,7 @@
<i class="far fa-map me-1"></i>Map
</button>
<button id="view.main.btncomplaints" type="button" class="btn btn-primary position-relative">
<i class="fa fa-exclamation-circle me-1"></i>Complaints
<i class="fa fa-exclamation-circle me-1"></i>Incidents
<span id="view.main.badgecomplaints"
class="position-absolute top-0 start-100 translate-middle mt-1 badge rounded-pill bg-danger">0</span>
</button>
......
......@@ -52,16 +52,17 @@
<i class="fa fa-crosshairs"></i>
</button>
<!-- Filters (top-right) -->
<!-- Section: Filters (bottom-right, above recenter) -->
<button id="btn_map_filters"
type="button"
class="btn btn-primary position-absolute top-0 end-0 m-2 shadow"
style="z-index:1000;"
class="btn btn-primary position-absolute end-0 me-2 shadow"
style="z-index:1000; bottom:4.5rem;"
data-bs-toggle="offcanvas"
data-bs-target="#map_filters_offcanvas"
aria-controls="map_filters_offcanvas">
<i class="fa fa-sliders-h"></i>
<span class="d-none d-sm-inline">Filters</span>
aria-controls="map_filters_offcanvas"
aria-label="Map filters"
title="Map filters">
<i class="fa fa-sliders-h" aria-hidden="true"></i>
</button>
</div>
</div>
......
......@@ -656,8 +656,6 @@ begin
end;
procedure TFViewMap.btnFindLocationClick(Sender: TObject);
var
coord: TTMSFNCMapsCoordinateRec;
begin
tmrLocate.Enabled := False;
FDoFocusZoom := False;
......@@ -665,18 +663,10 @@ begin
FPendingUnitId := '';
FPendingComplaintId := '';
if userLocationMarker = nil then
if lfMap.Polygons.Count = 0 then
Exit;
coord := CreateCoordinate(userLocationMarker.Latitude, userLocationMarker.Longitude);
lfMap.SetCenterCoordinate(coord);
FPendingFocusCoord := coord;
FPendingFocusZoom := 17;
FDoFocusZoom := True;
tmrLocate.Interval := 250;
tmrLocate.Enabled := True;
lfMap.ZoomToBounds(lfMap.Polygons.ToCoordinateArray);
end;
......
......@@ -15,7 +15,7 @@ object FViewUnitDetails: TFViewUnitDetails
ElementHeaderClassName = 'table-light'
ElementTableClassName =
'table table-sm table-striped table-hover table-bordered mb-0 ali' +
'gn-middle'
'gn-middle small'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
......@@ -44,7 +44,7 @@ object FViewUnitDetails: TFViewUnitDetails
item
ElementClassName = 'text-nowrap'
DataField = 'Complaint'
Title = 'Complaint'
Title = 'Incident'
end
item
DataField = 'Log'
......
......@@ -30,7 +30,7 @@
<div class="card border-0 shadow-sm mb-2">
<div class="card-body py-2">
<table class="table table-sm mb-0 w-100">
<table class="table table-sm mb-0 w-100 small">
<tbody>
<tr>
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Unit:</th>
......@@ -69,7 +69,7 @@
<td class="w-100 text-danger" id="lbl_unavailable_reason"></td>
</tr>
<tr id="row_complaint">
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Current Complaint:</th>
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Current Incident:</th>
<td class="w-100" id="lbl_complaint"></td>
</tr>
<tr id="row_call_type">
......
......@@ -49,8 +49,8 @@ object FViewUnits: TFViewUnits
'rentStation%)</div> <div class="small (%MovingToClass%)">Mo' +
'ving To: (%MovingToStation%)</div> <div class="small">Manpo' +
'wer: (%Manpower%)<span class="(%UndermannedClass%)"> - Undermann' +
'ed</span></div> <div class="small (%ComplaintClass%)">Compl' +
'aint: (%Complaint%)</div> <div class="small (%CallTypeClass' +
'ed</span></div> <div class="small (%ComplaintClass%)">Inci' +
'dent: (%Complaint%)</div> <div class="small (%CallTypeClass' +
'%)">Call: (%CallType%)</div> <hr class="unit-divider my-1" ' +
'style="width: 80px; margin-left: 0" /> <div class="small te' +
'xt-danger (%UnavailableReasonClass%)">Unavailable: (%Unavailable' +
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1, viewport-fit=cover" name="viewport"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<noscript>Your browser does not support JavaScript!</noscript>
<link href="data:;base64,=" rel="icon"/>
<title>emiMobile</title>
......@@ -29,6 +29,24 @@
</head>
<body>
<script type="text/javascript">rtl.run();</script>
<script>
function setIOSDivHeight() {
const targetDiv = document.querySelector('body');
if (targetDiv) {
const height = window.innerHeight;
targetDiv.style.maxHeight = (height - 100) + 'px';
}
}
// Note: Match Lems height updates when the iOS browser address bar changes.
const isIOSUA = /iPad|iPhone|iPod/.test(navigator.userAgent);
if (isIOSUA) {
window.addEventListener('load', setIOSDivHeight);
window.addEventListener('resize', setIOSDivHeight);
window.addEventListener('scroll', setIOSDivHeight);
}
</script>
</body>
</html>
......
......@@ -187,13 +187,23 @@ html, body {
}
/* Note: Keep navigation inside the visible mobile viewport and device safe areas. */
@supports (height: 100dvh) {
.emimobile-main { height: 100dvh !important; }
}
/* Note: Match Lems mobile height and safe-area handling. */
@supports (padding-top: env(safe-area-inset-top)) {
#top_nav { padding-top: calc(0.5rem + env(safe-area-inset-top)) !important; }
#bottom_nav { padding-bottom: calc(0.5rem + env(safe-area-inset-bottom)) !important; }
#top_nav {
padding-top: calc(0.5rem + env(safe-area-inset-top));
}
#bottom_nav {
padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}
}
@supports (-webkit-touch-callout: none) {
span.card {
border: none;
}
.vh-100 {
height: 93vh !important;
}
}
.complaint-detail-tabs .btn-success {
......
......@@ -584,7 +584,6 @@ object BFDAPIDataModule: TBFDAPIDataModule
' ca.APARTMENT,'
' ca.CITY,'
' ca.BUSINESS,'
' cd.CODE_DESC AS DISPATCHDISTRICT,'
' ca.DISPATCHSECTOR,'
' ca.ADDRESSDISTRICT,'
' ca.ADDRESSSECTOR,'
......@@ -600,8 +599,6 @@ object BFDAPIDataModule: TBFDAPIDataModule
' ct.DATEARRIVED,'
' ct.DATECLEARED,'
' cp.COLOR AS PRIORITY_COLOR,'
' cd.CODE_DESC AS DISTRICT_DESC,'
' sec.CODE_DESC AS SECTOR_DESC,'
' ca.STATUS,'
' cst.CODE_DESC AS STATUS_DESC,'
' cst.COLOR AS STATUS_COLOR,'
......@@ -616,10 +613,6 @@ object BFDAPIDataModule: TBFDAPIDataModule
'LEFT JOIN CD_DISPATCHCODES cdc ON cdc.CODE = ca.DISPATCHCODE'
'LEFT JOIN CD_CALLSOURCES ccs ON ccs.CODE = ca.SOURCE'
'LEFT JOIN CD_CALLPRIORITIES cp ON cp.CODE = ca.PRIORITY'
'LEFT JOIN CD_DISTRICT cd ON cd.AGENCYCODE = ca.DISPATCHDISTRICT'
'LEFT JOIN CD_SECTOR sec ON sec.AGENCYCODE = ca.DISPATCHSECTOR AN' +
'D sec.CODE_TYPE = cd.AGENCYCODE'
'LEFT JOIN CD_COMPLAINTSTATUS cst ON cst.CODE = ca.STATUS'
'WHERE ca.AGENCY = '#39'BFD'#39
' AND ca.COMPLAINT IS NOT NULL'
......@@ -679,11 +672,6 @@ object BFDAPIDataModule: TBFDAPIDataModule
FieldName = 'business'
Size = 35
end
object uqComplaintListdispatchdistrict: TStringField
FieldName = 'dispatchdistrict'
ReadOnly = True
Size = 120
end
object uqComplaintListdispatchsector: TStringField
FieldName = 'dispatchsector'
Size = 6
......@@ -739,16 +727,6 @@ object BFDAPIDataModule: TBFDAPIDataModule
FieldName = 'priority_color'
ReadOnly = True
end
object uqComplaintListdistrict_desc: TStringField
FieldName = 'district_desc'
ReadOnly = True
Size = 120
end
object uqComplaintListsector_desc: TStringField
FieldName = 'sector_desc'
ReadOnly = True
Size = 120
end
object uqComplaintListcomplaintNumber: TStringField
FieldKind = fkCalculated
FieldName = 'complaintNumber'
......@@ -1056,7 +1034,6 @@ object BFDAPIDataModule: TBFDAPIDataModule
'SELECT'
' q.COMPLAINTID,'
' q.COMPLAINT,'
' q.DISPATCHDISTRICT,'
' q.AGENCY,'
' q.AGENCY_NAME,'
' q.PRIORITY,'
......@@ -1075,7 +1052,6 @@ object BFDAPIDataModule: TBFDAPIDataModule
' SELECT'
' ca.COMPLAINTID,'
' ca.COMPLAINT,'
' cd.CODE_DESC AS DISPATCHDISTRICT,'
' ca.AGENCY,'
' ag.AGENCYNAME AS AGENCY_NAME,'
' ca.PRIORITY,'
......@@ -1103,8 +1079,6 @@ object BFDAPIDataModule: TBFDAPIDataModule
' ON ct.COMPLAINTID = ca.COMPLAINTID'
' LEFT JOIN CD_DISPATCHCODES cdc'
' ON cdc.CODE = ca.DISPATCHCODE'
' LEFT JOIN CD_DISTRICT cd'
' ON cd.AGENCYCODE = ca.DISPATCHDISTRICT'
' LEFT JOIN AGENCY ag'
' ON ag.AGENCYID = ca.AGENCY'
' LEFT JOIN CD_COMPLAINTSTATUS cst'
......@@ -1122,11 +1096,6 @@ object BFDAPIDataModule: TBFDAPIDataModule
FieldName = 'complaintid'
Required = True
end
object uqMapComplaintsdispatchdistrict: TStringField
FieldName = 'dispatchdistrict'
ReadOnly = True
Size = 120
end
object uqMapComplaintspriority: TStringField
FieldName = 'priority'
Size = 6
......
......@@ -40,7 +40,6 @@ type
uqComplaintListapartment: TStringField;
uqComplaintListcity: TStringField;
uqComplaintListbusiness: TStringField;
uqComplaintListdispatchdistrict: TStringField;
uqComplaintListdispatchsector: TStringField;
uqComplaintListaddressdistrict: TStringField;
uqComplaintListaddresssector: TStringField;
......@@ -56,8 +55,6 @@ type
uqComplaintListdatearrived: TDateTimeField;
uqComplaintListdatecleared: TDateTimeField;
uqComplaintListpriority_color: TFloatField;
uqComplaintListdistrict_desc: TStringField;
uqComplaintListsector_desc: TStringField;
uqComplaintListcomplaintNumber: TStringField;
uqComplaintDetailscomplaintid: TFloatField;
uqComplaintDetailscfsid: TFloatField;
......@@ -134,7 +131,6 @@ type
uqMapComplaintUnitsListdatecleared: TDateTimeField;
uqMapComplaintUnitsListlocation: TStringField;
uqMapComplaintscomplaintid: TFloatField;
uqMapComplaintsdispatchdistrict: TStringField;
uqMapComplaintspriority: TStringField;
uqMapComplaintsbusiness: TStringField;
uqMapComplaintsdispatchcodecategory: TStringField;
......@@ -269,7 +265,7 @@ type
public
procedure ConfigureQueryTimeouts; override;
function GetBadgeCounts: TJSONObject; override;
function GetComplaintMap(FormatComplaintNumber: Boolean = True): TJSONObject; override;
function GetComplaintMap: TJSONObject; override;
function GetUnitMap: TJSONObject; override;
function GetComplaintList: TJSONObject; override;
function GetUnitList: TJSONObject; override;
......@@ -518,7 +514,7 @@ begin
end;
// Note: BFD retains raw complaint numbers for both HTTP and WebSocket maps.
function TBFDAPIDataModule.GetComplaintMap(FormatComplaintNumber: Boolean): TJSONObject;
function TBFDAPIDataModule.GetComplaintMap: TJSONObject;
var
data: TJSONArray;
emitted: Integer;
......@@ -624,8 +620,10 @@ begin
end;
item.AddPair('ComplaintId', complaintId);
item.AddPair('Complaint', uqMapComplaintsCOMPLAINT.AsString);
item.AddPair('DispatchDistrict', uqMapComplaintsDISPATCHDISTRICT.AsString);
var complaintNumber := Trim(uqMapComplaintsCOMPLAINT.AsString);
if Length(complaintNumber) > 2 then
complaintNumber := Copy(complaintNumber, 1, 2) + '-' + Copy(complaintNumber, 3, MaxInt);
item.AddPair('Complaint', complaintNumber);
item.AddPair('Agency', uqMapComplaintsAGENCY.AsString);
item.AddPair('AgencyName', uqMapComplaintsAGENCY_NAME.AsString);
item.AddPair('DispatchCodeDesc', uqMapComplaintsDISPATCH_CODE_DESC.AsString);
......@@ -668,7 +666,7 @@ begin
on E: Exception do
begin
Logger.Log(2, '---TBFDAPIDataModule.GetComplaintMap error: ' + E.ClassName + ': ' + E.Message);
raise EXDataHttpException.Create(500, 'Failed to load complaint map');
raise EXDataHttpException.Create(500, 'Failed to load incident map');
end;
end;
finally
......@@ -888,7 +886,6 @@ begin
item.AddPair('Contacts', uqComplaintListCONTACTS.AsString);
item.AddPair('History', uqComplaintListHISTORY.AsString);
item.AddPair('DispatchDistrict', uqComplaintListDISPATCHDISTRICT.AsString);
item.AddPair('DateReported', uqComplaintListDATEREPORTED.AsString);
Next;
......@@ -902,7 +899,7 @@ begin
Result.AddPair('returned', TJSONNumber.Create(data.Count));
except
Logger.Log(2, '---TBFDAPIDataModule.GetComplaintList End (error)');
raise EXDataHttpException.Create(500, 'Failed to load complaints list');
raise EXDataHttpException.Create(500, 'Failed to load incidents list');
end;
Logger.Log(3, '---TBFDAPIDataModule.GetComplaintList End');
......@@ -1079,10 +1076,10 @@ begin
Open;
try
if Eof then
raise EXDataHttpException.Create(404, 'Complaint not found');
raise EXDataHttpException.Create(404, 'Incident not found');
if not Locate('STATUS', 0, []) then
raise EXDataHttpException.Create(404, 'Complaint not found');
raise EXDataHttpException.Create(404, 'Incident not found');
status := ComplaintDisplayStatus(
uqComplaintDetailsCOMPLAINT_STATUS.AsString,
......@@ -1220,7 +1217,7 @@ begin
on E: Exception do
begin
Logger.Log(3, '---TBFDAPIDataModule.GetComplaintDetails error: ' + E.Message);
raise EXDataHttpException.Create(500, 'Failed to load complaint details');
raise EXDataHttpException.Create(500, 'Failed to load incident details');
end;
end;
......@@ -1249,10 +1246,10 @@ begin
Open;
try
if Eof then
raise EXDataHttpException.Create(404, 'Complaint not found');
raise EXDataHttpException.Create(404, 'Incident not found');
if not Locate('STATUS', 1, []) then
raise EXDataHttpException.Create(404, 'Complaint archive not found');
raise EXDataHttpException.Create(404, 'Incident archive not found');
status := ComplaintDisplayStatus(
uqComplaintDetailsCOMPLAINT_STATUS.AsString,
......@@ -1375,7 +1372,7 @@ begin
on E: Exception do
begin
Logger.Log(3, '---TBFDAPIDataModule.GetComplaintArchiveDetails error: ' + E.Message);
raise EXDataHttpException.Create(500, 'Failed to load complaint archive details');
raise EXDataHttpException.Create(500, 'Failed to load incident archive details');
end;
end;
......@@ -1445,7 +1442,7 @@ begin
on E: Exception do
begin
Logger.Log(2, '---TBFDAPIDataModule.GetComplaintMemos error: ' + E.ClassName + ': ' + E.Message);
raise EXDataHttpException.Create(500, 'Failed to load complaint memos');
raise EXDataHttpException.Create(500, 'Failed to load incident memos');
end;
end;
......@@ -1528,7 +1525,7 @@ begin
on E: Exception do
begin
Logger.Log(2, '---TBFDAPIDataModule.GetComplaintHistory error: ' + E.ClassName + ': ' + E.Message);
raise EXDataHttpException.Create(500, 'Failed to load complaint history');
raise EXDataHttpException.Create(500, 'Failed to load incident history');
end;
end;
except
......@@ -1593,7 +1590,7 @@ begin
on E: Exception do
begin
Logger.Log(2, '---TBFDAPIDataModule.GetComplaintContacts error: ' + E.ClassName + ': ' + E.Message);
raise EXDataHttpException.Create(500, 'Failed to load complaint contacts');
raise EXDataHttpException.Create(500, 'Failed to load incident contacts');
end;
end;
except
......@@ -1681,7 +1678,7 @@ begin
on E: Exception do
begin
Logger.Log(2, '---TBFDAPIDataModule.GetComplaintWarnings error: ' + E.ClassName + ': ' + E.Message);
raise EXDataHttpException.Create(500, 'Failed to load complaint warnings');
raise EXDataHttpException.Create(500, 'Failed to load incident warnings');
end;
end;
except
......
......@@ -14,7 +14,7 @@ type
function StartUpdateListener: Boolean; virtual; abstract;
function ConsumeCADUpdate: Boolean; virtual; abstract;
function GetBadgeCounts: TJSONObject; virtual; abstract;
function GetComplaintMap(FormatComplaintNumber: Boolean = True): TJSONObject; virtual; abstract;
function GetComplaintMap: TJSONObject; virtual; abstract;
function GetUnitMap: TJSONObject; virtual; abstract;
function GetComplaintList: TJSONObject; virtual; abstract;
function GetUnitList: TJSONObject; virtual; abstract;
......
......@@ -4,7 +4,7 @@
## Ownership and use
- Authentication creates a store through `Agency.Selection.CreateDeviceStore(authDB.ucLemsOCSO)` and borrows its existing connection. Free the store before the authentication module.
- Authentication creates a store through `Agency.Selection.CreateDeviceStore(authDB.ucLems)` and borrows its existing connection. Free the store before the authentication module.
- API device operations and WebSocket activity checks create a store with `CreateDeviceStore`, which owns a separately configured connection. Free the store when that operation completes.
- Read operations return store-owned `TDataSet` results. Callers read/close those results; do not free them or retain them beyond the store's lifetime. Repeating the same operation reuses its query.
- Write operations return affected-row counts. Services retain their existing zero-row/not-found handling.
......
......@@ -214,7 +214,7 @@ var
obj: TJSONObject;
begin
AComplaintCount := 0;
obj := FData.GetComplaintMap(False);
obj := FData.GetComplaintMap;
try
AComplaintCount := obj.GetValue<Integer>('count');
obj.AddPair('RequestId', WS_MSG_COMPLAINT_MAP);
......
......@@ -221,7 +221,7 @@ type
public
procedure ConfigureQueryTimeouts; override;
function GetBadgeCounts: TJSONObject; override;
function GetComplaintMap(FormatComplaintNumber: Boolean = True): TJSONObject; override;
function GetComplaintMap: TJSONObject; override;
function GetUnitMap: TJSONObject; override;
function GetComplaintList: TJSONObject; override;
function GetUnitList: TJSONObject; override;
......@@ -497,7 +497,7 @@ begin
end;
end;
function TWCAPIDataModule.GetComplaintMap(FormatComplaintNumber: Boolean): TJSONObject;
function TWCAPIDataModule.GetComplaintMap: TJSONObject;
var
data: TJSONArray;
emitted: Integer;
......@@ -588,14 +588,9 @@ begin
item.AddPair('ComplaintId', uqMapComplaintsCOMPLAINTID.AsString);
complaintNumber := uqMapComplaintsCOMPLAINT.AsString;
// Note: Preserve the existing HTTP formatting and raw WebSocket value.
if FormatComplaintNumber then
begin
complaintNumber := Trim(complaintNumber);
if Length(complaintNumber) > 2 then
complaintNumber := Copy(complaintNumber, 1, 2) + '-' + Copy(complaintNumber, 3, MaxInt);
end;
complaintNumber := Trim(uqMapComplaintsCOMPLAINT.AsString);
if Length(complaintNumber) > 2 then
complaintNumber := Copy(complaintNumber, 1, 2) + '-' + Copy(complaintNumber, 3, MaxInt);
item.AddPair('Complaint', complaintNumber);
item.AddPair('DispatchDistrict', uqMapComplaintsDISPATCHDISTRICT.AsString);
......
......@@ -8,7 +8,7 @@ object WCAuthDatabase: TWCAuthDatabase
Left = 237
Top = 53
end
object ucLemsOCSO: TUniConnection
object ucLems: TUniConnection
ProviderName = 'PostgreSQL'
Database = 'lems_ocso'
Username = 'postgres'
......@@ -19,7 +19,7 @@ object WCAuthDatabase: TWCAuthDatabase
EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF'
end
object uqAuth: TUniQuery
Connection = ucLemsOCSO
Connection = ucLems
SQL.Strings = (
'select u.* from lems.users u '
'where upper(user_name) = :USER_NAME '
......@@ -32,7 +32,7 @@ object WCAuthDatabase: TWCAuthDatabase
Top = 148
end
object uqAgencies: TUniQuery
Connection = ucLemsOCSO
Connection = ucLems
SQL.Strings = (
'select agencyid as agency '
'from lems.agency '
......@@ -42,7 +42,7 @@ object WCAuthDatabase: TWCAuthDatabase
Top = 200
end
object uqAgencyConfig: TUniQuery
Connection = ucLemsOCSO
Connection = ucLems
SQL.Strings = (
'select agencyid, agencyname '
'from lems.agency '
......
......@@ -9,7 +9,7 @@ uses
type
TWCAuthDatabase = class(TAgencyAuth)
uqMisc: TUniQuery;
ucLemsOCSO: TUniConnection;
ucLems: TUniConnection;
uqAuth: TUniQuery;
uqAgencies: TUniQuery;
uqAgencyConfig: TUniQuery;
......@@ -49,7 +49,7 @@ uses
function TWCAuthDatabase.GetConnection: TUniConnection;
begin
Result := ucLemsOCSO;
Result := ucLems;
end;
function TWCAuthDatabase.GetUserData: TDataSet;
......@@ -89,13 +89,13 @@ end;
procedure TWCAuthDatabase.DataModuleCreate(Sender: TObject);
begin
IniEntries.ConfigureConnection(ucLemsOCSO);
IniEntries.ConfigureConnection(ucLems);
try
Logger.Log(2, '');
Logger.Log(2, 'Connecting to PostgreSQL auth database...');
if not ucLemsOCSO.Connected then
ucLemsOCSO.Connect;
if not ucLems.Connected then
ucLems.Connect;
except
on E: Exception do
Logger.Log(2, Format('Failed to connect to auth database: %s', [E.Message]));
......@@ -105,8 +105,8 @@ end;
procedure TWCAuthDatabase.DataModuleDestroy(Sender: TObject);
begin
if ucLemsOCSO.Connected then
ucLemsOCSO.Disconnect;
if ucLems.Connected then
ucLems.Disconnect;
end;
procedure TWCAuthDatabase.SetLoginAuditEntry( userStr: string );
......
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