Commit ab01a898 by cam

Fixed minor bugs and began construction on the customer list when adding an order

parent aadb8619
<div class="container pb-5 mt-5">
<h3 id="crime_title"></h3>
<div id="status_message" class="alert" style="display: none;"></div>
<hr class="custom-hr">
<h4 class="custom-h4 mt-3">Incident Information</h4>
<p>Please enter all the information that applies. A valid address is required.</p>
<hr class="custom-hr">
<form>
<h4 class="custom-h4 mt-3">Incident Location</h4>
<hr class="custom-hr">
<div class="row mt-3">
<div class="col-md-4">
<label for="edt_street_number" class="form-label">Street number*</label>
<input type="text" class="form-control" id="edt_street_number">
</div>
<div class="col-md-4">
<label for="drp_street_direction" class="form-label">St Dir</label>
<select class="form-select" id="drp_street_direction">
<!-- Street directions options will be loaded dynamically -->
</select>
</div>
<div class="col-md-4">
<label for="edt_street_name" class="form-label">Street Name*</label>
<input type="text" class="form-control" id="edt_street_name">
</div>
<div class="col-md-2">
<label for="drp_street_type" class="form-label">St Type*</label>
<select class="form-select" id="drp_street_type">
<!-- Street types options will be loaded dynamically -->
</select>
</div>
<div class="col-md-2">
<label for="edt_apt_unit" class="form-label">Apt/Unit</label>
<input type="text" class="form-control" id="edt_apt_unit">
</div>
<div class="col-md-4">
<label for="drp_state" class="form-label">State*</label>
<select class="form-select" id="drp_state">
<!-- States options will be loaded dynamically -->
</select>
</div>
<div class="col-md-4">
<label for="edt_zip_code" class="form-label">Zip Code*</label>
<input type="text" class="form-control" id="edt_zip_code">
</div>
</div>
<h4 class="custom-h4 mt-3">Incident Time</h4>
<hr class="custom-hr">
<div class="row mt-3">
<div class="col-md-3">
<label for="dpt_incident_time_start" class="form-label">Incident Time (start)*</label>
<input type="datetime-local" class="form-control" id="dpt_incident_time_start">
</div>
<div class="col-md-3">
<label for="dpt_incident_time_end" class="form-label">Incident Time (end)*</label>
<input type="datetime-local" class="form-control" id="dpt_incident_time_end">
</div>
<div class="col-md-3">
<label for="drp_location_type" class="form-label">Location Type</label>
<select class="form-select" id="drp_location_type">
<!-- Location type options will be loaded dynamically -->
</select>
</div>
</div>
<div class="mt-4">
<button id="btn_submit" type="submit" class="btn btn-secondary">Submit</button>
</div>
</form>
</div>
unit View.IncidentProperty;
interface
uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, App.Types, ConnectionModule, Data.DB,
WEBLib.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.ExtCtrls,
XData.Web.Client, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.DBCtrls, Vcl.Controls;
type
TFIncidentProperty = class(TWebForm)
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
WebLabel3: TWebLabel;
WebLabel4: TWebLabel;
WebLabel6: TWebLabel;
WebLabel7: TWebLabel;
WebLabel8: TWebLabel;
WebLabel9: TWebLabel;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
dtpOrderDate: TWebDateTimePicker;
dtpProofDate: TWebDateTimePicker;
dtpShipDate: TWebDateTimePicker;
dtpArtDue: TWebDateTimePicker;
dtpPlateDue: TWebDateTimePicker;
dtpMountDue: TWebDateTimePicker;
WebButton1: TWebButton;
dtpColorContractDate2: TWebDateTimePicker;
edtCompanyName: TWebDBEdit;
edtCompanyAccountName: TWebDBEdit;
edtInQuickBooks: TWebDBEdit;
edtShipVia: TWebDBEdit;
edtQuantity: TWebDBEdit;
edtPrice: TWebDBEdit;
edtInvoiceTo: TWebDBEdit;
edtShipTo: TWebDBEdit;
edtPONumber: TWebDBEdit;
edtJobName: TWebDBEdit;
edtQuickBooksItem: TWebDBEdit;
edtArtLocation: TWebDBEdit;
edtDimensionalLayout: TWebDBEdit;
edtEmail: TWebDBEdit;
edtFTP: TWebDBEdit;
edtOther: TWebDBEdit;
edtTotalInchesUsed: TWebDBEdit;
edtSheetsUsed: TWebDBEdit;
edtInitials: TWebDBEdit;
edtPitch: TWebDBEdit;
edtAround: TWebDBEdit;
edtAcross: TWebDBEdit;
edtCutoffDimension: TWebDBEdit;
edtCylinderRepeat: TWebDBEdit;
edtReversePrint: TWebDBEdit;
edtSurfacePrint: TWebDBEdit;
edtBleeded: TWebDBEdit;
edtDigitalColorKey: TWebDBEdit;
edtColorContract: TWebDBEdit;
edtColorContractTo: TWebDBEdit;
edtInkJetTo2: TWebDBEdit;
edtInkJetTo: TWebDBEdit;
edtPDFTo: TWebDBEdit;
edtAniloxInfo: TWebDBEdit;
edtPressName: TWebDBEdit;
edtJobNumber: TWebDBEdit;
edtPlateMaterial: TWebDBEdit;
edtThickness: TWebDBEdit;
cbPDFFile: TWebDBCheckBox;
cbFullSizeInkJet: TWebDBCheckBox;
cbPlate: TWebDBCheckBox;
cbColorCopy: TWebDBCheckBox;
cbBWCopy: TWebDBCheckBox;
edtComments: TWebDBEdit;
XDataWebClient1: TXDataWebClient;
tmrScrollTop: TWebTimer;
XDataWebDataSet1: TXDataWebDataSet;
XDataWebDataSet1Quantity: TStringField;
XDataWebDataSet1accountCompanyName: TStringField;
XDataWebDataSet1acrossNo: TStringField;
XDataWebDataSet1approvedDate: TStringField;
XDataWebDataSet1aroundNo: TStringField;
XDataWebDataSet1artApprovedAsIs: TBooleanField;
XDataWebDataSet1artDue: TStringField;
XDataWebDataSet1artLocation: TStringField;
XDataWebDataSet1bwCopy: TBooleanField;
XDataWebDataSet1cadFile: TStringField;
XDataWebDataSet1clemson: TStringField;
XDataWebDataSet1companyName: TStringField;
XDataWebDataSet1crossHairs: TIntegerField;
XDataWebDataSet1customAdhesive: TStringField;
XDataWebDataSet1customBacking: TStringField;
XDataWebDataSet1cylinderSize: TStringField;
XDataWebDataSet1dieCutNo: TStringField;
XDataWebDataSet1dimensionalLayout: TStringField;
XDataWebDataSet1diskOrCD: TBooleanField;
XDataWebDataSet1email: TStringField;
XDataWebDataSet1emailAttn: TStringField;
XDataWebDataSet1excaliburDie: TBooleanField;
XDataWebDataSet1existingCuttingDie: TStringField;
XDataWebDataSet1fax: TStringField;
XDataWebDataSet1faxAttn: TStringField;
XDataWebDataSet1ftp: TStringField;
XDataWebDataSet1fullMount: TBooleanField;
XDataWebDataSet1fullSizePanel: TBooleanField;
XDataWebDataSet1inQuickBooks: TStringField;
XDataWebDataSet1jobName: TStringField;
XDataWebDataSet1jobNumber: TStringField;
XDataWebDataSet1loose: TStringField;
XDataWebDataSet1machineIdent: TStringField;
XDataWebDataSet1mountDue: TStringField;
XDataWebDataSet1orderDate: TStringField;
XDataWebDataSet1other: TStringField;
XDataWebDataSet1pdfFile: TBooleanField;
XDataWebDataSet1plateDue: TStringField;
XDataWebDataSet1plateMaterial: TStringField;
XDataWebDataSet1plates: TBooleanField;
XDataWebDataSet1printCard: TBooleanField;
XDataWebDataSet1proofDate: TStringField;
XDataWebDataSet1proofEmail: TStringField;
XDataWebDataSet1proofOther: TStringField;
XDataWebDataSet1proofShipTo: TStringField;
XDataWebDataSet1quickBooksItem: TStringField;
XDataWebDataSet1refArtPrintCard: TStringField;
XDataWebDataSet1rscStyle: TStringField;
XDataWebDataSet1rscd: TStringField;
XDataWebDataSet1rescl: TStringField;
XDataWebDataSet1rscw: TStringField;
XDataWebDataSet1sampleCarton: TBooleanField;
XDataWebDataSet1shipDate: TStringField;
XDataWebDataSet1shipTo: TStringField;
XDataWebDataSet1shipVia: TStringField;
XDataWebDataSet1specialInstructions: TStringField;
XDataWebDataSet1standardSetup: TStringField;
XDataWebDataSet1stickyBak: TBooleanField;
XDataWebDataSet1stripMount: TStringField;
XDataWebDataSet1thickness: TStringField;
XDataWebDataSet1wideFormat: TStringField;
XDataWebDataSet1price: TStringField;
XDataWebDataSet1invoiceTo: TStringField;
XDataWebDataSet1colorCopy: TBooleanField;
XDataWebDataSet1refArtAPDF: TStringField;
XDataWebDataSet1poNumber: TStringField;
XDataWebDataSet1colors: TStringField;
WebDataSource1: TWebDataSource;
edtDisk: TWebDBEdit;
edtCutback: TWebDBEdit;
edtMinimumTrapDim: TWebDBEdit;
edtMaximumTrapDim: TWebDBEdit;
dtpPDFDate3: TWebDateTimePicker;
dtpPDFDate2: TWebDateTimePicker;
dtpPDFDate1: TWebDateTimePicker;
dtpInkJetDate3: TWebDateTimePicker;
dtpInkJetDate2: TWebDateTimePicker;
dtpInkJetDate1: TWebDateTimePicker;
dtpColorContractDate1: TWebDateTimePicker;
dtpDigitalColorDate: TWebDateTimePicker;
edtDigitalColorTo: TWebDBEdit;
WebLabel5: TWebLabel;
edtOtherComments: TWebDBEdit;
edtPlateOther: TWebDBEdit;
edtColorBarsComments: TWebDBEdit;
edtColorBars: TWebDBEdit;
edtCrosshairsComments: TWebDBEdit;
edtCrosshairs: TWebDBEdit;
edtMicrodotsComments: TWebDBEdit;
edtMicrodots: TWebDBEdit;
private
FAgencyCode: string;
FCurrentReportType: string;
FReportID: string;
//FJSONProc: TJSONProc;
public
class function CreateForm(AElementID, AReportType, AAgencyCode, AReportID: string): TWebForm;
end;
var
FIncidentProperty: TFIncidentProperty;
implementation
{$R *.dfm}
class function TFIncidentProperty.CreateForm(AElementID, AReportType, AAgencyCode, AReportID: string): TWebForm;
begin
Application.CreateForm(TFIncidentProperty, AElementID, Result,
procedure(AForm: TObject)
begin
with TFIncidentProperty(AForm) do
begin
FAgencyCode := AAgencyCode;
FCurrentReportType := AReportType;
FReportID := AReportID;
//FJSONProc := AJSONProc;
// InitializeForm;
end;
end
);
end;
end.
\ No newline at end of file
......@@ -149,8 +149,6 @@ begin
begin
link := TJSHTMLElement(links[i]);
link.classList.remove('active');
console.log(link.innerHTML);
console.log(link.innerText);
if link.innerText.Contains(page) then
link.classList.add('active');
end;
......@@ -225,7 +223,6 @@ procedure TFViewMain.ViewOrders(info: string);
begin
if Assigned(FChildForm) then
FChildForm.Free;
console.log(info);
FChildForm := TFViewOrders.CreateForm(WebPanel1.ElementID, info);
end;
......
......@@ -452,6 +452,7 @@ begin
addColorRow(String(color['#']), string(color['Color']), string(color['LPI']), string(color['Size']));
end;
end;
console.log(XDataWebDataSet1staff_fields_invoice_to.AsString);
if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then
dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value)
else
......
object FOrderList: TFOrderList
Width = 1016
Height = 683
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
Width = 77
Height = 14
Caption = 'Showing 0 of ...'
ElementID = 'lblentries'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblEntries2: TWebLabel
Left = 8
Top = 358
Width = 49
Height = 14
Caption = 'lblEntries2'
ElementID = 'lblentries2'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 8
Top = 384
Width = 121
Height = 22
HelpType = htKeyword
ChildOrder = 8
ElementClassName = 'form-control'
ElementID = 'edtsearch'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 220
Top = 429
Width = 121
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 1
object lblMessage: TWebLabel
Left = 28
Top = 9
Width = 44
Height = 14
Caption = 'Message'
ElementID = 'pnl_message'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementClassName = 'btn btn-light'
ElementID = 'view.login.message.button'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
end
end
object WebDBTableControl: TWebDBTableControl
Left = 160
Top = 131
Width = 530
Height = 265
ElementClassName = 'table-responsive'
ElementId = 'customer_list'
BorderColor = clSilver
ChildOrder = 5
ColHeader = False
ElementTableClassName = 'table table-striped table-bordered table-hover dataTable'
Options.ResizeColumns = True
OnGetCellChildren = WebDBTableControlGetCellChildren
Columns = <
item
DataField = 'ID'
Title = 'ID'
Width = 24
end
item
DataField = 'NAME'
Title = 'NAME'
Width = 100
end
item
DataField = 'SHORT_NAME'
Title = 'SHORT_NAME'
end
item
DataField = 'ADDRESS'
Title = 'ADDRESS'
end>
DataSource = wdsCustomers
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 88
Top = 434
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 84
Top = 490
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object xdwdsCustomersADDRESS: TStringField
FieldName = 'ADDRESS'
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 38
Top = 562
end
end
<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;
interface
uses
System.SysUtils, System.Generics.Collections, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, WEBLib.Grids,
Vcl.Grids;
type
TFOrderList = class(TWebForm)
lblEntries: TWebLabel;
lblEntries2: TWebLabel;
edtSearch: TWebEdit;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
wdsCustomers: TWebDataSource;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersNAME: TStringField;
xdwdsCustomersSHORT_NAME: TStringField;
xdwdsCustomersADDRESS: TStringField;
WebDBTableControl: TWebDBTableControl;
procedure WebFormShow(Sender: TObject);
procedure WebDBTableControlGetCellChildren(Sender: TObject; ACol,
ARow: Integer; AField: TField; AValue: string;
AElement: TJSHTMLElementRecord);
private
//FJSONProc: TJSONProc;
procedure AddRowToTable();
procedure ClearTable();
[async] procedure getCustomers();
public
class function CreateForm(AElementID: string): TWebForm;
end;
var
FOrderList: TFOrderList;
implementation
{$R *.dfm}
class function TFOrderList.CreateForm(AElementID: string): TWebForm;
begin
Application.CreateForm(TFOrderList, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderList(AForm) do
begin
end;
end
);
end;
procedure TFOrderList.WebDBTableControlGetCellChildren(Sender: TObject; ACol,
ARow: Integer; AField: TField; AValue: string;
AElement: TJSHTMLElementRecord);
begin
//WebDBTableControl.WidthStyle := TSizeStyle.ssAuto;
console.log(AValue);
WebDBTableControl.ColWidths[ACol] := AValue.Length * 12;
end;
procedure TFOrderList.WebFormShow(Sender: TObject);
begin
getCustomers();
end;
procedure TFOrderList.ClearTable();
// clears the table
var
tbody: TJSHTMLElement;
begin
tbody := TJSHTMLElement(document.getElementById('tblCustomerGrid').getElementsByTagName('tbody')[0]);
tbody.innerHTML := '';
end;
procedure TFOrderList.getCustomers();
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
data: TJSArray;
i, count: integer;
temp: TJSONObject;
customer: TJSObject;
begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomers',
[]));
customerList := TJSObject(xdcResponse.Result);
data := TJSArray(customerList['data']);
count := integer(customerList['count']);
// ClearTable();
//customerGrid.col
xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList['data']);
xdwdsCustomers.Open;
console.log(xdwdsCustomersID);
{for i := 0 to data.Length - 1 do
begin
customer := TJSObject(data[i]);
//AddRowToTable();
xdwdsCustomers.Next;
end;}
{TotalPages := (callListLength + PageSize - 1) div PageSize;
if callListLength = 0 then
begin
lblEntries.Caption := 'No entries found';
lblEntries2.Caption := 'No entries found';
end
else if (PageNumber * PageSize) < callListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(callListLength);
lblEntries2.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(callListLength);
end
else if (PageNumber * PageSize) >= callListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(callListLength) +
' of ' + IntToStr(callListLength);
lblEntries2.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(callListLength) +
' of ' + IntToStr(callListLength);
end;
//GeneratePagination(TotalPages);}
end;
procedure TFOrderList.AddRowToTable();
var
NewRow, Cell, P, Button, Audio: TJSHTMLElement;
ClickHandler: TJSFunction;
//strColorList: string;
id: integer;
begin
NewRow := TJSHTMLElement(document.createElement('tr'));
//NewRow.Attrs['orderType'] := XDataWebDataSet1orderType.Value;
NewRow.addEventListener('click', procedure
begin
//orderEntry(NewRow.Attrs['id'], 'EDIT');
end);
// Company ID Cell
NewRow.Attrs['id'] := xdwdsCustomersID.AsString;
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order ID');
if xdwdsCustomersID.AsString = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersID.AsString;
NewRow.appendChild(Cell);
// Company Name Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Company Name');
if xdwdsCustomersNAME.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersNAME.Value;
NewRow.appendChild(Cell);
// Short Name Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Job Name');
if xdwdsCustomersSHORT_NAME.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersSHORT_NAME.Value;
NewRow.appendChild(Cell);
// Address Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Order Date');
if xdwdsCustomersADDRESS.Value = '' then
Cell.innerText := 'None'
else
Cell.innerText := xdwdsCustomersADDRESS.Value;
NewRow.appendChild(Cell);
// Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblCustomerGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end;
end.
......@@ -242,15 +242,47 @@ object FViewOrders: TFViewOrders
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 566
Top = 317
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 13
ElementClassName = 'btn btn-light'
ElementID = 'btn_confirm_order'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object wcbCustomers: TWebDBLookupComboBox
Left = 550
Top = 286
Width = 145
Height = 22
ElementClassName = 'custom-select'
ElementID = 'wcbcustomer'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = wcbCustomersChange
DataField = 'CURR_ID'
DataSource = wdsSave
KeyField = 'ID'
ListField = 'NAME'
ListSource = wdsCustomers
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 426
Top = 240
Left = 8
Top = 430
end
object XDataWebDataSet1: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 440
Top = 300
Left = 58
Top = 432
object XDataWebDataSet1ID: TStringField
FieldName = 'ID'
end
......@@ -308,7 +340,39 @@ object FViewOrders: TFViewOrders
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
Left = 450
Top = 388
Left = 94
Top = 430
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 598
Top = 406
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 596
Top = 354
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
end
object xdwdsCustomersCURR_ID: TIntegerField
FieldName = 'CURR_ID'
end
end
object xdwdsSave: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 498
Top = 352
object xdwdsSaveCURR_ID: TIntegerField
FieldName = 'CURR_ID'
end
end
object wdsSave: TWebDataSource
DataSet = xdwdsSave
Left = 490
Top = 408
end
end
......@@ -12,31 +12,34 @@
</div>
</div>
<div class="mb-3" id="filter_info" style="display: none;">
<h4 class="custom-h4 mt-3">Filters</h4>
<hr class="custom-hr">
<div class="row">
<!-- Search Input Field -->
<div class="col-auto">
<label class='pe-2'style="font-weight: 700;">Search:</label>
<label class='pe-2' style="font-weight: 700;">Search:</label>
<input class="form-control input-sm" id="edtsearch">
</div>
<!-- Start Date Input Field -->
<div class="col-auto">
<label class='pe-2'style="font-weight: 700;">Start Date:</label>
<label class='pe-2' style="font-weight: 700;">Start Date:</label>
<input class="form-control input-sm" id="dtpstartdate" type="date">
</div>
<!-- End Date Input Field -->
<div class="col-auto">
<label class='pe-2'style="font-weight: 700;">End Date:</label>
<label class='pe-2' style="font-weight: 700;">End Date:</label>
<input class="form-control input-sm" id="dtpenddate" type="date">
</div>
<!-- Status Type Dropdown -->
<div class="col-auto">
<label style="font-weight: 700;">Status Type:</label>
<div>
<select class="custom-select" id="wcbsortby" style="font-size: 1.00rem;"></select>
</div>
<select class="form-control input-sm" id="wcbsortby" style="font-size: 1.00rem; height: calc(2.25rem + 2px); padding-top: 0.375rem; padding-bottom: 0.375rem;"></select>
</div>
</div>
<div class ="row mt-2">
<div class="col-auto">
<button class= "mt2-2" id="btnapply"></button>
<!-- Button (Align this with the inputs) -->
<div class="col-auto d-flex align-items-end">
<label style="font-weight: 700;"> </label>
<button class="btn btn-primary btn-sm" id="btnapply">Apply</button>
</div>
</div>
</div>
......@@ -100,28 +103,20 @@
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="audioModal" tabindex="-1" aria-labelledby="audioModalLabel" aria-hidden="true">
<div class="modal fade" id="confirmation_modal" tabindex="-1" aria-labelledby="confirmation_modal_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="audioModalLabel">Audio Player</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" onclick="stopAudio()"></button>
<h5 class="modal-title" id="confirmation_modal_label">Select Customer</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<audio controls id="audioPlayer">
<source src="" type="audio/mp3" id="audioSource">
Your browser does not support the audio element.
</audio>
<select class="form-control input-sm" id="wcbcustomer"></select>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="btn_confirm_order">Confirm</button>
</div>
</div>
</div>
</div>
<script>
// JavaScript function to stop audio
function stopAudio() {
var audioPlayer = document.getElementById('audioPlayer');
audioPlayer.pause(); // Pause the audio
audioPlayer.currentTime = 0; // Reset audio to beginning
}
</script>
......@@ -53,6 +53,16 @@ type
btnCloseNotification: TWebButton;
WebButton1: TWebButton;
WebButton2: TWebButton;
btnConfirm: TWebButton;
wdsCustomers: TWebDataSource;
wcbCustomers: TWebDBLookupComboBox;
xdwdsCustomers: TXDataWebDataSet;
xdwdsCustomersNAME: TStringField;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersCURR_ID: TIntegerField;
xdwdsSave: TXDataWebDataSet;
wdsSave: TWebDataSource;
xdwdsSaveCURR_ID: TIntegerField;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -60,6 +70,8 @@ type
procedure btnFiltersClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure wcbCustomersChange(Sender: TObject);
private
FChildForm: TWebForm;
procedure AddRowToTable(temp: string);
......@@ -69,6 +81,7 @@ type
procedure orderEntry(orderInfo, mode: string);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure ShowOrderListForm();
[async] procedure Search(searchOptions: string);
[async] procedure GetOrders(searchOptions: string);
[async] procedure getUser();
......@@ -93,7 +106,7 @@ var
implementation
uses
XData.Model.Classes, View.Main;
XData.Model.Classes, View.Main, View.OrderList;
{$R *.dfm}
......@@ -111,8 +124,8 @@ begin
wcbPageSize.Text := '10';
wcbSortBy.Text := 'PROOF';
//today := TDateTime.Today;
dtpStartDate.Date := Now;
dtpEndDate.Date := Now;
dtpStartDate.Date := 0;
dtpEndDate.Date := 0;
getOrders(GenerateSearchOptions());
end;
......@@ -154,6 +167,34 @@ begin
);
end;
procedure TFViewOrders.ShowOrderListForm();
var
newform: TFOrderList;
formattedBkNum: string;
begin
newform := TFOrderList.CreateNew;
{newform.FUserInfo := AUserInfo;
newform.FBKNum := ABKNum;
newform.FSource := ASource;
newform.FViewImages := AViewImages;}
newform.Caption := 'Select Company an 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';
newform.ShowModal(
procedure(AValue: TModalResult)
begin
//ShowMessage('View Booking Details Form closed');
end
);
end;
procedure TFViewOrders.AddRowToTable(temp: string);
// Adds rows to the table
// PhoneNumber: phone number of the location
......@@ -176,6 +217,7 @@ begin
begin
orderEntry(NewRow.Attrs['id'], 'EDIT');
end);
// Order ID Cell
NewRow.Attrs['id'] := XDataWebDataSet1ID.Value;
Cell := TJSHTMLElement(document.createElement('td'));
......@@ -605,7 +647,8 @@ end;
procedure TFViewOrders.btnaddOrderClick(Sender: TObject);
begin
orderEntry('', 'ADD');
//getCustomers();
ShowOrderListForm();
end;
procedure TFViewOrders.orderEntry(orderInfo, mode: string);
......@@ -635,6 +678,11 @@ begin
HideNotification();
end;
procedure TFViewOrders.btnConfirmClick(Sender: TObject);
begin
orderEntry('', 'ADD');
end;
procedure TFViewOrders.btnFiltersClick(Sender: TObject);
var
filterSection: TJSHTMLElement;
......@@ -737,5 +785,10 @@ begin
end;
end;
procedure TFViewOrders.wcbCustomersChange(Sender: TObject);
begin
console.log(wcbCustomers.Value);
end;
end.
......@@ -7,6 +7,8 @@
background-color: #fff;
}
.card-header {
width: 100%;
text-align: left; /* Align text to the left */
......
......@@ -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.IncidentProperty in 'View.IncidentProperty.pas' {FIncidentProperty: TWebForm} {*.html};
View.OrderList in 'View.OrderList.pas' {FOrderList: TWebForm} {*.html};
{$R *.res}
......
......@@ -171,8 +171,8 @@
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.IncidentProperty.pas">
<Form>FIncidentProperty</Form>
<DCCReference Include="View.OrderList.pas">
<Form>FOrderList</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
......
......@@ -81,7 +81,19 @@ type
TOrderList = class
Public
count: integer;
data: TList<TOrderItem>
data: TList<TOrderItem>;
end;
TCustomerItem = class
Public
NAME: string;
ID: integer;
end;
TCustomerList = class
Public
count: integer;
data: TList<TCustomerItem>;
end;
TFullOrder = class
......@@ -187,6 +199,7 @@ type
[HttpGet] function GetItems(searchOptions: string): TItemList;
[HttpGet] function GetOrders(searchOptions: string): TOrderList;
[HttpGet] function GetOrder(orderInfo: string): TFullOrder;
[HttpGet] function GetCustomers(): TCustomerList;
function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string;
......
......@@ -25,6 +25,7 @@ type
function GetUsers(searchOptions: string): TUserList;
function GetOrders(searchOptions: string): TOrderList;
function GetOrder(orderInfo: string): TFullOrder;
function GetCustomers(): TCustomerList;
function EditUser(const editOptions: string): string;
function Search(phoneNum: string): TOrderList;
function AddUser(userInfo: string): string;
......@@ -59,6 +60,32 @@ begin
inherited;
end;
function TLookupService.GetCustomers: TCustomerList;
var
SQL: string;
customer: TCustomerItem;
begin
SQL := 'select NAME, CUSTOMER_ID from customers';
doQuery(ordersDB.UniQuery1, SQL);
result := TCustomerList.Create;
Result.data := TList<TCustomerItem>.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( Result.data );
result.count := 0;
while not ordersDB.UniQuery1.Eof do
begin
customer := TCustomerItem.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add( customer );
customer.NAME := ordersDB.UniQuery1.FieldByName('NAME').AsString;
customer.ID := ordersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsInteger;
result.data.Add(customer);
result.count := result.count + 1;
ordersDB.UniQuery1.Next;
end;
ordersDB.UniQuery1.Close;
end;
function TLookupService.Search(phoneNum: string): TOrderList;
// Searchs the database for a specific from phone number then returns a list of
// calls from said number
......@@ -321,6 +348,7 @@ begin
result.staff_fields_price := ordersDB.UniQuery1.FieldByName('staff_fields_price').AsString;
result.staff_fields_mount_due := ordersDB.UniQuery1.FieldByName('staff_fields_mount_due').AsString;
result.staff_fields_art_location := ordersDB.UniQuery1.FieldByName('staff_fields_art_location').AsString;
result.staff_fields_invoice_to := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString;
// Supplied by Customer
if ordersDB.UniQuery1.FieldByName('supplied_by_customer_b_w_copy').AsString = 'T' then
......
[Options]
LogFileNum=207
LogFileNum=221
UpdateTimerLength=0
......
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