Commit 7c01cce8 by cam

Fixed issue with status schedule not being updated properly

Also added needed documentation
parent 7a2dffa1
// Pop-Up menu that appears when Add Order button is clicked on orders page.
// Used to select customer before entering an order.
unit View.AddOrder;
interface
......@@ -56,7 +58,6 @@ implementation
procedure TFAddOrder.btnCancelClick(Sender: TObject);
begin
edtID.Text := '';
Close;
end;
......@@ -89,6 +90,7 @@ begin
end;
[async] procedure TFAddOrder.getCustomers();
// retrieves customer list from server
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
......@@ -107,6 +109,7 @@ begin
end;
procedure TFAddOrder.PopulateGridManually;
// populates the grid with customers manually.
var
RowIndex: Integer;
begin
......@@ -122,10 +125,6 @@ begin
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;
......@@ -152,11 +151,13 @@ end;
procedure TFAddOrder.TMSFNCGrid1SelectedCell(Sender: TObject; ACol,
ARow: Integer);
// When a cell is clicked it puts the ID in the text box
begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow];
end;
procedure TFAddOrder.ApplyFilter;
// filters the grid based on search textbox contents.
var
fd: TTMSFNCGridFilterData;
i: Integer;
......
......@@ -26,7 +26,6 @@ type
cbStatus: TWebCheckBox;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject);
private
FChildForm: TWebForm;
......@@ -34,7 +33,6 @@ type
procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string;
[async] procedure Search(searchOptions: string);
[async] procedure GetItems(searchOptions: string);
[async] procedure getUser();
[async] procedure AddItem(itemOptions: string);
......@@ -86,11 +84,10 @@ end;
procedure TFViewItems.AddRowToTable(ID, Name, Description, Status: string);
// Adds rows to the table
// PhoneNumber: phone number of the location
// Caller: phone number of the caller
// Duration: duration of the call
// Transcript: transcription of the recording
// MediaUrl: Link to the recording
// ID: item ID
// Name: item name
// Description: item description
// Status: inactive or active
var
NewRow, Cell, P, Button, Audio: TJSHTMLElement;
begin
......@@ -293,6 +290,9 @@ begin
end;
procedure TFViewItems.GetItems(searchOptions: string);
// retrieves items from the server.
// searchOptions: info to limit how many items we retrieve from the server.
// probably not needed due to database size.
var
xdcResponse: TXDataClientResponse;
itemList : TJSObject;
......@@ -355,6 +355,7 @@ begin
end;
procedure TFViewItems.AddItem(itemOptions: string);
// adds an item to the database.
var
xdcResponse: TXDataClientResponse;
begin
......@@ -363,48 +364,13 @@ begin
getItems(GenerateSearchOptions());
end;
procedure TFViewItems.Search(searchOptions: string);
// Search method that searches the database for a specific phone number
var
xdcResponse: TXDataClientResponse;
callList : TJSObject;
i: integer;
data: TJSArray;
call: TJSObject;
callListLength: integer;
begin
{if PageNumber > 0 then
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.Search',
[searchOptions]));
callList := TJSObject(xdcResponse.Result);
data := TJSArray(callList['data']);
callListLength := integer(callList['count']);
ClearTable();
for i := 0 to data.Length - 1 do
begin
call := TJSObject(data[i]);
AddRowToTable(string(call['toNumber']), string(call['fromNumber']), string(call['dateCreated']),
string(call['duration']), string(call['transcription']), string(call['mediaUrl']));
end;
TotalPages := (callListLength + PageSize - 1) div PageSize;
lblEntries.Caption := 'Showing entries for phone number: ' + searchOptions;
end; }
end;
procedure TFViewItems.wcbPageSizeChange(Sender: TObject);
// gets a new amount of items based when the page size is changed
begin
PageNumber := 1;
getItems(GenerateSearchOptions());
end;
procedure TFViewItems.btnSearchClick(Sender: TObject);
// item Search method
begin
//Search(edtSearch.Text);
end;
procedure TFViewItems.ClearTable();
// clears the table
var
......
......@@ -797,8 +797,8 @@ object FOrderEntry: TFOrderEntry
DataSource = WebDataSource1
end
object btnConfirm: TWebButton
Left = 752
Top = 558
Left = 652
Top = 560
Width = 96
Height = 25
Caption = 'Confirm'
......@@ -965,6 +965,29 @@ object FOrderEntry: TFOrderEntry
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnEdit: TWebButton
Left = 870
Top = 560
Width = 96
Height = 25
Caption = 'Edit'
ChildOrder = 79
ElementID = 'btnedit'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCancel: TWebButton
Left = 764
Top = 560
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 79
ElementID = 'btncancel'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 244
......
......@@ -300,7 +300,13 @@
</div>
<div class="row">
<div class="col-auto">
<button id="btnconfirm" class="btn btn-primary btn-sm float-end">Confirm</button>
<button id="btnconfirm" class="btn btn-primary btn-sm float-end my-2">Confirm</button>
</div>
<div class="col-auto">
<button id="btncancel" class="btn btn-primary btn-sm float-end my-2">Cancel</button>
</div>
<div class="col-auto">
<button id="btnedit" class="btn btn-primary btn-sm float-end my-2">Edit</button>
</div>
</div>
</div>
......
// Order Entry page of Corruguated Orders. Used for both editting and adding
// orders.
unit View.OrderEntryCorrugated;
interface
......@@ -187,6 +189,8 @@ type
WebDBComboBox1: TWebDBComboBox;
cbEmail: TWebCheckBox;
XDataWebDataSet1supplied_by_customer_order_date: TStringField;
btnEdit: TWebButton;
btnCancel: TWebButton;
procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
......@@ -198,6 +202,7 @@ type
procedure addColorRow(num, Color, LPI, Size: string);
procedure btnConfirmClick(Sender: TObject);
[async] procedure AddCorrugatedOrder(orderJSON: TJSONObject);
procedure btnCancelClick(Sender: TObject);
private
FAgencyCode: string;
FCurrentReportType: string;
......@@ -221,6 +226,7 @@ uses
View.Home, View.Main;
procedure TFOrderEntry.btnConfirmClick(Sender: TObject);
// Converts all the information on the page into a JSON to then send to the server
var
colorList: TJSONArray;
container: TJSElement;
......@@ -358,6 +364,7 @@ begin
end;
procedure TFOrderEntry.AddCorrugatedOrder(orderJSON: TJSONObject);
// sends the order JSON object to the server
var
Response: TXDataClientResponse;
begin
......@@ -386,6 +393,9 @@ begin
end;
procedure TFOrderEntry.addColorRow(num: string; Color: string; LPI: string; Size: string);
// Java script code to add a row of colors when a button is clicked
// all variables are information to be placed in the boxes when loading an order.
// TODO: convert to Delphi
begin
asm
const container = document.getElementById('additionalFields');
......@@ -440,6 +450,11 @@ begin
addColorRow('','','','');
end;
procedure TFOrderEntry.btnCancelClick(Sender: TObject);
begin
FViewMain.ViewOrders('');
end;
procedure TFOrderEntry.WebFormCreate(Sender: TObject);
begin
if not DMConnection.ApiConnection.Connected then
......@@ -450,6 +465,7 @@ begin
end;
procedure TFOrderEntry.getOrder(Order_ID: string);
// retrieves an order from the server then loads the info into the page
var
xdcResponse: TXDataClientResponse;
orderList : TJSObject;
......@@ -598,6 +614,7 @@ begin
end;
procedure TFOrderEntry.getCustomer(customerID: string);
// gets a customer from the database then loads the appropiate fields
var
xdcResponse: TXDataClientResponse;
customer : TJSObject;
......
......@@ -64,7 +64,6 @@ type
procedure btnSearchClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnPDFClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject);
procedure wlcbOrderByChange(Sender: TObject);
......@@ -79,10 +78,7 @@ type
procedure ShowNotification(Notification: string);
procedure ShowAddOrderForm();
procedure ShowSearchForm();
[async] procedure Search(searchOptions: string);
[async] procedure GetOrders(searchOptions: string);
[async] procedure getUser();
procedure GeneratePDF(OrderID: string);
[async] procedure GenerateReportPDF;
var
PageNumber: integer;
......@@ -129,6 +125,7 @@ begin
end;
[async] procedure TFViewOrders.GenerateReportPDF;
// sends the search to the server which then sends back a pdf of the results
var
xdcResponse: TXDataClientResponse;
searchOptions, pdfURL: string;
......@@ -198,20 +195,6 @@ begin
getOrders(generateSearchOptions());
end;
procedure TFViewOrders.getUser();
var
xdcResponse: TXDataClientResponse;
userList, user: TJSObject;
data: TJSArray;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetUsers',
[JS.toString(AuthService.TokenPayload.Properties['user_name'])]));
userList := TJSObject(xdcResponse.Result);
data := TJSArray(userList['data']);
user := TJSObject(data[0]);
end;
class function TFViewOrders.CreateForm(AElementID, Info: string): TWebForm;
var
localInfo: string;
......@@ -230,6 +213,7 @@ end;
procedure TFViewOrders.ShowAddOrderForm();
// displays the add order pop-up so the user can choose a customer
var
newform: TFAddOrder;
begin
......@@ -252,6 +236,7 @@ begin
end;
procedure TFViewOrders.ShowSearchForm();
// displays the search pop-up that allows the user to filter the order list
var
newform: TFSearch;
begin
......@@ -513,6 +498,8 @@ end;
procedure TFViewOrders.GetOrders(searchOptions: string);
// retrieves a list of orders that fit a given search criteria
// searchOptions: search info to be sent to the server
var
xdcResponse: TXDataClientResponse;
orderList: TJSObject;
......@@ -578,65 +565,13 @@ begin
HideNotification();
end;
procedure TFViewOrders.btnConfirmClick(Sender: TObject);
begin
//orderEntry('', 'ADD');
end;
procedure TFViewOrders.btnSearchClick(Sender: TObject);
var
filterSection: TJSHTMLElement;
begin
{if btnFilters.Caption = 'Show Filters' then
begin
btnFilters.Caption := 'Hide Filters';
filterSection := TJSHTMLElement(document.getElementById('filter_info'));
if Assigned(filterSection) then
filterSection.style.setProperty('display', 'block');
end
else
begin
btnFilters.Caption := 'Show Filters';
filterSection := TJSHTMLElement(document.getElementById('filter_info'));
if Assigned(filterSection) then
filterSection.style.setProperty('display', 'none');
end;}
ShowSearchForm();
end;
procedure TFViewOrders.Search(searchOptions: string);
// Search method that searches the database for a specific phone number
var
xdcResponse: TXDataClientResponse;
callList : TJSObject;
i: integer;
data: TJSArray;
call: TJSObject;
callListLength: integer;
begin
if PageNumber > 0 then
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.Search',
[searchOptions]));
callList := TJSObject(xdcResponse.Result);
data := TJSArray(callList['data']);
callListLength := integer(callList['count']);
ClearTable();
for i := 0 to data.Length - 1 do
begin
call := TJSObject(data[i]);
{AddRowToTable(string(call['toNumber']), string(call['fromNumber']), string(call['dateCreated']),
string(call['duration']), string(call['transcription']), string(call['mediaUrl']));}
end;
TotalPages := (callListLength + PageSize - 1) div PageSize;
lblEntries.Caption := 'Showing entries for phone number: ' + searchOptions;
end;
end;
procedure TFViewOrders.ClearTable();
// clears the table
var
......@@ -718,24 +653,4 @@ begin
end;
end;
procedure TFViewOrders.GeneratePDF(OrderID: string);
var
XDCResponse: TXDataClientResponse;
PDFBase64: string;
PDFBlob: TJSUint8Array;
PDFLink: TJSHTMLElement;
begin
// XDCResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderPDF', [OrderID]));
// PDFBase64 := string(XDCResponse.Result);
//
// // Convert Base64 to binary and create a link to download it
// PDFBlob := TJSUint8Array.new(TJSBase64.decodeBase64(PDFBase64));
// PDFLink := TJSHTMLElement(document.createElement('a'));
// PDFLink.setAttribute('href', 'data:application/pdf;base64,' + PDFBase64);
// PDFLink.setAttribute('download', 'Order_' + OrderID + '.pdf');
// PDFLink.click;
end;
end.
// Search pop-up form used to filter the list.
// Author: Cameron Hayes
unit View.Search;
interface
......@@ -105,6 +107,7 @@ begin
end;
procedure TFSearch.WebFormShow(Sender: TObject);
// Auto fills information based on previous search
var
params: TStringList;
DateFormatSettings: TFormatSettings;
......@@ -241,6 +244,7 @@ begin
end;
[async] procedure TFSearch.getCustomers();
// Gets a list of customers from the server
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
......
......@@ -224,7 +224,6 @@ type
[ServiceContract, Model(API_MODEL)]
ILookupService = interface(IInvokable)
['{F24E1468-5279-401F-A877-CD48B44F4416}']
[HttpGet] function Search(phoneNum: string): TOrderList;
[HttpGet] function GetUsers(searchOptions: string): TUserList;
[HttpGet] function GetItems(searchOptions: string): TItemList;
[HttpGet] function GetOrders(searchOptions: string): TOrderList;
......
[Settings]
MemoLogLevel=4
FileLogLevel=5
LogFileNum=79
LogFileNum=86
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