Commit 5680ee7c by cam

Orders Page cleaned up

parent 37bffa08
...@@ -330,6 +330,25 @@ object FViewOrders: TFViewOrders ...@@ -330,6 +330,25 @@ object FViewOrders: TFViewOrders
end> end>
DataSource = wdsOrders DataSource = wdsOrders
end end
object wcbPageSize: TWebComboBox
Left = 22
Top = 52
Width = 145
Height = 21
ElementClassName = 'custom-select'
ElementID = 'wcbpagesize'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Text = '500'
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'100'
'250'
'500'
'1000')
end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 28 Left = 28
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
<!-- Actions Row --> <!-- Actions Row -->
<div class="row mt-3 justify-content-center"> <div class="row mt-3 justify-content-center">
<div class="col-auto d-flex align-items-center">
<label class="mt-3" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label>
</div>
<div class="col-auto"> <div class="col-auto">
<button id="btnaddorder" class="btn btn-secondary mt-3">Add Order</button> <button id="btnaddorder" class="btn btn-secondary mt-3">Add Order</button>
</div> </div>
......
...@@ -61,6 +61,7 @@ type ...@@ -61,6 +61,7 @@ type
wdsSave: TWebDataSource; wdsSave: TWebDataSource;
xdwdsSaveCURR_ID: TIntegerField; xdwdsSaveCURR_ID: TIntegerField;
wdbtcOrders: TWebDBTableControl; wdbtcOrders: TWebDBTableControl;
wcbPageSize: TWebComboBox;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject); procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject); procedure btnSearchClick(Sender: TObject);
...@@ -141,6 +142,7 @@ begin ...@@ -141,6 +142,7 @@ begin
//today := TDateTime.Today; //today := TDateTime.Today;
dtpStartDate.Date := 0; dtpStartDate.Date := 0;
dtpEndDate.Date := 0; dtpEndDate.Date := 0;
wcbPageSize.Text := '500';
getOrders(GenerateSearchOptions()); getOrders(GenerateSearchOptions());
end; end;
...@@ -413,6 +415,8 @@ procedure TFViewOrders.GetOrders(searchOptions: string); ...@@ -413,6 +415,8 @@ procedure TFViewOrders.GetOrders(searchOptions: string);
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
orderList: TJSObject; orderList: TJSObject;
orderListLength: integer;
TotalPages: integer;
begin begin
if PageNumber > 0 then if PageNumber > 0 then
begin begin
...@@ -431,9 +435,28 @@ begin ...@@ -431,9 +435,28 @@ begin
endSpinner(); endSpinner();
end; end;
lblEntries.Caption := 'Total entries: ' + IntToStr(integer(orderList['count'])); orderListLength := integer(orderList['count']);
TotalPages := ( (orderListLength + PageSize - 1) div PageSize);
if orderListLength = 0 then
begin
lblEntries.Caption := 'No entries found';
end
else if (PageNumber * PageSize) < orderListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(orderListLength);
end
else if (PageNumber * PageSize) >= orderListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(orderListLength) +
' of ' + IntToStr(orderListLength);
end;
// Optional: Continue using pagination if needed // Optional: Continue using pagination if needed
GeneratePagination((integer(orderList['count']) + PageSize - 1) div PageSize); GeneratePagination(TotalPages);
end; end;
end; end;
...@@ -555,7 +578,7 @@ var ...@@ -555,7 +578,7 @@ var
searchOptions: string; searchOptions: string;
begin begin
//PageNumber := 1; //PageNumber := 1;
PageSize := 50; PageSize := StrToInt(wcbPageSize.Text);
OrderBy := wcbSortBy.Text; OrderBy := wcbSortBy.Text;
searchOptions := '&pagenumber=' + IntToStr(PageNumber) + searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) + '&pagesize=' + IntToStr(PageSize) +
......
...@@ -387,7 +387,7 @@ begin ...@@ -387,7 +387,7 @@ begin
order.shipDone := ordersDB.UniQuery1.FieldByName('SHIP_DONE').AsString; order.shipDone := ordersDB.UniQuery1.FieldByName('SHIP_DONE').AsString;
order.price := ordersDB.UniQuery1.FieldByName('PRICE').AsString; order.price := ordersDB.UniQuery1.FieldByName('PRICE').AsString;
order.qbRefNum := ordersDB.UniQuery1.FieldByName('QB_REF_NUM').AsString; order.qbRefNum := ordersDB.UniQuery1.FieldByName('QB_REF_NUM').AsString;
order.orderType := ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString; order.orderType := ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString.Replace('_', ' ');
if ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'web_plate' then if ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'web_plate' then
begin begin
......
[Settings] [Settings]
MemoLogLevel=4 MemoLogLevel=4
FileLogLevel=5 FileLogLevel=5
LogFileNum=48 LogFileNum=50
webClientVersion=1.0.0 webClientVersion=1.0.0
[Database] [Database]
......
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