Commit af90a3ab by Elias Sarraf

cleanup a bit. rename View.OrderList View.AddOrder

parent 7f19b291
object FOrderList: TFOrderList
object FAddOrder: TFAddOrder
Width = 1016
Height = 683
Height = 637
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
......@@ -31,9 +32,33 @@ object FOrderList: TFOrderList
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel1: TWebLabel
Left = 447
Top = 169
Width = 53
Height = 14
Caption = 'Selected Id'
ElementID = 'lblentries2'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 278
Top = 169
Width = 95
Height = 14
Caption = 'Enter Customer Info'
ElementID = 'lblentries2'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 370
Top = 558
Left = 212
Top = 41
Width = 121
Height = 33
ElementClassName = 'card'
......@@ -75,84 +100,69 @@ object FOrderList: TFOrderList
end
end
object cbCorrugatedPlate: TWebCheckBox
Left = 190
Top = 26
Left = 430
Top = 123
Width = 113
Height = 22
Caption = 'Corrugated Plate'
Checked = True
ChildOrder = 5
ElementID = 'cb_corrugatedplate'
HeightPercent = 100.000000000000000000
State = cbChecked
WidthPercent = 100.000000000000000000
OnClick = cbCorrugatedPlateClick
end
object cbWebPlate: TWebCheckBox
Left = 324
Top = 26
Left = 562
Top = 123
Width = 113
Height = 22
Caption = 'Web Plate'
ChildOrder = 5
ElementID = 'cb_webplate'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 674
Top = 51
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 9
ElementID = 'btn_confirm'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = cbWebPlateClick
end
object edtCompanyName: TWebEdit
Left = 170
Top = 66
object edtID: TWebEdit
Left = 447
Top = 183
Width = 121
Height = 22
ChildOrder = 8
ElementID = 'edt_companyname'
HeightPercent = 100.000000000000000000
Text = 'edtCompanyName'
WidthPercent = 100.000000000000000000
OnChange = edtCompanyNameChange
end
object edtID: TWebEdit
Left = 334
Top = 66
Width = 121
Height = 22
object btnConfirm: TWebButton
Left = 574
Top = 180
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 9
ElementID = 'edt_id'
HeightPercent = 100.000000000000000000
Text = 'edtID'
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnFilter: TWebButton
Left = 564
Top = 195
object btnCancel: TWebButton
Left = 682
Top = 180
Width = 96
Height = 25
Caption = 'Filter'
Caption = 'Cancel'
ChildOrder = 9
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnFilterClick
OnClick = btnCancelClick
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 228
Top = 308
Width = 588
Left = 132
Top = 227
Width = 803
Height = 353
AdaptToStyle = True
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 7
TabOrder = 6
DefaultRowHeight = 40.000000000000000000
FixedColumns = 0
ColumnCount = 0
......@@ -170,6 +180,7 @@ object FOrderList: TFOrderList
Options.Mouse.RowSizeMargin = 6
Options.Mouse.FixedColumnSizing = True
Options.Mouse.FixedRowSizing = True
OnSelectedCell = TMSFNCGrid1SelectedCell
Columns = <
item
BorderWidth = 1
......@@ -328,9 +339,9 @@ object FOrderList: TFOrderList
DesignTimeSampleData = True
end
object edtSearch: TWebEdit
Left = 437
Top = 198
Width = 121
Left = 278
Top = 183
Width = 146
Height = 22
ChildOrder = 8
HeightPercent = 100.000000000000000000
......@@ -343,6 +354,7 @@ object FOrderList: TFOrderList
Top = 434
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 84
Top = 490
object xdwdsCustomersID: TIntegerField
......
<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;
unit View.AddOrder;
interface
......@@ -13,16 +13,15 @@ uses
Vcl.Controls, ConnectionModule;
type
TFOrderList = class(TWebForm)
TFAddOrder = class(TWebForm)
lblEntries: TWebLabel;
lblEntries2: TWebLabel;
edtSearch: TWebEdit;
edtCompanyName: TWebEdit;
edtID: TWebEdit;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
btnFilter: TWebButton;
btnCancel: TWebButton;
XDataWebClient1: TXDataWebClient;
wdsCustomers: TWebDataSource;
xdwdsCustomers: TXDataWebDataSet;
......@@ -34,12 +33,15 @@ type
btnConfirm: TWebButton;
cbCorrugatedPlate: TWebCheckBox;
cbWebPlate: TWebCheckBox;
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
procedure WebFormShow(Sender: TObject);
procedure btnFilterClick(Sender: TObject);
procedure cbCorrugatedPlateClick(Sender: TObject);
procedure cbWebPlateClick(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure edtSearchChange(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure TMSFNCGrid1SelectedCell(Sender: TObject; ACol, ARow: Integer);
private
[async] procedure getCustomers();
procedure PopulateGridManually;
......@@ -48,19 +50,19 @@ type
end;
var
FOrderList: TFOrderList;
FAddOrder: TFAddOrder;
implementation
{$R *.dfm}
procedure TFOrderList.WebFormShow(Sender: TObject);
procedure TFAddOrder.WebFormShow(Sender: TObject);
begin
getCustomers(); // Fetch and populate the grid with customer data
end;
[async]
procedure TFOrderList.getCustomers();
procedure TFAddOrder.getCustomers();
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
......@@ -78,7 +80,7 @@ begin
PopulateGridManually;
end;
procedure TFOrderList.PopulateGridManually;
procedure TFAddOrder.PopulateGridManually;
var
RowIndex: Integer;
begin
......@@ -90,10 +92,15 @@ begin
TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'ID';
TMSFNCGrid1.Cells[1, 0] := 'Name';
TMSFNCGrid1.Cells[2, 0] := 'Short Name';
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;
TMSFNCGrid1.ColumnWidths[3] := 400;
// Populate the grid with data from the dataset
xdwdsCustomers.First;
RowIndex := 1;
......@@ -103,22 +110,26 @@ begin
TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('ID').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('NAME').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('SHORT_NAME').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;
// Auto-size columns
TMSFNCGrid1.AutoSizeColumns;
finally
TMSFNCGrid1.EndUpdate;
end;
end;
procedure TFOrderList.ApplyFilter;
procedure TFAddOrder.TMSFNCGrid1SelectedCell(Sender: TObject; ACol,
ARow: Integer);
begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow];
end;
procedure TFAddOrder.ApplyFilter;
var
fd: TTMSFNCGridFilterData;
i: Integer;
......@@ -126,14 +137,11 @@ var
begin
SearchText := Trim(edtSearch.Text);
// Remove any existing filters
TMSFNCGrid1.RemoveFilter;
TMSFNCGrid1.Filter.Clear;
// Add a filter for each column
for i := 0 to TMSFNCGrid1.ColumnCount - 1 do
// match on first 3 columns
for i := 0 to 2 do
begin
fd := TMSFNCGrid1.Filter.Add;
fd.Column := i;
......@@ -152,27 +160,28 @@ begin
end;
procedure TFOrderList.btnFilterClick(Sender: TObject);
procedure TFAddOrder.cbCorrugatedPlateClick(Sender: TObject);
begin
ApplyFilter;
cbWebPlate.Checked := False;
end;
procedure TFOrderList.edtIDChange(Sender: TObject);
procedure TFAddOrder.cbWebPlateClick(Sender: TObject);
begin
cbWebPlate.Checked := False;
cbCorrugatedPlate.Checked := False;
end;
procedure TFOrderList.cbWebPlateClick(Sender: TObject);
procedure TFAddOrder.btnConfirmClick(Sender: TObject);
begin
cbCorrugatedPlate.Checked := False;
Close;
end;
procedure TFOrderList.btnConfirmClick(Sender: TObject);
procedure TFAddOrder.btnCancelClick(Sender: TObject);
begin
edtID.Text := '';
Close;
end;
procedure TFOrderList.edtSearchChange(Sender: TObject);
procedure TFAddOrder.edtSearchChange(Sender: TObject);
begin
ApplyFilter;
end;
......
<div class="container pb-5 mt-5 orders-modal rounded-sm shadow border border-secondary bg-white">
<div class="row sticky-top bg-white">
<div class="col-auto">
<h4 class="custom-h4 mt-4">Order List</h4>
<p>Review the list of orders below.</p>
<hr class="custom-hr">
</div>
</div>
<!-- Input Controls -->
<div class="row mb-3">
<div class="col-md-4">
<label for="edt_companyname" class="form-label">Company Name</label>
<input type="text" class="form-control" id="edt_companyname" placeholder="Enter company name">
</div>
<div class="col-md-4">
<label for="edt_id" class="form-label">Order ID</label>
<input type="text" class="form-control" id="edt_id" placeholder="Enter order ID">
</div>
<div class="col-md-2 d-flex align-items-center">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="cb_corrugatedplate">
<label class="form-check-label" for="cb_corrugatedplate">
Corrugated Plate
</label>
</div>
</div>
<div class="col-md-2 d-flex align-items-center">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="cb_webplate">
<label class="form-check-label" for="cb_webplate">
Web Plate
</label>
</div>
</div>
</div>
<!-- Orders Table -->
<div id="tbl_orders_container" class="overflow-auto" style="max-height: 400px;">
<table id="tbl_orders" class="table table-striped table-hover table-bordered">
<!-- TWebDBTableControl will render dynamically here -->
</table>
</div>
<!-- Pagination and Additional Labels -->
<div class="row mt-3">
<label id="lblentries" class="col-auto"></label>
<label id="lblentries2" class="col-auto"></label>
</div>
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center" id="pagination">
<!-- Pagination items will be added dynamically via Delphi code -->
</ul>
</nav>
<!-- Confirm Button -->
<div class="row mt-3">
<div class="col-auto">
<button type="button" id="btn_confirm" class="btn btn-primary">Confirm</button>
</div>
</div>
</div>
......@@ -274,20 +274,6 @@ object FViewOrders: TFViewOrders
ListField = 'NAME'
ListSource = wdsCustomers
end
object pnlOrders: TWebPanel
Left = 38
Top = 132
Width = 461
Height = 181
ElementClassName = 'card'
ElementID = 'pnl_orders'
Caption = 'pnlOrders'
ChildOrder = 15
ElementBodyClassName = 'card-body'
ElementFont = efCSS
TabOrder = 13
Visible = False
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 8
......
......@@ -120,18 +120,3 @@
</div>
</div>
</div>
<!-- pnl_orders Div -->
<div id="pnl_orders"
style="display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1050;
padding: 20px;
border-radius: 10px;
width: 75%;
background-color: white;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);">
</div>
......@@ -63,7 +63,6 @@ type
xdwdsSave: TXDataWebDataSet;
wdsSave: TWebDataSource;
xdwdsSaveCURR_ID: TIntegerField;
pnlOrders: TWebPanel;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -107,7 +106,7 @@ var
implementation
uses
XData.Model.Classes, View.Main, View.OrderList;
XData.Model.Classes, View.Main, View.AddOrder;
{$R *.dfm}
......@@ -168,20 +167,16 @@ begin
);
end;
procedure TFViewOrders.ShowOrderListForm();
var
OrdersPanel: TJSHTMLElement;
newform: TFAddOrder;
begin
// Get the panel element for orders
OrdersPanel := TJSHTMLElement(document.getElementById('pnl_orders'));
// Hide the panel before loading the form
if Assigned(OrdersPanel) then
OrdersPanel.style.setProperty('display', 'none');
newform := TFAddOrder.CreateNew;
// Create the order list form, passing the ElementID
TFOrderList.CreateForm(pnlOrders.ElementID);
newform.Caption := 'Select Customer and Order Type';
newForm.Popup := True;
newForm.Border := fbDialog;
console.log(newForm.GetElementHandle);
// used to manage Back button handling to close subform
window.location.hash := 'subform';
......@@ -189,16 +184,12 @@ begin
newform.ShowModal(
procedure(AValue: TModalResult)
begin
if newForm.edtID.Text <> '' then
if newform.edtID.Text <> '' then
orderEntry('', newForm.edtID.Text, 'ADD');
end
);
end;
procedure TFViewOrders.AddRowToTable(temp: string);
// Adds rows to the table
// PhoneNumber: phone number of the location
......
......@@ -18,7 +18,7 @@ uses
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html},
View.Orders in 'View.Orders.pas' {FViewOrders: 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}
......
......@@ -171,8 +171,8 @@
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.OrderList.pas">
<Form>FOrderList</Form>
<DCCReference Include="View.AddOrder.pas">
<Form>FAddOrder</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
......
......@@ -19,11 +19,9 @@ object AuthDatabase: TAuthDatabase
object ucKG: TUniConnection
ProviderName = 'MySQL'
Database = 'kg_order_entry'
SpecificOptions.Strings = (
'PostgreSQL.Schema=envoy')
Username = 'root'
LoginPrompt = False
Left = 69
Left = 67
Top = 131
EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF'
end
......
......@@ -56,27 +56,6 @@ begin
ucKG.Server := iniStr;
end;
iniStr := IniFile.ReadString( 'Twilio', 'AccountSID', '' );
if iniStr.IsEmpty then
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') +
' Twilio->AccountSID: Entry not found' )
else
begin
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') +
' Twilio->AccountSID: ' + iniStr );
//accountSID := iniStr;
end;
iniStr := IniFile.ReadString( 'Twilio', 'AuthHeader', '' );
if iniStr.IsEmpty then
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') +
' Twilio->AuthHeader: Entry not found' )
else
begin
Logger.Log( 1, 'iniFile: ' + ChangeFileExt(Application.ExeName, '.ini') +
' Twilio->AuthHeader: ' + iniStr );
//authHeader := iniStr;
end;
Logger.Log(1, '');
finally
IniFile.Free;
......
......@@ -5,8 +5,6 @@ object FDatabaseModule: TFDatabaseModule
object ucKG: TUniConnection
ProviderName = 'MySQL'
Database = 'kg_order_entry'
SpecificOptions.Strings = (
'PostgreSQL.Schema=envoy')
Username = 'root'
LoginPrompt = False
Left = 75
......
[Options]
LogFileNum=234
UpdateTimerLength=0
LogFileNum=22
[Database]
--Server=192.168.159.132
--Server=192.168.102.129
Server=192.168.102.130
[Twilio]
AccountSID=AC37aeef9c36a2cccbaecbadafc172b2ff
AuthHeader=Basic QUMzN2FlZWY5YzM2YTJjY2NiYWVjYmFkYWZjMTcyYjJmZjo5NzM5OTAwYTgyZmRlNjVlMzI2ODFmZjVmMmI5ZGZjZgo=
Server=192.168.198.129
--Server=192.168.75.133
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