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; unit View.AddOrder;
interface interface
...@@ -56,7 +58,6 @@ implementation ...@@ -56,7 +58,6 @@ implementation
procedure TFAddOrder.btnCancelClick(Sender: TObject); procedure TFAddOrder.btnCancelClick(Sender: TObject);
begin begin
edtID.Text := '';
Close; Close;
end; end;
...@@ -89,6 +90,7 @@ begin ...@@ -89,6 +90,7 @@ begin
end; end;
[async] procedure TFAddOrder.getCustomers(); [async] procedure TFAddOrder.getCustomers();
// retrieves customer list from server
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
customerList: TJSObject; customerList: TJSObject;
...@@ -107,6 +109,7 @@ begin ...@@ -107,6 +109,7 @@ begin
end; end;
procedure TFAddOrder.PopulateGridManually; procedure TFAddOrder.PopulateGridManually;
// populates the grid with customers manually.
var var
RowIndex: Integer; RowIndex: Integer;
begin begin
...@@ -122,10 +125,6 @@ begin ...@@ -122,10 +125,6 @@ begin
TMSFNCGrid1.Cells[2, 0] := 'Name'; TMSFNCGrid1.Cells[2, 0] := 'Name';
TMSFNCGrid1.Cells[3, 0] := 'Address'; 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 // Populate the grid with data from the dataset
xdwdsCustomers.First; xdwdsCustomers.First;
RowIndex := 1; RowIndex := 1;
...@@ -152,11 +151,13 @@ end; ...@@ -152,11 +151,13 @@ end;
procedure TFAddOrder.TMSFNCGrid1SelectedCell(Sender: TObject; ACol, procedure TFAddOrder.TMSFNCGrid1SelectedCell(Sender: TObject; ACol,
ARow: Integer); ARow: Integer);
// When a cell is clicked it puts the ID in the text box
begin begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow]; edtID.Text := TMSFNCGrid1.Cells[0, ARow];
end; end;
procedure TFAddOrder.ApplyFilter; procedure TFAddOrder.ApplyFilter;
// filters the grid based on search textbox contents.
var var
fd: TTMSFNCGridFilterData; fd: TTMSFNCGridFilterData;
i: Integer; i: Integer;
......
...@@ -26,7 +26,6 @@ type ...@@ -26,7 +26,6 @@ type
cbStatus: TWebCheckBox; cbStatus: TWebCheckBox;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject); procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject); procedure wcbPageSizeChange(Sender: TObject);
private private
FChildForm: TWebForm; FChildForm: TWebForm;
...@@ -34,7 +33,6 @@ type ...@@ -34,7 +33,6 @@ type
procedure ClearTable(); procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer); procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string; function GenerateSearchOptions(): string;
[async] procedure Search(searchOptions: string);
[async] procedure GetItems(searchOptions: string); [async] procedure GetItems(searchOptions: string);
[async] procedure getUser(); [async] procedure getUser();
[async] procedure AddItem(itemOptions: string); [async] procedure AddItem(itemOptions: string);
...@@ -86,11 +84,10 @@ end; ...@@ -86,11 +84,10 @@ end;
procedure TFViewItems.AddRowToTable(ID, Name, Description, Status: string); procedure TFViewItems.AddRowToTable(ID, Name, Description, Status: string);
// Adds rows to the table // Adds rows to the table
// PhoneNumber: phone number of the location // ID: item ID
// Caller: phone number of the caller // Name: item name
// Duration: duration of the call // Description: item description
// Transcript: transcription of the recording // Status: inactive or active
// MediaUrl: Link to the recording
var var
NewRow, Cell, P, Button, Audio: TJSHTMLElement; NewRow, Cell, P, Button, Audio: TJSHTMLElement;
begin begin
...@@ -293,6 +290,9 @@ begin ...@@ -293,6 +290,9 @@ begin
end; end;
procedure TFViewItems.GetItems(searchOptions: string); 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 var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
itemList : TJSObject; itemList : TJSObject;
...@@ -355,6 +355,7 @@ begin ...@@ -355,6 +355,7 @@ begin
end; end;
procedure TFViewItems.AddItem(itemOptions: string); procedure TFViewItems.AddItem(itemOptions: string);
// adds an item to the database.
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
begin begin
...@@ -363,48 +364,13 @@ begin ...@@ -363,48 +364,13 @@ begin
getItems(GenerateSearchOptions()); getItems(GenerateSearchOptions());
end; 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); procedure TFViewItems.wcbPageSizeChange(Sender: TObject);
// gets a new amount of items based when the page size is changed
begin begin
PageNumber := 1; PageNumber := 1;
getItems(GenerateSearchOptions()); getItems(GenerateSearchOptions());
end; end;
procedure TFViewItems.btnSearchClick(Sender: TObject);
// item Search method
begin
//Search(edtSearch.Text);
end;
procedure TFViewItems.ClearTable(); procedure TFViewItems.ClearTable();
// clears the table // clears the table
var var
......
...@@ -797,8 +797,8 @@ object FOrderEntry: TFOrderEntry ...@@ -797,8 +797,8 @@ object FOrderEntry: TFOrderEntry
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object btnConfirm: TWebButton object btnConfirm: TWebButton
Left = 752 Left = 652
Top = 558 Top = 560
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Confirm'
...@@ -965,6 +965,29 @@ object FOrderEntry: TFOrderEntry ...@@ -965,6 +965,29 @@ object FOrderEntry: TFOrderEntry
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end 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 object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 244 Left = 244
......
...@@ -300,7 +300,13 @@ ...@@ -300,7 +300,13 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-auto"> <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> </div>
</div> </div>
......
// Order Entry page of Corruguated Orders. Used for both editting and adding
// orders.
unit View.OrderEntryCorrugated; unit View.OrderEntryCorrugated;
interface interface
...@@ -187,6 +189,8 @@ type ...@@ -187,6 +189,8 @@ type
WebDBComboBox1: TWebDBComboBox; WebDBComboBox1: TWebDBComboBox;
cbEmail: TWebCheckBox; cbEmail: TWebCheckBox;
XDataWebDataSet1supplied_by_customer_order_date: TStringField; XDataWebDataSet1supplied_by_customer_order_date: TStringField;
btnEdit: TWebButton;
btnCancel: TWebButton;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure HideNotification(); procedure HideNotification();
procedure ShowNotification(Notification: string); procedure ShowNotification(Notification: string);
...@@ -198,6 +202,7 @@ type ...@@ -198,6 +202,7 @@ type
procedure addColorRow(num, Color, LPI, Size: string); procedure addColorRow(num, Color, LPI, Size: string);
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
[async] procedure AddCorrugatedOrder(orderJSON: TJSONObject); [async] procedure AddCorrugatedOrder(orderJSON: TJSONObject);
procedure btnCancelClick(Sender: TObject);
private private
FAgencyCode: string; FAgencyCode: string;
FCurrentReportType: string; FCurrentReportType: string;
...@@ -221,6 +226,7 @@ uses ...@@ -221,6 +226,7 @@ uses
View.Home, View.Main; View.Home, View.Main;
procedure TFOrderEntry.btnConfirmClick(Sender: TObject); procedure TFOrderEntry.btnConfirmClick(Sender: TObject);
// Converts all the information on the page into a JSON to then send to the server
var var
colorList: TJSONArray; colorList: TJSONArray;
container: TJSElement; container: TJSElement;
...@@ -358,6 +364,7 @@ begin ...@@ -358,6 +364,7 @@ begin
end; end;
procedure TFOrderEntry.AddCorrugatedOrder(orderJSON: TJSONObject); procedure TFOrderEntry.AddCorrugatedOrder(orderJSON: TJSONObject);
// sends the order JSON object to the server
var var
Response: TXDataClientResponse; Response: TXDataClientResponse;
begin begin
...@@ -386,6 +393,9 @@ begin ...@@ -386,6 +393,9 @@ begin
end; end;
procedure TFOrderEntry.addColorRow(num: string; Color: string; LPI: string; Size: string); 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 begin
asm asm
const container = document.getElementById('additionalFields'); const container = document.getElementById('additionalFields');
...@@ -440,6 +450,11 @@ begin ...@@ -440,6 +450,11 @@ begin
addColorRow('','','',''); addColorRow('','','','');
end; end;
procedure TFOrderEntry.btnCancelClick(Sender: TObject);
begin
FViewMain.ViewOrders('');
end;
procedure TFOrderEntry.WebFormCreate(Sender: TObject); procedure TFOrderEntry.WebFormCreate(Sender: TObject);
begin begin
if not DMConnection.ApiConnection.Connected then if not DMConnection.ApiConnection.Connected then
...@@ -450,6 +465,7 @@ begin ...@@ -450,6 +465,7 @@ begin
end; end;
procedure TFOrderEntry.getOrder(Order_ID: string); procedure TFOrderEntry.getOrder(Order_ID: string);
// retrieves an order from the server then loads the info into the page
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
orderList : TJSObject; orderList : TJSObject;
...@@ -598,6 +614,7 @@ begin ...@@ -598,6 +614,7 @@ begin
end; end;
procedure TFOrderEntry.getCustomer(customerID: string); procedure TFOrderEntry.getCustomer(customerID: string);
// gets a customer from the database then loads the appropiate fields
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
customer : TJSObject; customer : TJSObject;
......
...@@ -64,7 +64,6 @@ type ...@@ -64,7 +64,6 @@ type
procedure btnSearchClick(Sender: TObject); procedure btnSearchClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject); procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormShow(Sender: TObject); procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnPDFClick(Sender: TObject); procedure btnPDFClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject); procedure wcbPageSizeChange(Sender: TObject);
procedure wlcbOrderByChange(Sender: TObject); procedure wlcbOrderByChange(Sender: TObject);
...@@ -79,10 +78,7 @@ type ...@@ -79,10 +78,7 @@ type
procedure ShowNotification(Notification: string); procedure ShowNotification(Notification: string);
procedure ShowAddOrderForm(); procedure ShowAddOrderForm();
procedure ShowSearchForm(); procedure ShowSearchForm();
[async] procedure Search(searchOptions: string);
[async] procedure GetOrders(searchOptions: string); [async] procedure GetOrders(searchOptions: string);
[async] procedure getUser();
procedure GeneratePDF(OrderID: string);
[async] procedure GenerateReportPDF; [async] procedure GenerateReportPDF;
var var
PageNumber: integer; PageNumber: integer;
...@@ -129,6 +125,7 @@ begin ...@@ -129,6 +125,7 @@ begin
end; end;
[async] procedure TFViewOrders.GenerateReportPDF; [async] procedure TFViewOrders.GenerateReportPDF;
// sends the search to the server which then sends back a pdf of the results
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
searchOptions, pdfURL: string; searchOptions, pdfURL: string;
...@@ -198,20 +195,6 @@ begin ...@@ -198,20 +195,6 @@ begin
getOrders(generateSearchOptions()); getOrders(generateSearchOptions());
end; 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; class function TFViewOrders.CreateForm(AElementID, Info: string): TWebForm;
var var
localInfo: string; localInfo: string;
...@@ -230,6 +213,7 @@ end; ...@@ -230,6 +213,7 @@ end;
procedure TFViewOrders.ShowAddOrderForm(); procedure TFViewOrders.ShowAddOrderForm();
// displays the add order pop-up so the user can choose a customer
var var
newform: TFAddOrder; newform: TFAddOrder;
begin begin
...@@ -252,6 +236,7 @@ begin ...@@ -252,6 +236,7 @@ begin
end; end;
procedure TFViewOrders.ShowSearchForm(); procedure TFViewOrders.ShowSearchForm();
// displays the search pop-up that allows the user to filter the order list
var var
newform: TFSearch; newform: TFSearch;
begin begin
...@@ -513,6 +498,8 @@ end; ...@@ -513,6 +498,8 @@ end;
procedure TFViewOrders.GetOrders(searchOptions: string); 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 var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
orderList: TJSObject; orderList: TJSObject;
...@@ -578,65 +565,13 @@ begin ...@@ -578,65 +565,13 @@ begin
HideNotification(); HideNotification();
end; end;
procedure TFViewOrders.btnConfirmClick(Sender: TObject);
begin
//orderEntry('', 'ADD');
end;
procedure TFViewOrders.btnSearchClick(Sender: TObject); procedure TFViewOrders.btnSearchClick(Sender: TObject);
var var
filterSection: TJSHTMLElement; filterSection: TJSHTMLElement;
begin 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(); ShowSearchForm();
end; 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(); procedure TFViewOrders.ClearTable();
// clears the table // clears the table
var var
...@@ -718,24 +653,4 @@ begin ...@@ -718,24 +653,4 @@ begin
end; end;
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. end.
// Search pop-up form used to filter the list.
// Author: Cameron Hayes
unit View.Search; unit View.Search;
interface interface
...@@ -105,6 +107,7 @@ begin ...@@ -105,6 +107,7 @@ begin
end; end;
procedure TFSearch.WebFormShow(Sender: TObject); procedure TFSearch.WebFormShow(Sender: TObject);
// Auto fills information based on previous search
var var
params: TStringList; params: TStringList;
DateFormatSettings: TFormatSettings; DateFormatSettings: TFormatSettings;
...@@ -241,6 +244,7 @@ begin ...@@ -241,6 +244,7 @@ begin
end; end;
[async] procedure TFSearch.getCustomers(); [async] procedure TFSearch.getCustomers();
// Gets a list of customers from the server
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
customerList: TJSObject; customerList: TJSObject;
......
...@@ -224,7 +224,6 @@ type ...@@ -224,7 +224,6 @@ type
[ServiceContract, Model(API_MODEL)] [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 GetUsers(searchOptions: string): TUserList; [HttpGet] function GetUsers(searchOptions: string): TUserList;
[HttpGet] function GetItems(searchOptions: string): TItemList; [HttpGet] function GetItems(searchOptions: string): TItemList;
[HttpGet] function GetOrders(searchOptions: string): TOrderList; [HttpGet] function GetOrders(searchOptions: string): TOrderList;
......
[Settings] [Settings]
MemoLogLevel=4 MemoLogLevel=4
FileLogLevel=5 FileLogLevel=5
LogFileNum=79 LogFileNum=86
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