Commit c0a44280 by Elias Sarraf

Merge remote-tracking branch 'origin/master' into cam2

parents 7005e50c bb05403e
kgOrdersClient/.vscode/
kgOrdersClient/__history/ kgOrdersClient/__history/
kgOrdersClient/__recovery/ kgOrdersClient/__recovery/
kgOrdersClient/TMSWeb kgOrdersClient/TMSWeb/
kgOrdersClient/Win32 kgOrdersClient/Win32/
kgOrdersClient/template/css/__history/ kgOrdersClient/css/__history/
kgOrdersClient/config/__history/
kgOrdersServer/__history kgOrdersServer/__history
kgOrdersServer/__recovery kgOrdersServer/__recovery
kgOrdersServer/doc/
kgOrdersServer/Win32/
kgOrdersServer/*.log kgOrdersServer/*.log
kgOrdersServer/*.txt kgOrdersServer/*.txt
kgOrdersServer/Source/__history kgOrdersServer/doc/
kgOrdersServer/Win32/
kgOrdersServer/Source/__history/
kgOrdersServer/Source/__recovery/ kgOrdersServer/Source/__recovery/
*.local
*.exe *.exe
*.local
*.identcache *.identcache
*.res *.res
*.skincfg
*.tvsconfig *.tvsconfig
...@@ -45,10 +45,6 @@ procedure LoadConfig(LoadProc: TConfigLoadedProc); ...@@ -45,10 +45,6 @@ procedure LoadConfig(LoadProc: TConfigLoadedProc);
if JS.toString(Obj['ApiUrl']) <> '' then if JS.toString(Obj['ApiUrl']) <> '' then
Config.ApiUrl := JS.toString(Obj['ApiUrl']); Config.ApiUrl := JS.toString(Obj['ApiUrl']);
if JS.toString(Obj['AppUrl']) <> '' then
Config.AppUrl := JS.toString(Obj['AppUrl']);
end; end;
finally finally
LoadProc(Config); LoadProc(Config);
......
...@@ -2,7 +2,7 @@ object DMConnection: TDMConnection ...@@ -2,7 +2,7 @@ object DMConnection: TDMConnection
Height = 264 Height = 264
Width = 395 Width = 395
object ApiConnection: TXDataWebConnection object ApiConnection: TXDataWebConnection
URL = 'http://localhost:2004/emsys/envoy/api/' URL = 'http://localhost:2004/emsys/kgOrders/api/'
OnError = ApiConnectionError OnError = ApiConnectionError
OnRequest = ApiConnectionRequest OnRequest = ApiConnectionRequest
OnResponse = ApiConnectionResponse OnResponse = ApiConnectionResponse
...@@ -10,7 +10,7 @@ object DMConnection: TDMConnection ...@@ -10,7 +10,7 @@ object DMConnection: TDMConnection
Top = 80 Top = 80
end end
object AuthConnection: TXDataWebConnection object AuthConnection: TXDataWebConnection
URL = 'http://localhost:2004/emsys/envoycalls/auth/' URL = 'http://localhost:2004/emsys/kgOrders/auth/'
OnError = AuthConnectionError OnError = AuthConnectionError
Left = 48 Left = 48
Top = 16 Top = 16
......
object FAddOrder: TFAddOrder
Width = 871
Height = 477
OnShow = WebFormShow
object WebLabel1: TWebLabel
Left = 278
Top = 44
Width = 35
Height = 15
Caption = 'Search'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 414
Top = 44
Width = 58
Height = 15
Caption = 'Selected ID'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 278
Top = 62
Width = 121
Height = 22
HeightPercent = 100.000000000000000000
Text = 'edtSearch'
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
object edtID: TWebEdit
Left = 414
Top = 62
Width = 69
Height = 22
ChildOrder = 1
HeightPercent = 100.000000000000000000
Text = 'WebEdit1'
WidthPercent = 100.000000000000000000
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 0
Top = 166
Width = 871
Height = 303
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 2
DefaultRowHeight = 40.000000000000000000
FixedColumns = 0
ColumnCount = 4
Options.Bands.Enabled = True
Options.ColumnSize.Stretch = True
Options.Editing.CalcFormat = '%g'
Options.Grouping.CalcFormat = '%g'
Options.Grouping.GroupCountFormat = '(%d)'
Options.IO.XMLEncoding = 'ISO-8859-1'
Options.Mouse.ClickMargin = 0
Options.Mouse.ColumnSizeMargin = 6
Options.Mouse.RowSizeMargin = 6
OnSelectedCell = TMSFNCGrid1SelectedCell
Columns = <
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 70.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 250.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 100.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 432.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 90.000000000000000000
end>
DefaultFont.Charset = DEFAULT_CHARSET
DefaultFont.Color = clWindowText
DefaultFont.Height = -11
DefaultFont.Name = 'Segoe UI'
DefaultFont.Style = []
TopRow = 1
Appearance.FixedLayout.Fill.Color = 16380654
Appearance.FixedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedLayout.Font.Color = 4539717
Appearance.FixedLayout.Font.Height = -13
Appearance.FixedLayout.Font.Name = 'Segoe UI'
Appearance.FixedLayout.Font.Style = [fsBold]
Appearance.NormalLayout.Fill.Color = 16578806
Appearance.NormalLayout.Font.Charset = DEFAULT_CHARSET
Appearance.NormalLayout.Font.Color = 8026746
Appearance.NormalLayout.Font.Height = -11
Appearance.NormalLayout.Font.Name = 'Segoe UI'
Appearance.NormalLayout.Font.Style = []
Appearance.GroupLayout.Fill.Color = 12817262
Appearance.GroupLayout.Font.Charset = DEFAULT_CHARSET
Appearance.GroupLayout.Font.Color = clBlack
Appearance.GroupLayout.Font.Height = -11
Appearance.GroupLayout.Font.Name = 'Segoe UI'
Appearance.GroupLayout.Font.Style = []
Appearance.SummaryLayout.Fill.Color = 14009785
Appearance.SummaryLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SummaryLayout.Font.Color = clBlack
Appearance.SummaryLayout.Font.Height = -11
Appearance.SummaryLayout.Font.Name = 'Segoe UI'
Appearance.SummaryLayout.Font.Style = []
Appearance.SelectedLayout.Fill.Color = 16441019
Appearance.SelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SelectedLayout.Font.Color = 4539717
Appearance.SelectedLayout.Font.Height = -11
Appearance.SelectedLayout.Font.Name = 'Segoe UI'
Appearance.SelectedLayout.Font.Style = []
Appearance.FocusedLayout.Fill.Color = 16039284
Appearance.FocusedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FocusedLayout.Font.Color = 4539717
Appearance.FocusedLayout.Font.Height = -11
Appearance.FocusedLayout.Font.Name = 'Segoe UI'
Appearance.FocusedLayout.Font.Style = []
Appearance.FixedSelectedLayout.Fill.Color = clLightsteelblue
Appearance.FixedSelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedSelectedLayout.Font.Color = clBlack
Appearance.FixedSelectedLayout.Font.Height = -11
Appearance.FixedSelectedLayout.Font.Name = 'Segoe UI'
Appearance.FixedSelectedLayout.Font.Style = []
Appearance.BandLayout.Fill.Color = 16711679
Appearance.BandLayout.Font.Charset = DEFAULT_CHARSET
Appearance.BandLayout.Font.Color = 8026746
Appearance.BandLayout.Font.Height = -11
Appearance.BandLayout.Font.Name = 'Segoe UI'
Appearance.BandLayout.Font.Style = []
Appearance.ProgressLayout.Format = '%.0f%%'
LeftCol = 0
ScrollMode = scmItemScrolling
DesignTimeSampleData = True
end
object cbCorrugatedPlate: TWebCheckBox
Left = 26
Top = 63
Width = 113
Height = 22
Caption = 'Corrugated Plate'
ChildOrder = 3
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = cbCorrugatedPlateClick
end
object cbWebPlate: TWebCheckBox
Left = 152
Top = 64
Width = 83
Height = 22
Caption = 'Web Plate'
ChildOrder = 3
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = cbWebPlateClick
end
object btnCancel: TWebButton
Left = 674
Top = 61
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object btnConfirm: TWebButton
Left = 554
Top = 61
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 728
Top = 109
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 600
Top = 109
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object xdwdsCustomersADDRESS: TStringField
FieldName = 'ADDRESS'
Size = 100
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 470
Top = 109
end
end
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>TMS Web Project</title>
<style>
</style>
</head>
<body>
</body>
</html>
\ No newline at end of file
unit View.AddOrder;
interface
uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, VCL.TMSFNCTypes, VCL.TMSFNCUtils,
VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCGridCell,
VCL.TMSFNCGridOptions, Vcl.Controls, VCL.TMSFNCCustomControl,
VCL.TMSFNCCustomScrollControl, VCL.TMSFNCGridData, VCL.TMSFNCCustomGrid,
VCL.TMSFNCGrid, Vcl.StdCtrls, WEBLib.StdCtrls, XData.Web.Client, Data.DB,
XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, ConnectionModule;
type
TFAddOrder = class(TWebForm)
edtSearch: TWebEdit;
edtID: TWebEdit;
TMSFNCGrid1: TTMSFNCGrid;
cbCorrugatedPlate: TWebCheckBox;
cbWebPlate: TWebCheckBox;
btnCancel: TWebButton;
btnConfirm: TWebButton;
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersNAME: TStringField;
xdwdsCustomersSHORT_NAME: TStringField;
wdsCustomers: TWebDataSource;
xdwdsCustomersADDRESS: TStringField;
procedure WebFormShow(Sender: TObject);
procedure TMSFNCGrid1SelectedCell(Sender: TObject; ACol, ARow: Integer);
procedure edtSearchChange(Sender: TObject);
procedure cbCorrugatedPlateClick(Sender: TObject);
procedure cbWebPlateClick(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
private
[async] procedure getCustomers;
procedure PopulateGridManually;
procedure ApplyFilter;
{ Private declarations }
public
{ Public declarations }
end;
var
FAddOrder: TFAddOrder;
implementation
{$R *.dfm}
procedure TFAddOrder.btnCancelClick(Sender: TObject);
begin
edtID.Text := '';
Close;
end;
procedure TFAddOrder.btnConfirmClick(Sender: TObject);
begin
Close;
end;
procedure TFAddOrder.WebFormShow(Sender: TObject);
begin
getCustomers();
end;
procedure TFAddOrder.cbCorrugatedPlateClick(Sender: TObject);
begin
cbWebPlate.Checked := False;
end;
procedure TFAddOrder.cbWebPlateClick(Sender: TObject);
begin
cbCorrugatedPlate.Checked := False;
end;
procedure TFAddOrder.edtSearchChange(Sender: TObject);
begin
ApplyFilter;
end;
[async] procedure TFAddOrder.getCustomers();
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
begin
// Fetch data from XData service
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomers', []));
customerList := TJSObject(xdcResponse.Result);
// Load data into TXDataWebDataset
xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList['data']);
xdwdsCustomers.Open;
// Manually populate the grid
PopulateGridManually;
end;
procedure TFAddOrder.PopulateGridManually;
var
RowIndex: Integer;
begin
TMSFNCGrid1.BeginUpdate;
try
TMSFNCGrid1.Clear; // Clear any existing data
// Set up column headers
TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'ID';
TMSFNCGrid1.Cells[1, 0] := 'Short Name';
TMSFNCGrid1.Cells[2, 0] := 'Name';
TMSFNCGrid1.Cells[3, 0] := 'Address';
// TMSFNCGrid1.ColumnWidths[0] := 40;
// TMSFNCGrid1.ColumnWidths[1] := 80;
// TMSFNCGrid1.ColumnWidths[2] := 250;
// Populate the grid with data from the dataset
xdwdsCustomers.First;
RowIndex := 1;
while not xdwdsCustomers.EOF do
begin
TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('ID').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('SHORT_NAME').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('NAME').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('ADDRESS').AsString;
Inc(RowIndex);
xdwdsCustomers.Next;
end;
finally
TMSFNCGrid1.EndUpdate;
end;
end;
procedure TFAddOrder.TMSFNCGrid1SelectedCell(Sender: TObject; ACol,
ARow: Integer);
begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow];
end;
procedure TFAddOrder.ApplyFilter;
var
fd: TTMSFNCGridFilterData;
i: Integer;
SearchText: string;
begin
SearchText := Trim(edtSearch.Text);
TMSFNCGrid1.RemoveFilter;
TMSFNCGrid1.Filter.Clear;
// match on first 3 columns
for i := 0 to 2 do
begin
fd := TMSFNCGrid1.Filter.Add;
fd.Column := i;
fd.Condition := '*' + SearchText + '*'; // Match text anywhere in the cell
fd.CaseSensitive := False; // Make the filter case-insensitive
// Use foOR for "match any column" logic
if i > 0 then
fd.Operation := foOR
else
fd.Operation := foNONE; // First filter has no logical operation
end;
// Apply the filters to the grid
TMSFNCGrid1.ApplyFilter;
end;
end.
\ No newline at end of file
object FAddOrder: TFAddOrder
Width = 894
Height = 633
Align = alClient
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
OnShow = WebFormShow
object cbWebPlate: TWebCheckBox
Left = 172
Top = 55
Width = 113
Height = 22
Caption = 'Web Plate'
ChildOrder = 5
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = cbWebPlateClick
end
object cbCorrugatedPlate: TWebCheckBox
Left = 40
Top = 55
Width = 113
Height = 22
Caption = 'Corrugated Plate'
Checked = True
ChildOrder = 5
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
State = cbChecked
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = cbCorrugatedPlateClick
end
object edtSearch: TWebEdit
Left = 306
Top = 55
Width = 146
Height = 22
ChildOrder = 8
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
object edtID: TWebEdit
Left = 475
Top = 55
Width = 121
Height = 22
ChildOrder = 8
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 612
Top = 52
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 9
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 730
Top = 52
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 9
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 0
Top = 220
Width = 894
Height = 413
Align = alBottom
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 6
DefaultRowHeight = 40.000000000000000000
FixedColumns = 0
ColumnCount = 3
Options.Bands.Enabled = True
Options.ColumnSize.Stretch = True
Options.Editing.CalcFormat = '%g'
Options.Grouping.CalcFormat = '%g'
Options.Grouping.GroupCountFormat = '(%d)'
Options.IO.XMLEncoding = 'ISO-8859-1'
Options.Mouse.ClickMargin = 0
Options.Mouse.ColumnSizeMargin = 6
Options.Mouse.RowSizeMargin = 6
Columns = <
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 327.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 327.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 239.000000000000000000
end>
DefaultFont.Charset = DEFAULT_CHARSET
DefaultFont.Color = clWindowText
DefaultFont.Height = -11
DefaultFont.Name = 'Segoe UI'
DefaultFont.Style = []
TopRow = 1
Appearance.FixedLayout.Fill.Color = 16380654
Appearance.FixedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedLayout.Font.Color = 4539717
Appearance.FixedLayout.Font.Height = -13
Appearance.FixedLayout.Font.Name = 'Segoe UI'
Appearance.FixedLayout.Font.Style = [fsBold]
Appearance.NormalLayout.Fill.Color = 16578806
Appearance.NormalLayout.Font.Charset = DEFAULT_CHARSET
Appearance.NormalLayout.Font.Color = 8026746
Appearance.NormalLayout.Font.Height = -11
Appearance.NormalLayout.Font.Name = 'Segoe UI'
Appearance.NormalLayout.Font.Style = []
Appearance.GroupLayout.Fill.Color = 12817262
Appearance.GroupLayout.Font.Charset = DEFAULT_CHARSET
Appearance.GroupLayout.Font.Color = clBlack
Appearance.GroupLayout.Font.Height = -11
Appearance.GroupLayout.Font.Name = 'Segoe UI'
Appearance.GroupLayout.Font.Style = []
Appearance.SummaryLayout.Fill.Color = 14009785
Appearance.SummaryLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SummaryLayout.Font.Color = clBlack
Appearance.SummaryLayout.Font.Height = -11
Appearance.SummaryLayout.Font.Name = 'Segoe UI'
Appearance.SummaryLayout.Font.Style = []
Appearance.SelectedLayout.Fill.Color = 16441019
Appearance.SelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SelectedLayout.Font.Color = 4539717
Appearance.SelectedLayout.Font.Height = -11
Appearance.SelectedLayout.Font.Name = 'Segoe UI'
Appearance.SelectedLayout.Font.Style = []
Appearance.FocusedLayout.Fill.Color = 16039284
Appearance.FocusedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FocusedLayout.Font.Color = 4539717
Appearance.FocusedLayout.Font.Height = -11
Appearance.FocusedLayout.Font.Name = 'Segoe UI'
Appearance.FocusedLayout.Font.Style = []
Appearance.FixedSelectedLayout.Fill.Color = clLightsteelblue
Appearance.FixedSelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedSelectedLayout.Font.Color = clBlack
Appearance.FixedSelectedLayout.Font.Height = -11
Appearance.FixedSelectedLayout.Font.Name = 'Segoe UI'
Appearance.FixedSelectedLayout.Font.Style = []
Appearance.BandLayout.Fill.Color = 16711679
Appearance.BandLayout.Font.Charset = DEFAULT_CHARSET
Appearance.BandLayout.Font.Color = 8026746
Appearance.BandLayout.Font.Height = -11
Appearance.BandLayout.Font.Name = 'Segoe UI'
Appearance.BandLayout.Font.Style = []
Appearance.ProgressLayout.Format = '%.0f%%'
LeftCol = 0
ScrollMode = scmItemScrolling
DesignTimeSampleData = True
ExplicitWidth = 982
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 370
Top = 562
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 206
Top = 564
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 38
Top = 562
end
end
...@@ -128,7 +128,11 @@ object FViewMain: TFViewMain ...@@ -128,7 +128,11 @@ object FViewMain: TFViewMain
Width = 471 Width = 471
Height = 369 Height = 369
ElementID = 'main.webpanel' ElementID = 'main.webpanel'
HeightStyle = ssAuto
WidthStyle = ssAuto
ChildOrder = 3 ChildOrder = 3
ElementFont = efCSS
ElementPosition = epIgnore
TabOrder = 0 TabOrder = 0
end end
object WebMessageDlg1: TWebMessageDlg object WebMessageDlg1: TWebMessageDlg
......
...@@ -45,13 +45,13 @@ ...@@ -45,13 +45,13 @@
</div> </div>
</nav> </nav>
<div id="page-wrapper" class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div id="main.webpanel" class="col-12"></div> <div id="main.webpanel" class="col-12"></div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="form-outline mb-4"> <div class="form-outline">
<textarea class="form-control" id="main.debugmemo" rows="4"></textarea> <textarea class="form-control" id="main.debugmemo" rows="4"></textarea>
</div> </div>
</div> </div>
......
object FOrderList: TFOrderList
Width = 1016
Height = 683
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
OnShow = WebFormShow
object lblEntries: TWebLabel
Left = 0
Top = 336
Width = 77
Height = 14
Caption = 'Showing 0 of ...'
ElementID = 'lblentries'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblEntries2: TWebLabel
Left = 8
Top = 358
Width = 49
Height = 14
Caption = 'lblEntries2'
ElementID = 'lblentries2'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 8
Top = 384
Width = 121
Height = 22
HelpType = htKeyword
ChildOrder = 8
ElementClassName = 'form-control'
ElementID = 'edtsearch'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 24
Top = 57
Width = 121
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 1
object lblMessage: TWebLabel
Left = 28
Top = 9
Width = 44
Height = 14
Caption = 'Message'
ElementID = 'pnl_message'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementClassName = 'btn btn-light'
ElementID = 'view.login.message.button'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
end
end
object WebDBTableControl: TWebDBTableControl
Left = 172
Top = 287
Width = 530
Height = 265
ElementClassName = 'table-responsive'
ElementId = 'customer_list'
BorderColor = clSilver
ChildOrder = 5
ColHeader = False
ElementTableClassName = 'table table-striped table-bordered table-hover dataTable'
Options.ResizeColumns = True
Columns = <
item
DataField = 'ID'
Title = 'ID'
Width = 24
end
item
DataField = 'NAME'
Title = 'NAME'
Width = 100
end
item
DataField = 'SHORT_NAME'
Title = 'SHORT_NAME'
end
item
DataField = 'ADDRESS'
Title = 'ADDRESS'
end>
DataSource = wdsCustomers
end
object cbCorrugatedPlate: TWebCheckBox
Left = 172
Top = 210
Width = 113
Height = 22
Caption = 'Corrugated Plate'
Checked = True
ChildOrder = 5
HeightPercent = 100.000000000000000000
State = cbChecked
WidthPercent = 100.000000000000000000
OnClick = cbCorrugatedPlateClick
end
object cbWebPlate: TWebCheckBox
Left = 304
Top = 210
Width = 113
Height = 22
Caption = 'Web Plate'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = cbWebPlateClick
end
object edtCompanyName: TWebEdit
Left = 302
Top = 252
Width = 121
Height = 22
ChildOrder = 7
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtID: TWebEdit
Left = 172
Top = 252
Width = 121
Height = 22
ChildOrder = 8
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 564
Top = 251
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 9
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 88
Top = 434
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 84
Top = 490
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object xdwdsCustomersADDRESS: TStringField
FieldName = 'ADDRESS'
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 38
Top = 562
end
end
<div class="row">
<div class="col-12">
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
<div class="row">
<div class="col-sm">
<div id="pnl_message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
</div>
</div>
<div class="row">
<label id="lblentries"></label>
</div>
<label id="lblentries2"></label>
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center" id="pagination">
<!-- Pagination items will be added dynamically via Delphi code -->
</ul>
</nav>
</div>
</div>
</div>
</div>
unit View.OrderList;
interface
uses
System.SysUtils, System.Generics.Collections, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, WEBLib.Grids,
Vcl.Grids;
type
TFOrderList = class(TWebForm)
lblEntries: TWebLabel;
lblEntries2: TWebLabel;
edtSearch: TWebEdit;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
wdsCustomers: TWebDataSource;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersNAME: TStringField;
xdwdsCustomersSHORT_NAME: TStringField;
xdwdsCustomersADDRESS: TStringField;
WebDBTableControl: TWebDBTableControl;
cbCorrugatedPlate: TWebCheckBox;
cbWebPlate: TWebCheckBox;
edtCompanyName: TWebEdit;
edtID: TWebEdit;
btnConfirm: TWebButton;
procedure WebFormShow(Sender: TObject);
procedure WebDBTableControlGetCellChildren(Sender: TObject; ACol,
ARow: Integer; AField: TField; AValue: string;
AElement: TJSHTMLElementRecord);
procedure cbCorrugatedPlateClick(Sender: TObject);
procedure cbWebPlateClick(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
private
//FJSONProc: TJSONProc;
procedure AddRowToTable();
procedure ClearTable();
[async] procedure getCustomers();
public
class function CreateForm(AElementID: string): TWebForm;
end;
var
FOrderList: TFOrderList;
implementation
{$R *.dfm}
class function TFOrderList.CreateForm(AElementID: string): TWebForm;
begin
Application.CreateForm(TFOrderList, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderList(AForm) do
begin
end;
end
);
end;
procedure TFOrderList.WebDBTableControlGetCellChildren(Sender: TObject; ACol,
ARow: Integer; AField: TField; AValue: string;
AElement: TJSHTMLElementRecord);
begin
//WebDBTableControl.WidthStyle := TSizeStyle.ssAuto;
console.log(AValue);
WebDBTableControl.ColWidths[ACol] := AValue.Length * 12;
end;
procedure TFOrderList.WebFormShow(Sender: TObject);
begin
getCustomers();
end;
procedure TFOrderList.btnConfirmClick(Sender: TObject);
begin
Close;
end;
procedure TFOrderList.cbCorrugatedPlateClick(Sender: TObject);
begin
cbWebPlate.Checked := false;
end;
procedure TFOrderList.cbWebPlateClick(Sender: TObject);
begin
cbCorrugatedPlate.Checked := false;
end;
procedure TFOrderList.ClearTable();
// clears the table
var
tbody: TJSHTMLElement;
begin
tbody := TJSHTMLElement(document.getElementById('tblCustomerGrid').getElementsByTagName('tbody')[0]);
tbody.innerHTML := '';
end;
procedure TFOrderList.getCustomers();
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
data: TJSArray;
i, count: integer;
temp: TJSONObject;
customer: TJSObject;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomers',
[]));
customerList := TJSObject(xdcResponse.Result);
data := TJSArray(customerList['data']);
count := integer(customerList['count']);
xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList['data']);
xdwdsCustomers.Open;
end;
procedure TFOrderList.AddRowToTable();
var
NewRow, Cell, P, Button, Audio: TJSHTMLElement;
ClickHandler: TJSFunction;
//strColorList: string;
id: integer;
begin
NewRow := TJSHTMLElement(document.createElement('tr'));
//NewRow.Attrs['orderType'] := XDataWebDataSet1orderType.Value;
NewRow.addEventListener('click', procedure
begin
//orderEntry(NewRow.Attrs['id'], 'EDIT');
end);
// Company ID Cell
NewRow.Attrs['id'] := xdwdsCustomersID.AsString;
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order ID');
if xdwdsCustomersID.AsString = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersID.AsString;
NewRow.appendChild(Cell);
// Company Name Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Company Name');
if xdwdsCustomersNAME.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersNAME.Value;
NewRow.appendChild(Cell);
// Short Name Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Job Name');
if xdwdsCustomersSHORT_NAME.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersSHORT_NAME.Value;
NewRow.appendChild(Cell);
// Address Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order Date');
if xdwdsCustomersADDRESS.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersADDRESS.Value;
NewRow.appendChild(Cell);
// Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblCustomerGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end;
end.
...@@ -12,8 +12,8 @@ object FViewOrders: TFViewOrders ...@@ -12,8 +12,8 @@ object FViewOrders: TFViewOrders
OnCreate = WebFormCreate OnCreate = WebFormCreate
OnShow = WebFormShow OnShow = WebFormShow
object lblEntries: TWebLabel object lblEntries: TWebLabel
Left = 0 Left = 68
Top = 336 Top = 333
Width = 77 Width = 77
Height = 13 Height = 13
Caption = 'Showing 0 of ...' Caption = 'Showing 0 of ...'
...@@ -23,46 +23,17 @@ object FViewOrders: TFViewOrders ...@@ -23,46 +23,17 @@ object FViewOrders: TFViewOrders
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblEntries2: TWebLabel
Left = 8
Top = 358
Width = 49
Height = 13
Caption = 'lblEntries2'
ElementID = 'lblentries2'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object wcbPageSize: TWebComboBox
Left = -4
Top = 52
Width = 145
Height = 21
ElementClassName = 'custom-select'
ElementID = 'wcbpagesize'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Text = '10'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'10'
'25'
'50')
end
object wcbSortBy: TWebComboBox object wcbSortBy: TWebComboBox
Left = 0 Left = 368
Top = 18 Top = 16
Width = 145 Width = 145
Height = 21 Height = 21
ElementClassName = 'custom-select'
ElementID = 'wcbsortby' ElementID = 'wcbsortby'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = 4
TabStop = False
Text = 'PROOF DONE' Text = 'PROOF DONE'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
...@@ -85,20 +56,22 @@ object FViewOrders: TFViewOrders ...@@ -85,20 +56,22 @@ object FViewOrders: TFViewOrders
Height = 25 Height = 25
Caption = 'Apply' Caption = 'Apply'
ChildOrder = 7 ChildOrder = 7
ElementClassName = 'btn btn-light'
ElementID = 'btnapply' ElementID = 'btnapply'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = 5
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnApplyClick OnClick = btnApplyClick
end end
object edtSearch: TWebEdit object edtSearch: TWebEdit
Left = 48 Left = 35
Top = 382 Top = 16
Width = 121 Width = 121
Height = 22 Height = 22
HelpType = htKeyword HelpType = htKeyword
TabStop = False
ChildOrder = 8 ChildOrder = 8
ElementClassName = 'form-control' ElementClassName = 'form-control'
ElementID = 'edtsearch' ElementID = 'edtsearch'
...@@ -106,44 +79,46 @@ object FViewOrders: TFViewOrders ...@@ -106,44 +79,46 @@ object FViewOrders: TFViewOrders
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
TabOrder = 1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object btnaddOrder: TWebButton object btnAddOrder: TWebButton
Left = 0 Left = 59
Top = 79 Top = 79
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Add Order' Caption = 'Add Order'
ChildOrder = 5 ChildOrder = 5
ElementClassName = 'btn btn-light'
ElementID = 'btnaddorder' ElementID = 'btnaddorder'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = 6
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnaddOrderClick OnClick = btnAddOrderClick
end end
object btnFilters: TWebButton object btnFilters: TWebButton
Left = 542 Left = 462
Top = 50 Top = 79
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Show Filters' Caption = 'Show Filters'
ChildOrder = 6 ChildOrder = 6
ElementClassName = 'btn btn-light'
ElementID = 'btnfilters' ElementID = 'btnfilters'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = 9
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnFiltersClick OnClick = btnFiltersClick
end end
object dtpStartDate: TWebDateTimePicker object dtpStartDate: TWebDateTimePicker
Left = 168 Left = 168
Top = 16 Top = 16
Width = 170 Width = 85
Height = 22 Height = 22
ElementClassName = 'form-control'
ElementID = 'dtpstartdate' ElementID = 'dtpstartdate'
HeightStyle = ssAuto HeightStyle = ssAuto
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -152,14 +127,15 @@ object FViewOrders: TFViewOrders ...@@ -152,14 +127,15 @@ object FViewOrders: TFViewOrders
Date = 45553.505972858790000000 Date = 45553.505972858790000000
ElementFont = efCSS ElementFont = efCSS
Role = '' Role = ''
TabOrder = 2
TabStop = False
Text = '' Text = ''
end end
object dtpEndDate: TWebDateTimePicker object dtpEndDate: TWebDateTimePicker
Left = 356 Left = 266
Top = 16 Top = 16
Width = 170 Width = 87
Height = 22 Height = 22
ElementClassName = 'form-control'
ElementID = 'dtpenddate' ElementID = 'dtpenddate'
HeightStyle = ssAuto HeightStyle = ssAuto
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -168,12 +144,14 @@ object FViewOrders: TFViewOrders ...@@ -168,12 +144,14 @@ object FViewOrders: TFViewOrders
Date = 45553.505972858790000000 Date = 45553.505972858790000000
ElementFont = efCSS ElementFont = efCSS
Role = '' Role = ''
TabOrder = 3
TabStop = False
Text = '' Text = ''
end end
object pnlMessage: TWebPanel object pnlMessage: TWebPanel
Left = 220 Left = 82
Top = 429 Top = 352
Width = 121 Width = 125
Height = 33 Height = 33
ElementClassName = 'card' ElementClassName = 'card'
ElementID = 'pnl_message' ElementID = 'pnl_message'
...@@ -182,10 +160,10 @@ object FViewOrders: TFViewOrders ...@@ -182,10 +160,10 @@ object FViewOrders: TFViewOrders
ElementFont = efCSS ElementFont = efCSS
ElementPosition = epRelative ElementPosition = epRelative
Role = 'alert' Role = 'alert'
TabOrder = 8 TabOrder = 7
object lblMessage: TWebLabel object lblMessage: TWebLabel
Left = 28 Left = 32
Top = 9 Top = 11
Width = 42 Width = 42
Height = 13 Height = 13
Caption = 'Message' Caption = 'Message'
...@@ -215,74 +193,44 @@ object FViewOrders: TFViewOrders ...@@ -215,74 +193,44 @@ object FViewOrders: TFViewOrders
end end
end end
object WebButton1: TWebButton object WebButton1: TWebButton
Left = 174 Left = 188
Top = 79 Top = 79
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Set Status' Caption = 'Set Status'
ChildOrder = 11 ChildOrder = 11
ElementClassName = 'btn btn-light'
ElementID = 'btnsetstatus' ElementID = 'btnsetstatus'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = 7
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebButton2: TWebButton object WebButton2: TWebButton
Left = 344 Left = 328
Top = 79 Top = 79
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'PDF' Caption = 'PDF'
ChildOrder = 12 ChildOrder = 12
ElementClassName = 'btn btn-light'
ElementID = 'btngeneratepdf' ElementID = 'btngeneratepdf'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabOrder = 8
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object btnConfirm: TWebButton
Left = 566
Top = 317
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 13
ElementClassName = 'btn btn-light'
ElementID = 'btn_confirm_order'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object wcbCustomers: TWebDBLookupComboBox
Left = 550
Top = 286
Width = 145
Height = 22
ElementClassName = 'custom-select'
ElementID = 'wcbcustomer'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = wcbCustomersChange
DataField = 'CURR_ID'
DataSource = wdsSave
KeyField = 'ID'
ListField = 'NAME'
ListSource = wdsCustomers
end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 8 Left = 28
Top = 430 Top = 410
end end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 58 Left = 70
Top = 432 Top = 410
object XDataWebDataSet1ID: TStringField object XDataWebDataSet1ID: TStringField
FieldName = 'ID' FieldName = 'ID'
end end
...@@ -340,18 +288,18 @@ object FViewOrders: TFViewOrders ...@@ -340,18 +288,18 @@ object FViewOrders: TFViewOrders
end end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1 DataSet = XDataWebDataSet1
Left = 94 Left = 120
Top = 430 Top = 410
end end
object wdsCustomers: TWebDataSource object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers DataSet = xdwdsCustomers
Left = 598 Left = 518
Top = 406 Top = 414
end end
object xdwdsCustomers: TXDataWebDataSet object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 596 Left = 422
Top = 354 Top = 412
object xdwdsCustomersNAME: TStringField object xdwdsCustomersNAME: TStringField
FieldName = 'NAME' FieldName = 'NAME'
end end
...@@ -364,15 +312,15 @@ object FViewOrders: TFViewOrders ...@@ -364,15 +312,15 @@ object FViewOrders: TFViewOrders
end end
object xdwdsSave: TXDataWebDataSet object xdwdsSave: TXDataWebDataSet
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 498 Left = 188
Top = 352 Top = 408
object xdwdsSaveCURR_ID: TIntegerField object xdwdsSaveCURR_ID: TIntegerField
FieldName = 'CURR_ID' FieldName = 'CURR_ID'
end end
end end
object wdsSave: TWebDataSource object wdsSave: TWebDataSource
DataSet = xdwdsSave DataSet = xdwdsSave
Left = 490 Left = 346
Top = 408 Top = 412
end end
end end
...@@ -13,14 +13,13 @@ uses ...@@ -13,14 +13,13 @@ uses
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage, WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls, ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB; XData.Web.JsonDataset, WEBLib.DB, Data.DB, XData.Web.Dataset, View.AddOrder;
type type
TFViewOrders = class(TWebForm) TFViewOrders = class(TWebForm)
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
XDataWebDataSet1: TXDataWebDataSet; XDataWebDataSet1: TXDataWebDataSet;
lblEntries: TWebLabel; lblEntries: TWebLabel;
wcbPageSize: TWebComboBox;
wcbSortBy: TWebComboBox; wcbSortBy: TWebComboBox;
btnApply: TWebButton; btnApply: TWebButton;
edtSearch: TWebEdit; edtSearch: TWebEdit;
...@@ -40,11 +39,10 @@ type ...@@ -40,11 +39,10 @@ type
XDataWebDataSet1ID: TStringField; XDataWebDataSet1ID: TStringField;
XDataWebDataSet1qbRefNum: TStringField; XDataWebDataSet1qbRefNum: TStringField;
XDataWebDataSet1colors: TStringField; XDataWebDataSet1colors: TStringField;
btnaddOrder: TWebButton; btnAddOrder: TWebButton;
btnFilters: TWebButton; btnFilters: TWebButton;
dtpStartDate: TWebDateTimePicker; dtpStartDate: TWebDateTimePicker;
dtpEndDate: TWebDateTimePicker; dtpEndDate: TWebDateTimePicker;
lblEntries2: TWebLabel;
XDataWebDataSet1plateDue: TStringField; XDataWebDataSet1plateDue: TStringField;
XDataWebDataSet1plateDone: TStringField; XDataWebDataSet1plateDone: TStringField;
XDataWebDataSet1orderType: TStringField; XDataWebDataSet1orderType: TStringField;
...@@ -53,9 +51,7 @@ type ...@@ -53,9 +51,7 @@ type
btnCloseNotification: TWebButton; btnCloseNotification: TWebButton;
WebButton1: TWebButton; WebButton1: TWebButton;
WebButton2: TWebButton; WebButton2: TWebButton;
btnConfirm: TWebButton;
wdsCustomers: TWebDataSource; wdsCustomers: TWebDataSource;
wcbCustomers: TWebDBLookupComboBox;
xdwdsCustomers: TXDataWebDataSet; xdwdsCustomers: TXDataWebDataSet;
xdwdsCustomersNAME: TStringField; xdwdsCustomersNAME: TStringField;
xdwdsCustomersID: TIntegerField; xdwdsCustomersID: TIntegerField;
...@@ -66,12 +62,11 @@ type ...@@ -66,12 +62,11 @@ type
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject); procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject); procedure btnSearchClick(Sender: TObject);
procedure btnaddOrderClick(Sender: TObject); procedure btnAddOrderClick(Sender: TObject);
procedure btnFiltersClick(Sender: TObject); procedure btnFiltersClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject); procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormShow(Sender: TObject); procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
procedure wcbCustomersChange(Sender: TObject);
private private
FChildForm: TWebForm; FChildForm: TWebForm;
procedure AddRowToTable(temp: string); procedure AddRowToTable(temp: string);
...@@ -106,7 +101,7 @@ var ...@@ -106,7 +101,7 @@ var
implementation implementation
uses uses
XData.Model.Classes, View.Main, View.OrderList; XData.Model.Classes, View.Main;
{$R *.dfm} {$R *.dfm}
...@@ -121,7 +116,6 @@ begin ...@@ -121,7 +116,6 @@ begin
DMConnection.ApiConnection.Connected := True; DMConnection.ApiConnection.Connected := True;
PageNumber := 1; PageNumber := 1;
TotalPages := 1; // Initial total pages TotalPages := 1; // Initial total pages
wcbPageSize.Text := '10';
wcbSortBy.Text := 'PROOF'; wcbSortBy.Text := 'PROOF';
//today := TDateTime.Today; //today := TDateTime.Today;
dtpStartDate.Date := 0; dtpStartDate.Date := 0;
...@@ -167,19 +161,14 @@ begin ...@@ -167,19 +161,14 @@ begin
); );
end; end;
procedure TFViewOrders.ShowOrderListForm(); procedure TFViewOrders.ShowOrderListForm();
var var
newform: TFOrderList; newform: TFAddOrder;
formattedBkNum: string;
begin begin
newform := TFOrderList.CreateNew; newform := TFAddOrder.CreateNew;
{newform.FUserInfo := AUserInfo;
newform.FBKNum := ABKNum;
newform.FSource := ASource;
newform.FViewImages := AViewImages;}
newform.Caption := 'Select Company an Order Type'; newform.Caption := 'Select Customer and Order Type';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
console.log(newForm.GetElementHandle); console.log(newForm.GetElementHandle);
...@@ -190,12 +179,13 @@ begin ...@@ -190,12 +179,13 @@ begin
newform.ShowModal( newform.ShowModal(
procedure(AValue: TModalResult) procedure(AValue: TModalResult)
begin begin
if newForm.edtID.Text <> '' then if newform.edtID.Text <> '' then
orderEntry('', newForm.edtID.Text, 'ADD'); orderEntry('', newForm.edtID.Text, 'ADD');
end end
); );
end; end;
procedure TFViewOrders.AddRowToTable(temp: string); procedure TFViewOrders.AddRowToTable(temp: string);
// Adds rows to the table // Adds rows to the table
// PhoneNumber: phone number of the location // PhoneNumber: phone number of the location
...@@ -622,33 +612,25 @@ begin ...@@ -622,33 +612,25 @@ begin
if callListLength = 0 then if callListLength = 0 then
begin begin
lblEntries.Caption := 'No entries found'; lblEntries.Caption := 'No entries found';
lblEntries2.Caption := 'No entries found';
end end
else if (PageNumber * PageSize) < callListLength then else if (PageNumber * PageSize) < callListLength then
begin begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) + ' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(callListLength); ' of ' + IntToStr(callListLength);
lblEntries2.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(callListLength);
end end
else if (PageNumber * PageSize) >= callListLength then else if (PageNumber * PageSize) >= callListLength then
begin begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(callListLength) + ' - ' + IntToStr(callListLength) +
' of ' + IntToStr(callListLength); ' of ' + IntToStr(callListLength);
lblEntries2.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(callListLength) +
' of ' + IntToStr(callListLength);
end; end;
GeneratePagination(TotalPages); GeneratePagination(TotalPages);
end; end;
end; end;
procedure TFViewOrders.btnaddOrderClick(Sender: TObject); procedure TFViewOrders.btnAddOrderClick(Sender: TObject);
begin begin
//getCustomers();
ShowOrderListForm(); ShowOrderListForm();
end; end;
...@@ -663,7 +645,7 @@ var ...@@ -663,7 +645,7 @@ var
searchOptions: string; searchOptions: string;
begin begin
PageNumber := 1; PageNumber := 1;
PageSize := StrToInt(wcbPageSize.Text); PageSize := 50;
OrderBy := wcbSortBy.Text; OrderBy := wcbSortBy.Text;
searchOptions := '&pagenumber=' + IntToStr(PageNumber) + searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) + '&pagesize=' + IntToStr(PageSize) +
...@@ -755,7 +737,7 @@ var ...@@ -755,7 +737,7 @@ var
searchOptions: string; searchOptions: string;
begin begin
//PageNumber := 1; //PageNumber := 1;
PageSize := StrToInt(wcbPageSize.Text); PageSize := 50;
OrderBy := wcbSortBy.Text; OrderBy := wcbSortBy.Text;
searchOptions := '&pagenumber=' + IntToStr(PageNumber) + searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) + '&pagesize=' + IntToStr(PageSize) +
...@@ -786,10 +768,5 @@ begin ...@@ -786,10 +768,5 @@ begin
end; end;
end; end;
procedure TFViewOrders.wcbCustomersChange(Sender: TObject);
begin
console.log(wcbCustomers.Value);
end;
end. end.
{
"AuthUrl": "hhttp://localhost:2004/emsys/envoy/auth/",
"ApiUrl": "http://localhost:2004/emsys/envoy/api/",
"AppUrl": "http://localhost:2004/emsys/envoy/app/"
}
\ No newline at end of file
{ {
"AuthUrl" : "http://144.71.200.57:2004/emsys/envoy/auth/", "AuthUrl" : "http://localhost:2004/emsys/kgOrders/auth/",
"ApiUrl" : "http://144.71.200.57:2004/emsys/envoy/api/", "ApiUrl" : "http://localhost:2004/emsys/kgOrders/api/"
"AppUrl" : "http://144.71.200.57:2004/emsys/envoy/app/" }
}
\ No newline at end of file
...@@ -280,5 +280,42 @@ input[type="text"] { ...@@ -280,5 +280,42 @@ input[type="text"] {
} }
.grid-container {
position: relative; /* Ensure the container is the reference for child positioning */
height: 400px; /* Set the height for the grid */
width: 100%; /* Full width of the parent container */
overflow: hidden; /* Prevent unintended overflow */
}
#TFAddOrder_TMSFNCGrid2 {
top: 0px !important; /* Reset the top offset */
left: 0px !important; /* Reset the left offset */
position: absolute !important; /* Use relative positioning to align with the grid container */
}
#TFAddOrder_TMSFNCGrid2_Canvas {
position: relative !important; /* Ensure absolute positioning within the parent */
width: 100% !important; /* Make the canvas fill the container width */
height: 100% !important; /* Make the canvas fill the container height */
left: 0px !important; /* Align canvas to the left */
}
#TFAddOrder_ScrollBar5 {
top: 0px !important; /* Align scrollbar to the top */
right: 0px !important; /* Align scrollbar to the right edge */
position: absolute !important; /* Position within the grid container */
height: 400px !important; /* Match the height of the grid container */
box-sizing: border-box !important; /* Prevent borders from affecting dimensions */
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<noscript>Your browser does not support JavaScript!</noscript> <noscript>Your browser does not support JavaScript!</noscript>
<link rel="icon" href="data:;base64,="> <link rel="icon" href="data:;base64,=">
<title>TMS Web Project</title> <title>TMS Web Project</title>
<link href="template/css/app.css" rel="stylesheet" type="text/css"> <link href="css/app.css" rel="stylesheet" type="text/css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/css/flag-icon.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/css/flag-icon.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet">
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</script> </script>
<title>EM Systems webCharms App</title> <title>EM Systems webKGOrders App</title>
<script type="text/javascript" src="$(ProjectName).js"></script> <script type="text/javascript" src="$(ProjectName).js"></script>
<style> <style>
/*-----svg loader styles-------*/ /*-----svg loader styles-------*/
......
...@@ -18,7 +18,7 @@ uses ...@@ -18,7 +18,7 @@ uses
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html}, View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html},
View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html}, View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html},
View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntry: TWebForm} {*.html}, View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntry: TWebForm} {*.html},
View.OrderList in 'View.OrderList.pas' {FOrderList: TWebForm} {*.html}; View.AddOrder in 'View.AddOrder.pas' {FAddOrder: TWebForm} {*.html};
{$R *.res} {$R *.res}
...@@ -66,6 +66,6 @@ begin ...@@ -66,6 +66,6 @@ begin
Application.Initialize; Application.Initialize;
Application.MainFormOnTaskbar := True; Application.MainFormOnTaskbar := True;
Application.CreateForm(TDMConnection, DMConnection); Application.CreateForm(TDMConnection, DMConnection);
Application.Run;
DMConnection.InitApp(@StartApplication, @UnauthorizedAccessProc); DMConnection.InitApp(@StartApplication, @UnauthorizedAccessProc);
//Application.Run;
end. end.
...@@ -90,11 +90,11 @@ ...@@ -90,11 +90,11 @@
<DCC_RemoteDebug>false</DCC_RemoteDebug> <DCC_RemoteDebug>false</DCC_RemoteDebug>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.3.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;LastCompiledTime=2018/08/27 15:18:29</VerInfo_Keys> <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;LastCompiledTime=2018/08/27 15:18:29</VerInfo_Keys>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode> <AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
<VerInfo_MinorVer>3</VerInfo_MinorVer>
<TMSUseJSDebugger>2</TMSUseJSDebugger> <TMSUseJSDebugger>2</TMSUseJSDebugger>
<TMSWebSingleInstance>1</TMSWebSingleInstance> <TMSWebSingleInstance>1</TMSWebSingleInstance>
<TMSWebBrowser>5</TMSWebBrowser>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''"> <PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
...@@ -171,13 +171,14 @@ ...@@ -171,13 +171,14 @@
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="View.OrderList.pas"> <DCCReference Include="View.AddOrder.pas">
<Form>FOrderList</Form> <Form>FAddOrder</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<None Include="index.html"/> <None Include="index.html"/>
<None Include="template\css\app.css"/> <None Include="css\app.css"/>
<None Include="config\config.json"/>
<BuildConfiguration Include="Base"> <BuildConfiguration Include="Base">
<Key>Base</Key> <Key>Base</Key>
</BuildConfiguration> </BuildConfiguration>
...@@ -213,22 +214,28 @@ ...@@ -213,22 +214,28 @@
<Overwrite>true</Overwrite> <Overwrite>true</Overwrite>
</Platform> </Platform>
</DeployFile> </DeployFile>
<DeployFile LocalName="index.html" Configuration="Debug" Class="ProjectFile"/> <DeployFile LocalName="config\config.json" Configuration="Debug" Class="ProjectFile">
<DeployFile LocalName="index.html" Configuration="Debug" Class="ProjectFile">
<Platform Name="Win32"> <Platform Name="Win32">
<RemoteDir>.\</RemoteDir> <RemoteDir>.\</RemoteDir>
<Overwrite>true</Overwrite> <Overwrite>true</Overwrite>
</Platform> </Platform>
</DeployFile> </DeployFile>
<DeployFile LocalName="template\bootstrap\bootstrap.min.css" Configuration="Debug" Class="ProjectFile"/> <DeployFile LocalName="css\app.css" Configuration="Debug" Class="ProjectFile">
<DeployFile LocalName="template\bootstrap\bootstrap.min.js" Configuration="Debug" Class="ProjectFile"/>
<DeployFile LocalName="template\bootstrap\dataTables.bootstrap.css" Configuration="Debug" Class="ProjectFile"/>
<DeployFile LocalName="template\css\app.css" Configuration="Debug" Class="ProjectFile">
<Platform Name="Win32"> <Platform Name="Win32">
<RemoteDir>.\</RemoteDir> <RemoteDir>.\</RemoteDir>
<Overwrite>true</Overwrite> <Overwrite>true</Overwrite>
</Platform> </Platform>
</DeployFile> </DeployFile>
<DeployFile LocalName="index.html" Configuration="Debug" Class="ProjectFile"/>
<DeployFile LocalName="index.html" Configuration="Debug" Class="ProjectFile">
<Platform Name="Win32">
<RemoteDir>.\</RemoteDir>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="template\bootstrap\bootstrap.min.css" Configuration="Debug" Class="ProjectFile"/>
<DeployFile LocalName="template\bootstrap\bootstrap.min.js" Configuration="Debug" Class="ProjectFile"/>
<DeployFile LocalName="template\bootstrap\dataTables.bootstrap.css" Configuration="Debug" Class="ProjectFile"/>
<DeployFile LocalName="template\css\emsys.css" Configuration="Debug" Class="ProjectFile"/> <DeployFile LocalName="template\css\emsys.css" Configuration="Debug" Class="ProjectFile"/>
<DeployFile LocalName="template\css\metisMenu.min.css" Configuration="Debug" Class="ProjectFile"/> <DeployFile LocalName="template\css\metisMenu.min.css" Configuration="Debug" Class="ProjectFile"/>
<DeployFile LocalName="template\css\morris.css" Configuration="Debug" Class="ProjectFile"/> <DeployFile LocalName="template\css\morris.css" Configuration="Debug" Class="ProjectFile"/>
......
...@@ -3,20 +3,21 @@ object ApiServerModule: TApiServerModule ...@@ -3,20 +3,21 @@ object ApiServerModule: TApiServerModule
Width = 230 Width = 230
object SparkleHttpSysDispatcher: TSparkleHttpSysDispatcher object SparkleHttpSysDispatcher: TSparkleHttpSysDispatcher
Active = True Active = True
Left = 84 Left = 86
Top = 30 Top = 30
end end
object XDataServer: TXDataServer object XDataServer: TXDataServer
BaseUrl = 'http://localhost:2004/emsys/envoy/api/' BaseUrl = 'http://localhost:2004/emsys/kgOrders/api/'
Dispatcher = SparkleHttpSysDispatcher Dispatcher = SparkleHttpSysDispatcher
ModelName = 'Api'
EntitySetPermissions = <> EntitySetPermissions = <>
SwaggerOptions.Enabled = True SwaggerOptions.Enabled = True
SwaggerOptions.AuthMode = Jwt SwaggerOptions.AuthMode = Jwt
SwaggerUIOptions.Enabled = True SwaggerUIOptions.Enabled = True
SwaggerUIOptions.ShowFilter = True SwaggerUIOptions.ShowFilter = True
SwaggerUIOptions.TryItOutEnabled = True SwaggerUIOptions.TryItOutEnabled = True
Left = 85 Left = 89
Top = 110 Top = 112
object XDataServerLogging: TSparkleGenericMiddleware object XDataServerLogging: TSparkleGenericMiddleware
OnMiddlewareCreate = XDataServerLoggingMiddlewareCreate OnMiddlewareCreate = XDataServerLoggingMiddlewareCreate
end end
......
...@@ -32,7 +32,7 @@ type ...@@ -32,7 +32,7 @@ type
{ Private declarations } { Private declarations }
public public
{ Public declarations } { Public declarations }
procedure StartApiServer(ABaseUrl: string); procedure StartApiServer(ABaseUrl: string; AModelName: string);
end; end;
const const
...@@ -67,7 +67,7 @@ begin ...@@ -67,7 +67,7 @@ begin
Result := (User <> nil) and User.Claims.Exists('admin') and User.Claims['admin'].AsBoolean; Result := (User <> nil) and User.Claims.Exists('admin') and User.Claims['admin'].AsBoolean;
end; end;
procedure TApiServerModule.StartApiServer(ABaseUrl: string); procedure TApiServerModule.StartApiServer(ABaseUrl: string; AModelName: string);
var var
Url: string; Url: string;
begin begin
...@@ -79,9 +79,10 @@ begin ...@@ -79,9 +79,10 @@ begin
Url := Url + SERVER_PATH_SEGMENT; Url := Url + SERVER_PATH_SEGMENT;
XDataServer.BaseUrl := Url; XDataServer.BaseUrl := Url;
XDataServer.ModelName := AModelName;
SparkleHttpSysDispatcher.Start; SparkleHttpSysDispatcher.Start;
Logger.Log(1, Format('Api server module listening at "%s"', [Url])); Logger.Log(1, Format('Api server module listening at "%s"', [XDataServer.BaseUrl]));
end; end;
procedure TApiServerModule.XDataServerLoggingMiddlewareCreate(Sender: TObject; procedure TApiServerModule.XDataServerLoggingMiddlewareCreate(Sender: TObject;
......
...@@ -19,11 +19,7 @@ object AuthDatabase: TAuthDatabase ...@@ -19,11 +19,7 @@ object AuthDatabase: TAuthDatabase
object ucKG: TUniConnection object ucKG: TUniConnection
ProviderName = 'MySQL' ProviderName = 'MySQL'
Database = 'kg_order_entry' Database = 'kg_order_entry'
SpecificOptions.Strings = (
'PostgreSQL.Schema=envoy')
Username = 'root' Username = 'root'
Server = '192.168.159.132'
Connected = True
LoginPrompt = False LoginPrompt = False
Left = 67 Left = 67
Top = 131 Top = 131
......
...@@ -20,7 +20,6 @@ type ...@@ -20,7 +20,6 @@ type
{ Private declarations } { Private declarations }
public public
{ Public declarations } { Public declarations }
procedure SetLoginAuditEntry( userStr: string );
end; end;
var var
...@@ -40,46 +39,61 @@ uses ...@@ -40,46 +39,61 @@ uses
procedure TAuthDatabase.DataModuleCreate(Sender: TObject); procedure TAuthDatabase.DataModuleCreate(Sender: TObject);
var var
IniFile: TIniFile; iniFile: TIniFile;
iniStr: string; iniStr: string;
begin begin
IniFile := TIniFile.Create( ChangeFileExt(Application.ExeName, '.ini') ); Logger.Log( 5, 'TAuthDatabase.DataModuleCreate' );
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
try try
iniStr := IniFile.ReadString( 'Database', 'Server', '' ); Logger.Log( 5, '--iniFile entries:' );
iniStr := iniFile.ReadString('Database', 'Server', '');
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Server: Entry not found' )
' Database->Server: Entry not found' )
else else
begin begin
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Server: ' + iniStr );
' Database->Server: ' + iniStr );
ucKG.Server := iniStr; ucKG.Server := iniStr;
end; end;
iniStr := IniFile.ReadString( 'Twilio', 'AccountSID', '' ); iniStr := iniFile.ReadString('Database', 'Database', '');
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Database: Entry not found' )
' Twilio->AccountSID: Entry not found' )
else else
begin begin
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Database: ' + iniStr );
' Twilio->AccountSID: ' + iniStr ); ucKG.Database := iniStr;
//accountSID := iniStr;
end; end;
iniStr := IniFile.ReadString( 'Twilio', 'AuthHeader', '' ); iniStr := iniFile.ReadString('Database', 'Username', '');
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Username: Entry not found' )
' Twilio->AuthHeader: Entry not found' )
else else
begin begin
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Username: ' + iniStr );
' Twilio->AuthHeader: ' + iniStr ); ucKG.Username := iniStr;
//authHeader := iniStr;
end; end;
iniStr := iniFile.ReadString('Database', 'Password', '');
if iniStr.IsEmpty then
Logger.Log( 5, '----Database->Password: Entry not found' )
else
begin
Logger.Log( 5, '----Database->Password: xxxxxxxx' );
ucKG.Password := iniStr;
end;
try
ucKG.Connect;
except
on E: Exception do
begin
Logger.Log(3, '--TAuthDatabase.DataModuleCreate -Error connecting to database: ' + E.Message);
end;
end;
Logger.Log(1, ''); Logger.Log(1, '');
finally finally
IniFile.Free; iniFile.Free;
end; end;
end; end;
...@@ -88,34 +102,5 @@ begin ...@@ -88,34 +102,5 @@ begin
ucKG.Connected := false; ucKG.Connected := false;
end; end;
procedure TAuthDatabase.SetLoginAuditEntry( userStr: string );
var
auditMasterId: string;
userInfo: TStringList;
entry: string;
username: string;
fullname: string;
agency: string;
userid: string;
personnelid: string;
admin: boolean;
i: Integer;
begin
Logger.Log( 3, 'TAuthDatabase.SetLoginAuditEntry - start' );
userInfo := TStringList.Create;
try
userInfo.Delimiter := '&';
userInfo.StrictDelimiter := True;
userInfo.DelimitedText := userStr;
username := userInfo.Values['username'];
fullname := userInfo.Values['fullname'];
userid := userInfo.Values['userId'];
personnelid := userInfo.Values['personnelid'];
finally
userInfo.Free;
end;
end;
end. end.
...@@ -6,7 +6,7 @@ object AuthServerModule: TAuthServerModule ...@@ -6,7 +6,7 @@ object AuthServerModule: TAuthServerModule
Top = 16 Top = 16
end end
object XDataServer: TXDataServer object XDataServer: TXDataServer
BaseUrl = 'http://localhost:2004/emsys/envoy/auth/' BaseUrl = 'http://localhost:2004/emsys/kgOrders/auth/'
Dispatcher = SparkleHttpSysDispatcher Dispatcher = SparkleHttpSysDispatcher
ModelName = 'Auth' ModelName = 'Auth'
EntitySetPermissions = <> EntitySetPermissions = <>
......
...@@ -67,7 +67,7 @@ begin ...@@ -67,7 +67,7 @@ begin
XDataServer.ModelName := AModelName; XDataServer.ModelName := AModelName;
SparkleHttpSysDispatcher.Start; SparkleHttpSysDispatcher.Start;
Logger.Log(1, Format('Auth server module listening at "%s"', [Url])); Logger.Log(1, Format('Auth server module listening at "%s"', [XDataServer.BaseUrl]));
end; end;
procedure TAuthServerModule.XDataServerLoggingMiddlewareCreate(Sender: TObject; procedure TAuthServerModule.XDataServerLoggingMiddlewareCreate(Sender: TObject;
......
...@@ -6,7 +6,7 @@ unit Common.Config; ...@@ -6,7 +6,7 @@ unit Common.Config;
interface interface
const const
defaultServerUrl = 'http://localhost:2004/emsys/envoycalls/'; defaultServerUrl = 'http://localhost:2004/emsys/kgOrders/';
type type
TServerConfig = class TServerConfig = class
...@@ -15,16 +15,12 @@ type ...@@ -15,16 +15,12 @@ type
FJWTTokenSecret: string; FJWTTokenSecret: string;
FAdminPassword: string; FAdminPassword: string;
FWebAppFolder: string; FWebAppFolder: string;
FMemoLogLevel: Integer;
FFileLogLevel: Integer;
public public
constructor Create; constructor Create;
property url: string read FUrl write FUrl; property url: string read FUrl write FUrl;
property jwtTokenSecret: string read FJWTTokenSecret write FJWTTokenSecret; property jwtTokenSecret: string read FJWTTokenSecret write FJWTTokenSecret;
property adminPassword: string read FAdminPassword write FAdminPassword; property adminPassword: string read FAdminPassword write FAdminPassword;
property webAppFolder: string read FWebAppFolder write FWebAppFolder; property webAppFolder: string read FWebAppFolder write FWebAppFolder;
property memoLogLevel: Integer read FMemoLogLevel write FMemoLogLevel;
property fileLogLevel: Integer read FFileLogLevel write FFileLogLevel;
end; end;
procedure LoadServerConfig; procedure LoadServerConfig;
...@@ -65,8 +61,6 @@ begin ...@@ -65,8 +61,6 @@ begin
Logger.Log( 1, '-- serverConfig.adminPassword: ' + serverConfig.adminPassword ); Logger.Log( 1, '-- serverConfig.adminPassword: ' + serverConfig.adminPassword );
Logger.Log( 1, '-- serverConfig.jwtTokenSecret: ' + serverConfig.jwtTokenSecret ); Logger.Log( 1, '-- serverConfig.jwtTokenSecret: ' + serverConfig.jwtTokenSecret );
Logger.Log( 1, '-- serverConfig.webAppFolder: ' + serverConfig.webAppFolder ); Logger.Log( 1, '-- serverConfig.webAppFolder: ' + serverConfig.webAppFolder );
Logger.Log( 1, '-- serverConfig.memoLogLevel: ' + IntToStr(serverConfig.memoLogLevel) );
Logger.Log( 1, '-- serverConfig.fileLogLevel: ' + IntToStr(serverConfig.fileLogLevel) );
Logger.Log( 1, '--LoadServerConfig - end' ); Logger.Log( 1, '--LoadServerConfig - end' );
end; end;
...@@ -82,8 +76,6 @@ begin ...@@ -82,8 +76,6 @@ begin
adminPassword := 'whatisthisusedfor'; adminPassword := 'whatisthisusedfor';
jwtTokenSecret := 'super_secret0123super_secret4567'; jwtTokenSecret := 'super_secret0123super_secret4567';
webAppFolder := 'static'; webAppFolder := 'static';
memoLogLevel := 3;
fileLogLevel := 4;
// ServerConfigStr := Bcl.Json.TJson.Serialize( ServerConfig ); // ServerConfigStr := Bcl.Json.TJson.Serialize( ServerConfig );
// ConfigFile := 'serverconfig.json'; // ConfigFile := 'serverconfig.json';
// TFile.WriteAllText( ConfigFile, ServerConfigStr ); // TFile.WriteAllText( ConfigFile, ServerConfigStr );
......
...@@ -172,7 +172,7 @@ object FData: TFData ...@@ -172,7 +172,7 @@ object FData: TFData
SortSettings.HeaderColorTo = clWhite SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite SortSettings.HeaderMirrorColorTo = clWhite
Version = '2.8.3.1' Version = '2.8.3.2'
AutoCreateColumns = True AutoCreateColumns = True
AutoRemoveColumns = True AutoRemoveColumns = True
Columns = < Columns = <
...@@ -753,7 +753,7 @@ object FData: TFData ...@@ -753,7 +753,7 @@ object FData: TFData
SortSettings.HeaderColorTo = clWhite SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite SortSettings.HeaderMirrorColorTo = clWhite
Version = '2.8.3.1' Version = '2.8.3.2'
AutoCreateColumns = True AutoCreateColumns = True
AutoRemoveColumns = True AutoRemoveColumns = True
Columns = < Columns = <
...@@ -1505,7 +1505,6 @@ object FData: TFData ...@@ -1505,7 +1505,6 @@ object FData: TFData
Top = 472 Top = 472
end end
object uqUsers: TUniQuery object uqUsers: TUniQuery
Connection = FDatabaseModule.ucKG
SQL.Strings = ( SQL.Strings = (
'select * from users') 'select * from users')
Left = 669 Left = 669
......
...@@ -51,11 +51,11 @@ implementation ...@@ -51,11 +51,11 @@ implementation
{$R *.dfm} {$R *.dfm}
uses Database, uLibrary; uses KGOrders.Database, uLibrary;
procedure TFData.FormCreate(Sender: TObject); procedure TFData.FormCreate(Sender: TObject);
begin begin
FDatabaseModule := TFDatabaseModule.Create(Self); KGOrdersDatabase := TKGOrdersDatabase.Create(Self);
end; end;
procedure TFData.btnFindClick(Sender: TObject); procedure TFData.btnFindClick(Sender: TObject);
......
object FDatabaseModule: TFDatabaseModule object KGOrdersDatabase: TKGOrdersDatabase
OnCreate = DataModuleCreate OnCreate = DataModuleCreate
Height = 480 Height = 358
Width = 640 Width = 519
object ucKG: TUniConnection object ucKG: TUniConnection
ProviderName = 'MySQL' ProviderName = 'MySQL'
Database = 'kg_order_entry' Database = 'kg_order_entry'
SpecificOptions.Strings = (
'PostgreSQL.Schema=envoy')
Username = 'root' Username = 'root'
Server = '192.168.159.132'
Connected = True
LoginPrompt = False LoginPrompt = False
Left = 75 Left = 75
Top = 139 Top = 65
EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF' EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF'
end end
object UniQuery1: TUniQuery object UniQuery1: TUniQuery
Connection = ucKG Connection = ucKG
SQL.Strings = ( SQL.Strings = (
'') '')
Left = 363 Left = 73
Top = 138 Top = 148
end end
object MySQLUniProvider1: TMySQLUniProvider object MySQLUniProvider1: TMySQLUniProvider
Left = 220 Left = 162
Top = 134 Top = 66
end end
object UniQuery2: TUniQuery object UniQuery2: TUniQuery
Connection = ucKG Connection = ucKG
SQL.Strings = ( SQL.Strings = (
'') '')
Left = 433 Left = 179
Top = 144 Top = 148
end end
object uqOrders: TUniQuery object uqOrders: TUniQuery
Connection = ucKG Connection = ucKG
SQL.Strings = ( SQL.Strings = (
'select * from corrugated_plate_orders') 'select * from corrugated_plate_orders')
Left = 527 Left = 263
Top = 120 Top = 156
object uqOrdersORDER_ID: TIntegerField object uqOrdersORDER_ID: TIntegerField
FieldName = 'ORDER_ID' FieldName = 'ORDER_ID'
end end
......
// Where the database is kept. Only used by Lookup.ServiceImpl to retrieve info // Where the database is kept. Only used by Lookup.ServiceImpl to retrieve info
// from the data base and send it to the client. // from the data base and send it to the client.
// Author: ??? // Author: ???
unit Database; unit KGOrders.Database;
interface interface
...@@ -11,7 +11,7 @@ uses ...@@ -11,7 +11,7 @@ uses
Common.Logging, Vcl.Forms, MySQLUniProvider; Common.Logging, Vcl.Forms, MySQLUniProvider;
type type
TFDatabaseModule = class(TDataModule) TKGOrdersDatabase = class(TDataModule)
ucKG: TUniConnection; ucKG: TUniConnection;
UniQuery1: TUniQuery; UniQuery1: TUniQuery;
MySQLUniProvider1: TMySQLUniProvider; MySQLUniProvider1: TMySQLUniProvider;
...@@ -113,7 +113,7 @@ type ...@@ -113,7 +113,7 @@ type
end; end;
var var
FDatabaseModule: TFDatabaseModule; KGOrdersDatabase: TKGOrdersDatabase;
implementation implementation
...@@ -121,58 +121,71 @@ implementation ...@@ -121,58 +121,71 @@ implementation
{$R *.dfm} {$R *.dfm}
procedure TFDatabaseModule.DataModuleCreate(Sender: TObject); procedure TKGOrdersDatabase.DataModuleCreate(Sender: TObject);
// Sets the database connection to the ini file IP
// TODO: clean up unnecessary reads from the ini file
var var
IniFile: TIniFile; iniFile: TIniFile;
iniStr: string; iniStr: string;
begin begin
IniFile := TIniFile.Create( ChangeFileExt(Application.ExeName, '.ini') ); Logger.Log( 5, 'TKGOrdersDatabase.DataModuleCreate' );
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
try try
iniStr := IniFile.ReadString( 'Database', 'Server', '' ); Logger.Log( 5, '--iniFile entries:' );
iniStr := iniFile.ReadString('Database', 'Server', '');
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Server: Entry not found' )
' Database->Server: Entry not found' )
else else
begin begin
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Server: ' + iniStr );
' Database->Server: ' + iniStr );
ucKG.Server := iniStr; ucKG.Server := iniStr;
end; end;
iniStr := IniFile.ReadString( 'Twilio', 'AccountSID', '' ); iniStr := iniFile.ReadString('Database', 'Database', '');
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Database: Entry not found' )
' Twilio->AccountSID: Entry not found' )
else else
begin begin
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Database: ' + iniStr );
' Twilio->AccountSID: ' + iniStr ); ucKG.Database := iniStr;
//accountSID := iniStr;
end; end;
iniStr := IniFile.ReadString( 'Twilio', 'AuthHeader', '' ); iniStr := iniFile.ReadString('Database', 'Username', '');
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Username: Entry not found' )
' Twilio->AuthHeader: Entry not found' )
else else
begin begin
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') + Logger.Log( 5, '----Database->Username: ' + iniStr );
' Twilio->AuthHeader: ' + iniStr ); ucKG.Username := iniStr;
//authHeader := iniStr;
end; end;
iniStr := iniFile.ReadString('Database', 'Password', '');
if iniStr.IsEmpty then
Logger.Log( 5, '----Database->Password: Entry not found' )
else
begin
Logger.Log( 5, '----Database->Password: xxxxxxxx' );
ucKG.Password := iniStr;
end;
try
ucKG.Connect;
except
on E: Exception do
begin
Logger.Log(3, '--TKGOrdersDatabase.DataModuleCreate -Error connecting to database: ' + E.Message);
end;
end;
Logger.Log(1, ''); Logger.Log(1, '');
finally finally
IniFile.Free; iniFile.Free;
end; end;
end; end;
class procedure TFDatabaseModule.ExecSQL(const SQL: string); class procedure TKGOrdersDatabase.ExecSQL(const SQL: string);
var var
DB: TFDatabaseModule; DB: TKGOrdersDatabase;
begin begin
DB := TFDatabaseModule.Create(nil); DB := TKGOrdersDatabase.Create(nil);
try try
DB.UniQuery1.SQL.Text := SQL; DB.UniQuery1.SQL.Text := SQL;
DB.UniQuery1.ExecSQL; DB.UniQuery1.ExecSQL;
......
...@@ -141,7 +141,6 @@ type ...@@ -141,7 +141,6 @@ type
supplied_by_customer_existing_: string; supplied_by_customer_existing_: string;
supplied_by_customer_ref_art_p: string; supplied_by_customer_ref_art_p: string;
supplied_by_customer_ref_art_a: string; supplied_by_customer_ref_art_a: string;
supplied_by_customer_order_date: string;
// Layout // Layout
layout_rsc_l: string; layout_rsc_l: string;
...@@ -200,7 +199,7 @@ type ...@@ -200,7 +199,7 @@ type
type type
[ServiceContract] [ServiceContract, Model(API_MODEL)]
ILookupService = interface(IInvokable) ILookupService = interface(IInvokable)
['{F24E1468-5279-401F-A877-CD48B44F4416}'] ['{F24E1468-5279-401F-A877-CD48B44F4416}']
[HttpGet] function Search(phoneNum: string): TOrderList; [HttpGet] function Search(phoneNum: string): TOrderList;
......
...@@ -11,7 +11,7 @@ interface ...@@ -11,7 +11,7 @@ interface
uses uses
XData.Server.Module, XData.Server.Module,
XData.Service.Common, XData.Service.Common,
Database, Data.DB, KGOrders.Database, Data.DB,
Lookup.Service, System.Hash, System.Classes, System.JSON; Lookup.Service, System.Hash, System.Classes, System.JSON;
...@@ -19,7 +19,7 @@ type ...@@ -19,7 +19,7 @@ type
[ServiceImplementation] [ServiceImplementation]
TLookupService = class(TInterfacedObject, ILookupService) TLookupService = class(TInterfacedObject, ILookupService)
strict private strict private
ordersDB: TFDatabaseModule; ordersDB: TKGOrdersDatabase;
private private
function GetItems(searchOptions: string): TItemList; function GetItems(searchOptions: string): TItemList;
function GetUsers(searchOptions: string): TUserList; function GetUsers(searchOptions: string): TUserList;
...@@ -51,7 +51,7 @@ uses ...@@ -51,7 +51,7 @@ uses
procedure TLookupService.AfterConstruction; procedure TLookupService.AfterConstruction;
begin begin
inherited; inherited;
ordersDB := TFDatabaseModule.Create(nil); ordersDB := TKGOrdersDatabase.Create(nil);
end; end;
...@@ -383,7 +383,6 @@ begin ...@@ -383,7 +383,6 @@ begin
result.staff_fields_mount_due := ordersDB.UniQuery1.FieldByName('staff_fields_mount_due').AsString; result.staff_fields_mount_due := ordersDB.UniQuery1.FieldByName('staff_fields_mount_due').AsString;
result.staff_fields_art_location := ordersDB.UniQuery1.FieldByName('staff_fields_art_location').AsString; result.staff_fields_art_location := ordersDB.UniQuery1.FieldByName('staff_fields_art_location').AsString;
result.staff_fields_invoice_to := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString; result.staff_fields_invoice_to := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString;
result.staff_fields_order_date := ordersDB.UniQuery1.FieldByName('staff_fields_order_date').AsString;
// Supplied by Customer // Supplied by Customer
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_b_w_copy').AsString = 'T' then if ordersDB.UniQuery1.FieldByName('supplied_by_customer_b_w_copy').AsString = 'T' then
......
...@@ -3,7 +3,7 @@ object FMain: TFMain ...@@ -3,7 +3,7 @@ object FMain: TFMain
Top = 0 Top = 0
Caption = 'KG Orders Server' Caption = 'KG Orders Server'
ClientHeight = 597 ClientHeight = 597
ClientWidth = 764 ClientWidth = 773
Color = clBtnFace Color = clBtnFace
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
...@@ -12,15 +12,21 @@ object FMain: TFMain ...@@ -12,15 +12,21 @@ object FMain: TFMain
Font.Style = [] Font.Style = []
OnClose = FormClose OnClose = FormClose
DesignSize = ( DesignSize = (
764 773
597) 597)
TextHeight = 13 TextHeight = 13
object memoInfo: TMemo object memoInfo: TMemo
Left = 8 Left = 8
Top = 40 Top = 44
Width = 744 Width = 753
Height = 549 Height = 549
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Lucida Console'
Font.Style = []
ParentFont = False
ReadOnly = True ReadOnly = True
TabOrder = 0 TabOrder = 0
end end
...@@ -60,13 +66,6 @@ object FMain: TFMain ...@@ -60,13 +66,6 @@ object FMain: TFMain
TabOrder = 4 TabOrder = 4
OnClick = btnAuthSwaggerUIClick OnClick = btnAuthSwaggerUIClick
end end
object tmrTwilio: TTimer
Enabled = False
Interval = 300000
OnTimer = tmrTwilioTimer
Left = 167
Top = 399
end
object initTimer: TTimer object initTimer: TTimer
OnTimer = initTimerTimer OnTimer = initTimerTimer
Left = 58 Left = 58
......
...@@ -9,7 +9,7 @@ uses ...@@ -9,7 +9,7 @@ uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, Winapi.ShellApi, Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, Winapi.ShellApi,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
Vcl.StdCtrls, Vcl.ExtCtrls, System.Generics.Collections, System.IniFiles, Vcl.StdCtrls, Vcl.ExtCtrls, System.Generics.Collections, System.IniFiles,
Auth.Service, Auth.Server.Module, Api.Server.Module, App.Server.Module; Auth.Service, Auth.Server.Module, Lookup.Service, Api.Server.Module, App.Server.Module;
type type
TFMain = class(TForm) TFMain = class(TForm)
...@@ -17,21 +17,17 @@ type ...@@ -17,21 +17,17 @@ type
btnApiSwaggerUI: TButton; btnApiSwaggerUI: TButton;
btnData: TButton; btnData: TButton;
btnExit: TButton; btnExit: TButton;
tmrTwilio: TTimer;
initTimer: TTimer; initTimer: TTimer;
btnAuthSwaggerUI: TButton; btnAuthSwaggerUI: TButton;
procedure btnApiSwaggerUIClick(Sender: TObject); procedure btnApiSwaggerUIClick(Sender: TObject);
procedure btnDataClick(Sender: TObject); procedure btnDataClick(Sender: TObject);
procedure btnExitClick(Sender: TObject); procedure btnExitClick(Sender: TObject);
procedure tmrTwilioTimer(Sender: TObject);
procedure ContactFormData(AText: String); procedure ContactFormData(AText: String);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure initTimerTimer(Sender: TObject); procedure initTimerTimer(Sender: TObject);
procedure btnAuthSwaggerUIClick(Sender: TObject); procedure btnAuthSwaggerUIClick(Sender: TObject);
strict private strict private
phoneDict: TDictionary<string, string>;
procedure StartServers; procedure StartServers;
procedure UpdateGUI; procedure UpdateGUI;
end; end;
...@@ -45,7 +41,8 @@ uses ...@@ -45,7 +41,8 @@ uses
Common.Logging, Common.Logging,
Common.Config, Common.Config,
Sparkle.Utils, Sparkle.Utils,
Database, Data; KGOrders.Database,
Data;
{$R *.dfm} {$R *.dfm}
...@@ -99,29 +96,39 @@ procedure TFMain.StartServers; ...@@ -99,29 +96,39 @@ procedure TFMain.StartServers;
// Reads from the ini file to figure out what IP the database is located at and // Reads from the ini file to figure out what IP the database is located at and
// whether or not Twilio automatic updates should be enabled // whether or not Twilio automatic updates should be enabled
var var
iniFilename: string;
iniFile: TIniFile; iniFile: TIniFile;
iniStr: string; iniStr: string;
begin begin
// this looks ok in the log file but not in the memo on the form // this looks ok in the log file but not in the memo on the form
Logger.Log(1, '*******************************************************'); Logger.Log( 1, '*******************************************************' );
Logger.Log(1, '* kgOrders Server - beta ver. *'); Logger.Log( 1, '* kgOrdersServer - ver 1.1.0 *' );
Logger.Log(1, '* Developed by EM Systems, Inc. *'); Logger.Log( 1, '* Developed by EM Systems, Inc. *' );
Logger.Log(1, '*******************************************************'); Logger.Log( 1, '*******************************************************' );
Logger.Log(1, ''); Logger.Log( 1, '' );
Logger.Log(1, 'TMemoLogAppender - logLevel: ' + IntToStr(serverConfig.memoLogLevel));
Logger.Log(1, 'TFileLogAppender - logLevel: ' + IntToStr(serverConfig.fileLogLevel)); iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
Logger.Log(1, '');
iniFilename := ChangeFileExt(Application.ExeName, '.ini');
Logger.Log( 1, 'iniFilename: ' + iniFileName);
iniFile := TIniFile.Create( iniFilename );
try try
iniStr := iniFile.ReadString( 'Options', 'LogFileNum', '' ); Logger.Log( 1, 'iniFile: ' + ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
Logger.Log( 1, 'LogLevels are displayed here. They were set in kgOrders.dpr, it executes first' );
iniStr := iniFile.ReadString( 'Settings', 'MemoLogLevel', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Settings->memoLogLevel: Entry not found - default: 3' )
else
Logger.Log( 1, '--Settings->memoLogLevel: ' + iniStr );
iniStr := iniFile.ReadString( 'Settings', 'FileLogLevel', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Settings->fileLogLevel: Entry not found - default: 4' )
else
Logger.Log( 1, '--Settings->fileLogLevel: ' + iniStr );
Logger.Log( 1, '' );
iniStr := iniFile.ReadString( 'Settings', 'LogFileNum', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
Logger.Log( 1, '--Options->LogFileNum: Entry not found' ) Logger.Log( 1, '--Settings->LogFileNum: Entry not found' )
else else
Logger.Log( 1, '--Options->LogFileNum: ' + IntToStr(StrToInt(iniStr) - 1) ); Logger.Log( 1, '--Settings->LogFileNum: ' + IntToStr(StrToInt(iniStr) - 1) );
iniStr := IniFile.ReadString( 'Database', 'Server', '' ); iniStr := IniFile.ReadString( 'Database', 'Server', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
...@@ -129,28 +136,7 @@ begin ...@@ -129,28 +136,7 @@ begin
else else
Logger.Log( 1, '--Database->Server: ' + iniStr ); Logger.Log( 1, '--Database->Server: ' + iniStr );
iniStr := IniFile.ReadString( 'Options', 'TwilioUpdateTime', '' ); Logger.Log( 1, '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Options->TwilioUpdateTime: Entry not found' )
else
begin
Logger.Log( 1, '--Options->TwilioUpdateTime: ' + iniStr );
if iniStr = '0' then
begin
Logger.Log( 1, '--Twilio Update Timer not enabled due to timer length of ' +
'0. Edit the ini file to enable auto updates.');
tmrTwilio.Enabled := False;
end
else
begin
Logger.Log( 1, '--Twilio Update Timer enabled and set to update every '+ iniStr + ' minutes.');
tmrTwilio.Interval := StrToInt(IniStr) * 60000;
tmrTwilio.Enabled := True;
end;
end;
Logger.Log(1, '');
finally finally
IniFile.Free; IniFile.Free;
end; end;
...@@ -159,26 +145,14 @@ begin ...@@ -159,26 +145,14 @@ begin
AuthServerModule.StartAuthServer(serverConfig.url, AUTH_MODEL); AuthServerModule.StartAuthServer(serverConfig.url, AUTH_MODEL);
ApiServerModule := TApiServerModule.Create( Self ); ApiServerModule := TApiServerModule.Create( Self );
ApiServerModule.StartApiServer(serverConfig.url); ApiServerModule.StartApiServer(serverConfig.url, API_MODEL);
AppServerModule := TAppServerModule.Create(Self); AppServerModule := TAppServerModule.Create(Self);
AppServerModule.StartAppServer( serverConfig.url ); AppServerModule.StartAppServer( serverConfig.url );
end; end;
procedure TFMain.tmrTwilioTimer(Sender: TObject);
var
key: string;
phoneNum: string;
begin
memoInfo.Lines.Add('Timer set off');
tmrTwilio.Enabled := False;
tmrTwilio.Enabled := True;
end;
procedure TFMain.FormClose(Sender: TObject; var Action: TCloseAction); procedure TFMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin begin
phoneDict.Free;
ServerConfig.Free; ServerConfig.Free;
AuthServerModule.Free; AuthServerModule.Free;
ApiServerModule.Free; ApiServerModule.Free;
......
...@@ -9,7 +9,7 @@ uses ...@@ -9,7 +9,7 @@ uses
Api.Server.Module in 'Source\Api.Server.Module.pas' {ApiServerModule: TDataModule}, Api.Server.Module in 'Source\Api.Server.Module.pas' {ApiServerModule: TDataModule},
Main in 'Source\Main.pas' {FMain}, Main in 'Source\Main.pas' {FMain},
Common.Logging in 'Source\Common.Logging.pas', Common.Logging in 'Source\Common.Logging.pas',
Database in 'Source\Database.pas' {FDatabaseModule: TDataModule}, KGOrders.Database in 'Source\KGOrders.Database.pas' {KGOrdersDatabase: TDataModule},
Common.Middleware.Logging in 'Source\Common.Middleware.Logging.pas', Common.Middleware.Logging in 'Source\Common.Middleware.Logging.pas',
Common.Config in 'Source\Common.Config.pas', Common.Config in 'Source\Common.Config.pas',
Auth.Server.Module in 'Source\Auth.Server.Module.pas' {AuthServerModule: TDataModule}, Auth.Server.Module in 'Source\Auth.Server.Module.pas' {AuthServerModule: TDataModule},
...@@ -92,12 +92,12 @@ var ...@@ -92,12 +92,12 @@ var
begin begin
FLogLevel := ALogLevel; FLogLevel := ALogLevel;
FCriticalSection := TCriticalSection.Create; FCriticalSection := TCriticalSection.Create;
IniFile := TIniFile.Create( ChangeFileExt( Application.ExeName, '.ini' ) ); iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
try try
fileNum := IniFile.ReadInteger( 'Options', 'LogFileNum', 0 ); fileNum := iniFile.ReadInteger( 'Settings', 'LogFileNum', 0 );
// FFilename := AFilename + Format('%.*d',[4, fileNum]); // FFilename := AFilename + Format('%.*d',[4, fileNum]);
FFilename := AFilename + Format('%.4d',[fileNum]); FFilename := AFilename + Format('%.4d',[fileNum]);
iniFile.WriteInteger( 'Options', 'LogFileNum', fileNum + 1 ); iniFile.WriteInteger( 'Settings', 'LogFileNum', fileNum + 1 );
finally finally
iniFile.Free; iniFile.Free;
end; end;
...@@ -132,14 +132,12 @@ begin ...@@ -132,14 +132,12 @@ begin
try try
AssignFile( FLogFile, LogFile ); AssignFile( FLogFile, LogFile );
if FileExists(LogFile) then
Append( FLogFile )
else
ReWrite( FLogFile );
if logLevel <= FLogLevel then if logLevel <= FLogLevel then
begin
if FileExists(LogFile) then
Append( FLogFile )
else
ReWrite( FLogFile );
WriteLn( FLogFile, FormattedMessage ); WriteLn( FLogFile, FormattedMessage );
end;
finally finally
CloseFile(FLogFile); CloseFile(FLogFile);
end; end;
...@@ -150,12 +148,24 @@ end; ...@@ -150,12 +148,24 @@ end;
{$R *.res} {$R *.res}
var
iniFile: TIniFile;
memoLogLevel: Integer;
fileLogLevel: Integer;
begin begin
ReportMemoryLeaksOnShutdown := True; ReportMemoryLeaksOnShutdown := True;
Application.Initialize; Application.Initialize;
Application.MainFormOnTaskbar := True; Application.MainFormOnTaskbar := True;
Application.CreateForm(TFMain, FMain); Application.CreateForm(TFMain, FMain);
Logger.AddAppender(TMemoLogAppender.Create( 5, FMain.memoinfo )); iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
Logger.AddAppender(TFileLogAppender.Create( 5, 'kgOrdersServer' )); try
memoLogLevel := iniFile.ReadInteger( 'Settings', 'memoLogLevel', 3 );
fileLogLevel := iniFile.ReadInteger( 'Settings', 'memoLogLevel', 4 );
finally
iniFile.Free;
end;
Logger.AddAppender(TMemoLogAppender.Create( memoLogLevel, FMain.memoinfo ));
Logger.AddAppender(TFileLogAppender.Create( fileLogLevel, 'kgOrdersServer' ));
Application.Run; Application.Run;
end. end.
...@@ -133,8 +133,8 @@ ...@@ -133,8 +133,8 @@
<Form>FMain</Form> <Form>FMain</Form>
</DCCReference> </DCCReference>
<DCCReference Include="Source\Common.Logging.pas"/> <DCCReference Include="Source\Common.Logging.pas"/>
<DCCReference Include="Source\Database.pas"> <DCCReference Include="Source\KGOrders.Database.pas">
<Form>FDatabaseModule</Form> <Form>KGOrdersDatabase</Form>
<FormType>dfm</FormType> <FormType>dfm</FormType>
<DesignClass>TDataModule</DesignClass> <DesignClass>TDataModule</DesignClass>
</DCCReference> </DCCReference>
......
[Options] [Settings]
MemoLogLevel=5
LogFileNum=234 FileLogLevel=5
LogFileNum=23
UpdateTimerLength=0 webClientVersion=1.0.0
[Database] [Database]
Server=192.168.159.132 --Server=192.168.159.132
--Server=192.168.102.129 Server=192.168.198.131
--Server=192.168.75.133
[Twilio] --Database=
AccountSID=AC37aeef9c36a2cccbaecbadafc172b2ff --Username=
AuthHeader=Basic QUMzN2FlZWY5YzM2YTJjY2NiYWVjYmFkYWZjMTcyYjJmZjo5NzM5OTAwYTgyZmRlNjVlMzI2ODFmZjVmMmI5ZGZjZgo= --Password=
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