Commit 6dcf14e1 by Mac Stephens

WIP commit while changing to new VM

parent a7138bea
...@@ -590,7 +590,7 @@ object ApiDatabaseModule: TApiDatabaseModule ...@@ -590,7 +590,7 @@ object ApiDatabaseModule: TApiDatabaseModule
' a.STRPREFIX,' ' a.STRPREFIX,'
' a.STRNAME,' ' a.STRNAME,'
' a.STRSUFFIX,' ' a.STRSUFFIX,'
' a.CITY.' ' a.CITY,'
' 0 as status' ' 0 as status'
'FROM COMPLAINT_ACTIVE ca' 'FROM COMPLAINT_ACTIVE ca'
'JOIN COMPLAINT_TIMES ct' 'JOIN COMPLAINT_TIMES ct'
...@@ -637,7 +637,7 @@ object ApiDatabaseModule: TApiDatabaseModule ...@@ -637,7 +637,7 @@ object ApiDatabaseModule: TApiDatabaseModule
' a.STRPREFIX,' ' a.STRPREFIX,'
' a.STRNAME,' ' a.STRNAME,'
' a.STRSUFFIX,' ' a.STRSUFFIX,'
' a.CITY.' ' a.CITY,'
' 1 as status' ' 1 as status'
'FROM COMPLAINT_ARCHIVE ca' 'FROM COMPLAINT_ARCHIVE ca'
'JOIN COMPLAINT_TIMES ct' 'JOIN COMPLAINT_TIMES ct'
...@@ -657,7 +657,7 @@ object ApiDatabaseModule: TApiDatabaseModule ...@@ -657,7 +657,7 @@ object ApiDatabaseModule: TApiDatabaseModule
item item
DataType = ftUnknown DataType = ftUnknown
Name = 'COMPLAINTID' Name = 'COMPLAINTID'
Value = nil Value = Null
end> end>
object uqComplaintDetailsCOMPLAINTID: TFloatField object uqComplaintDetailsCOMPLAINTID: TFloatField
FieldName = 'COMPLAINTID' FieldName = 'COMPLAINTID'
...@@ -762,6 +762,10 @@ object ApiDatabaseModule: TApiDatabaseModule ...@@ -762,6 +762,10 @@ object ApiDatabaseModule: TApiDatabaseModule
FieldName = 'BUSINESS' FieldName = 'BUSINESS'
Size = 35 Size = 35
end end
object uqComplaintDetailsSTATUS: TFloatField
FieldName = 'STATUS'
ReadOnly = True
end
end end
object ucENTCAD: TUniConnection object ucENTCAD: TUniConnection
ProviderName = 'Oracle' ProviderName = 'Oracle'
...@@ -959,6 +963,7 @@ object ApiDatabaseModule: TApiDatabaseModule ...@@ -959,6 +963,7 @@ object ApiDatabaseModule: TApiDatabaseModule
' where ca.complaintid = :COMPLAINTID' ' where ca.complaintid = :COMPLAINTID'
')' ')'
'select' 'select'
' c.complaintid,'
' c.complaint,' ' c.complaint,'
' c.apartment,' ' c.apartment,'
' c.datereported,' ' c.datereported,'
...@@ -980,14 +985,39 @@ object ApiDatabaseModule: TApiDatabaseModule ...@@ -980,14 +985,39 @@ object ApiDatabaseModule: TApiDatabaseModule
'and (ctx.city is null or c.city = ctx.city)' 'and (ctx.city is null or c.city = ctx.city)'
'order by c.datereported desc') 'order by c.datereported desc')
ReadOnly = True ReadOnly = True
Left = 328 Left = 330
Top = 72 Top = 72
ParamData = < ParamData = <
item item
DataType = ftUnknown DataType = ftUnknown
Name = 'COMPLAINTID' Name = 'COMPLAINTID'
Value = nil Value = Null
end> end>
object uqComplaintHistoryCOMPLAINTID: TFloatField
FieldName = 'COMPLAINTID'
Required = True
end
object uqComplaintHistoryCOMPLAINT: TStringField
FieldName = 'COMPLAINT'
Size = 10
end
object uqComplaintHistoryAPARTMENT: TStringField
FieldName = 'APARTMENT'
Size = 6
end
object uqComplaintHistoryDATEREPORTED: TDateTimeField
FieldName = 'DATEREPORTED'
end
object uqComplaintHistoryDPRIORITY: TStringField
FieldName = 'DPRIORITY'
ReadOnly = True
Size = 120
end
object uqComplaintHistoryDCALLTYPE: TStringField
FieldName = 'DCALLTYPE'
ReadOnly = True
Size = 60
end
end end
object uqComplaintContacts: TUniQuery object uqComplaintContacts: TUniQuery
Connection = ucENTCAD Connection = ucENTCAD
......
...@@ -172,6 +172,13 @@ type ...@@ -172,6 +172,13 @@ type
uqMapUnitsDIS_UNITID: TFloatField; uqMapUnitsDIS_UNITID: TFloatField;
uqMapComplaintsBUSINESS: TStringField; uqMapComplaintsBUSINESS: TStringField;
uqComplaintDetailsBUSINESS: TStringField; uqComplaintDetailsBUSINESS: TStringField;
uqComplaintDetailsSTATUS: TFloatField;
uqComplaintHistoryCOMPLAINTID: TFloatField;
uqComplaintHistoryCOMPLAINT: TStringField;
uqComplaintHistoryAPARTMENT: TStringField;
uqComplaintHistoryDATEREPORTED: TDateTimeField;
uqComplaintHistoryDPRIORITY: TStringField;
uqComplaintHistoryDCALLTYPE: TStringField;
procedure uqComplaintListCalcFields(DataSet: TDataSet); procedure uqComplaintListCalcFields(DataSet: TDataSet);
procedure uqMapComplaintsCalcFields(DataSet: TDataSet); procedure uqMapComplaintsCalcFields(DataSet: TDataSet);
private private
......
...@@ -22,6 +22,7 @@ type ...@@ -22,6 +22,7 @@ type
[HttpGet] function GetComplaintMap: TJSONObject; [HttpGet] function GetComplaintMap: TJSONObject;
[HttpGet] function GetUnitMap: TJSONObject; [HttpGet] function GetUnitMap: TJSONObject;
[HttpGet] function GetComplaintDetails(const ComplaintId: string): TJSONObject; [HttpGet] function GetComplaintDetails(const ComplaintId: string): TJSONObject;
[HttpGet] function GetComplaintArchiveDetails(const ComplaintId: string): TJSONObject;
[HttpGet] function GetComplaintMemos(const CfsId: string): TJSONObject; [HttpGet] function GetComplaintMemos(const CfsId: string): TJSONObject;
[HttpGet] function GetComplaintHistory(const ComplaintId: string): TJSONObject; [HttpGet] function GetComplaintHistory(const ComplaintId: string): TJSONObject;
[HttpGet] function GetComplaintContacts(const ComplaintId: string): TJSONObject; [HttpGet] function GetComplaintContacts(const ComplaintId: string): TJSONObject;
......
...@@ -24,6 +24,7 @@ type ...@@ -24,6 +24,7 @@ type
function GetComplaintMap: TJSONObject; function GetComplaintMap: TJSONObject;
function GetUnitMap: TJSONObject; function GetUnitMap: TJSONObject;
function GetComplaintDetails(const ComplaintId: string): TJSONObject; function GetComplaintDetails(const ComplaintId: string): TJSONObject;
function GetComplaintArchiveDetails(const ComplaintId: string): TJSONObject;
function GetComplaintHistory(const ComplaintId: string): TJSONObject; function GetComplaintHistory(const ComplaintId: string): TJSONObject;
function GetComplaintContacts(const ComplaintId: string): TJSONObject; function GetComplaintContacts(const ComplaintId: string): TJSONObject;
function GetComplaintWarnings(const ComplaintId: string): TJSONObject; function GetComplaintWarnings(const ComplaintId: string): TJSONObject;
...@@ -443,7 +444,6 @@ begin ...@@ -443,7 +444,6 @@ begin
end; end;
function TApiService.GetComplaintDetails(const ComplaintId: string): TJSONObject; function TApiService.GetComplaintDetails(const ComplaintId: string): TJSONObject;
var var
obj: TJSONObject; obj: TJSONObject;
...@@ -525,6 +525,91 @@ begin ...@@ -525,6 +525,91 @@ begin
end; end;
function TApiService.GetComplaintArchiveDetails(const ComplaintId: string): TJSONObject;
var
obj: TJSONObject;
begin
Logger.Log(3,'---TApiService.GetComplaintArchiveDetails initiated: '+ComplaintId);
Result := TJSONObject.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
try
with ApiDB.uqComplaintDetails do
begin
ParamByName('COMPLAINTID').AsString := ComplaintId;
Open;
try
if Eof then raise EXDataHttpException.Create(404,'Complaint not found');
if not Locate('STATUS', 1, []) then
raise EXDataHttpException.Create(404,'Complaint archive not found');
obj := TJSONObject.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add(obj);
obj.AddPair('ComplaintId', ApiDB.uqComplaintDetailsCOMPLAINTID.AsString);
obj.AddPair('CFSId', ApiDB.uqComplaintDetailsCFSID.AsString);
obj.AddPair('Complaint', ApiDB.uqComplaintDetailsCOMPLAINT.AsString);
obj.AddPair('Priority', ApiDB.uqComplaintDetailsPRIORITY.AsString);
obj.AddPair('DispatchCode', ApiDB.uqComplaintDetailsDISPATCHCODE.AsString);
obj.AddPair('DispatchCodeDesc', ApiDB.uqComplaintDetailsDISPATCH_CODE_DESC.AsString);
obj.AddPair('DispatchDistrict', ApiDB.uqComplaintDetailsDISPATCHDISTRICT.AsString);
obj.AddPair('Address', ApiDB.uqComplaintDetailsADDRESS.AsString);
obj.AddPair('Business', ApiDB.uqComplaintDetailsBUSINESS.AsString);
obj.AddPair('History', ApiDB.uqComplaintDetailsHISTORY.AsString);
obj.AddPair('Contacts', ApiDB.uqComplaintDetailsCONTACTS.AsString);
obj.AddPair('Warnings', ApiDB.uqComplaintDetailsWARNINGS.AsString);
if ApiDB.uqComplaintDetailsDATEREPORTED.IsNull then
obj.AddPair('DateReported', '')
else
obj.AddPair('DateReported', FormatDateTime('yyyy-mm-dd hh:nn:ss', ApiDB.uqComplaintDetailsDATEREPORTED.AsDateTime));
if ApiDB.uqComplaintDetailsDATERECEIVED.IsNull then
obj.AddPair('DateReceived', '')
else
obj.AddPair('DateReceived', FormatDateTime('yyyy-mm-dd hh:nn:ss', ApiDB.uqComplaintDetailsDATERECEIVED.AsDateTime));
if ApiDB.uqComplaintDetailsDATEDISPATCHED.IsNull then
obj.AddPair('DateDispatched', '')
else
obj.AddPair('DateDispatched', FormatDateTime('yyyy-mm-dd hh:nn:ss', ApiDB.uqComplaintDetailsDATEDISPATCHED.AsDateTime));
if ApiDB.uqComplaintDetailsDATERESPONDED.IsNull then
obj.AddPair('DateResponded', '')
else
obj.AddPair('DateResponded', FormatDateTime('yyyy-mm-dd hh:nn:ss', ApiDB.uqComplaintDetailsDATERESPONDED.AsDateTime));
if ApiDB.uqComplaintDetailsDATEARRIVED.IsNull then
obj.AddPair('DateArrived', '')
else
obj.AddPair('DateArrived', FormatDateTime('yyyy-mm-dd hh:nn:ss', ApiDB.uqComplaintDetailsDATEARRIVED.AsDateTime));
if ApiDB.uqComplaintDetailsDATECLEARED.IsNull then
obj.AddPair('DateCleared', '')
else
obj.AddPair('DateCleared', FormatDateTime('yyyy-mm-dd hh:nn:ss', ApiDB.uqComplaintDetailsDATECLEARED.AsDateTime));
Result.AddPair('data', obj);
finally
Close;
end;
end;
except
on E: EXDataHttpException do
begin
Logger.Log(3,'---TApiService.GetComplaintArchiveDetails not found');
raise;
end;
on E: Exception do
begin
Logger.Log(3,'---TApiService.GetComplaintArchiveDetails error: '+E.Message);
raise EXDataHttpException.Create(500,'Failed to load complaint archive details');
end;
end;
Logger.Log(3,'---TApiService.GetComplaintArchiveDetails End');
end;
function TApiService.GetComplaintMemos(const CfsId: string): TJSONObject; function TApiService.GetComplaintMemos(const CfsId: string): TJSONObject;
var var
data: TJSONArray; data: TJSONArray;
...@@ -612,16 +697,17 @@ begin ...@@ -612,16 +697,17 @@ begin
rowObj := TJSONObject.Create; rowObj := TJSONObject.Create;
dataArr.AddElement(rowObj); dataArr.AddElement(rowObj);
rowObj.AddPair('Complaint', FieldByName('COMPLAINT').AsString); rowObj.AddPair('ComplaintId', ApiDB.uqComplaintHistoryCOMPLAINTID.AsString);
rowObj.AddPair('Apartment', FieldByName('APARTMENT').AsString); rowObj.AddPair('Complaint', ApiDB.uqComplaintHistoryCOMPLAINT.AsString);
rowObj.AddPair('Apartment', ApiDB.uqComplaintHistoryAPARTMENT.AsString);
if FieldByName('DATEREPORTED').IsNull then if ApiDB.uqComplaintHistoryDATEREPORTED.IsNull then
rowObj.AddPair('DateReported', '') rowObj.AddPair('DateReported', '')
else else
rowObj.AddPair('DateReported', FormatDateTime('yyyy-mm-dd', FieldByName('DATEREPORTED').AsDateTime)); rowObj.AddPair('DateReported', FormatDateTime('yyyy-mm-dd', ApiDB.uqComplaintHistoryDATEREPORTED.AsDateTime));
rowObj.AddPair('DPriority', FieldByName('DPRIORITY').AsString); rowObj.AddPair('DPriority', ApiDB.uqComplaintHistoryDPRIORITY.AsString);
rowObj.AddPair('DCallType', FieldByName('DCALLTYPE').AsString); rowObj.AddPair('DCallType', ApiDB.uqComplaintHistoryDCALLTYPE.AsString);
Inc(returnedCount); Inc(returnedCount);
Next; Next;
......
[Settings] [Settings]
LogFileNum=629 LogFileNum=640
webClientVersion=0.1.0 webClientVersion=0.1.0
...@@ -179,6 +179,6 @@ begin ...@@ -179,6 +179,6 @@ begin
iniFile.Free; iniFile.Free;
end; end;
Logger.AddAppender(TMemoLogAppender.Create( memoLogLevel, FMain.memoinfo )); Logger.AddAppender(TMemoLogAppender.Create( memoLogLevel, FMain.memoinfo ));
Logger.AddAppender(TFileLogAppender.Create( fileLogLevel, 'webPoliceReports' )); Logger.AddAppender(TFileLogAppender.Create( fileLogLevel, 'emiMobileServer' ));
Application.Run; Application.Run;
end. end.
object FViewComplaintArchive: TFViewComplaintArchive
Width = 640
Height = 480
object tblRemarksArc: TWebDBTableControl
Left = 102
Top = 128
Width = 191
Height = 147
ElementId = 'tbl_remarks_arc'
BorderColor = clSilver
ChildOrder = 8
ElementFont = efCSS
ElementHeaderClassName = 'table-light'
ElementTableClassName =
'table table-sm table-striped table-hover table-bordered mb-0 ali' +
'gn-middle'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
Footer.InputElementClassName = 'form-control'
Footer.LinkActiveElementClassName = 'link-primary'
Footer.LinkElementClassName = 'link-secondary'
Footer.ListElementClassName = 'pagination'
Footer.ListItemElementClassName = 'page-item'
Footer.ListLinkElementClassName = 'page-link'
Header.ButtonActiveElementClassName = 'btn btn-primary'
Header.ButtonElementClassName = 'btn btn-light'
Header.DropDownElementClassName = 'form-control'
Header.InputElementClassName = 'form-control'
Header.LinkActiveElementClassName = 'link-primary'
Header.LinkElementClassName = 'link-secondary'
Header.ListElementClassName = 'pagination'
Header.ListItemElementClassName = 'page-item'
Header.ListLinkElementClassName = 'page-link'
WordWrap = True
Columns = <
item
ElementClassName = 'd-none'
DataField = 'MemoType'
Title = 'Type'
TitleElementClassName = 'd-none'
end
item
DataField = 'Timestamp'
Title = 'Timestamp'
end
item
DataField = 'Remarks'
Title = 'Remarks'
end>
DataSource = wdsRemarksArc
end
object btnUntArc: TWebButton
Left = 378
Top = 85
Width = 96
Height = 25
Caption = 'UNT'
ChildOrder = 1
ElementID = 'btn_unt_arc'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnUntArcClick
end
object btnREMArc: TWebButton
Left = 276
Top = 85
Width = 96
Height = 25
Caption = 'REM'
ChildOrder = 1
ElementID = 'btn_rem_arc'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnREMArcClick
end
object btnE911Arc: TWebButton
Left = 166
Top = 85
Width = 96
Height = 25
Caption = 'E-911'
ChildOrder = 1
ElementID = 'btn_e911_arc'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnE911ArcClick
end
object btnCmpArc: TWebButton
Left = 64
Top = 85
Width = 96
Height = 25
Caption = 'CMP'
ChildOrder = 1
ElementID = 'btn_cmp_arc'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnCmpArcClick
end
object btnComplaintViewOnMapArc: TWebButton
Left = 342
Top = 259
Width = 96
Height = 25
Caption = 'Map'
ChildOrder = 1
ElementID = 'btn_complaint_view_on_map_arc'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnComplaintViewOnMapArcClick
end
object xdwcComplaintArchive: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 292
Top = 310
end
object xdwdsRemarksArc: TXDataWebDataSet
Left = 68
Top = 316
object xdwdsRemarksArcMemoId: TStringField
FieldName = 'MemoId'
end
object xdwdsRemarksArcCFSId: TStringField
FieldName = 'CFSId'
end
object xdwdsRemarksArcMemoType: TStringField
FieldName = 'MemoType'
end
object xdwdsRemarksArcTimestamp: TStringField
FieldName = 'Timestamp'
end
object xdwdsRemarksArcBadgeNumber: TStringField
FieldName = 'BadgeNumber'
end
object xdwdsRemarksArcRemarks: TStringField
FieldName = 'Remarks'
end
end
object wdsRemarksArc: TWebDataSource
DataSet = xdwdsRemarksArc
Left = 156
Top = 314
end
end
<div class="d-flex flex-column h-100 w-100 overflow-hidden">
<div class="flex-grow-1 d-flex flex-column overflow-auto bg-light p-2 p-md-3" style="min-height:0;">
<!-- Sticky block: Summary header + summary body -->
<div class="sticky-top bg-light" style="z-index:20;">
<!-- Summary header -->
<div class="card border-0 shadow-sm mb-2">
<div class="card-header bg-white py-2">
<button
class="btn btn-link text-decoration-none p-0 w-100 d-flex align-items-center justify-content-between summary-toggle"
type="button"
data-bs-toggle="collapse"
data-bs-target="#cdetails_summary_arc"
aria-expanded="true"
aria-controls="cdetails_summary_arc">
<span class="fw-semibold text-dark" id="lbl_summary_title_arc">Summary</span>
<span class="summary-chevron" aria-hidden="true">
<svg class="summary-chevron-icon" viewBox="0 0 16 16" focusable="false">
<path fill="currentColor" d="M7.646 5.354a.5.5 0 0 1 .708 0l5 5a.5.5 0 0 1-.708.708L8 6.414 3.354 11.06a.5.5 0 1 1-.708-.708l5-5z"/>
</svg>
</span>
</button>
</div>
</div>
<!-- Summary body -->
<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">
<tbody>
<tr>
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Priority:</th>
<td class="w-100" id="lbl_priority_arc"></td>
</tr>
<tr>
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Status:</th>
<td class="w-100" id="lbl_status_arc"></td>
</tr>
<tr>
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Dispatch Code:</th>
<td class="w-100" id="lbl_dispatch_code_arc"></td>
</tr>
<tr>
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Dispatch District:</th>
<td class="w-100" id="lbl_dispatch_district_arc"></td>
</tr>
<tr>
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Address:</th>
<td class="w-100" id="lbl_address_arc"></td>
</tr>
<tr id="row_business_arc" class="d-none">
<th scope="row" class="fw-semibold text-nowrap pe-2 w-auto">Business:</th>
<td class="w-100" id="lbl_business_arc"></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Remarks toggle filters -->
<div class="pb-2">
<div class="d-flex flex-wrap gap-2 justify-content-center mt-2" id="row_remarks_toggles_arc">
<button type="button" class="btn btn-success btn-sm px-3 active" id="btn_cmp_arc" aria-pressed="true">CMP</button>
<button type="button" class="btn btn-success btn-sm px-3 active" id="btn_e911_arc" aria-pressed="true">E-911</button>
<button type="button" class="btn btn-success btn-sm px-3 active" id="btn_rem_arc" aria-pressed="true">REM</button>
<button type="button" class="btn btn-success btn-sm px-3 active" id="btn_unt_arc" aria-pressed="true">UNT</button>
</div>
</div>
</div>
</div>
<!-- Remarks table (scrolls with page) -->
<div class="card border-0 shadow-sm">
<div class="card-body p-0">
<div id="tbl_remarks_arc"></div>
</div>
</div>
</div>
<button id="btn_complaint_view_on_map_arc"
type="button"
class="btn btn-primary btn-sm shadow position-fixed"
style="right: 15px; bottom: 25px; z-index: 1040;">
Map
</button>
</div>
unit View.ComplaintArchive;
interface
uses
System.SysUtils, System.Classes, JS, Web,
WEBLib.Graphics, WEBLib.Controls, WEBLib.Forms, WEBLib.Dialogs,
Vcl.Controls, Vcl.StdCtrls, Data.DB,
WEBLib.StdCtrls, WEBLib.Grids, WEBLib.DBCtrls, WEBLib.DB,
XData.Web.Client, XData.Web.JsonDataset, XData.Web.Dataset,
ConnectionModule;
type
TFViewComplaintArchive = class(TWebForm)
tblRemarksArc: TWebDBTableControl;
xdwcComplaintArchive: TXDataWebClient;
xdwdsRemarksArc: TXDataWebDataSet;
xdwdsRemarksArcMemoId: TStringField;
xdwdsRemarksArcCFSId: TStringField;
xdwdsRemarksArcMemoType: TStringField;
xdwdsRemarksArcTimestamp: TStringField;
xdwdsRemarksArcBadgeNumber: TStringField;
xdwdsRemarksArcRemarks: TStringField;
wdsRemarksArc: TWebDataSource;
btnUntArc: TWebButton;
btnREMArc: TWebButton;
btnE911Arc: TWebButton;
btnCmpArc: TWebButton;
btnComplaintViewOnMapArc: TWebButton;
procedure WebFormCreate(Sender: TObject);
procedure btnCmpArcClick(Sender: TObject);
procedure btnE911ArcClick(Sender: TObject);
procedure btnREMArcClick(Sender: TObject);
procedure btnUntArcClick(Sender: TObject);
procedure btnComplaintViewOnMapArcClick(Sender: TObject);
private
FComplaintId: string;
FCfsId: string;
FAllMemos: TJSArray;
FShowCMP: Boolean;
FShowE911: Boolean;
FShowREM: Boolean;
FShowUNT: Boolean;
procedure WireUi;
procedure SetTextById(const Id, Value: string);
procedure SetHiddenById(const Id: string; Hidden: Boolean);
procedure SetButtonActive(aButton: TWebButton; Active: Boolean);
[async] procedure LoadArchiveAsync;
[async] procedure LoadMemosAsync;
procedure ApplyMemoFilters;
function GetMemoTypeCode(const MemoType: string): string;
function MemoTypeLabel(const MemoType: string): string;
public
class function CreateForm(const AHostId, AComplaintId: string): TFViewComplaintArchive;
end;
implementation
uses
View.Main;
{$R *.dfm}
class function TFViewComplaintArchive.CreateForm(const AHostId, AComplaintId: string): TFViewComplaintArchive;
begin
Result := TFViewComplaintArchive(inherited CreateNew(AHostId));
Result.FComplaintId := AComplaintId;
end;
procedure TFViewComplaintArchive.WebFormCreate(Sender: TObject);
begin
FAllMemos := nil;
FShowCMP := True;
FShowE911 := True;
FShowREM := True;
FShowUNT := True;
WireUi;
LoadArchiveAsync;
end;
procedure TFViewComplaintArchive.WireUi;
begin
// Nothing required here beyond component OnClick handlers;
// all element IDs are bound via the DFM.
end;
procedure TFViewComplaintArchive.SetTextById(const Id, Value: string);
var
el: TJSElement;
begin
el := Document.getElementById(Id);
if el <> nil then
el.innerHTML := Value;
end;
procedure TFViewComplaintArchive.SetHiddenById(const Id: string; Hidden: Boolean);
var
el: TJSHTMLElement;
begin
el := TJSHTMLElement(Document.getElementById(Id));
if el = nil then
Exit;
if Hidden then
el.classList.add('d-none')
else
el.classList.remove('d-none');
end;
procedure TFViewComplaintArchive.SetButtonActive(aButton: TWebButton; Active: Boolean);
var
el: TJSHTMLElement;
begin
if (aButton = nil) or (aButton.ElementHandle = nil) then
Exit;
el := TJSHTMLElement(aButton.ElementHandle);
if Active then
begin
el.classList.add('active');
el.setAttribute('aria-pressed', 'true');
end
else
begin
el.classList.remove('active');
el.setAttribute('aria-pressed', 'false');
end;
end;
[async] procedure TFViewComplaintArchive.LoadArchiveAsync;
var
resp: TXDataClientResponse;
rootObj: TJSObject;
dataObj: TJSObject;
business: string;
begin
resp := await(xdwcComplaintArchive.RawInvokeAsync('IApiService.GetComplaintArchiveDetails', [FComplaintId]));
rootObj := TJSObject(resp.Result);
dataObj := TJSObject(rootObj['data']);
// Summary title (optional)
SetTextById('lbl_summary_title_arc', 'Summary');
SetTextById('lbl_priority_arc', string(dataObj['Priority']));
SetTextById('lbl_dispatch_code_arc', string(dataObj['DispatchCodeDesc']));
SetTextById('lbl_dispatch_district_arc', string(dataObj['DispatchDistrict']));
SetTextById('lbl_address_arc', string(dataObj['Address']));
business := string(dataObj['Business']);
if business <> '' then
begin
SetTextById('lbl_business_arc', business);
SetHiddenById('row_business_arc', False);
end
else
SetHiddenById('row_business_arc', True);
// Status: same logic style as details; simplest is derive from timestamps if you want,
// but archive view can just show blank unless you prefer the full logic.
// If your archive endpoint includes a computed Status, you can display it directly.
if dataObj.hasOwnProperty('Status') then
SetTextById('lbl_status_arc', string(dataObj['Status']))
else
SetTextById('lbl_status_arc', '');
// CFSId is needed for memos
FCfsId := string(dataObj['CFSId']);
await(LoadMemosAsync);
end;
function TFViewComplaintArchive.MemoTypeLabel(const MemoType: string): string;
var
c: string;
begin
c := GetMemoTypeCode(MemoType);
if c = 'CMP' then Exit('CMP');
if c = 'E911' then Exit('E-911');
if c = 'REM' then Exit('REM');
if c = 'UNT' then Exit('UNT');
Result := MemoType;
end;
function TFViewComplaintArchive.GetMemoTypeCode(const MemoType: string): string;
var
mt: string;
begin
mt := LowerCase(Trim(MemoType));
// Match whatever your server returns in GetComplaintMemos:
// Keep these mappings aligned with ComplaintDetails.
if (mt = 'cmp') or (mt = 'complaint') then Exit('CMP');
if (mt = 'e-911') or (mt = 'e911') then Exit('E911');
if (mt = 'rem') or (mt = 'remarks') then Exit('REM');
if (mt = 'unt') or (mt = 'unit') then Exit('UNT');
Result := UpperCase(mt);
end;
[async] procedure TFViewComplaintArchive.LoadMemosAsync;
var
resp: TXDataClientResponse;
rootObj: TJSObject;
dataArr: TJSArray;
i: Integer;
memoObj: TJSObject;
memoType: string;
begin
// Reset dataset
xdwdsRemarksArc.Close;
resp := await(xdwcComplaintArchive.RawInvokeAsync('IApiService.GetComplaintMemos', [FCfsId]));
rootObj := TJSObject(resp.Result);
dataArr := TJSArray(rootObj['data']);
// Save master array for filtering
FAllMemos := dataArr;
// Add/normalize memo type label/code (client-side)
for i := 0 to dataArr.length - 1 do
begin
memoObj := TJSObject(dataArr[i]);
memoType := string(memoObj['MemoType']);
memoObj['MemoTypeCode'] := GetMemoTypeCode(memoType);
memoObj['MemoType'] := MemoTypeLabel(memoType);
end;
ApplyMemoFilters;
end;
procedure TFViewComplaintArchive.ApplyMemoFilters;
var
filtered: TJSArray;
i: Integer;
memoObj: TJSObject;
code: string;
ok: Boolean;
begin
if FAllMemos = nil then
Exit;
filtered := TJSArray.new;
for i := 0 to FAllMemos.length - 1 do
begin
memoObj := TJSObject(FAllMemos[i]);
code := string(memoObj['MemoTypeCode']);
ok := False;
if (code = 'CMP') and FShowCMP then ok := True;
if (code = 'E911') and FShowE911 then ok := True;
if (code = 'REM') and FShowREM then ok := True;
if (code = 'UNT') and FShowUNT then ok := True;
if ok then
filtered.push(memoObj);
end;
xdwdsRemarksArc.SetJsonData(filtered);
xdwdsRemarksArc.Open;
end;
procedure TFViewComplaintArchive.btnCmpArcClick(Sender: TObject);
begin
FShowCMP := not FShowCMP;
SetButtonActive(btnCmpArc, FShowCMP);
ApplyMemoFilters;
end;
procedure TFViewComplaintArchive.btnE911ArcClick(Sender: TObject);
begin
FShowE911 := not FShowE911;
SetButtonActive(btnE911Arc, FShowE911);
ApplyMemoFilters;
end;
procedure TFViewComplaintArchive.btnREMArcClick(Sender: TObject);
begin
FShowREM := not FShowREM;
SetButtonActive(btnREMArc, FShowREM);
ApplyMemoFilters;
end;
procedure TFViewComplaintArchive.btnUntArcClick(Sender: TObject);
begin
FShowUNT := not FShowUNT;
SetButtonActive(btnUntArc, FShowUNT);
ApplyMemoFilters;
end;
procedure TFViewComplaintArchive.btnComplaintViewOnMapArcClick(Sender: TObject);
begin
if Assigned(FViewMain) then
FViewMain.ShowMapFocusComplaint(FComplaintId);
end;
end.
...@@ -113,7 +113,7 @@ object FViewComplaintDetails: TFViewComplaintDetails ...@@ -113,7 +113,7 @@ object FViewComplaintDetails: TFViewComplaintDetails
Top = 196 Top = 196
Width = 191 Width = 191
Height = 147 Height = 147
ElementId = 'tbl_remarks' ElementId = 'tbl_remarks_arc'
BorderColor = clSilver BorderColor = clSilver
ChildOrder = 8 ChildOrder = 8
ElementFont = efCSS ElementFont = efCSS
...@@ -375,12 +375,12 @@ object FViewComplaintDetails: TFViewComplaintDetails ...@@ -375,12 +375,12 @@ object FViewComplaintDetails: TFViewComplaintDetails
end end
object xdwcComplaintDetails: TXDataWebClient object xdwcComplaintDetails: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 378 Left = 384
Top = 424 Top = 422
end end
object xdwdsRemarks: TXDataWebDataSet object xdwdsRemarks: TXDataWebDataSet
Left = 40 Left = 40
Top = 350 Top = 348
object xdwdsRemarksMemoId: TStringField object xdwdsRemarksMemoId: TStringField
FieldName = 'MemoId' FieldName = 'MemoId'
end end
...@@ -402,12 +402,15 @@ object FViewComplaintDetails: TFViewComplaintDetails ...@@ -402,12 +402,15 @@ object FViewComplaintDetails: TFViewComplaintDetails
end end
object wdsRemarks: TWebDataSource object wdsRemarks: TWebDataSource
DataSet = xdwdsRemarks DataSet = xdwdsRemarks
Left = 126 Left = 128
Top = 350 Top = 348
end end
object xdwdsHistory: TXDataWebDataSet object xdwdsHistory: TXDataWebDataSet
Left = 238 Left = 238
Top = 348 Top = 348
object xdwdsHistoryComplaintId: TStringField
FieldName = 'ComplaintId'
end
object xdwdsHistoryComplaint: TStringField object xdwdsHistoryComplaint: TStringField
FieldName = 'Complaint' FieldName = 'Complaint'
end end
...@@ -427,11 +430,11 @@ object FViewComplaintDetails: TFViewComplaintDetails ...@@ -427,11 +430,11 @@ object FViewComplaintDetails: TFViewComplaintDetails
object wdsHistory: TWebDataSource object wdsHistory: TWebDataSource
DataSet = xdwdsHistory DataSet = xdwdsHistory
Left = 328 Left = 328
Top = 350 Top = 348
end end
object xdwdsContacts: TXDataWebDataSet object xdwdsContacts: TXDataWebDataSet
Left = 438 Left = 438
Top = 350 Top = 348
object xdwdsContactsName: TStringField object xdwdsContactsName: TStringField
FieldName = 'Name' FieldName = 'Name'
end end
...@@ -447,12 +450,12 @@ object FViewComplaintDetails: TFViewComplaintDetails ...@@ -447,12 +450,12 @@ object FViewComplaintDetails: TFViewComplaintDetails
end end
object wdsContacts: TWebDataSource object wdsContacts: TWebDataSource
DataSet = xdwdsContacts DataSet = xdwdsContacts
Left = 530 Left = 532
Top = 350 Top = 348
end end
object xdwdsWarnings: TXDataWebDataSet object xdwdsWarnings: TXDataWebDataSet
Left = 612 Left = 612
Top = 424 Top = 422
object xdwdsWarningsCodeDesc: TStringField object xdwdsWarningsCodeDesc: TStringField
FieldName = 'CodeDesc' FieldName = 'CodeDesc'
end end
...@@ -466,6 +469,6 @@ object FViewComplaintDetails: TFViewComplaintDetails ...@@ -466,6 +469,6 @@ object FViewComplaintDetails: TFViewComplaintDetails
object wdsWarnings: TWebDataSource object wdsWarnings: TWebDataSource
DataSet = xdwdsWarnings DataSet = xdwdsWarnings
Left = 712 Left = 712
Top = 424 Top = 422
end end
end end
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<button id="btn_complaint_view_on_map" <button id="btn_complaint_view_on_map"
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: 15px; bottom: 25px; z-index: 1040;">
Map Map
</button> </button>
</div> </div>
......
...@@ -54,6 +54,7 @@ type ...@@ -54,6 +54,7 @@ type
btnUnt: TWebButton; btnUnt: TWebButton;
lstWarnings: TWebDBListControl; lstWarnings: TWebDBListControl;
btnComplaintViewOnMap: TWebButton; btnComplaintViewOnMap: TWebButton;
xdwdsHistoryComplaintId: TStringField;
procedure btnRemarksClick(Sender: TObject); procedure btnRemarksClick(Sender: TObject);
procedure btnHistoryClick(Sender: TObject); procedure btnHistoryClick(Sender: TObject);
...@@ -560,6 +561,7 @@ begin ...@@ -560,6 +561,7 @@ begin
rootObj := TJSObject(resp.Result); rootObj := TJSObject(resp.Result);
dataObj := TJSObject(rootObj['data']); dataObj := TJSObject(rootObj['data']);
complaintText := string(dataObj['Complaint']); complaintText := string(dataObj['Complaint']);
priorityText := string(dataObj['Priority']); priorityText := string(dataObj['Priority']);
dispatchDescText := string(dataObj['DispatchCodeDesc']); dispatchDescText := string(dataObj['DispatchCodeDesc']);
......
...@@ -158,65 +158,43 @@ object FViewMain: TFViewMain ...@@ -158,65 +158,43 @@ object FViewMain: TFViewMain
TabOrder = 6 TabOrder = 6
end end
object pnlUnits: TWebPanel object pnlUnits: TWebPanel
Left = 752 Left = 740
Top = 114 Top = 180
Width = 227 Width = 227
Height = 139 Height = 139
ElementID = 'pnl_units' ElementID = 'pnl_units'
ChildOrder = 3 ChildOrder = 3
TabOrder = 7 TabOrder = 7
object btnUnitsModalClose: TWebButton
Left = 190
Top = 8
Width = 28
Height = 23
ElementID = 'btn_units_modal_close'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
end end
object pnlComplaints: TWebPanel object pnlComplaints: TWebPanel
Left = 752 Left = 740
Top = 268 Top = 346
Width = 227 Width = 227
Height = 145 Height = 145
ElementID = 'pnl_complaints' ElementID = 'pnl_complaints'
ChildOrder = 3 ChildOrder = 3
TabOrder = 8 TabOrder = 8
object btnComplaintsModalClose: TWebButton
Left = 192
Top = 10
Width = 28
Height = 23
ElementID = 'btn_complaints_modal_close'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
end end
object pnlDetails: TWebPanel object pnlDetails: TWebPanel
Left = 992 Left = 992
Top = 195 Top = 277
Width = 163 Width = 163
Height = 114 Height = 114
ElementID = 'pnl_details' ElementID = 'pnl_details'
ChildOrder = 15 ChildOrder = 15
ElementFont = efCSS ElementFont = efCSS
TabOrder = 9 TabOrder = 9
object WebButton1: TWebButton object btnDetailsModalClose: TWebButton
Left = 127 Left = 127
Top = 8 Top = 8
Width = 28 Width = 28
Height = 23 Height = 23
ElementClassName = 'btn btn-light' ElementID = 'btn_details_modal_close'
ElementID = 'btn_units_modal_close'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnDetailsModalCloseClick
end end
end end
object xdwcBadgeCounts: TXDataWebClient object xdwcBadgeCounts: TXDataWebClient
......
...@@ -19,41 +19,14 @@ ...@@ -19,41 +19,14 @@
<!-- Main content: fills space between navbars --> <!-- Main content: fills space between navbars -->
<div id="pnl_main" class="flex-grow-1 position-relative p-0 overflow-hidden d-none" style="min-height:0;"></div> <div id="pnl_main" class="flex-grow-1 position-relative p-0 overflow-hidden d-none" style="min-height:0;"></div>
<div id="pnl_map" class="flex-grow-1 position-relative p-0 overflow-hidden" style="min-height:0;"></div> <div id="pnl_map" class="flex-grow-1 position-relative p-0 overflow-hidden" style="min-height:0;"></div>
<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>
<!-- Units modal (panel kept as-is; now acts as modal backdrop container) -->
<div id="pnl_units"
class="position-fixed top-0 start-0 w-100 d-none d-flex justify-content-center align-items-center"
style="height: calc(100% - var(--bottom-nav-h)); background: rgba(0,0,0,0.5); z-index:1050;">
<div class="card shadow-lg w-100 mx-2 d-flex flex-column" style="max-width: 96vw; height: 96%;">
<div class="card-header d-flex align-items-center justify-content-between">
<h5 class="card-title mb-0">Units</h5>
<button id="btn_units_modal_close" type="button" class="btn-close" aria-label="Close"></button>
</div>
<div class="card-body p-0 flex-grow-1 overflow-hidden" style="min-height:0;">
<div id="pnl_units_host" class="h-100"></div>
</div>
</div>
</div>
<!-- Complaints modal (panel kept as-is; now acts as modal backdrop container) -->
<div id="pnl_complaints"
class="position-fixed top-0 start-0 w-100 d-none d-flex justify-content-center align-items-center"
style="height: calc(100% - var(--bottom-nav-h)); background: rgba(0,0,0,0.5); z-index:1050;">
<div class="card shadow-lg w-100 mx-2 d-flex flex-column" style="max-width: 96vw; height: 96%;">
<div class="card-header d-flex align-items-center justify-content-between">
<h5 class="card-title mb-0">Complaints</h5>
<button id="btn_complaints_modal_close" type="button" class="btn-close" aria-label="Close"></button>
</div>
<div class="card-body p-0 flex-grow-1 overflow-hidden" style="min-height:0;">
<div id="pnl_complaints_host" class="h-100"></div>
</div>
</div>
</div>
<!-- Details modal (new panel pnl_details) --> <!-- Details modal (new panel pnl_details) -->
<div id="pnl_details" <div id="pnl_details"
class="position-fixed top-0 start-0 w-100 d-none d-flex justify-content-center align-items-center" class="position-fixed top-0 start-0 w-100 h-100 d-none d-flex justify-content-center align-items-center"
style="height: calc(100% - var(--bottom-nav-h)); background: rgba(0,0,0,0.5); z-index:1060;"> style="background: rgba(0,0,0,0.5); z-index:1060;">
<div class="card shadow-lg w-100 mx-2 d-flex flex-column" style="max-width: 98vw; height: 96%;"> <div class="card shadow-lg w-100 mx-2 d-flex flex-column" style="max-width: 98vw; height: 96%;">
<div class="card-header d-flex align-items-center justify-content-between"> <div class="card-header d-flex align-items-center justify-content-between">
<h5 class="card-title mb-0" id="lbl_details_title">Details</h5> <h5 class="card-title mb-0" id="lbl_details_title">Details</h5>
......
...@@ -29,9 +29,7 @@ type ...@@ -29,9 +29,7 @@ type
pnlComplaints: TWebPanel; pnlComplaints: TWebPanel;
tmrGlobalRefresh: TWebTimer; tmrGlobalRefresh: TWebTimer;
pnlDetails: TWebPanel; pnlDetails: TWebPanel;
btnUnitsModalClose: TWebButton; btnDetailsModalClose: TWebButton;
btnComplaintsModalClose: TWebButton;
WebButton1: TWebButton;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure mnuLogoutClick(Sender: TObject); procedure mnuLogoutClick(Sender: TObject);
procedure wllblLogoutClick(Sender: TObject); procedure wllblLogoutClick(Sender: TObject);
...@@ -40,6 +38,7 @@ type ...@@ -40,6 +38,7 @@ type
procedure btnMapClick(Sender: TObject); procedure btnMapClick(Sender: TObject);
procedure tmrBadgeCountsTimer(Sender: TObject); procedure tmrBadgeCountsTimer(Sender: TObject);
procedure tmrGlobalRefreshTimer(Sender: TObject); procedure tmrGlobalRefreshTimer(Sender: TObject);
procedure btnDetailsModalCloseClick(Sender: TObject);
private private
{ Private declarations } { Private declarations }
FUserInfo: string; FUserInfo: string;
...@@ -53,10 +52,7 @@ type ...@@ -53,10 +52,7 @@ type
procedure ShowUnitDetails(UnitId: string); procedure ShowUnitDetails(UnitId: string);
procedure SetHeaderTitle(const title: string); procedure SetHeaderTitle(const title: string);
procedure HideDetailsModal; procedure HideDetailsModal;
procedure HideListModals;
procedure ShowComplaintsModal;
procedure ShowDetailsModal(const titleText: string); procedure ShowDetailsModal(const titleText: string);
procedure ShowUnitsModal;
type TActivePanel = (apNone, apMap, apUnits, apComplaints); type TActivePanel = (apNone, apMap, apUnits, apComplaints);
var var
...@@ -102,8 +98,6 @@ uses ...@@ -102,8 +98,6 @@ uses
{$R *.dfm} {$R *.dfm}
const const
UNITS_HOST_ID = 'pnl_units_host';
COMPLAINTS_HOST_ID = 'pnl_complaints_host';
DETAILS_HOST_ID = 'pnl_details_host'; DETAILS_HOST_ID = 'pnl_details_host';
procedure TFViewMain.WebFormCreate(Sender: TObject); procedure TFViewMain.WebFormCreate(Sender: TObject);
...@@ -126,12 +120,11 @@ begin ...@@ -126,12 +120,11 @@ begin
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
// ensure map exists and is visible under everything HidePanel(pnlMain);
ShowPanel(pnlMap); ShowPanel(pnlMap);
HidePanel(pnlUnits); HidePanel(pnlUnits);
HidePanel(pnlComplaints); HidePanel(pnlComplaints);
HidePanel(pnlDetails); HidePanel(pnlDetails);
HidePanel(pnlMain);
if not Assigned(FMapForm) then if not Assigned(FMapForm) then
begin begin
...@@ -184,7 +177,7 @@ begin ...@@ -184,7 +177,7 @@ begin
case panel of case panel of
apMap: apMap:
if Assigned(FMapForm) then if Assigned(FMapForm) then
FMapForm.RefreshData; // ADD THIS DELETE BEFORE DEPLOY FMapForm.RefreshData;
apUnits: apUnits:
if Assigned(FUnitsForm) then if Assigned(FUnitsForm) then
...@@ -233,21 +226,24 @@ end; ...@@ -233,21 +226,24 @@ end;
procedure TFViewMain.btnComplaintsClick(Sender: TObject); procedure TFViewMain.btnComplaintsClick(Sender: TObject);
begin begin
ShowComplaintsModal; ShowForm(TFViewComplaints);
end; end;
procedure TFViewMain.btnDetailsModalCloseClick(Sender: TObject);
begin
HideDetailsModal;
end;
procedure TFViewMain.btnMapClick(Sender: TObject); procedure TFViewMain.btnMapClick(Sender: TObject);
begin begin
HideListModals; ShowForm(TFViewMap);
SetHeaderTitle('Map');
SetActiveNavButton('view.main.btnmap');
end; end;
procedure TFViewMain.btnUnitsClick(Sender: TObject); procedure TFViewMain.btnUnitsClick(Sender: TObject);
begin begin
ShowUnitsModal; ShowForm(TFViewUnits);
end; end;
...@@ -262,31 +258,80 @@ end; ...@@ -262,31 +258,80 @@ end;
procedure TFViewMain.ShowForm(AFormClass: TWebFormClass); procedure TFViewMain.ShowForm(AFormClass: TWebFormClass);
begin begin
HideDetailsModal;
if AFormClass = TFViewMap then if AFormClass = TFViewMap then
begin begin
HideListModals; ShowPanel(pnlMap);
HidePanel(pnlUnits);
HidePanel(pnlComplaints);
HidePanel(pnlMain);
SetHeaderTitle('Map');
SetActiveNavButton('view.main.btnmap');
SetActivePanel(apMap);
if not Assigned(FMapForm) then
begin
Application.CreateForm(TFViewMap, pnlMap.ElementID, TWebForm(FMapForm));
MarkPanelCreatedUpToDate(apMap);
end
else
RefreshPanelIfNeeded(apMap);
Exit; Exit;
end; end;
if AFormClass = TFViewUnits then if AFormClass = TFViewUnits then
begin begin
ShowUnitsModal; HidePanel(pnlMap);
ShowPanel(pnlUnits);
HidePanel(pnlComplaints);
HidePanel(pnlMain);
SetHeaderTitle('Units');
SetActiveNavButton('view.main.btnunits');
SetActivePanel(apUnits);
if not Assigned(FUnitsForm) then
begin
Application.CreateForm(TFViewUnits, pnlUnits.ElementID, TWebForm(FUnitsForm));
MarkPanelCreatedUpToDate(apUnits);
end
else
RefreshPanelIfNeeded(apUnits);
Exit; Exit;
end; end;
if AFormClass = TFViewComplaints then if AFormClass = TFViewComplaints then
begin begin
ShowComplaintsModal; HidePanel(pnlMap);
HidePanel(pnlUnits);
ShowPanel(pnlComplaints);
HidePanel(pnlMain);
SetHeaderTitle('Complaints');
SetActiveNavButton('view.main.btncomplaints');
SetActivePanel(apComplaints);
if not Assigned(FComplaintsForm) then
begin
Application.CreateForm(TFViewComplaints, pnlComplaints.ElementID, TWebForm(FComplaintsForm));
MarkPanelCreatedUpToDate(apComplaints);
end
else
RefreshPanelIfNeeded(apComplaints);
Exit; Exit;
end; end;
// everything else (admin/users/etc) can still use pnlMain // everything else (admin/users/etc)
SetActivePanel(apNone); SetActivePanel(apNone);
HidePanel(pnlMap);
HidePanel(pnlUnits); HidePanel(pnlUnits);
HidePanel(pnlComplaints); HidePanel(pnlComplaints);
HidePanel(pnlDetails);
ShowPanel(pnlMain); ShowPanel(pnlMain);
if Assigned(FChildForm) and (FChildForm <> FMapForm) and (FChildForm <> FUnitsForm) and (FChildForm <> FComplaintsForm) then if Assigned(FChildForm) and (FChildForm <> FMapForm) and (FChildForm <> FUnitsForm) and (FChildForm <> FComplaintsForm) then
...@@ -319,9 +364,6 @@ end; ...@@ -319,9 +364,6 @@ end;
procedure TFViewMain.ShowComplaintDetails(ComplaintId: string); procedure TFViewMain.ShowComplaintDetails(ComplaintId: string);
begin begin
// ensure complaints list is visible underneath
ShowComplaintsModal;
ShowDetailsModal('Complaint Details'); ShowDetailsModal('Complaint Details');
if Assigned(FDetailsForm) then if Assigned(FDetailsForm) then
...@@ -332,8 +374,6 @@ end; ...@@ -332,8 +374,6 @@ end;
procedure TFViewMain.ShowUnitDetails(UnitId: string); procedure TFViewMain.ShowUnitDetails(UnitId: string);
begin begin
ShowUnitsModal;
ShowDetailsModal('Unit Details'); ShowDetailsModal('Unit Details');
if Assigned(FDetailsForm) then if Assigned(FDetailsForm) then
...@@ -412,7 +452,7 @@ procedure TFViewMain.ShowMapFocusUnit(const unitId: string); ...@@ -412,7 +452,7 @@ procedure TFViewMain.ShowMapFocusUnit(const unitId: string);
var var
pendingUnitId: string; pendingUnitId: string;
begin begin
HideListModals; ShowForm(TFViewMap);
pendingUnitId := unitId; pendingUnitId := unitId;
...@@ -428,7 +468,7 @@ procedure TFViewMain.ShowMapFocusComplaint(const complaintId: string); ...@@ -428,7 +468,7 @@ procedure TFViewMain.ShowMapFocusComplaint(const complaintId: string);
var var
pendingComplaintId: string; pendingComplaintId: string;
begin begin
HideListModals; ShowForm(TFViewMap);
pendingComplaintId := complaintId; pendingComplaintId := complaintId;
...@@ -454,53 +494,6 @@ begin ...@@ -454,53 +494,6 @@ begin
end; end;
end; end;
procedure TFViewMain.HideListModals;
begin
HidePanel(pnlUnits);
HidePanel(pnlComplaints);
HideDetailsModal;
SetHeaderTitle('Map');
SetActiveNavButton('view.main.btnmap');
SetActivePanel(apMap);
end;
procedure TFViewMain.ShowUnitsModal;
begin
// show units, hide complaints, keep map visible underneath
HidePanel(pnlComplaints);
ShowPanel(pnlUnits);
SetHeaderTitle('Units');
SetActiveNavButton('view.main.btnunits');
SetActivePanel(apUnits);
if not Assigned(FUnitsForm) then
begin
Application.CreateForm(TFViewUnits, UNITS_HOST_ID, TWebForm(FUnitsForm));
MarkPanelCreatedUpToDate(apUnits);
end
else
RefreshPanelIfNeeded(apUnits);
end;
procedure TFViewMain.ShowComplaintsModal;
begin
HidePanel(pnlUnits);
ShowPanel(pnlComplaints);
SetHeaderTitle('Complaints');
SetActiveNavButton('view.main.btncomplaints');
SetActivePanel(apComplaints);
if not Assigned(FComplaintsForm) then
begin
Application.CreateForm(TFViewComplaints, COMPLAINTS_HOST_ID, TWebForm(FComplaintsForm));
MarkPanelCreatedUpToDate(apComplaints);
end
else
RefreshPanelIfNeeded(apComplaints);
end;
procedure TFViewMain.ShowDetailsModal(const titleText: string); procedure TFViewMain.ShowDetailsModal(const titleText: string);
var var
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
<button id="btn_unit_view_on_map" <button id="btn_unit_view_on_map"
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: 15px; bottom: 25px; z-index: 1040;">
Map Map
</button> </button>
</div> </div>
......
...@@ -4,9 +4,6 @@ span.card { ...@@ -4,9 +4,6 @@ span.card {
border: none; border: none;
} }
:root {
--bottom-nav-h: 54px;
}
/* --- Login Screen Styling --- */ /* --- Login Screen Styling --- */
.login-card { .login-card {
......
...@@ -23,7 +23,8 @@ uses ...@@ -23,7 +23,8 @@ uses
View.ErrorPage in 'View.ErrorPage.pas' {FViewErrorPage: TWebForm} {*.html}, View.ErrorPage in 'View.ErrorPage.pas' {FViewErrorPage: TWebForm} {*.html},
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};
{$R *.res} {$R *.res}
......
...@@ -188,6 +188,11 @@ ...@@ -188,6 +188,11 @@
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="uMapFilters.pas"/> <DCCReference Include="uMapFilters.pas"/>
<DCCReference Include="View.ComplaintArchive.pas">
<Form>FViewComplaintArchive</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<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