Commit 7a8ad9bf by Mac Stephens

Merge remote-tracking branch 'origin/cam3' into mac3

parents b43edfc2 342290a5
......@@ -4,6 +4,7 @@ kgOrdersClient/__recovery/
kgOrdersClient/TMSWeb/
kgOrdersClient/Win32/
kgOrdersClient/css/__history/
kgOrdersClient/css/__recovery/
kgOrdersClient/config/__history/
kgOrdersServer/__history
kgOrdersServer/__recovery
......
......@@ -11,6 +11,7 @@ type
TSuccessProc = reference to procedure;
TLogoutProc = reference to procedure(AMessage: string = '');
TUnauthorizedAccessProc = reference to procedure(AMessage: string);
TVersionCheckCallback = reference to procedure(Success: Boolean; ErrorMessage: string);
TListProc = reference to procedure;
TSelectProc = reference to procedure(AParam: string);
......
......@@ -2,7 +2,6 @@ object DMConnection: TDMConnection
Height = 264
Width = 395
object ApiConnection: TXDataWebConnection
URL = 'http://localhost:2004/emsys/kgOrders/api/'
OnError = ApiConnectionError
OnRequest = ApiConnectionRequest
OnResponse = ApiConnectionResponse
......@@ -10,9 +9,13 @@ object DMConnection: TDMConnection
Top = 80
end
object AuthConnection: TXDataWebConnection
URL = 'http://localhost:2004/emsys/kgOrders/auth/'
OnError = AuthConnectionError
Left = 48
Top = 16
end
object XDataWebClient1: TXDataWebClient
Connection = AuthConnection
Left = 269
Top = 164
end
end
......@@ -4,21 +4,25 @@ interface
uses
System.SysUtils, System.Classes, WEBLib.Modules, XData.Web.Connection,
App.Types, App.Config;
App.Types, App.Config, XData.Web.Client;
type
TDMConnection = class(TWebDataModule)
ApiConnection: TXDataWebConnection;
AuthConnection: TXDataWebConnection;
XDataWebClient1: TXDataWebClient;
procedure ApiConnectionError(Error: TXDataWebConnectionError);
procedure ApiConnectionRequest(Args: TXDataWebConnectionRequest);
procedure ApiConnectionResponse(Args: TXDataWebConnectionResponse);
procedure AuthConnectionError(Error: TXDataWebConnectionError);
private
FUnauthorizedAccessProc: TUnauthorizedAccessProc;
public
const clientVersion = '0.9.4';
procedure InitApp(SuccessProc: TSuccessProc;
UnauthorizedAccessProc: TUnauthorizedAccessProc);
procedure SetClientConfig(Callback: TVersionCheckCallback);
end;
var
......@@ -79,4 +83,31 @@ begin
LoadConfig(@ConfigLoaded);
end;
procedure TDMConnection.SetClientConfig(Callback: TVersionCheckCallback);
begin
XDataWebClient1.Connection := AuthConnection;
XDataWebClient1.RawInvoke('IAuthService.VerifyVersion', [clientVersion],
procedure(Response: TXDataClientResponse)
var
jsonResult: TJSObject;
error: string;
begin
jsonResult := TJSObject(Response.Result);
if jsonResult.HasOwnProperty('error') then
error := string(jsonResult['error'])
else
error := '';
if error <> '' then
Callback(False, error)
else
Callback(True, '');
end);
end;
end.
unit Utils;
interface
uses
System.Classes, SysUtils, JS, Web, WEBLib.Forms, WEBLib.Toast, DateUtils;
procedure ShowStatusMessage(const AMessage, AClass: string; const AElementId: string);
procedure HideStatusMessage(const AElementId: string);
procedure ShowSpinner(SpinnerID: string);
procedure HideSpinner(SpinnerID: string);
function CalculateAge(DateOfBirth: TDateTime): Integer;
function FormatPhoneNumber(PhoneNumber: string): string;
procedure ApplyReportTitle(CurrentReportType: string);
// function FormatDollarValue(ValueStr: string): string;
implementation
procedure ShowStatusMessage(const AMessage, AClass: string; const AElementId: string);
var
StatusMessage: TJSHTMLElement;
begin
StatusMessage := TJSHTMLElement(document.getElementById(AElementId));
if Assigned(StatusMessage) then
begin
if AMessage = '' then
begin
StatusMessage.style.setProperty('display', 'none');
StatusMessage.className := '';
StatusMessage.innerHTML := '';
end
else
begin
StatusMessage.innerHTML := AMessage;
StatusMessage.className := 'alert ' + AClass;
StatusMessage.style.setProperty('display', 'block');
end
end
else
console.log('Error: Status message element not found');
end;
procedure HideStatusMessage(const AElementId: string);
var
StatusMessage: TJSHTMLElement;
begin
StatusMessage := TJSHTMLElement(document.getElementById(AElementId));
if Assigned(StatusMessage) then
begin
StatusMessage.style.setProperty('display', 'none');
StatusMessage.className := '';
StatusMessage.innerHTML := '';
end
else
console.log('Error: Status message element not found');
end;
procedure ShowSpinner(SpinnerID: string);
var
SpinnerElement: TJSHTMLElement;
begin
SpinnerElement := TJSHTMLElement(document.getElementById(SpinnerID));
if Assigned(SpinnerElement) then
begin
SpinnerElement.classList.remove('d-none');
SpinnerElement.classList.add('d-block');
end;
end;
procedure HideSpinner(SpinnerID: string);
var
SpinnerElement: TJSHTMLElement;
begin
SpinnerElement := TJSHTMLElement(document.getElementById(SpinnerID));
if Assigned(SpinnerElement) then
begin
SpinnerElement.classList.remove('d-block');
SpinnerElement.classList.add('d-none');
end;
end;
function CalculateAge(DateOfBirth: TDateTime): Integer;
var
Today, BirthDate: TJSDate;
Year, Month, Day, BirthYear, BirthMonth, BirthDay: NativeInt;
DOBString: string;
begin
Today := TJSDate.New;
Year := Today.FullYear;
Month := Today.Month + 1;
Day := Today.Date;
// Formats the DateOfBirth as an ISO 8601 date string
DOBString := FormatDateTime('yyyy-mm-dd', DateOfBirth);
BirthDate := TJSDate.New(DOBString);
if BirthDate = nil then
begin
Exit(0); // Exit the function with an age of 0 if the date creation fails
end;
BirthYear := BirthDate.FullYear;
BirthMonth := BirthDate.Month + 1;
BirthDay := BirthDate.Date;
Result := Year - BirthYear;
if (Month < BirthMonth) or ((Month = BirthMonth) and (Day < BirthDay)) then
Dec(Result);
end;
function FormatPhoneNumber(PhoneNumber: string): string;
var
Digits: string;
begin
Digits := PhoneNumber.Replace('(', '').Replace(')', '').Replace('-', '').Replace(' ', '');
case Length(Digits) of
7: Result := Format('%s-%s', [Copy(Digits, 1, 3), Copy(Digits, 4, 4)]);
10: Result := Format('(%s) %s-%s', [Copy(Digits, 1, 3), Copy(Digits, 4, 3), Copy(Digits, 7, 4)]);
else
// If the number does not have 7 or 10 digits, whatever they typed is returned
Result := PhoneNumber;
end;
end;
procedure ApplyReportTitle(CurrentReportType: string);
var
CrimeTitleElement: TJSHTMLElement;
begin
CrimeTitleElement := TJSHTMLElement(document.getElementById('crime_title'));
if Assigned(CrimeTitleElement) then
CrimeTitleElement.innerText := CurrentReportType
else
Console.Log('Element with ID "crime_title" not found.');
end;
// Used html number input type to restrict the input instead of this function
// function FormatDollarValue(ValueStr: string): string;
// var
// i: Integer;
// begin
// Result := ''; // Initialize the result
// // Filter out any characters that are not digits or decimal point
// for i := 1 to Length(ValueStr) do
// begin
// if (Pos(ValueStr[i], '0123456789.') > 0) then
// begin
// Result := Result + ValueStr[i];
// end;
// end;
// end;
end.
object FViewAddAddress: TFViewAddAddress
Width = 281
Height = 402
object WebLabel1: TWebLabel
Left = 8
Top = 283
Width = 92
Height = 15
Caption = 'Shipping Contact'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 8
Top = 234
Width = 67
Height = 15
Caption = 'Shipping Zip'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 8
Top = 136
Width = 71
Height = 15
Caption = 'Shipping City'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 8
Top = 185
Width = 76
Height = 15
Caption = 'Shipping State'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 8
Top = 87
Width = 92
Height = 15
Caption = 'Shipping Address'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel6: TWebLabel
Left = 8
Top = 36
Width = 47
Height = 15
Caption = 'First Line'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtState: TWebEdit
Left = 8
Top = 206
Width = 78
Height = 22
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtFirstLine: TWebEdit
Left = 8
Top = 59
Width = 198
Height = 22
ChildOrder = 1
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtCity: TWebEdit
Left = 8
Top = 157
Width = 149
Height = 22
ChildOrder = 2
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtZip: TWebEdit
Left = 8
Top = 255
Width = 121
Height = 22
ChildOrder = 3
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtContact: TWebEdit
Left = 8
Top = 304
Width = 198
Height = 22
ChildOrder = 4
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtAddress: TWebEdit
Left = 8
Top = 108
Width = 198
Height = 22
ChildOrder = 1
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtNotification: TWebEdit
Left = 8
Top = 8
Width = 198
Height = 22
ChildOrder = 12
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnSave: TWebButton
Left = 8
Top = 340
Width = 96
Height = 25
Caption = 'Save'
ChildOrder = 13
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnSaveClick
end
object btnCancel: TWebButton
Left = 110
Top = 340
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 13
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
end
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>TMS Web Project</title>
<style>
</style>
</head>
<body>
</body>
</html>
\ No newline at end of file
// Small Pop-Up page when adding orders if you want to quickly add an address
unit View.AddAddress;
interface
uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls;
type
TFViewAddAddress = class(TWebForm)
edtState: TWebEdit;
edtFirstLine: TWebEdit;
edtCity: TWebEdit;
edtZip: TWebEdit;
edtContact: TWebEdit;
edtAddress: TWebEdit;
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
WebLabel3: TWebLabel;
WebLabel4: TWebLabel;
WebLabel5: TWebLabel;
WebLabel6: TWebLabel;
edtNotification: TWebEdit;
btnSave: TWebButton;
btnCancel: TWebButton;
procedure btnCancelClick(Sender: TObject);
procedure btnSaveClick(Sender: TObject);
private
{ Private declarations }
function Verify(): boolean;
public
{ Public declarations }
var
confirm: boolean;
end;
var
FViewAddAddress: TFViewAddAddress;
implementation
{$R *.dfm}
procedure TFViewAddAddress.btnSaveClick(Sender: TObject);
begin
if Verify() then
begin
confirm := true;
Close;
end;
end;
function TFViewAddAddress.Verify(): boolean;
// Makes sure the address is filled in.
begin
result := true;
if edtFirstLine.Text = '' then
begin
edtNotification.Text := 'Please Fill in the First Line';
result := false;
end
else if edtAddress.Text = '' then
begin
edtNotification.Text := 'Please Fill in the Address';
result := false;
end
else if edtCity.Text = '' then
begin
edtNotification.Text := 'Please Fill in the City';
result := false;
end
else
if edtState.Text = '' then
begin
edtNotification.Text := 'Please Fill in the State';
result := false;
end
else if edtZip.Text = '' then
begin
edtNotification.Text := 'Please Fill in the Zip Code';
result := false;
end
else if edtContact.Text = '' then
begin
edtNotification.Text := 'Please Fill in the Contact';
result := false;
end
end;
procedure TFViewAddAddress.btnCancelClick(Sender: TObject);
begin
Close;
end;
end.
\ No newline at end of file
......@@ -3,26 +3,35 @@ object FAddOrder: TFAddOrder
Height = 477
OnShow = WebFormShow
object WebLabel1: TWebLabel
Left = 334
Top = 56
Width = 35
Left = 4
Top = 81
Width = 95
Height = 15
Caption = 'Search'
Caption = 'Search Customers'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 482
Top = 56
Width = 58
Left = 135
Top = 81
Width = 113
Height = 15
Caption = 'Selected ID'
Caption = 'Selected Customer ID'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 283
Top = 81
Width = 134
Height = 15
Caption = 'Selected Customer Name'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 334
Top = 82
Left = 4
Top = 102
Width = 121
Height = 22
HeightPercent = 100.000000000000000000
......@@ -30,19 +39,20 @@ object FAddOrder: TFAddOrder
OnChange = edtSearchChange
end
object edtID: TWebEdit
Left = 482
Top = 82
Width = 69
Left = 135
Top = 102
Width = 142
Height = 22
ChildOrder = 1
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 0
Top = 146
Top = 160
Width = 871
Height = 331
Height = 317
Align = alBottom
ParentDoubleBuffered = False
DoubleBuffered = True
......@@ -59,7 +69,6 @@ object FAddOrder: TFAddOrder
Options.Mouse.ClickMargin = 0
Options.Mouse.ColumnSizeMargin = 6
Options.Mouse.RowSizeMargin = 6
OnSelectedCell = TMSFNCGrid1SelectedCell
Columns = <
item
BorderWidth = 1
......@@ -74,7 +83,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 70.000000000000000000
Width = 90.000000000000000000
end
item
BorderWidth = 1
......@@ -89,7 +98,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 250.000000000000000000
Width = 200.000000000000000000
end
item
BorderWidth = 1
......@@ -104,7 +113,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 100.000000000000000000
Width = 200.000000000000000000
end
item
BorderWidth = 1
......@@ -119,7 +128,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 432.000000000000000000
Width = 362.000000000000000000
end
item
BorderWidth = 1
......@@ -194,21 +203,23 @@ object FAddOrder: TFAddOrder
LeftCol = 0
ScrollMode = scmItemScrolling
DesignTimeSampleData = True
OnCellClick = TMSFNCGrid1CellClick
end
object cbCorrugatedPlate: TWebCheckBox
Left = 4
Top = 83
Top = 49
Width = 113
Height = 22
Caption = 'Corrugated Plate'
ChildOrder = 3
ElementID = 'cbcorrugatedplate'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = cbCorrugatedPlateClick
end
object cbWebPlate: TWebCheckBox
Left = 128
Top = 83
Left = 134
Top = 49
Width = 83
Height = 22
Caption = 'Web Plate'
......@@ -218,8 +229,8 @@ object FAddOrder: TFAddOrder
OnClick = cbWebPlateClick
end
object btnCancel: TWebButton
Left = 680
Top = 81
Left = 542
Top = 101
Width = 96
Height = 25
Caption = 'Cancel'
......@@ -229,19 +240,19 @@ object FAddOrder: TFAddOrder
OnClick = btnCancelClick
end
object btnConfirm: TWebButton
Left = 564
Top = 81
Left = 436
Top = 101
Width = 96
Height = 25
Caption = 'Confirm'
Caption = 'Select'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object cbCuttingDie: TWebCheckBox
Left = 231
Top = 83
Left = 239
Top = 49
Width = 83
Height = 22
Caption = 'Cutting Die'
......@@ -258,12 +269,11 @@ object FAddOrder: TFAddOrder
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Color = clRed
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
......@@ -272,6 +282,16 @@ object FAddOrder: TFAddOrder
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtName: TWebEdit
Left = 283
Top = 102
Width = 142
Height = 22
ChildOrder = 1
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 780
......@@ -281,18 +301,17 @@ object FAddOrder: TFAddOrder
Connection = DMConnection.ApiConnection
Left = 726
Top = 7
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'
Size = 100
object xdwdsCustomersstaff_fields_invoice_to: TStringField
FieldName = 'staff_fields_invoice_to'
end
object xdwdsCustomersCUSTOMER_ID: TIntegerField
FieldName = 'CUSTOMER_ID'
end
end
object wdsCustomers: TWebDataSource
......
......@@ -26,21 +26,23 @@ type
WebLabel2: TWebLabel;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersNAME: TStringField;
xdwdsCustomersSHORT_NAME: TStringField;
wdsCustomers: TWebDataSource;
xdwdsCustomersADDRESS: TStringField;
cbCuttingDie: TWebCheckBox;
edtNotification: TWebEdit;
xdwdsCustomersstaff_fields_invoice_to: TStringField;
xdwdsCustomersCUSTOMER_ID: TIntegerField;
WebLabel3: TWebLabel;
edtName: TWebEdit;
procedure WebFormShow(Sender: TObject);
procedure TMSFNCGrid1SelectedCell(Sender: TObject; ACol, ARow: Integer);
procedure edtSearchChange(Sender: TObject);
procedure cbCorrugatedPlateClick(Sender: TObject);
procedure cbWebPlateClick(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure cbCuttingDieClick(Sender: TObject);
procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
private
[async] procedure getCustomers;
procedure PopulateGridManually;
......@@ -50,6 +52,7 @@ type
{ Public declarations }
var
confirm: boolean;
DBID: string;
end;
var
......@@ -66,13 +69,28 @@ end;
procedure TFAddOrder.btnConfirmClick(Sender: TObject);
begin
confirm := true;
edtNotification.ElementHandle.style.setProperty('color', '#8B0000', 'important');
if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) ) then
edtNotification.Text := 'Please Select an Order Type'
else if edtID.Text = '' then
edtNotification.Text := 'Please Select a Customer'
else
begin
confirm := true;
edtNotification.Text := 'Please Select an Order Type';
confirm := false;
end;
if edtID.Text = '' then
begin
edtNotification.Text := 'Please Select a Customer';
confirm := false;
end;
if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) and (edtID.Text = '' )) then
begin
edtNotification.Text := 'Please Select an Order Type and a Customer';
confirm := false;
end;
if confirm = true then
begin
Close;
end;
end;
......@@ -138,9 +156,9 @@ begin
// Set up column headers
TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'ID';
TMSFNCGrid1.Cells[1, 0] := 'Short Name';
TMSFNCGrid1.Cells[2, 0] := 'Name';
TMSFNCGrid1.Cells[0, 0] := 'Customer Num';
TMSFNCGrid1.Cells[1, 0] := 'Customer ID';
TMSFNCGrid1.Cells[2, 0] := 'Customer Name';
TMSFNCGrid1.Cells[3, 0] := 'Address';
// Populate the grid with data from the dataset
......@@ -150,11 +168,10 @@ begin
while not xdwdsCustomers.EOF do
begin
TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('ID').AsString;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('CUSTOMER_ID').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('SHORT_NAME').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('NAME').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('ADDRESS').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('staff_fields_invoice_to').AsString;
Inc(RowIndex);
xdwdsCustomers.Next;
......@@ -167,11 +184,11 @@ end;
procedure TFAddOrder.TMSFNCGrid1SelectedCell(Sender: TObject; ACol,
ARow: Integer);
// When a cell is clicked it puts the ID in the text box
procedure TFAddOrder.TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow];
edtID.Text := TMSFNCGrid1.Cells[1, ARow];
edtName.Text := TMSFNCGrid1.Cells[2, ARow];
DBID := TMSFNCGrid1.Cells[0, ARow];
end;
procedure TFAddOrder.ApplyFilter;
......
object FViewCustomers: TFViewCustomers
Width = 640
Height = 480
OnCreate = WebFormCreate
object lblEntries: TWebLabel
Left = 12
Top = 117
Width = 81
Height = 15
Caption = 'Showing 0 of ...'
ElementID = 'lblentries'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnAddCustomer: TWebButton
Left = 12
Top = 81
Width = 96
Height = 25
Caption = 'Add Customer'
ChildOrder = 5
ElementID = 'btnaddcustomer'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
TabOrder = 6
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnAddCustomerClick
end
object wcbPageSize: TWebComboBox
Left = 22
Top = 52
Width = 145
Height = 23
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 pnlMessage: TWebPanel
Left = 12
Top = 16
Width = 121
Height = 33
ElementID = 'view.login.message'
ChildOrder = 17
TabOrder = 2
object lblMessage: TWebLabel
Left = 16
Top = 11
Width = 46
Height = 15
Caption = 'Message'
ElementID = 'view.login.message.label'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
end
object wdbtcCustomers: TWebDBTableControl
Left = 8
Top = 202
Width = 631
Height = 200
ElementClassName = 'table'
ElementId = 'tblPhoneGrid'
BorderColor = clSilver
ChildOrder = 11
ElementFont = efCSS
ElementHeaderClassName = 'thead-light sticky-top bg-light'
ElementPosition = epRelative
ElementTableClassName = 'table table-striped table-hover table-bordered text-sm'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
Footer.ButtonElementClassName = 'btn btn-light'
Footer.DropDownElementClassName = 'form-control'
Footer.InputElementClassName = 'form-control'
Footer.LinkActiveElementClassName = 'link-primary'
Footer.LinkElementClassName = 'link-secondary'
Footer.ListElementClassName = 'pagination'
Footer.ListItemElementClassName = 'page-item'
Footer.ListLinkElementClassName = 'page-link'
Header.ButtonActiveElementClassName = 'btn btn-primary'
Header.ButtonElementClassName = 'btn btn-light'
Header.DropDownElementClassName = 'form-control'
Header.InputElementClassName = 'form-control'
Header.LinkActiveElementClassName = 'link-primary'
Header.LinkElementClassName = 'link-secondary'
Header.ListElementClassName = 'pagination'
Header.ListItemElementClassName = 'page-item'
Header.ListLinkElementClassName = 'page-link'
WordWrap = True
OnDblClickCell = wdbtcCustomersDblClickCell
Columns = <
item
DataField = 'CUSTOMER_ID'
Title = 'Customer Num'
end
item
DataField = 'SHORT_NAME'
Title = 'Customer ID'
end
item
DataField = 'NAME'
Title = 'Customer Name'
end
item
DataField = 'START_DATE'
Title = 'Start Date'
end>
DataSource = wdsCustomers
end
object edtFilter: TWebEdit
Left = 246
Top = 20
Width = 121
Height = 22
ChildOrder = 5
ElementID = 'edtfilter'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = edtFilterChange
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 158
Top = 90
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 262
Top = 116
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 346
Top = 92
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
Size = 0
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSTART_DATE: TStringField
FieldName = 'START_DATE'
end
object xdwdsCustomersCUSTOMER_ID: TIntegerField
FieldName = 'CUSTOMER_ID'
end
end
end
<div class="container h-100 d-flex flex-column mt-0" style="max-width: 100%; padding-bottom: 0;">
<!-- Alert Section -->
<div class="row">
<div class=col-sm>
<div id="view.login.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>
<!-- Actions Row -->
<div class="row mt-3 justify-content-center align-items-end">
<div class="col-auto">
<label for="wcbpagesize" class="form-label fw-bold" style="font-size: 1.1rem;">
Show
<select class="form-select d-inline-block w-auto" id="wcbpagesize" style="font-size: 1rem;"></select>
entries
</label>
</div>
<div class="col-auto">
<button id="btnaddcustomer" class="btn btn-secondary">Add Customer</button>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<input id="edtfilter" type="text" class="form-control" style="width: 200px;" />
</div>
</div>
<!-- Entries Label Section d-flex justify-content-between w-100 mt-2-->
<div class="row">
<div class="col-auto">
<label id="lblentries" style="font-size: 1.10rem;"></label>
</div>
</div>
<!-- Table Section -->
<div id="order_table_section" class="overflow-auto mt-2"
style="max-height: calc(100vh - 250px); padding-bottom: 0; width: 100%;">
<table id="tblPhoneGrid" class="table table-striped table-bordered" style="width: 100%;">
<thead class="sticky-top thead-light">
<tr style="font-size: 0.875rem;">
<!-- Table headers are dynamically generated -->
</tr>
</thead>
<tbody id="orderTableBody" class="align-middle">
<!-- Table rows are dynamically generated -->
</tbody>
</table>
</div>
<!-- Pagination Section -->
<div class="d-flex justify-content-center w-100 mt-4">
<nav aria-label="Page navigation">
<ul id="pagination" class="pagination">
<!-- Pagination items added dynamically -->
</ul>
</nav>
</div>
</div>
......@@ -24,17 +24,6 @@ object FViewEditUser: TFViewEditUser
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblQB: TWebLabel
Left = 256
Top = 65
Width = 80
Height = 15
Caption = 'Quickbooks ID:'
Color = clBtnFace
ElementID = 'lblQB'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 284
Top = 8
......@@ -92,20 +81,21 @@ object FViewEditUser: TFViewEditUser
object lblAccess: TWebLabel
Left = 272
Top = 96
Width = 66
Width = 67
Height = 15
Caption = 'Access Type:'
ElementID = 'lblaccess'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblPerspective: TWebLabel
Left = 3
Top = 132
Width = 77
object lblQB: TWebLabel
Left = 256
Top = 65
Width = 80
Height = 15
Caption = 'Perspective ID:'
ElementID = 'lblperspective'
Caption = 'Quickbooks ID:'
Color = clBtnFace
ElementID = 'lblQB'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
......@@ -256,16 +246,6 @@ object FViewEditUser: TFViewEditUser
ParentFont = False
WidthPercent = 100.000000000000000000
end
object edtQB: TWebEdit
Left = 348
Top = 62
Width = 121
Height = 22
ChildOrder = 7
ElementID = 'edtQB'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtRights: TWebEdit
Left = 96
Top = 93
......@@ -293,13 +273,13 @@ object FViewEditUser: TFViewEditUser
'ALL'
'ACTIVE')
end
object edtPerspective: TWebEdit
Left = 96
Top = 129
object edtQB: TWebEdit
Left = 346
Top = 62
Width = 121
Height = 22
ChildOrder = 23
ElementID = 'edtperspective'
ChildOrder = 7
ElementID = 'edtQB'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
......
......@@ -48,15 +48,10 @@
</div>
</form>
<div class="row">
<div class="col-sm">
<div class="col-6">
<label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblrights">System Rights:</label>
<input id="edtrights" class= "form-control input-sm" width='50%'/>
</div>
<div class="col-sm-6">
<label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblperspective">Perspective ID:</label>
<input id="edtperspective" class= "form-control input-sm" width='50%'/>
</div>
</div>
<div class="row">
<div class="col-sm py-3">
......
......@@ -14,7 +14,6 @@ type
TFViewEditUser = class(TWebForm)
WebLabel2: TWebLabel;
WebLabel3: TWebLabel;
lblQB: TWebLabel;
WebLabel5: TWebLabel;
WebLabel6: TWebLabel;
WebLabel7: TWebLabel;
......@@ -34,12 +33,11 @@ type
lblactive: TWebLabel;
cbStatus: TWebCheckBox;
lblRights: TWebLabel;
edtQB: TWebEdit;
edtRights: TWebEdit;
lblAccess: TWebLabel;
cbAccess: TWebComboBox;
lblPerspective: TWebLabel;
edtPerspective: TWebEdit;
lblQB: TWebLabel;
edtQB: TWebEdit;
procedure WebFormCreate(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
......@@ -80,7 +78,8 @@ Windows,
View.Main,
View.Users,
VCL.Dialogs,
ConnectionModule;
ConnectionModule,
Utils;
procedure TFViewEditUser.btnCancelClick(Sender: TObject);
// Cancels the edit or addition
......@@ -101,9 +100,7 @@ begin
else
AddUser();
WebTimer1.Enabled := true;
asm
startSpinner();
end;
Utils.ShowSpinner('spinner');
end;
function TFViewEditUser.AddUser(): string;
......@@ -121,7 +118,6 @@ begin
'&access=' + cbAccess.Text +
'&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text +
'&perspective=' + edtPerspective.Text +
'&QB=' + edtQB.Text;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser',
......@@ -160,7 +156,6 @@ begin
'&access=' + cbAccess.Text +
'&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text +
'&perspective=' + edtPerspective.Text +
'&QB=' + edtQB.Text;
console.log(editOptions);
......@@ -215,15 +210,12 @@ begin
edtQB.Text := QB;
if Status = 'ACTIVE' then
cbStatus.checked := true;
edtPerspective.Text := Perspective
end;
procedure TFViewEditUser.WebTimer1Timer(Sender: TObject);
begin
WebTimer1.Enabled := False;
asm
endSpinner();
end;
Utils.HideSpinner('spinner');
if (not Info.Contains('Failure')) then
begin
FViewMain.ShowUserForm(Info);
......@@ -344,9 +336,16 @@ begin
end;
}
asm
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), {
keyboard: false });
confirmationModal.show();
var modal = document.getElementById('confirmation_modal');
// ensure the modal is directly under <body>
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
var bsModal = new bootstrap.Modal(modal, {
keyboard: false
});
bsModal.show();
end;
end;
......
......@@ -55,7 +55,7 @@ implementation
uses
JS, XData.Model.Classes,
ConnectionModule, Auth.Service;
ConnectionModule, Auth.Service, Utils;
{$R *.dfm}
......@@ -119,6 +119,7 @@ begin
// Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
Utils.HideSpinner('spinner');
end;
procedure TFViewItems.GeneratePagination(TotalPages: Integer);
......@@ -304,18 +305,14 @@ begin
console.log('correct');
if PageNumber > 0 then
begin
asm
startSpinner();
end;
Utils.ShowSpinner('spinner');
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems',
[searchOptions]));
itemList := TJSObject(xdcResponse.Result);
data := TJSArray(itemList['data']);
itemListLength := integer(itemList['count']);
ClearTable();
asm
setTimeout(endSpinner, 2000);
end;
Utils.HideSpinner('Spinner');
for i := 0 to data.Length - 1 do
begin
item := TJSObject(data[i]);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -27,7 +27,6 @@ type
FMessage: string;
procedure ShowNotification(Notification: string);
procedure HideNotification;
[async] procedure VerifyVersion();
public
class procedure Display(LoginProc: TSuccessProc); overload;
class procedure Display(LoginProc: TSuccessProc; AMsg: string); overload;
......@@ -85,7 +84,8 @@ end;
procedure TFViewLogin.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
pnlMessage.ElementHandle.classList.add('d-none');
pnlMessage.Visible := False;
end;
procedure TFViewLogin.ShowNotification(Notification: string);
......@@ -93,32 +93,23 @@ begin
if Notification <> '' then
begin
lblMessage.Caption := Notification;
pnlMessage.ElementHandle.hidden := False;
pnlMessage.ElementHandle.classList.remove('d-none');
pnlMessage.Visible := True;
end;
end;
procedure TFViewLogin.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification;
end;
procedure TFViewLogin.VerifyVersion();
var
xdcResponse: TXDataClientResponse;
begin
xdcResponse := await(XDataWebClient.RawInvokeAsync('IAuthService.VerifyVersion',
['1.0.0']));
ShowNotification(string(TJSObject(xdcResponse.Result)['value']));
end;
procedure TFViewLogin.WebFormCreate(Sender: TObject);
begin
// lblAppTitle.Caption := 'EM Systems - webCharms App ver 0.9.2.22';
VerifyVersion();
if FMessage <> '' then
ShowNotification(FMessage)
else
HideNotification;
end;
procedure TFViewLogin.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification;
end;
end.
object FViewMain: TFViewMain
Width = 640
Height = 586
Width = 1322
Height = 764
CSSLibrary = cssBootstrap
ElementFont = efCSS
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
OnCreate = WebFormCreate
object lblUsername: TWebLabel
Left = 529
Top = 4
Width = 66
Height = 15
Width = 59
Height = 14
Caption = 'lblUsername'
ElementID = 'view.main.username'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000
Transparent = False
WidthPercent = 100.000000000000000000
......@@ -18,8 +25,8 @@ object FViewMain: TFViewMain
object wllblUserProfile: TWebLinkLabel
Left = 529
Top = 21
Width = 63
Height = 15
Width = 59
Height = 14
ElementID = 'dropdown.menu.userprofile'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
......@@ -29,8 +36,8 @@ object FViewMain: TFViewMain
object wllblLogout: TWebLinkLabel
Left = 551
Top = 143
Width = 41
Height = 15
Width = 36
Height = 14
ElementID = 'dropdown.menu.logout'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
......@@ -40,8 +47,8 @@ object FViewMain: TFViewMain
object lblHome: TWebLinkLabel
Left = 556
Top = 38
Width = 33
Height = 15
Width = 27
Height = 14
ElementID = 'dropdown.menu.home'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
......@@ -51,10 +58,11 @@ object FViewMain: TFViewMain
object lblAppTitle: TWebLabel
Left = 57
Top = 31
Width = 82
Height = 15
Width = 75
Height = 14
Caption = 'Koehler-Gibson'
ElementID = 'view.main.apptitle'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000
Transparent = False
WidthPercent = 100.000000000000000000
......@@ -62,8 +70,8 @@ object FViewMain: TFViewMain
object lblItemsList: TWebLinkLabel
Left = 560
Top = 85
Width = 29
Height = 15
Width = 25
Height = 14
ElementID = 'dropdown.menu.itemlist'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
......@@ -74,8 +82,8 @@ object FViewMain: TFViewMain
object lblUsers: TWebLinkLabel
Left = 561
Top = 108
Width = 28
Height = 15
Width = 29
Height = 14
ElementID = 'dropdown.menu.users'
ElementFont = efCSS
HeightPercent = 100.000000000000000000
......@@ -86,11 +94,12 @@ object FViewMain: TFViewMain
object lblorders: TWebLabel
Left = 556
Top = 52
Width = 35
Height = 15
Width = 34
Height = 14
Caption = 'Orders'
ElementID = 'lblorders'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
......@@ -99,11 +108,12 @@ object FViewMain: TFViewMain
object lblCustomers: TWebLabel
Left = 540
Top = 69
Width = 57
Height = 15
Width = 52
Height = 14
Caption = 'Customers'
ElementID = 'lblcustomers'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
......@@ -112,52 +122,87 @@ object FViewMain: TFViewMain
object lblQuickbooks: TWebLabel
Left = 546
Top = 125
Width = 63
Height = 15
Width = 57
Height = 14
Caption = 'QuickBooks'
ElementID = 'lblquickbooks'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblQuickbooksClick
end
object lblVersion: TWebLabel
Left = 358
Top = 209
Width = 47
Height = 14
Caption = 'lblVersion'
ElementID = 'view.main.version'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebPanel1: TWebPanel
Left = 77
Top = 112
Width = 471
Height = 369
Width = 1322
Height = 0
ElementID = 'main.webpanel'
HeightStyle = ssAuto
WidthStyle = ssAuto
ChildOrder = 3
ElementFont = efCSS
ElementPosition = epIgnore
Role = 'null'
TabOrder = 0
end
object WebMessageDlg1: TWebMessageDlg
Left = 47
Top = 232
Width = 24
Height = 24
Buttons = []
CustomButtons = <>
Opacity = 0.200000000000000000
end
object WebMemo1: TWebMemo
Left = 77
Top = 479
Width = 471
Height = 83
ElementID = 'main.debugmemo'
ElementPosition = epRelative
HeightPercent = 100.000000000000000000
Lines.Strings = (
'WebMemo1')
Role = 'null'
SelLength = 0
SelStart = 0
Visible = False
WidthPercent = 100.000000000000000000
end
object WebMessageDlg1: TWebMessageDlg
Left = 47
Top = 232
Width = 24
Height = 24
Buttons = []
CustomButtons = <>
DialogText.Strings = (
'Warning'
'Error'
'Information'
'Confirm'
'Custom'
'OK'
'Cancel'
'Yes'
'No'
'Abort'
'Retry'
'Ignore'
'All'
'Yes to all'
'No to all'
'Help'
'Close')
Opacity = 0.200000000000000000
end
object XDataWebClient: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 44
......
<div id="wrapper">
<nav class="navbar navbar-expand navbar-light bg-light" style="margin-bottom: 0px;">
<div class="container-fluid">
<a id="view.main.apptitle" class="navbar-brand" href="index.html">Koehler-Gibson Orders</a>
<div class="d-flex align-items-center">
<a id="view.main.apptitle" class="navbar-brand" href="index.html">Koehler-Gibson Orders</a>
<span id="view.main.version" class="small text-muted ms-2"></span>
</div>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="dropdown-item" id="lblorders" href="#"><i class="fa fa-tags fa-fw"></i><span> Orders</span></a>
......@@ -59,3 +62,13 @@
</div>
</div>
<div id="spinner" class="position-absolute top-50 start-50 translate-middle d-none">
<div class="lds-roller">
<div></div><div></div><div></div><div></div>
<div></div><div></div><div></div><div></div>
</div>
</div>
......@@ -6,7 +6,7 @@ uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.ExtCtrls, Vcl.Controls, Vcl.StdCtrls,
WEBLib.StdCtrls, Data.DB, XData.Web.JsonDataset, XData.Web.Dataset,
App.Types, ConnectionModule, XData.Web.Client;
App.Types, ConnectionModule, XData.Web.Client, WEBLib.Menus;
type
TFViewMain = class(TWebForm)
......@@ -24,6 +24,7 @@ type
lblorders: TWebLabel;
lblCustomers: TWebLabel;
lblQuickbooks: TWebLabel;
lblVersion: TWebLabel;
procedure WebFormCreate(Sender: TObject);
procedure mnuLogoutClick(Sender: TObject);
procedure wllblUserProfileClick(Sender: TObject);
......@@ -49,13 +50,17 @@ type
{ Public declarations }
class procedure Display(LogoutProc: TLogoutProc);
procedure ShowForm( AFormClass: TWebFormClass );
procedure EditUser( Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string);
procedure ViewOrderEntryCorrugated(orderInfo, customerInfo, mode: string);
procedure ViewOrderEntryWeb(orderInfo, customerInfo, mode: string);
procedure ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode: string);
procedure EditUser( Mode, Username, Password, Name, Status, Email, Access, Rights, Perspective, QB: string);
procedure ViewOrderEntryCorrugated(orderInfo, customerInfo, mode, info: string);
procedure ViewOrderEntryWeb(orderInfo, customerInfo, mode, info: string);
procedure ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode, info: string);
procedure ViewOrders(info: string);
procedure ViewCustomerList(info: string);
procedure ShowUserForm(Info: string);
procedure ViewAddCustomer(customerInfo, info: string);
var
search: string;
change: boolean;
end;
var
......@@ -74,7 +79,8 @@ uses
View.Orders,
View.OrderEntryCorrugated,
View.OrderEntryCuttingDie,
View.OrderEntryWeb;
View.OrderEntryWeb,
View.Customers, AddCustomer;
{$R *.dfm}
......@@ -86,6 +92,7 @@ begin
userName := JS.toString(AuthService.TokenPayload.Properties['user_name']);
lblUsername.Caption := ' ' + userName.ToLower + ' ';
FChildForm := nil;
change := false;
if (not (JS.toBoolean(AuthService.TokenPayload.Properties['user_admin']))) then
lblUsers.Visible := false;
......@@ -93,6 +100,8 @@ begin
lblUsers.Visible := true;
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders';
lblVersion.Caption := 'v' + DMConnection.clientVersion;
setActive('Orders');
end;
......@@ -101,43 +110,74 @@ end;
procedure TFViewMain.lblCustomersClick(Sender: TObject);
begin
//ShowForm(TFViewCustomers);
lblAppTitle.Caption := 'Koehler-Gibson Customers';
setActive('Customers');
if ( not ( change ) ) then
begin
ShowForm(TFViewCustomers);
lblAppTitle.Caption := 'Koehler-Gibson Customers';
setActive('Customers');
end
else
ShowMessage('Please Save or Cancel your changes');
end;
procedure TFViewMain.lblHomeClick(Sender: TObject);
begin
ShowForm(TFViewHome);
lblAppTitle.Caption := 'Koehler-Gibson Home';
//setActive('Home');
if ( not ( change ) ) then
begin
ShowForm(TFViewHome);
lblAppTitle.Caption := 'Koehler-Gibson Home';
//setActive('Home');
end
else
ShowMessage('Please Save or Cancel your changes');
end;
procedure TFViewMain.lblordersClick(Sender: TObject);
begin
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders';
setActive('Orders');
console.log(change);
if ( not ( change ) ) then
begin
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders';
setActive('Orders');
end
else
ShowMessage('Please Save or Cancel your changes');
end;
procedure TFViewMain.lblQuickbooksClick(Sender: TObject);
begin
//ShowForm(TFViewQuickbooks);
lblAppTitle.Caption := 'Koehler-Gibson QuickBooks';
setActive('QuickBooks');
if ( not ( change ) ) then
begin
//ShowForm(TFViewQuickbooks);
lblAppTitle.Caption := 'Koehler-Gibson QuickBooks';
setActive('QuickBooks');
end
else
ShowMessage('Please Save or Cancel your changes');
end;
procedure TFViewMain.lblUsersClick(Sender: TObject);
begin
ShowForm(TFViewUsers);
lblAppTitle.Caption := 'Koehler-Gibson Users';
if ( not ( change ) ) then
begin
ShowForm(TFViewUsers);
lblAppTitle.Caption := 'Koehler-Gibson Users';
end
else
ShowMessage('Please Save or Cancel your changes');
end;
procedure TFViewMain.lblItemsListClick(Sender: TObject);
begin
ShowForm(TFViewItems);
lblAppTitle.Caption := 'Koehler-Gibson Items';
setActive('Items');
if ( not ( change ) ) then
begin
ShowForm(TFViewItems);
lblAppTitle.Caption := 'Koehler-Gibson Items';
setActive('Items');
end
else
ShowMessage('Please Save or Cancel your changes');
end;
procedure TFViewMain.setActive(page: string);
......@@ -176,7 +216,7 @@ begin
lblAppTitle.Caption := 'Koehler-Gibson User Profile';
end;
//needs to be changed
function TFViewMain.GetUserInfo: string;
var
userStr: string;
......@@ -214,6 +254,11 @@ begin
Application.CreateForm(AFormClass, WebPanel1.ElementID, FChildForm);
end;
procedure TFViewMain.ViewCustomerList(info: string);
begin
end;
procedure TFViewMain.EditUser(Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string);
begin
......@@ -231,28 +276,36 @@ begin
end;
procedure TFViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode: string);
procedure TFViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode, info: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFOrderEntryCorrugated.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode);
FChildForm := TFOrderEntryCorrugated.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode, info);
end;
procedure TFViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode: string);
procedure TFViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode, info: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFOrderEntryWeb.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode);
FChildForm := TFOrderEntryWeb.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode, info);
end;
procedure TFViewMain.ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode: string);
procedure TFViewMain.ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode, info: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFOrderEntryCuttingDie.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode);
FChildForm := TFOrderEntryCuttingDie.CreateForm(WebPanel1.ElementID, orderInfo, customerInfo, mode, info);
end;
procedure TFViewMain.ViewAddCustomer(customerInfo: string; info: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Add Customer';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFViewAddCustomer.CreateForm(WebPanel1.ElementID, customerInfo, info);
end;
procedure TFViewMain.ShowUserForm(Info: string);
......
......@@ -70,6 +70,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpProofDate: TWebDateTimePicker
Left = 22
......@@ -83,6 +84,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpShipDate: TWebDateTimePicker
Left = 22
......@@ -96,6 +98,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object edtShipVia: TWebDBEdit
Left = 24
......@@ -188,19 +191,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
DataField = 'staff_fields_job_name'
DataSource = WebDataSource1
end
object edtQuickBooksItem: TWebDBEdit
Left = 26
Top = 514
Width = 121
Height = 23
AutoSize = True
ChildOrder = 79
ElementID = 'edtquickbooksitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'staff_fields_quickbooks_item'
DataSource = WebDataSource1
end
object edtSpecialInstructions: TWebDBEdit
Left = 835
Top = 185
......@@ -214,21 +204,21 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
DataField = 'general_special_instructions'
DataSource = WebDataSource1
end
object btnConfirm: TWebButton
Left = 652
Top = 560
object btnSave: TWebButton
Left = 526
Top = 418
Width = 96
Height = 25
Caption = 'Confirm'
Caption = 'Save'
ChildOrder = 79
ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
OnClick = btnSaveClick
end
object btnCancel: TWebButton
Left = 764
Top = 560
Left = 640
Top = 418
Width = 96
Height = 25
Caption = 'Cancel'
......@@ -243,11 +233,11 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Top = 19
Width = 121
Height = 33
ElementID = 'pnl_message'
ElementID = 'view.login.message'
ChildOrder = 5
ElementPosition = epRelative
Role = 'alert'
TabOrder = 16
TabOrder = 15
object lblMessage: TWebLabel
Left = 28
Top = 9
......@@ -287,12 +277,134 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
DataField = 'NAME'
DataSource = WebDataSource1
end
object wcbQBItem: TWebDBComboBox
Left = 26
Top = 515
Width = 145
Height = 23
ElementID = 'wcbqbitem'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
DataField = 'staff_fields_quickbooks_item'
DataSource = WebDataSource1
ListField = 'name'
ListSource = wdsQBItem
end
object btnPDF: TWebButton
Left = 742
Top = 417
Width = 96
Height = 25
Caption = 'PDF'
ChildOrder = 77
ElementID = 'btnpdf'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnPDFClick
end
object edtOrderNum: TWebEdit
Left = 126
Top = 194
Width = 121
Height = 22
ChildOrder = 81
ElementID = 'edtordernum'
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnDelete: TWebButton
Left = 534
Top = 458
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 79
ElementID = 'btndelete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnDeleteClick
end
object btnClose: TWebButton
Left = 644
Top = 453
Width = 96
Height = 25
Caption = 'Close'
ChildOrder = 80
ElementID = 'btnclose'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseClick
end
object btn_confirm_delete: TWebButton
Left = 776
Top = 279
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 82
ElementID = 'btn_confirm_delete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btn_confirm_deleteClick
end
object btnCopy: TWebButton
Left = 746
Top = 453
Width = 96
Height = 25
Caption = 'Copy'
ChildOrder = 78
ElementID = 'btncopy'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCopyClick
end
object btnEdit: TWebButton
Left = 644
Top = 495
Width = 96
Height = 25
Caption = 'Edit'
ChildOrder = 78
ElementID = 'btnedit'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnEditClick
end
object btnAdd: TWebButton
Left = 532
Top = 495
Width = 96
Height = 25
Caption = 'Add'
ChildOrder = 78
ElementID = 'btnadd'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnAddClick
end
object WebButton2: TWebButton
Left = 186
Top = 429
Width = 96
Height = 25
Caption = 'Add Address'
ChildOrder = 85
ElementID = 'btnaddaddress'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = WebButton2Click
end
object WebDataSource1: TWebDataSource
DataSet = XDataWebDataSet1
Left = 22
Top = 10
end
object XDataWebDataSet1: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Connection = DMConnection.ApiConnection
Left = 90
Top = 20
......@@ -344,17 +456,23 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
object XDataWebDataSet1staff_fields_ship_date: TStringField
FieldName = 'staff_fields_ship_date'
end
object XDataWebDataSet1ORDER_ID: TStringField
FieldName = 'ORDER_ID'
end
object XDataWebDataSet1NAME: TStringField
FieldName = 'NAME'
end
object XDataWebDataSet1staff_fields_quickbooks_item: TStringField
FieldName = 'staff_fields_quickbooks_item'
end
object XDataWebDataSet1general_special_instructions: TStringField
FieldName = 'general_special_instructions'
end
object XDataWebDataSet1staff_fields_quantity: TStringField
FieldName = 'staff_fields_quantity'
end
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 160
Top = 18
Left = 192
Top = 92
end
object tmrScrollTop: TWebTimer
Interval = 100
......@@ -364,14 +482,34 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
end
object wdsShipTo: TWebDataSource
DataSet = xdwdsShipTo
Left = 212
Top = 436
Left = 302
Top = 418
end
object xdwdsShipTo: TXDataWebDataSet
Left = 192
Top = 486
AfterEdit = xdwdsShipToAfterEdit
Left = 288
Top = 370
object xdwdsShipToADDRESS: TStringField
FieldName = 'ADDRESS'
end
end
object wdsQBItem: TWebDataSource
DataSet = xdwdsQBItem
Left = 230
Top = 554
end
object xdwdsQBItem: TXDataWebDataSet
AfterEdit = xdwdsQBItemAfterEdit
Left = 190
Top = 548
object xdwdsQBItemname: TStringField
FieldName = 'name'
end
end
object tmrReturn: TWebTimer
Enabled = False
OnTimer = tmrReturnTimer
Left = 306
Top = 62
end
end
<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>
<nav class="navbar navbar-expand navbar-light bg-light sticky-top" style="z-index: 100;">
<div class="container-fluid ps-0">
<div id="view.login.message" class="alert alert-danger"
style="padding: 0.25rem 0.5rem; font-size: 0.875rem; line-height: 1.5; display: flex; align-items: center; margin: 0 0 0 60px; height: 32px; width: 400px;">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
<ul class="navbar-nav me-auto ps-2">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btncopy" class="btn btn-primary btn-sm">Copy</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-secondary btn-sm">Close</button>
</li>
</ul>
</div>
<h4 class="custom-h4 mt-3">Company</h4>
</nav>
<div class="row mx-5">
<h4 class="custom-h4 mt-3">Customer</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Company Name:</label>
<input id="edtcompanyname" type="text" class="form-control" style="width: 300px;"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Account Company Name:</label>
<input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px"/>
</div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer Name:</label>
<input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Customer Name.
</div>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<input id="edtaccountcompanyname"type="text" class="form-control" style="width: 150px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Customer ID.
</div>
</div>
<div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">In Quickbooks?:</label>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">In Quickbooks?:</label>
<input id="edtinquickbooks"type="text" class="form-control" style="width: 150px"/>
</div>
</div>
......@@ -27,10 +60,17 @@
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Order Date:</label>
<input class="form-control input-sm" id="dtporderdate" type="date">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Order Num:</label>
<input id="edtordernum" class="form-control input-sm" style="width: 100px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Order Date:</label>
<input class="form-control input-sm" id="dtporderdate" type="date" required>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide an Order Date.
</div>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Proof Date:</label>
<input class="form-control input-sm" id="dtpproofdate" type="date">
</div>
......@@ -52,11 +92,20 @@
</div>
<div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Invoice To:</label>
<input id="edtinvoiceto" class="form-control input-sm"/>
<input id="edtinvoiceto" class="form-control input-sm" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide an Invoice Address.
</div>
</div>
<div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ship To:</label>
<select id="wcbshipto" class='form-select'></select>
<select id="wcbshipto" class='form-select' required></select>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Ship To Address.
</div>
<div class="mt-2">
<button id="btnaddaddress" class="btn btn-primary btn-sm">Add Address</button>
</div>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PO Number:</label>
......@@ -64,11 +113,11 @@
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Job Name:</label>
<input id="edtjobname" class="form-control input-sm" width='50%'/>
<input id="edtjobname" class="form-control input-sm" style="width: 300px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QuickBooks Item:</label>
<input id="edtquickbooksitem" class="form-control input-sm" width='50%'/>
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">QuickBooks Item:</label>
<select id="wcbqbitem" class='form-select'></select>
</div>
</div>
<h4 class="custom-h4 mt-3">General</h4>
......@@ -79,12 +128,27 @@
<textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea>
</div>
</div>
<div class="row">
<div class="col-auto">
<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>
<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="confirmation_modal_label">Confirm</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="modal_body">
Are you sure you want to delete this order?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id=btn_confirm_cancel>Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="btn_confirm_delete">Delete</button>
</div>
</div>
</div>
</div>
</div>
<style>
.modal-backdrop {
opacity: 0 !important;
}
</style>
object FOrderEntryWeb: TFOrderEntryWeb
Width = 1015
Width = 1261
Height = 628
OnShow = WebFormShow
object WebLabel2: TWebLabel
......@@ -117,7 +117,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 19
Width = 121
Height = 33
ElementID = 'pnl_message'
ElementID = 'view.login.message'
ChildOrder = 5
ElementPosition = epRelative
Role = 'alert'
......@@ -147,6 +147,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object edtCompanyName: TWebDBEdit
......@@ -202,6 +203,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpProofDate: TWebDateTimePicker
Left = 22
......@@ -215,6 +217,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpShipDate: TWebDateTimePicker
Left = 22
......@@ -228,6 +231,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpArtDue: TWebDateTimePicker
Left = 24
......@@ -241,6 +245,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpPlateDue: TWebDateTimePicker
Left = 24
......@@ -254,6 +259,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object edtShipVia: TWebDBEdit
Left = 24
......@@ -514,6 +520,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpPDFDate3: TWebDateTimePicker
Left = 444
......@@ -527,6 +534,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpPDFDate2: TWebDateTimePicker
Left = 444
......@@ -540,6 +548,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object cbInkJet: TWebDBCheckBox
Left = 444
......@@ -592,6 +601,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpInkJetDate3: TWebDateTimePicker
Left = 444
......@@ -605,6 +615,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpInkJetDate2: TWebDateTimePicker
Left = 444
......@@ -618,6 +629,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object edtColorContrastTo: TWebDBEdit
Left = 444
......@@ -644,6 +656,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object dtpColorContractDate2: TWebDateTimePicker
Left = 444
......@@ -657,6 +670,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object edtDigitalColorTo: TWebDBEdit
Left = 444
......@@ -696,6 +710,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Date = 45638.529943136570000000
Role = ''
Text = ''
OnChange = dtpOrderDateChange
end
object edtAniloxInfo: TWebDBEdit
Left = 634
......@@ -1073,31 +1088,32 @@ object FOrderEntryWeb: TFOrderEntryWeb
DataField = 'general_comments'
DataSource = WebDataSource1
end
object btnConfirm: TWebButton
object btnSave: TWebButton
Left = 649
Top = 568
Width = 96
Height = 25
Caption = 'Confirm'
Caption = 'Save'
ChildOrder = 79
ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
OnClick = btnSaveClick
end
object btnEdit: TWebButton
Left = 867
object btnPDF: TWebButton
Left = 963
Top = 568
Width = 96
Height = 25
Caption = 'Edit'
Caption = 'PDF'
ChildOrder = 79
ElementID = 'btnedit'
ElementID = 'btnpdf'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnPDFClick
end
object btnCancel: TWebButton
Left = 761
Left = 853
Top = 568
Width = 96
Height = 25
......@@ -1106,6 +1122,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ElementID = 'btncancel'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object wcbQBItem: TWebDBComboBox
Left = 26
......@@ -1184,6 +1201,101 @@ object FOrderEntryWeb: TFOrderEntryWeb
DataField = 'print_orientation_print_orient'
DataSource = WebDataSource1
end
object btnCopy: TWebButton
Left = 751
Top = 568
Width = 96
Height = 25
Caption = 'Copy'
ChildOrder = 91
ElementID = 'btncopy'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCopyClick
end
object btnDelete: TWebButton
Left = 1065
Top = 568
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 79
ElementID = 'btndelete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnDeleteClick
end
object btnClose: TWebButton
Left = 1063
Top = 523
Width = 96
Height = 25
Caption = 'Close'
ChildOrder = 80
ElementID = 'btnclose'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseClick
end
object edtOrderNum: TWebEdit
Left = 126
Top = 194
Width = 121
Height = 22
ChildOrder = 81
ElementID = 'edtordernum'
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btn_confirm_delete: TWebButton
Left = 1094
Top = 414
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 82
ElementID = 'btn_confirm_delete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btn_confirm_deleteClick
end
object btnEdit: TWebButton
Left = 1165
Top = 560
Width = 96
Height = 25
Caption = 'Edit'
ChildOrder = 83
ElementID = 'btnedit'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnEditClick
end
object btnAdd: TWebButton
Left = 1165
Top = 520
Width = 96
Height = 25
Caption = 'Add'
ChildOrder = 84
ElementID = 'btnadd'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnAddClick
end
object WebButton2: TWebButton
Left = 174
Top = 372
Width = 96
Height = 25
Caption = 'Add Address'
ChildOrder = 85
ElementID = 'btnaddaddress'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = WebButton2Click
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 160
......@@ -1196,6 +1308,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 8
end
object XDataWebDataSet1: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Connection = DMConnection.ApiConnection
Left = 90
Top = 20
......@@ -1465,6 +1578,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 436
end
object xdwdsShipTo: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Left = 208
Top = 398
object xdwdsShipToADDRESS: TStringField
......@@ -1477,10 +1591,17 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 518
end
object xdwdsQBItem: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Left = 200
Top = 512
object xdwdsQBItemname: TStringField
FieldName = 'name'
end
end
object tmrReturn: TWebTimer
Enabled = False
OnTimer = tmrReturnTimer
Left = 306
Top = 62
end
end
......@@ -98,7 +98,7 @@ object FViewOrders: TFViewOrders
BorderColor = clSilver
ChildOrder = 11
ElementFont = efCSS
ElementHeaderClassName = 'thead-light sticky-top bg-light'
ElementHeaderClassName = 'thead-light sticky-top bg-light border-light'
ElementPosition = epRelative
ElementTableClassName = 'table table-striped table-hover table-bordered text-sm'
Footer.ButtonActiveElementClassName = 'btn btn-primary'
......@@ -124,12 +124,16 @@ object FViewOrders: TFViewOrders
OnDblClickCell = wdbtcOrdersDblClickCell
Columns = <
item
DataField = 'DBID'
Title = 'Order Num'
end
item
DataField = 'ID'
Title = 'ID'
Title = 'Customer ID'
end
item
DataField = 'companyName'
Title = 'Company Name'
Title = 'Customer Name'
end
item
DataField = 'jobName'
......@@ -188,8 +192,10 @@ object FViewOrders: TFViewOrders
Title = 'Price'
end
item
ElementClassName = 'text-nowrap'
DataField = 'qbRefNum'
Title = 'QB Ref Num'
TitleElementClassName = 'min-w-80'
end
item
DataField = 'colors'
......@@ -231,7 +237,9 @@ object FViewOrders: TFViewOrders
ItemIndex = -1
LookupValues = <
item
Value = 'o.ORDER_ID DESC'
Value =
'COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_dat' +
'e, cdo.staff_fields_order_date) DESC'
DisplayText = 'ID'
end
item
......@@ -340,6 +348,9 @@ object FViewOrders: TFViewOrders
Connection = DMConnection.ApiConnection
Left = 70
Top = 410
object xdwdsOrdersDBID: TStringField
FieldName = 'DBID'
end
object xdwdsOrdersID: TStringField
FieldName = 'ID'
end
......@@ -432,4 +443,10 @@ object FViewOrders: TFViewOrders
Left = 346
Top = 412
end
object tmrReturn: TWebTimer
Enabled = False
OnTimer = tmrReturnTimer
Left = 294
Top = 362
end
end
<div class="container h-100 d-flex flex-column mt-0" style="max-width: 100%; padding-bottom: 0;">
<div class="container h-100 d-flex flex-column mt-0 py-0" style="max-width: 100%;">
<!-- Alert Section -->
<div class="row">
<div class=col-sm>
......@@ -10,7 +10,7 @@
</div>
<!-- Actions Row -->
<div class="row mt-3 justify-content-center">
<div class="row mt-2 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>
......@@ -49,7 +49,7 @@
<!-- Table Section -->
<div id="order_table_section" class="overflow-auto mt-2"
style="max-height: calc(100vh - 250px); padding-bottom: 0; width: 100%;">
<table id="tblPhoneGrid" class="table table-striped table-bordered" style="width: 100%;">
<table id="tblPhoneGrid" class="table table-striped table-bordered border-light" style="width: 100%;">
<thead class="sticky-top thead-light">
<tr style="font-size: 0.875rem;">
<!-- Table headers are dynamically generated -->
......@@ -62,7 +62,7 @@
</div>
<!-- Pagination Section -->
<div class="d-flex justify-content-center w-100 mt-4">
<div class="d-flex justify-content-center w-100 mt-2">
<nav aria-label="Page navigation">
<ul id="pagination" class="pagination">
<!-- Pagination items added dynamically -->
......@@ -71,3 +71,6 @@
</div>
</div>
......@@ -132,9 +132,9 @@ object FSearch: TFSearch
object WebLabel1: TWebLabel
Left = 20
Top = 8
Width = 48
Width = 63
Height = 14
Caption = 'Order ID:'
Caption = 'Order Num:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
......@@ -149,7 +149,7 @@ object FSearch: TFSearch
Top = 56
Width = 107
Height = 14
Caption = 'Search Companies:'
Caption = 'Search Customers:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
......@@ -162,9 +162,9 @@ object FSearch: TFSearch
object lblCompanyID: TWebLabel
Left = 174
Top = 56
Width = 68
Width = 72
Height = 14
Caption = 'Company ID:'
Caption = 'Customer ID:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
......@@ -207,9 +207,9 @@ object FSearch: TFSearch
object WebLabel5: TWebLabel
Left = 338
Top = 56
Width = 89
Width = 93
Height = 14
Caption = 'Company Name:'
Caption = 'Customer Name:'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
......@@ -219,49 +219,6 @@ object FSearch: TFSearch
ParentFont = False
WidthPercent = 100.000000000000000000
end
object pnlMessage: TWebPanel
Left = 92
Top = 637
Width = 121
Height = 33
ElementClassName = 'card'
ElementID = 'pnl_message'
ChildOrder = 5
ElementBodyClassName = 'card-body'
ElementFont = efCSS
ElementPosition = epRelative
Role = 'alert'
TabOrder = 0
object lblMessage: TWebLabel
Left = 26
Top = 11
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 wcbFilterType1: TWebComboBox
Left = 8
Top = 462
......@@ -294,7 +251,7 @@ object FSearch: TFSearch
Top = 579
Width = 96
Height = 25
Caption = 'Confirm'
Caption = 'Search'
ChildOrder = 7
ElementClassName = 'btn btn-secondary'
ElementFont = efCSS
......@@ -393,6 +350,7 @@ object FSearch: TFSearch
Items.Strings = (
'Corrugated'
'Web'
'Cutting die'
'Any')
end
object wcbFilterType2: TWebComboBox
......@@ -472,7 +430,7 @@ object FSearch: TFSearch
Height = 233
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 12
TabOrder = 11
DefaultRowHeight = 40.000000000000000000
FixedColumns = 0
ColumnCount = 4
......@@ -499,7 +457,7 @@ object FSearch: TFSearch
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 40.000000000000000000
Width = 80.000000000000000000
end
item
BorderWidth = 1
......@@ -544,7 +502,7 @@ object FSearch: TFSearch
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 320.000000000000000000
Width = 280.000000000000000000
end
item
BorderWidth = 1
......@@ -653,6 +611,7 @@ object FSearch: TFSearch
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
......@@ -721,7 +680,7 @@ object FSearch: TFSearch
object edtCompanyName: TWebEdit
Left = 338
Top = 76
Width = 239
Width = 377
Height = 22
HelpType = htKeyword
TabStop = False
......@@ -749,18 +708,18 @@ object FSearch: TFSearch
Connection = DMConnection.ApiConnection
Left = 418
Top = 393
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
end
object xdwdsCustomersstaff_fields_invoice_to: TStringField
FieldName = 'staff_fields_invoice_to'
end
object xdwdsCustomersCUSTOMER_ID: TIntegerField
FieldName = 'CUSTOMER_ID'
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
......
......@@ -17,9 +17,6 @@ uses
type
TFSearch = class(TWebForm)
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
wcbFilterType1: TWebComboBox;
btnConfirm: TWebButton;
edtOrderID: TWebEdit;
......@@ -47,9 +44,7 @@ type
lblCompanyID: TWebLabel;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
xdwdsCustomersID: TIntegerField;
xdwdsCustomersNAME: TStringField;
xdwdsCustomersSHORT_NAME: TStringField;
wdsCustomers: TWebDataSource;
WebLabel3: TWebLabel;
edtJobName: TWebEdit;
......@@ -59,6 +54,8 @@ type
xdwdsCustomersstaff_fields_invoice_to: TStringField;
WebLabel5: TWebLabel;
edtCompanyName: TWebEdit;
xdwdsCustomersSHORT_NAME: TStringField;
xdwdsCustomersCUSTOMER_ID: TIntegerField;
procedure btnConfirmClick(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
......@@ -72,13 +69,12 @@ type
[async] procedure getCustomers;
procedure PopulateGridManually;
procedure ApplyFilter;
var
temp: string;
public
class function CreateForm(AElementID: string): TWebForm;
var
confirm: boolean;
searchOptions: string;
DBID: string;
end;
var
......@@ -120,7 +116,6 @@ begin
DateFormatSettings := TFormatSettings.Create;
DateFormatSettings.ShortDateFormat := 'yyyy/mm/dd';
wcbOrderType.Text := UpperCase(Copy(params.Values['orderType'], 1, 1)) + LowerCase(Copy(params.Values['orderType'], 2, MaxInt));
edtOrderID.Text := params.Values['orderID'];
edtCompanyID.Text := params.Values['companyID'];
......@@ -131,7 +126,6 @@ begin
wcbFilterType1.Text := params.Values['filterType1']
else
wcbFilterType1.Text := 'NONE';
console.log(params.Values['startDate1']);
if params.Values['startDate1'] = '' then
dtpStartDate1.Date := 0
......@@ -161,7 +155,6 @@ begin
else
wcbFilterType2.Text := 'NONE';
console.log(params.Values['startDate2']);
if params.Values['startDate2'] = '' then
dtpStartDate2.Date := 0
else
......@@ -174,7 +167,7 @@ begin
if params.values['null2'] <> '' then
begin
cbNull1.Checked := StrToBool(params.Values['null2']);
cbNull2.Checked := StrToBool(params.Values['null2']);
if StrToBool(params.Values['null2']) then
begin
dtpStartDate2.Visible := false;
......@@ -207,6 +200,10 @@ begin
dtpStartDate2.Date := 0;
dtpEndDate2.Date := 0;
cbNull2.Checked := false;
dtpStartDate1.Visible := true;
dtpStartDate2.Visible := true;
dtpEndDate1.Visible := true;
dtpEndDate2.Visible := true;
end;
procedure TFSearch.btnConfirmClick(Sender: TObject);
......@@ -264,8 +261,10 @@ end;
procedure TFSearch.TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
begin
edtCompanyID.Text := TMSFNCGrid1.Cells[0, ARow];
edtCompanyID.Text := TMSFNCGrid1.Cells[1, ARow];
edtCompanyName.Text := TMSFNCGrid1.Cells[2, ARow];
DBID := TMSFNCGrid1.Cells[0, ARow];
end;
procedure TFSearch.PopulateGridManually;
......@@ -279,15 +278,11 @@ begin
// Set up column headers
TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'ID';
TMSFNCGrid1.Cells[1, 0] := 'Short Name';
TMSFNCGrid1.Cells[2, 0] := 'Name';
TMSFNCGrid1.Cells[0, 0] := 'Customer Num';
TMSFNCGrid1.Cells[1, 0] := 'Customer ID';
TMSFNCGrid1.Cells[2, 0] := 'Customer 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;
......@@ -295,8 +290,7 @@ begin
while not xdwdsCustomers.EOF do
begin
TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('ID').AsString;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('CUSTOMER_ID').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('SHORT_NAME').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('NAME').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('staff_fields_invoice_to').AsString;
......
object FAddOrder: TFAddOrder
Width = 894
Height = 633
Align = alClient
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
object FSelectCustomer: TFSelectCustomer
Width = 765
Height = 480
OnCreate = WebFormCreate
OnShow = WebFormShow
object cbWebPlate: TWebCheckBox
Left = 172
Top = 55
Width = 113
Height = 22
Caption = 'Web Plate'
ChildOrder = 5
HeightStyle = ssAuto
object WebLabel1: TWebLabel
Left = 8
Top = 81
Width = 95
Height = 15
Caption = 'Search Customers'
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = cbWebPlateClick
end
object cbCorrugatedPlate: TWebCheckBox
Left = 40
Top = 55
Width = 113
Height = 22
Caption = 'Corrugated Plate'
Checked = True
ChildOrder = 5
HeightStyle = ssAuto
object WebLabel2: TWebLabel
Left = 279
Top = 81
Width = 134
Height = 15
Caption = 'Selected Customer Name'
HeightPercent = 100.000000000000000000
State = cbChecked
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = cbCorrugatedPlateClick
end
object edtSearch: TWebEdit
Left = 306
Top = 55
Width = 146
Height = 22
ChildOrder = 8
HeightStyle = ssAuto
object WebLabel3: TWebLabel
Left = 131
Top = 81
Width = 113
Height = 15
Caption = 'Selected Customer ID'
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end
object edtID: TWebEdit
Left = 475
Top = 55
object edtSearch: TWebEdit
Left = 4
Top = 102
Width = 121
Height = 22
ChildOrder = 8
HeightStyle = ssAuto
ChildOrder = 2
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 612
Top = 52
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 9
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 730
Top = 52
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 9
HeightStyle = ssAuto
object edtName: TWebEdit
Left = 279
Top = 102
Width = 142
Height = 22
ChildOrder = 1
Enabled = False
HeightPercent = 100.000000000000000000
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 0
Top = 220
Width = 894
Height = 413
Top = 163
Width = 765
Height = 317
Align = alBottom
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 6
TabOrder = 2
DefaultRowHeight = 40.000000000000000000
FixedColumns = 0
ColumnCount = 3
ColumnCount = 4
Options.Bands.Enabled = True
Options.ColumnSize.Stretch = True
Options.Editing.CalcFormat = '%g'
......@@ -121,7 +84,37 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 327.000000000000000000
Width = 90.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 150.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 200.000000000000000000
end
item
BorderWidth = 1
......@@ -136,7 +129,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 327.000000000000000000
Width = 306.000000000000000000
end
item
BorderWidth = 1
......@@ -151,7 +144,7 @@ object FAddOrder: TFAddOrder
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 239.000000000000000000
Width = 90.000000000000000000
end>
DefaultFont.Charset = DEFAULT_CHARSET
DefaultFont.Color = clWindowText
......@@ -211,30 +204,115 @@ object FAddOrder: TFAddOrder
LeftCol = 0
ScrollMode = scmItemScrolling
DesignTimeSampleData = True
ExplicitWidth = 982
OnCellClick = TMSFNCGrid1CellClick
end
object btnCancel: TWebButton
Left = 556
Top = 101
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton
Left = 440
Top = 101
Width = 96
Height = 25
Caption = 'Select'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object edtNotification: TWebEdit
Left = 4
Top = 16
Width = 510
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clRed
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtID: TWebEdit
Left = 131
Top = 102
Width = 142
Height = 22
ChildOrder = 1
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 370
Top = 562
Left = 630
Top = 47
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 206
Top = 564
object xdwdsCustomersID: TIntegerField
FieldName = 'ID'
Left = 166
Top = 129
object xdwdsCustomersBillAddr: TStringField
FieldName = 'BillAddr'
end
object xdwdsCustomersCompanyName: TStringField
FieldName = 'CompanyName'
end
object xdwdsCustomersId: TStringField
FieldName = 'Id'
end
object xdwdsCustomersPrimaryPhone: TStringField
FieldName = 'PrimaryPhone'
end
object xdwdsCustomersShipAddr: TStringField
FieldName = 'ShipAddr'
end
object xdwdsCustomersShipAddrLine1: TStringField
FieldName = 'ShipAddrLine1'
end
object xdwdsCustomersShipAddrCity: TStringField
FieldName = 'ShipAddrCity'
end
object xdwdsCustomersShipAddrState: TStringField
FieldName = 'ShipAddrState'
end
object xdwdsCustomersShipAddrZip: TStringField
FieldName = 'ShipAddrZip'
end
object xdwdsCustomersBillAddrLine1: TStringField
FieldName = 'BillAddrLine1'
end
object xdwdsCustomersBillAddrCity: TStringField
FieldName = 'BillAddrCity'
end
object xdwdsCustomersBillAddrState: TStringField
FieldName = 'BillAddrState'
end
object xdwdsCustomersNAME: TStringField
FieldName = 'NAME'
object xdwdsCustomersBillAddrZip: TStringField
FieldName = 'BillAddrZip'
end
object xdwdsCustomersSHORT_NAME: TStringField
FieldName = 'SHORT_NAME'
object xdwdsCustomersInKGOrders: TBooleanField
FieldName = 'In KGOrders'
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 38
Top = 562
Left = 104
Top = 135
end
end
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>TMS Web Project</title>
<style>
</style>
</head>
<body>
</body>
</html>
\ No newline at end of file
unit View.SelectCustomer;
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, VCL.TMSFNCTypes, VCL.TMSFNCUtils,
VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCGridCell,
VCL.TMSFNCGridOptions, VCL.TMSFNCCustomControl, VCL.TMSFNCCustomScrollControl,
VCL.TMSFNCGridData, VCL.TMSFNCCustomGrid, VCL.TMSFNCGrid;
type
TFSelectCustomer = class(TWebForm)
WebLabel1: TWebLabel;
WebLabel2: TWebLabel;
edtSearch: TWebEdit;
edtName: TWebEdit;
TMSFNCGrid1: TTMSFNCGrid;
btnCancel: TWebButton;
btnConfirm: TWebButton;
edtNotification: TWebEdit;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
wdsCustomers: TWebDataSource;
xdwdsCustomersBillAddr: TStringField;
xdwdsCustomersCompanyName: TStringField;
xdwdsCustomersId: TStringField;
xdwdsCustomersPrimaryPhone: TStringField;
xdwdsCustomersShipAddr: TStringField;
xdwdsCustomersShipAddrLine1: TStringField;
xdwdsCustomersShipAddrCity: TStringField;
xdwdsCustomersShipAddrState: TStringField;
xdwdsCustomersShipAddrZip: TStringField;
xdwdsCustomersBillAddrLine1: TStringField;
xdwdsCustomersBillAddrCity: TStringField;
xdwdsCustomersBillAddrState: TStringField;
xdwdsCustomersBillAddrZip: TStringField;
WebLabel3: TWebLabel;
edtID: TWebEdit;
xdwdsCustomersInKGOrders: TBooleanField;
procedure WebFormCreate(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure TMSFNCGrid1CellDblClick(Sender: TObject; ACol, ARow: Integer);
procedure btnConfirmClick(Sender: TObject);
procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
private
{ Private declarations }
[Async] procedure GetCustomers();
[Async] procedure SendCustomerToServer();
procedure PopulateGridManually();
public
{ Public declarations }
end;
var
FSelectCustomer: TFSelectCustomer;
implementation
{$R *.dfm}
uses View.Main, Utils;
procedure TFSelectCustomer.WebFormCreate(Sender: TObject);
begin
if not DMConnection.ApiConnection.Connected then
begin
DMConnection.ApiConnection.OpenAsync;
console.log('report requirements connection open')
end;
end;
procedure TFSelectCustomer.WebFormShow(Sender: TObject);
begin
Utils.ShowSpinner('spinner');
getCustomers();
end;
procedure TFSelectCustomer.btnConfirmClick(Sender: TObject);
begin
if edtID.Text = '' then
edtNotification.Text := 'Please Select a Customer'
else
begin
xdwdsCustomers.Locate('Id', edtID.Text, []);
SendCustomerToServer();
end;
end;
[async] procedure TFSelectCustomer.getCustomers();
// retrieves customer list from server
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
i: integer;
begin
// Fetch data from XData service
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.getQBCustomers', []));
customerList := TJSObject(xdcResponse.Result);
// Load data into TXDataWebDataset
xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList);
xdwdsCustomers.Open;
// Manually populate the grid
PopulateGridManually;
Utils.HideSpinner('spinner');
end;
procedure TFSelectCustomer.PopulateGridManually;
// populates the grid with customers manually.
var
RowIndex: Integer;
begin
TMSFNCGrid1.BeginUpdate;
try
TMSFNCGrid1.Clear; // Clear any existing data
// Set up column headers
TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'Quickbooks ID';
TMSFNCGrid1.Cells[1, 0] := 'Customer Name';
TMSFNCGrid1.Cells[2, 0] := 'Address';
TMSFNCGrid1.Cells[3, 0] := 'In KGOrders';
// Populate the grid with data from the dataset
xdwdsCustomers.First;
RowIndex := 1;
while not xdwdsCustomers.EOF do
begin
TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('Id').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('CompanyName').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('BillAddr').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('In KGOrders').AsString;
Inc(RowIndex);
xdwdsCustomers.Next;
end;
finally
TMSFNCGrid1.EndUpdate;
end;
end;
procedure TFSelectCustomer.TMSFNCGrid1CellClick(Sender: TObject; ACol,
ARow: Integer);
begin
edtID.Text := TMSFNCGrid1.Cells[0, ARow];
edtName.Text := TMSFNCGrid1.Cells[1, ARow];
end;
procedure TFSelectCustomer.TMSFNCGrid1CellDblClick(Sender: TObject; ACol,
ARow: Integer);
begin
edtID.Text := TMSFNCGrid1.Cells[2, ARow];
xdwdsCustomers.Locate('Id', TMSFNCGrid1.Cells[0, ARow], [] );
end;
procedure TFSelectCustomer.SendCustomerToServer;
var
CustomerJSON: TJSONObject;
Response: TXDataClientResponse;
notification: TJSObject;
begin
CustomerJSON := TJSONObject.Create;
CustomerJSON.AddPair('NAME', xdwdsCustomers.FieldByName('CompanyName').AsString);
CustomerJSON.AddPair('QB_LIST_ID', xdwdsCustomers.FieldByName('Id').AsString);
CustomerJSON.AddPair('PHONE', xdwdsCustomers.FieldByName('PrimaryPhone').AsString);
CustomerJSON.AddPair('BILL_ADDRESS', xdwdsCustomers.FieldByName('BillAddrLine1').AsString);
CustomerJSON.AddPair('BILL_CITY', xdwdsCustomers.FieldByName('BillAddrCity').AsString);
CustomerJSON.AddPair('BILL_STATE', xdwdsCustomers.FieldByName('BillAddrState').AsString);
CustomerJSON.AddPair('BILL_ZIP', xdwdsCustomers.FieldByName('BillAddrZip').AsString);
CustomerJSON.AddPair('BILL_ADDRESS_BLOCK', xdwdsCustomers.FieldByName('BillAddr').AsString);
CustomerJSON.AddPair('address', xdwdsCustomers.FieldByName('ShipAddrLine1').AsString);
CustomerJSON.AddPair('city', xdwdsCustomers.FieldByName('ShipAddrCity').AsString);
CustomerJSON.AddPair('state', xdwdsCustomers.FieldByName('ShipAddrState').AsString);
CustomerJSON.AddPair('zip', xdwdsCustomers.FieldByName('ShipAddrZip').AsString);
CustomerJSON.AddPair('ship_block', xdwdsCustomers.FieldByName('ShipAddr').AsString);
CustomerJSON.AddPair('name', xdwdsCustomers.FieldByName('CompanyName').AsString);
CustomerJSON.AddPair('mode', 'ADD');
Utils.ShowSpinner('spinner');
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.ImportQBCustomer',
[customerJSON.ToString]));
notification := TJSObject(Response.Result);
Utils.HideSpinner('spinner');
FViewMain.ViewAddCustomer(string(notification['CustomerID']), string(notification['status']));
Close();
end;
end.
\ No newline at end of file
......@@ -92,9 +92,9 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel6: TWebLabel
Left = 326
Top = 140
object lblMount: TWebLabel
Left = 324
Top = 200
Width = 62
Height = 14
Caption = 'Mount Due:'
......@@ -107,9 +107,9 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel7: TWebLabel
Left = 484
Top = 140
object lblMountNew: TWebLabel
Left = 482
Top = 200
Width = 78
Height = 14
Caption = 'New Due Date:'
......@@ -122,7 +122,7 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel8: TWebLabel
object lblPlate: TWebLabel
Left = 11
Top = 200
Width = 54
......@@ -137,7 +137,7 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel9: TWebLabel
object lblPlateNew: TWebLabel
Left = 169
Top = 200
Width = 78
......@@ -152,9 +152,9 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel10: TWebLabel
object lblArt: TWebLabel
Left = 324
Top = 200
Top = 142
Width = 44
Height = 14
Caption = 'Art Due:'
......@@ -167,9 +167,9 @@ object FSetStatus: TFSetStatus
ParentFont = False
WidthPercent = 100.000000000000000000
end
object WebLabel11: TWebLabel
object lblArtNew: TWebLabel
Left = 482
Top = 200
Top = 142
Width = 78
Height = 14
Caption = 'New Due Date:'
......@@ -191,27 +191,7 @@ object FSetStatus: TFSetStatus
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
LookupValues = <
item
Value = 'PROOF'
DisplayText = 'Proof Done'
end
item
Value = 'ART'
DisplayText = 'Art Done'
end
item
Value = 'PLATE'
DisplayText = 'Plate Done'
end
item
Value = 'MOUNT'
DisplayText = 'Mount Done'
end
item
Value = 'SHIP'
DisplayText = 'Ship Done'
end>
LookupValues = <>
end
object dtpDate: TWebDateTimePicker
Left = 484
......@@ -226,8 +206,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object btnConfirm: TWebButton
Left = 11
Top = 271
Left = 14
Top = 273
Width = 96
Height = 25
Caption = 'Confirm'
......@@ -242,8 +222,8 @@ object FSetStatus: TFSetStatus
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 133
Top = 271
Left = 125
Top = 273
Width = 96
Height = 25
Caption = 'Cancel'
......@@ -349,8 +329,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpMountDue: TWebDateTimePicker
Left = 326
Top = 160
Left = 324
Top = 220
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -362,8 +342,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpNewMountDue: TWebDateTimePicker
Left = 484
Top = 160
Left = 482
Top = 220
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -400,7 +380,7 @@ object FSetStatus: TFSetStatus
end
object dtpArtDue: TWebDateTimePicker
Left = 324
Top = 220
Top = 162
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -413,7 +393,7 @@ object FSetStatus: TFSetStatus
end
object dtpNewArtDue: TWebDateTimePicker
Left = 482
Top = 220
Top = 162
Width = 145
Height = 22
BorderStyle = bsSingle
......
......@@ -24,17 +24,17 @@ type
dtpShipDue: TWebDateTimePicker;
WebLabel5: TWebLabel;
dtpNewShipDue: TWebDateTimePicker;
WebLabel6: TWebLabel;
lblMount: TWebLabel;
dtpMountDue: TWebDateTimePicker;
WebLabel7: TWebLabel;
lblMountNew: TWebLabel;
dtpNewMountDue: TWebDateTimePicker;
WebLabel8: TWebLabel;
lblPlate: TWebLabel;
dtpPlateDue: TWebDateTimePicker;
WebLabel9: TWebLabel;
lblPlateNew: TWebLabel;
dtpNewPlateDue: TWebDateTimePicker;
WebLabel10: TWebLabel;
lblArt: TWebLabel;
dtpArtDue: TWebDateTimePicker;
WebLabel11: TWebLabel;
lblArtNew: TWebLabel;
dtpNewArtDue: TWebDateTimePicker;
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
......@@ -46,7 +46,7 @@ type
public
{ Public declarations }
confirm: boolean;
OrderID, JobName: string;
OrderID, JobName, OrderType: string;
ShipDue, MountDue, PlateDue, ArtDue: TDateTime;
end;
......@@ -66,6 +66,10 @@ procedure TFSetStatus.btnConfirmClick(Sender: TObject);
begin
if ( (dtpDate.Date = 0 ) or ( wlcbStatus.value = '' ) ) then
ShowNotification('Failure:Please fill in all information')
else if ( ( OrderType = 'web plate' ) and ( wlcbStatus.Value = 'MOUNT' ) ) then
ShowNotification('Failure:Web Plate Orders do not have Mount Due/Done dates')
else if ( ( OrderType = 'cutting die' ) and ( wlcbStatus.Value = 'MOUNT' ) or ( wlcbStatus.Value = 'ART' ) or (wlcbStatus.Value = 'PLATE') ) then
ShowNotification('Failure:Cutting Die Orders do not have Art/Plate/Mount Due or Done Dates')
else
begin
confirm := true;
......@@ -74,6 +78,10 @@ begin
end;
procedure TFSetStatus.WebFormShow(Sender: TObject);
var
ItemsToRemove: TStringList;
i: integer;
filteredItems: TJSArray;
begin
HideNotification();
edtOrderID.Text := OrderID;
......@@ -87,6 +95,46 @@ begin
dtpNewMountDue.Date := 0;
dtpNewPlateDue.Date := 0;
dtpNewArtDue.Date := 0;
ItemsToRemove := TStringList.Create;
if orderType = 'web plate' then
begin
dtpNewMountDue.Visible := false;
dtpMountDue.Visible := false;
lblMount.Visible := false;
lblMountNew.Visible := false;
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('Art', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end
else if orderType = 'cutting die' then
begin
dtpNewMountDue.Visible := false;
dtpMountDue.Visible := false;
lblMount.Visible := false;
lblMountNew.Visible := false;
dtpPlateDue.Visible := false;
dtpNewPlateDue.Visible := false;
lblPlate.Visible := false;
lblPlateNew.Visible := false;
dtpArtDue.Visible := false;
dtpNewArtDue.Visible := false;
lblArt.Visible := false;
lblArtNew.Visible := false;
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end
else
begin
wlcbStatus.LookupValues.AddPair('PROOF', 'Proof Done');
wlcbStatus.LookupValues.AddPair('Art', 'Art Done');
wlcbStatus.LookupValues.AddPair('PLATE', 'Plate Done');
wlcbStatus.LookupValues.AddPair('MOUNT', 'Mount Done');
wlcbStatus.LookupValues.AddPair('SHIP', 'Ship Done');
end;
end;
procedure TFSetStatus.HideNotification;
......
......@@ -6,7 +6,7 @@ uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls,
XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset,
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms;
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, ConnectionModule;
type
TFViewUserProfile = class(TWebForm)
......@@ -47,8 +47,7 @@ implementation
uses
Auth.Service,
XData.Model.Classes,
ConnectionModule;
XData.Model.Classes;
{$R *.dfm}
......
......@@ -28,7 +28,6 @@
<th scope="col">Email Address</th>
<th scope="col">Access Type</th>
<th scope="col">System Rights</th>
<th scope="col">Perspective ID</th>
<th scope="col">QB ID</th>
<th scope="col">Edit</th>
</tr>
......
......@@ -433,12 +433,6 @@ begin
Cell.innerText := IntToStr(Rights);
NewRow.appendChild(Cell);
// Perspective ID Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Perspective ID');
Cell.innerText := PID;
NewRow.appendChild(Cell);
// QB ID Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'QB ID');
......
{
"AuthUrl" : "http://localhost:2004/emsys/kgOrders/auth/",
"ApiUrl" : "http://localhost:2004/emsys/kgOrders/api/"
"AuthUrl" : "http://localhost:2004/kgOrders/auth/",
"ApiUrl" : "http://localhost:2004/kgOrders/api/"
}
......@@ -14,6 +14,14 @@ input[type="text"] {
padding-left: 5px;
}
is-invalid .form-check-input {
border: 1px solid #dc3545 !important;
}
.is-invalid .form-check-label {
color: #dc3545 !important;
}
.input-search input {
width: 100px; /* Adjust the width of the input */
height: 35px; /* Set the height to match label height */
......@@ -157,6 +165,7 @@ input[type="text"] {
.table tbody tr:hover {
background-color: #d1e7fd; /* Light blue color for hover effect */
cursor: pointer;
margin-top: 5px;
}
.form-input{
......@@ -171,6 +180,19 @@ input[type="text"] {
transition: background-color 0.3s ease;
}
.table thead th{
border: 2px;
background-color: #e6e6e6;
}
.table thead {
border-color: #e6e6e6;
}
.min-w-80 {
min-width: 80px;
}
.table {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 5px;
......@@ -333,6 +355,18 @@ input[type="text"] {
box-sizing: border-box !important; /* Prevent borders from affecting dimensions */
}
#tblPhoneGrid {
--bs-table-bg: #fff;
--bs-table-border-color: #dee2e6; /* or whatever border tone you like */
}
/* and make sure the table collapses borders so there are no gaps */
#tblPhoneGrid {
border-collapse: collapse !important;
}
......
.lds-roller {
display: inline-block;
position: relative;
width: 80px;
height: 80px;
}
.lds-roller div {
animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
transform-origin: 40px 40px;
}
.lds-roller div:after {
content: " ";
display: block;
position: absolute;
width: 10px;
height: 10px;
border-radius: 50%;
background: #204d74;
margin: -5px 0 0 -5px;
}
.lds-roller div:nth-child(1) {
animation-delay: -0.036s;
}
.lds-roller div:nth-child(1):after {
top: 63px;
left: 63px;
}
.lds-roller div:nth-child(2) {
animation-delay: -0.072s;
}
.lds-roller div:nth-child(2):after {
top: 68px;
left: 56px;
}
.lds-roller div:nth-child(3) {
animation-delay: -0.108s;
}
.lds-roller div:nth-child(3):after {
top: 71px;
left: 48px;
}
.lds-roller div:nth-child(4) {
animation-delay: -0.144s;
}
.lds-roller div:nth-child(4):after {
top: 72px;
left: 40px;
}
.lds-roller div:nth-child(5) {
animation-delay: -0.18s;
}
.lds-roller div:nth-child(5):after {
top: 71px;
left: 32px;
}
.lds-roller div:nth-child(6) {
animation-delay: -0.216s;
}
.lds-roller div:nth-child(6):after {
top: 68px;
left: 24px;
}
.lds-roller div:nth-child(7) {
animation-delay: -0.252s;
}
.lds-roller div:nth-child(7):after {
top: 63px;
left: 17px;
}
.lds-roller div:nth-child(8) {
animation-delay: -0.288s;
}
.lds-roller div:nth-child(8):after {
top: 56px;
left: 12px;
}
@keyframes lds-roller {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
<html><head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<noscript>Your browser does not support JavaScript!</noscript>
<link rel="icon" href="data:;base64,=">
<title>Web KG Orders</title>
<link href="css/app.css" rel="stylesheet" type="text/css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/css/flag-icon.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet">
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script>
<script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
<script type="text/javascript" src="$(ProjectName).js"></script>
<script>
function startSpinner() {
//window.scrollTo(0, 0);
document.body.style.setProperty('--spinner-top', window.scrollY+'px');
$(".hide-scene").addClass("scene");
}
function endSpinner() {
$(".hide-scene").removeClass("scene");
}
</script>
<title>EM Systems webKGOrders App</title>
<script type="text/javascript" src="$(ProjectName).js"></script>
<style>
/*-----svg loader styles-------*/
:root {
--spinner-top: 0px; }
.hide-scene {
display:none;
}
.scene {
position: absolute;
z-index: 9999999;
top: var(--spinner-top);
width: 100%;
height: 100%;
perspective: 600;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
}
.scene svg {
width: 165px;
height: 165px;
/* background-color: lavender; */
}
@keyframes arrow-spin {
50% {
transform: rotateY(360deg);
}
}
/*-------------------------------------------*/
</style>
</head>
<body>
</body>
<script type="text/javascript">
rtl.run();
</script>
<div class="hide-scene">
<svg
version="1.1"
id="dc-spinner"
xmlns="http://www.w3.org/2000/svg"
x="0px" y="0px"
width:"38"
height:"38"
viewBox="0 0 38 38"
preserveAspectRatio="xMinYMin meet">
<circle cx="20" cy="20" r="16" fill="#D3D3D3"></circle>
<text x="55%" y="54%" font-family="Monaco" font-size="2px" text-anchor="middle" dy=".3em" style="letter-spacing:0.6">PROCESSING
<animate
attributeName="opacity"
values="0;1;0" dur="1.8s"
repeatCount="indefinite"/>
</text>
<path fill="#373a42" d="M20,35c-8.271,0-15-6.729-15-15S11.729,5,20,5s15,6.729,15,15S28.271,35,20,35z M20,5.203
C11.841,5.203,5.203,11.841,5.203,20c0,8.159,6.638,14.797,14.797,14.797S34.797,28.159,34.797,20
C34.797,11.841,28.159,5.203,20,5.203z">
</path>
<path fill="#373a42" d="M20,33.125c-7.237,0-13.125-5.888-13.125-13.125S12.763,6.875,20,6.875S33.125,12.763,33.125,20
S27.237,33.125,20,33.125z M20,7.078C12.875,7.078,7.078,12.875,7.078,20c0,7.125,5.797,12.922,12.922,12.922
S32.922,27.125,32.922,20C32.922,12.875,27.125,7.078,20,7.078z">
</path>
<path fill="#2AA198" stroke="#2AA198" stroke-width="0.6027" stroke-miterlimit="10" d="M5.203,20
c0-8.159,6.638-14.797,14.797-14.797V5C11.729,5,5,11.729,5,20s6.729,15,15,15v-0.203C11.841,34.797,5.203,28.159,5.203,20z">
<animateTransform
attributeName="transform"
type="rotate"
from="0 20 20"
to="360 20 20"
calcMode="spline"
keySplines="0.4, 0, 0.2, 1"
keyTimes="0;1"
dur="2s"
repeatCount="indefinite" />
</path>
<path fill="#859900" stroke="#859900" stroke-width="0.2027" stroke-miterlimit="10" d="M7.078,20
c0-7.125,5.797-12.922,12.922-12.922V6.875C12.763,6.875,6.875,12.763,6.875,20S12.763,33.125,20,33.125v-0.203
C12.875,32.922,7.078,27.125,7.078,20z">
<animateTransform
attributeName="transform"
type="rotate"
from="0 20 20"
to="360 20 20"
dur="1.8s"
repeatCount="indefinite" />
</path>
</svg>
</div>
</html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<noscript>Your browser does not support JavaScript!</noscript>
<link href="data:;base64,=" rel="icon"/>
<title>Web KG Orders</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/css/flag-icon.min.css" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet"/>
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script>
<script crossorigin="anonymous" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="$(ProjectName).js" type="text/javascript"></script>
<title>EM Systems webKGOrders App</title>
<link href="css/app.css" rel="stylesheet" type="text/css"/>
<link href="css/spinner.css" rel="stylesheet" type="text/css">
<script src="$(ProjectName).js" type="text/javascript"></script>
<body>
</body>
<script type="text/javascript">rtl.run();</script>
</html>
program webKGOrders;
uses
Vcl.Forms,
XData.Web.Connection,
WEBLib.Dialogs,
Auth.Service in 'Auth.Service.pas',
App.Types in 'App.Types.pas',
ConnectionModule in 'ConnectionModule.pas' {DMConnection: TWebDataModule},
......@@ -22,7 +24,12 @@ uses
View.Search in 'View.Search.pas' {FSearch: TWebForm} {*.html},
View.SetStatus in 'View.SetStatus.pas' {FSetStatus: TWebForm} {*.html},
View.OrderEntryCuttingDie in 'View.OrderEntryCuttingDie.pas' {FOrderEntryCuttingDie: TWebForm} {*.html},
View.OrderEntryWeb in 'View.OrderEntryWeb.pas' {FOrderEntryWeb: TWebForm} {*.html};
View.OrderEntryWeb in 'View.OrderEntryWeb.pas' {FOrderEntryWeb: TWebForm} {*.html},
View.Customers in 'View.Customers.pas' {FViewCustomers: TWebForm} {*.html},
AddCustomer in 'AddCustomer.pas' {FViewAddCustomer: TWebForm} {*.html},
View.AddAddress in 'View.AddAddress.pas' {FViewAddAddress: TWebForm} {*.html},
View.SelectCustomer in 'View.SelectCustomer.pas' {FSelectCustomer: TWebForm} {*.html},
Utils in 'Utils.pas';
{$R *.res}
......@@ -44,6 +51,7 @@ begin
ConnectProc;
end;
procedure DisplayLoginView(AMessage: string);
begin
AuthService.Logout;
......@@ -53,23 +61,64 @@ begin
TFViewLogin.Display(@DisplayMainView, AMessage);
end;
procedure UnauthorizedAccessProc(AMessage: string);
begin
DisplayLoginView(AMessage);
end;
procedure StartApplication;
begin
if (not AuthService.Authenticated) or AuthService.TokenExpired then
DisplayLoginView
else
DisplayMainView;
DMConnection.InitApp(
procedure
begin
DMConnection.SetClientConfig(
procedure(Success: Boolean; ErrorMessage: string)
begin
if Success then
begin
if (not AuthService.Authenticated) or AuthService.TokenExpired then
DisplayLoginView
else
DisplayMainView;
end
else
begin
asm
var dlg = document.createElement("dialog");
dlg.classList.add("shadow", "rounded", "border", "p-4");
dlg.style.maxWidth = "500px";
dlg.style.width = "90%";
dlg.style.fontFamily = "system-ui, sans-serif";
dlg.innerHTML =
"<h5 class='fw-bold mb-3 text-danger'>kgOrders web app</h5>" +
"<p class='mb-3' style='white-space: pre-wrap;'>" + ErrorMessage + "</p>" +
"<div class='text-end'>" +
"<button id='refreshBtn' class='btn btn-primary'>Reload</button></div>";
document.body.appendChild(dlg);
dlg.showModal();
document.getElementById("refreshBtn").addEventListener("click", function () {
location.reload(true); // Hard refresh
});
end;
end;
end);
end,
@UnauthorizedAccessProc
);
end;
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDMConnection, DMConnection);
DMConnection.InitApp(@StartApplication, @UnauthorizedAccessProc);
StartApplication;
Application.Run;
end.
unit QBService;
interface
uses
XData.Service.Common,
Aurelius.Mapping.Attributes,
System.JSON,
System.Generics.Collections,
System.Classes;
type
[ServiceContract]
IQBService = interface(IInvokable)
['{D119A273-0644-484B-B75E-B6FE57BB422C}']
[HttpGet] function getCustomers(): TJSONArray;
end;
implementation
initialization
RegisterServiceType(TypeInfo(IQBService));
end.
unit QBServiceImplementation;
interface
uses
XData.Server.Module,
XData.Service.Common,
Api.Database, Data.DB, frxClass, frxExportPDF, JS, System.Hash, System.JSON,
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, MemDS, DBAccess, Uni,
hyiedefs, hyieutils, iexBitmaps, iesettings, iexLayers, iexRulers,
iexToolbars, iexUserInteractions, imageenio, imageenproc, QuickRpt, QRCtrls,
dbimageen, Vcl.ExtCtrls, ieview, imageenview, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdFTP,
iexProcEffects, frCoreClasses, Common.Logging,
DateUtils, QBService, WEBLib.REST, WEBLib.WebTools,System.Net.HttpClient,
System.Net.URLClient, System.Net.HttpClientComponent, System.netencoding,
IdHTTP, IdSSLOpenSSL, IdSSLOpenSSLHeaders, System.IniFiles, REST.Client, REST.Types;
type
[ServiceImplementation]
TQBService = class(TInterfacedObject, IQBService)
private
procedure SaveTokens(AccessToken, RefreshToken: string);
function getCustomers(): TJSONArray;
function refreshAccessToken(): string;
var
AccessToken,RefreshToken,CompanyID,Client,Secret: string;
LastRefresh: TDateTime;
end;
implementation
function TQBService.getCustomers: TJSONArray;
var
restClient: TRESTClient;
restRequest: TRESTRequest;
restResponse: TRESTResponse;
param: TRESTRequestParameter;
res: string;
jsValue: TJSONValue;
Customer: TJSONValue;
jsObj: TJSONObject;
CustomerList: TJSONArray;
pair: TJSONPair;
begin
restClient := TRESTClient.Create(nil);
restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com';
restRequest := TRESTRequest.Create(nil);
restRequest.Client := restClient;
restResponse := TRESTResponse.Create(nil);
restRequest.Response := restResponse;
if MinutesBetween(Now, LastRefresh) > 58 then
begin
RefreshAccessToken();
end;
restRequest.Method := rmGET;
//GET /v3/company/<realmId>/customer/<customerId>
res := '/v3/company/' + companyid + '/customer/58';
restRequest.Resource := res;
param := restRequest.Params.AddItem;
param.Name := 'Authorization';
param.Kind := pkHTTPHEADER;
param.Options := param.Options + [TRESTRequestParameterOption.poDoNotEncode];
param.Value := 'Bearer ' + AccessToken;
restRequest.Execute;
jsValue := restResponse.JSONValue;
jsObj := TJSONObject(jsValue);
CustomerList := TJSONArray( TJSONObject( jsObj.GetValue('QueryResponse') ).GetValue('Customer')) ;
result := CustomerList;
// LoadJSONArray( CustomerList );
restClient.Free;
restRequest.Free;
restResponse.Free;
end;
function TQBService.RefreshAccessToken: string;
// Refresh Token changes so make sure to save refresh token.
var
IdHTTP: TIdHTTP;
SSLIO: TIdSSLIOHandlerSocketOpenSSL;
RequestStream: TStringStream;
EncodedAuth, EncodedAuth2, PostData, response: string;
f: TStringList;
fi: string;
JSObj: TJSONObject;
iniFile: TIniFile;
Encoder: TBase64Encoding;
begin
// 1. Encode credentials (same as working Postman request)
// TNetEncoding.Base64.Encode adds a new line every 72 chars, this stops that
Encoder := TBase64Encoding.Create(0);
if( (Client = '') or (Secret = '') ) then
begin
Logger.Log(1, 'Missing Client ID or Client Secret in INI File');
Exit();
end;
EncodedAuth := Encoder.Encode(Client + ':' + Secret);
if RefreshToken = '' then
begin
Logger.Log(3, 'Missing Refresh Token, Please Manually Get a New One and Store in INI File');
Exit();
end;
// 2. Prepare POST data (EXACTLY as in Postman)
PostData := 'grant_type=refresh_token&refresh_token=' + RefreshToken;
// 3. Configure HTTP client
IdHTTP := TIdHTTP.Create(nil);
SSLIO := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
try
// Force TLS 1.2
SSLIO.SSLOptions.Method := sslvTLSv1_2;
SSLIO.SSLOptions.SSLVersions := [sslvTLSv1_2];
IdHTTP.IOHandler := SSLIO;
// Set headers (EXACT match with Postman)
IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP.Request.Accept := 'application/json';
IdHTTP.Request.CustomHeaders.AddValue('Authorization', 'Basic ' + EncodedAuth);
// 4. Create and send request
RequestStream := TStringStream.Create(PostData, TEncoding.UTF8);
try
// Execute POST
try
response := IdHTTP.Post('https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer', RequestStream);
JSObj := TJSONObject.ParseJSONValue(response) as TJSONObject;
RefreshToken := JSObj.GetValue('refresh_token').ToString.Trim(['"']);
AccessToken := JSObj.GetValue('access_token').ToString.Trim(['"']);
SaveTokens(AccessToken, RefreshToken);
Result := AccessToken;
Logger.Log(1, 'qbAPI - Tokens Successfully Saved');
except
on E: EIdHTTPProtocolException do
// Memo2.Lines.Add('Error: ' + E.Message + #13#10 + 'Response: ' + E.ErrorMessage);
end;
finally
RequestStream.Free;
end;
finally
SSLIO.Free;
IdHTTP.Free;
end;
end;
procedure TQBService.SaveTokens(AccessToken, RefreshToken: string);
var
f: TStringList;
iniStr, line: string;
iniFile: TIniFile;
begin
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + 'kgOrdersServer.ini' );
try
iniFile.WriteString('Quickbooks', 'RefreshToken', RefreshToken);
LastRefresh := Now;
Logger.Log(1, 'Tokens Successfully Saved');
finally
IniFile.Free;
end;
f := TStringList.Create;
// Save to file (overwrites existing file)
f.SaveToFile('QB.txt');
f.Free;
end;
initialization
RegisterServiceType(TQBService);
end.
......@@ -4,12 +4,9 @@ object ApiDatabase: TApiDatabase
Width = 519
object ucKG: TUniConnection
ProviderName = 'MySQL'
Database = 'kg_order_entry'
Username = 'root'
LoginPrompt = False
Left = 75
Top = 65
EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF'
end
object UniQuery1: TUniQuery
Connection = ucKG
......@@ -33,8 +30,8 @@ object ApiDatabase: TApiDatabase
Connection = ucKG
SQL.Strings = (
'select * from corrugated_plate_orders')
Left = 263
Top = 156
Left = 257
Top = 148
object uqOrdersORDER_ID: TIntegerField
FieldName = 'ORDER_ID'
end
......
......@@ -18,12 +18,9 @@ object AuthDatabase: TAuthDatabase
end
object ucKG: TUniConnection
ProviderName = 'MySQL'
Database = 'kg_order_entry'
Username = 'root'
LoginPrompt = False
Left = 67
Top = 131
EncryptedPassword = '9AFF92FF8CFF86FF8CFFCFFFCEFF'
end
object MySQLUniProvider1: TMySQLUniProvider
Left = 230
......
......@@ -7,7 +7,8 @@ interface
uses
XData.Service.Common,
Aurelius.Mapping.Attributes,
System.Generics.Collections;
System.Generics.Collections,
System.JSON;
const
AUTH_MODEL = 'Auth';
......@@ -18,7 +19,7 @@ type
IAuthService = interface(IInvokable)
['{9CFD59B2-A832-4F82-82BB-9A25FC93F305}']
function Login(const user, password: string): string;
function VerifyVersion(version: string): string;
function VerifyVersion(ClientVersion: string): TJSONObject;
end;
implementation
......
......@@ -10,7 +10,7 @@ uses
XData.Server.Module,
Auth.Service,
Auth.Database,
Uni, Data.DB, System.Hash;
Uni, Data.DB, System.Hash, System.IniFiles, System.JSON;
type
[ServiceImplementation]
......@@ -33,7 +33,7 @@ type
function CheckUser(const user, password: string): Integer;
public
function Login(const user, password: string): string;
function VerifyVersion(version: string): string;
function VerifyVersion(ClientVersion: string): TJSONObject;
end;
implementation
......@@ -69,17 +69,36 @@ begin
Result := authDB.uq;
end;
function TAuthService.VerifyVersion(version: string): string;
function TAuthService.VerifyVersion(ClientVersion: string): TJSONObject;
var
iniFile: TIniFile;
webClientVersion: string;
begin
if( version <> '1.0.0' ) then
begin
Logger.Log( 2, 'TLoginService.GetAgenciesConfigList - Error: wrong ver!' );
result := 'Error - You have the wrong version! Please clear your cache and refresh!';
Exit;
Result := TJSONObject.Create;
TXDataOperationContext.Current.Handler.ManagedObjects.Add(Result);
iniFile := TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini'));
try
webClientVersion := iniFile.ReadString('Settings', 'webClientVersion', '');
Result.AddPair('webClientVersion', webClientVersion);
if webClientVersion = '' then
begin
Result.AddPair('error', 'webClientVersion is not configured.');
Exit;
end;
if clientVersion <> webClientVersion then
begin
Result.AddPair('error',
'Your browser is running an old version of the app.' + sLineBreak +
'Please click below to reload.');
end;
finally
iniFile.Free;
end;
result := '';
end;
function TAuthService.Login(const user, password: string): string;
// Login verification: currently checks if logins are the same or if the user
// is admin, checks for admin password. Eventually will do a database lookup
......
// The configuartion file for the program. Contains important info like the admin
// password and the secret token. Should likely move this to the ini file..
unit Common.Config;
interface
const
defaultServerUrl = 'http://localhost:2004/emsys/kgOrders/';
defaultServerUrl = 'http://localhost:2004/kgOrders/';
type
TServerConfig = class
private
Furl: string;
FJWTTokenSecret: string;
FAdminPassword: string;
FWebAppFolder: string;
FReportsFolder: string;
FjwtTokenSecret: string;
FadminPassword: string;
FwebAppFolder: string;
FreportsFolder: string;
public
property url: string read Furl write Furl;
property jwtTokenSecret: string read FjwtTokenSecret write FjwtTokenSecret;
property adminPassword: string read FadminPassword write FadminPassword;
property webAppFolder: string read FwebAppFolder write FwebAppFolder;
property reportsFolder: string read FreportsFolder write FreportsFolder;
constructor Create;
property url: string read FUrl write FUrl;
property jwtTokenSecret: string read FJWTTokenSecret write FJWTTokenSecret;
property adminPassword: string read FAdminPassword write FAdminPassword;
property webAppFolder: string read FWebAppFolder write FWebAppFolder;
property reportsFolder: string read FReportsFolder write FReportsFolder;
end;
procedure LoadServerConfig;
......@@ -33,59 +31,57 @@ var
implementation
uses
Bcl.Json, System.SysUtils, System.IOUtils,
Common.Logging;
Bcl.Json, System.SysUtils, System.IOUtils, Common.Logging;
procedure LoadServerConfig;
var
configFile: string;
localConfig: TServerConfig;
begin
Logger.Log( 1, '--LoadServerConfig - start' );
configFile := TPath.ChangeExtension( ParamStr(0), '.json' );
Logger.Log( 1, '-- Config file: ' + ConfigFile );
if TFile.Exists(ConfigFile) then
Logger.Log(1, '--LoadServerConfig - start');
configFile := TPath.ChangeExtension(ParamStr(0), '.json');
Logger.Log(1, '-- Config file: ' + ConfigFile);
if TFile.Exists(configFile) then
begin
Logger.Log( 1, '-- Config file found.' );
Logger.Log(1, '-- Config file found.');
localConfig := TJson.Deserialize<TServerConfig>(TFile.ReadAllText(configFile));
Logger.Log( 1, '-- localConfig loaded from config file' );
Logger.Log(1, '-- localConfig loaded from config file');
serverConfig.Free;
Logger.Log( 1, '-- serverConfig.Free - called' );
Logger.Log(1, '-- serverConfig.Free - called');
serverConfig := localConfig;
Logger.Log( 1, '-- serverConfig := localConfig - called' );
Logger.Log(1, '-- serverConfig := localConfig - called');
end
else
begin
Logger.Log( 1, '-- Config file not found.' );
Logger.Log(1, '-- Config file not found.');
end;
Logger.Log( 1, '-------------------------------------------------------------' );
Logger.Log( 1, '-- serverConfig.Server url: ' + serverConfig.url );
Logger.Log( 1, '-- serverConfig.adminPassword: ' + serverConfig.adminPassword );
Logger.Log( 1, '-- serverConfig.jwtTokenSecret: ' + serverConfig.jwtTokenSecret );
Logger.Log( 1, '-- serverConfig.webAppFolder: ' + serverConfig.webAppFolder );
Logger.Log( 1, '-- serverConfig.reportsFolder: ' + serverConfig.reportsFolder );
Logger.Log( 1, '--LoadServerConfig - end' );
Logger.Log(1, '-------------------------------------------------------------');
Logger.Log(1, '-- serverConfig.url: ' + serverConfig.url);
Logger.Log(1, '-- serverConfig.adminPassword: ' + serverConfig.adminPassword);
Logger.Log(1, '-- serverConfig.jwtTokenSecret: ' + serverConfig.jwtTokenSecret);
Logger.Log(1, '-- serverConfig.webAppFolder: ' + serverConfig.webAppFolder);
Logger.Log(1, '-- serverConfig.reportsFolder: ' + serverConfig.reportsFolder);
Logger.Log(1, '--LoadServerConfig - end');
end;
{ TServerConfig }
constructor TServerConfig.Create;
//var
// ConfigFile: string;
// ServerConfigStr: string;
var
ServerConfigStr: string;
begin
Logger.Log( 1, '--TServerConfig.Create - start' );
Logger.Log(1, '--TServerConfig.Create - start');
url := defaultServerUrl;
adminPassword := 'whatisthisusedfor';
jwtTokenSecret := 'super_secret0123super_secret4567';
webAppFolder := 'static';
reportsFolder := '..\kgOrdersClient\TMSWeb\Debug\';
// ServerConfigStr := Bcl.Json.TJson.Serialize( ServerConfig );
// ConfigFile := 'serverconfig.json';
// TFile.WriteAllText( ConfigFile, ServerConfigStr );
// Logger.Log( 1, 'ServerConfig saved to file: ' + ConfigFile );
Logger.Log( 1, '--TServerConfig.Create - end' );
reportsFolder := 'static/';
ServerConfigStr := Bcl.Json.TJson.Serialize(ServerConfig);
Logger.Log(1, '--ServerConfigSerialize: ' + ServerConfigStr);
Logger.Log(1, '--TServerConfig.Create - end');
end;
end.
......@@ -36,10 +36,98 @@ type
edtEmailAddress: TEdit;
btnPDF: TButton;
Timer1: TTimer;
Button1: TButton;
uqWeb: TUniQuery;
uqWebORDER_ID: TIntegerField;
uqWebCOMPANY_ID: TIntegerField;
uqWebUSER_ID: TIntegerField;
uqWebORDER_DATE: TDateTimeField;
uqWebSTART_DATE: TDateField;
uqWebEND_DATE: TDateField;
uqWebORDER_STATUS: TStringField;
uqWebSCHED_JSON: TStringField;
uqWebstaff_fields_order_date: TDateField;
uqWebstaff_fields_proof_date: TDateField;
uqWebstaff_fields_ship_date: TDateField;
uqWebstaff_fields_ship_via: TStringField;
uqWebstaff_fields_price: TStringField;
uqWebstaff_fields_invoice_to: TStringField;
uqWebstaff_fields_invoice_attention: TStringField;
uqWebstaff_fields_ship_to: TStringField;
uqWebstaff_fields_ship_attention: TStringField;
uqWebstaff_fields_po_number: TStringField;
uqWebstaff_fields_job_name: TStringField;
uqWebstaff_fields_art_due: TDateField;
uqWebstaff_fields_plate_due: TDateField;
uqWebplates_job_number: TStringField;
uqWebsupplied_by_customer_b_w_or_co: TStringField;
uqWebsupplied_by_customer_plates: TStringField;
uqWebsupplied_by_customer_sample: TStringField;
uqWebsupplied_by_customer_dimension: TStringField;
uqWebsupplied_by_customer_other: TStringField;
uqWebsupplied_by_customer_disk: TStringField;
uqWebsupplied_by_customer_e_mail: TStringField;
uqWebsupplied_by_customer_ftp: TStringField;
uqWebplates_plate_material: TStringField;
uqWebplates_thickness: TStringField;
uqWebsupplied_by_customer_total_inc: TStringField;
uqWebsupplied_by_customer_sheets_us: TStringField;
uqWebsupplied_by_customer_initials: TStringField;
uqWebproofing_pdf: TStringField;
uqWebproofing_pdf_to: TStringField;
uqWebproofing_pdf_date_1: TDateField;
uqWebproofing_pdf_date_2: TDateField;
uqWebproofing_pdf_date_3: TDateField;
uqWebproofing_full_size_ink_jet_for: TStringField;
uqWebproofing_ink_jet_to: TStringField;
uqWebproofing_ink_jet_to_2: TStringField;
uqWebproofing_ink_jet_date_1: TDateField;
uqWebproofing_ink_jet_date_2: TDateField;
uqWebproofing_ink_jet_date_3: TDateField;
uqWebproofing_color_contract: TStringField;
uqWebproofing_color_contrac_to: TStringField;
uqWebproofing_color_contrac_date_1: TDateField;
uqWebproofing_color_contrac_date_2: TDateField;
uqWebproofing_digital_color_key: TStringField;
uqWebproofing_digital_color_to: TStringField;
uqWebproofing_digital_color_date_1: TDateField;
uqWebquantity_and_colors_press_name: TStringField;
uqWebquantity_and_colors_anilox_info: TStringField;
uqWebplate_marks_microdots: TStringField;
uqWebplate_marks_microdots_comments: TStringField;
uqWebplate_marks_crosshairs: TStringField;
uqWebplate_marks_crosshairs_comments: TStringField;
uqWebplate_marks_color_bars: TStringField;
uqWebplate_marks_color_bars_comments: TStringField;
uqWebplate_marks_other: TStringField;
uqWebplate_marks_other_comments: TStringField;
uqWebprint_orientation_print_orient: TStringField;
uqWeblayout_around: TStringField;
uqWeblayout_accross: TStringField;
uqWeblayout_surface_print: TStringField;
uqWeblayout_reverse_print: TStringField;
uqWeblayout_cylinder_repeat: TStringField;
uqWeblayout_cutoff_dimension: TStringField;
uqWeblayout_pitch: TStringField;
uqWeblayout_teeth: TStringField;
uqWeblayout_bleed: TStringField;
uqWeblayout_cutback: TStringField;
uqWeblayout_minimum_trap_dim: TStringField;
uqWeblayout_maximum_trap_dim: TStringField;
uqWebupc_size: TStringField;
uqWebupc_bar_width_reduction: TStringField;
uqWebquantity_and_colors_qty_colors: TStringField;
uqWebgeneral_comments: TStringField;
uqWebstaff_fields_quickbooks_item: TStringField;
uqWebstaff_fields_quantity: TStringField;
uqWebupc_distortion_percent: TStringField;
uqWebupc_distortion_amount: TStringField;
uqWebstaff_fields_art_location: TStringField;
procedure FormCreate(Sender: TObject);
procedure btnFindClick(Sender: TObject);
procedure btnPDFClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
kgDB: TApiDatabase;
accountSID: string;
......@@ -55,7 +143,7 @@ implementation
{$R *.dfm}
uses uLibrary, rOrderList;
uses uLibrary, rOrderList, rOrderWeb, rOrderCorrugated;
procedure TFData.FormCreate(Sender: TObject);
begin
......@@ -80,6 +168,22 @@ begin
end;
procedure TFData.Button1Click(Sender: TObject);
var
Field: TField;
SQL: string;
begin
for Field in uqWeb.Fields do
begin
SQL := 'SELECT ORDER_ID, ORDER_DATE, ' + Field.FieldName + ', LENGTH( ' + Field.FieldName +
') AS max_length FROM web_plate_orders ORDER BY max_length DESC LIMIT 1';
doQuery(uqUsers, SQL);
memo1.Lines.Add(Field.FieldName + ', ' + uqUsers.FieldByName('ORDER_ID').AsString +
', ' + uqUsers.FieldByName('max_length').AsString + ', ' + uqUsers.FieldByName('ORDER_DATE').AsString);
end;
end;
procedure TFData.btnFindClick(Sender: TObject);
// Retrieves calls from a specific number from the database.
// SQL: SQL statement to retrieve calls from the database
......@@ -104,7 +208,7 @@ var
begin
rptOrderList := TrptOrderList.Create(nil);
try
rptOrderList.PrepareReport(searchOptions);
rptOrderList.PrepareReport(searchOptions, '');
dsGrid2.DataSet := rptOrderList.uqOrders;
finally
rptOrderList.Free;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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