Commit 5680ee7c by cam

Orders Page cleaned up

parent 37bffa08
......@@ -330,6 +330,25 @@ object FViewOrders: TFViewOrders
end>
DataSource = wdsOrders
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
Connection = DMConnection.ApiConnection
Left = 28
......
......@@ -38,6 +38,9 @@
<!-- Actions Row -->
<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">
<button id="btnaddorder" class="btn btn-secondary mt-3">Add Order</button>
</div>
......
......@@ -61,6 +61,7 @@ type
wdsSave: TWebDataSource;
xdwdsSaveCURR_ID: TIntegerField;
wdbtcOrders: TWebDBTableControl;
wcbPageSize: TWebComboBox;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -141,6 +142,7 @@ begin
//today := TDateTime.Today;
dtpStartDate.Date := 0;
dtpEndDate.Date := 0;
wcbPageSize.Text := '500';
getOrders(GenerateSearchOptions());
end;
......@@ -413,6 +415,8 @@ procedure TFViewOrders.GetOrders(searchOptions: string);
var
xdcResponse: TXDataClientResponse;
orderList: TJSObject;
orderListLength: integer;
TotalPages: integer;
begin
if PageNumber > 0 then
begin
......@@ -431,9 +435,28 @@ begin
endSpinner();
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
GeneratePagination((integer(orderList['count']) + PageSize - 1) div PageSize);
GeneratePagination(TotalPages);
end;
end;
......@@ -555,7 +578,7 @@ var
searchOptions: string;
begin
//PageNumber := 1;
PageSize := 50;
PageSize := StrToInt(wcbPageSize.Text);
OrderBy := wcbSortBy.Text;
searchOptions := '&pagenumber=' + IntToStr(PageNumber) +
'&pagesize=' + IntToStr(PageSize) +
......
......@@ -387,7 +387,7 @@ begin
order.shipDone := ordersDB.UniQuery1.FieldByName('SHIP_DONE').AsString;
order.price := ordersDB.UniQuery1.FieldByName('PRICE').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
begin
......
[Settings]
MemoLogLevel=4
FileLogLevel=5
LogFileNum=48
LogFileNum=50
webClientVersion=1.0.0
[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