Commit 149a9791 by Cam Hayes

Merge branch 'master' into cam

parents 5be931b6 b2f7a7bc
......@@ -27,3 +27,5 @@ kgOrdersServer/bin/logs/
kgOrdersServer/bin/static/
kgOrdersServer/static/reports/
kgOrdersServer/bin/kgOrdersServer_MemoryManager_EventLog.txt
......@@ -117,7 +117,7 @@ type
shipmode: string;
public
{ Public declarations }
class function CreateForm(AElementID, customerInfo, info: string): TWebForm;
class function CreateForm(AElementID, customerInfo, info: string): TWebForm;
end;
var
......
......@@ -19,7 +19,7 @@ type
FUnauthorizedAccessProc: TUnauthorizedAccessProc;
public
const clientVersion = '1.0.0';
const clientVersion = '0.9.11';
procedure InitApp(SuccessProc: TSuccessProc;
UnauthorizedAccessProc: TUnauthorizedAccessProc);
procedure SetClientConfig(Callback: TVersionCheckCallback);
......
......@@ -15,6 +15,7 @@ function FormatPhoneNumber(PhoneNumber: string): string;
procedure ApplyReportTitle(CurrentReportType: string);
procedure ShowToast(const MessageText: string; const ToastType: string = 'success');
procedure ShowConfirmationModal(msg, leftLabel, rightLabel: string; ConfirmProc: TProc<Boolean>);
procedure ShowNotificationModal(msg: string);
// function FormatDollarValue(ValueStr: string): string;
......@@ -121,6 +122,37 @@ begin
end;
procedure ShowNotificationModal(msg: string);
begin
asm
var modal = document.getElementById('main_notification_modal');
var label = document.getElementById('main_notification_modal_body');
var closeBtn = document.getElementById('btn_modal_close');
if (label) label.innerText = msg;
// Ensure modal is a direct child of <body>
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
// Button simply closes the modal
if (closeBtn) {
closeBtn.onclick = function () {
var existing = bootstrap.Modal.getInstance(modal);
if (existing) {
existing.hide();
}
};
}
// Show the Bootstrap modal
var bsModal = new bootstrap.Modal(modal, { keyboard: false });
bsModal.show();
end;
end;
// ShowConfirmationModal displays a two-button modal with custom labels.
// Params:
// - messageText: text shown in the modal body
......@@ -255,7 +287,7 @@ begin
toastBody.innerText = ParsedText;
toastEl.classList.remove('bg-success', 'bg-danger', 'bg-warning', 'bg-info');
toastEl.classList.remove('bg-success', 'bg-danger', 'bg-warning', 'bg-primary');
toastEl.classList.remove('slide-in');
switch (ToastKind) {
......@@ -266,7 +298,7 @@ begin
toastEl.classList.add('bg-warning');
break;
case 'info':
toastEl.classList.add('bg-info');
toastEl.classList.add('bg-primary');
break;
default:
toastEl.classList.add('bg-success');
......@@ -286,7 +318,6 @@ begin
end;
procedure ApplyReportTitle(CurrentReportType: string);
var
CrimeTitleElement: TJSHTMLElement;
......@@ -318,3 +349,4 @@ end;
// end;
end.
......@@ -184,7 +184,7 @@ begin
if AuthService.TokenPayload.Properties['qb_enabled'] then
ShowSelectCustomerForm()
else
ShowToast('QB interface not currently active', 'info');
ShowNotificationModal('QuickBooks interface is not currently active');
end;
procedure TFViewCustomers.edtFilterChange(Sender: TObject);
......
......@@ -115,7 +115,6 @@ object FViewEditUser: TFViewEditUser
Height = 25
Caption = 'Save'
ChildOrder = 9
ElementClassName = 'btn btn-light'
ElementID = 'btnconfirm'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
......@@ -154,7 +153,6 @@ object FViewEditUser: TFViewEditUser
Height = 25
Caption = 'Cancel'
ChildOrder = 9
ElementClassName = 'btn btn-light'
ElementID = 'btncancel'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
......
......@@ -3,7 +3,7 @@
<!-- Edit-User form -->
<div class="row">
<div class="col-lg-10 col-xl-8 mx-auto">
<form id="edituserform" class="row g-3 needs-validation" novalidate>
<form id="edituserform" class="row g-3" novalidate>
<div class="col-md-6">
<label id="lblusername" for="edtusername" class="form-label">Username</label>
......@@ -52,11 +52,11 @@
</select>
</div>
<div class="d-flex gap-2 mt-4">
<button id="btnconfirm" type="button" class="btn btn-primary flex-grow-1">
<div class="gap-2 mt-4">
<button id="btnconfirm" type="button" class="btn btn-primary">
Confirm
</button>
<button id="btncancel" type="button" class="btn btn-outline-secondary flex-grow-1">
<button id="btncancel" type="button" class="btn btn-danger">
Cancel
</button>
</div>
......
......@@ -191,23 +191,51 @@ end;
procedure TFViewEditUser.btnConfirmClick(Sender: TObject);
var
FormEl: TJSHTMLFormElement;
AllValid: Boolean;
begin
FormEl := TJSHTMLFormElement(document.getElementById('edituserform'));
FormEl := TJSHTMLFormElement(document.getElementById('userprofileform'));
if not FormEl.checkValidity then
// Clear previous invalid state
edtUsername.ElementHandle.classList.remove('is-invalid');
edtFullName.ElementHandle.classList.remove('is-invalid');
edtEmail.ElementHandle.classList.remove('is-invalid');
if Assigned(FormEl) then
FormEl.classList.remove('was-validated');
AllValid := True;
if edtUsername.Text.Trim = '' then
begin
FormEl.classList.add('was-validated');
Exit;
edtUsername.ElementHandle.classList.add('is-invalid');
AllValid := False;
end;
Utils.ShowSpinner('spinner');
if edtFullName.Text.Trim = '' then
begin
edtFullName.ElementHandle.classList.add('is-invalid');
AllValid := False;
end;
if Mode = 'Edit' then
EditUser
else
AddUser;
if not TJSHTMLInputElement(edtEmail.ElementHandle).checkValidity then
begin
edtEmail.ElementHandle.classList.add('is-invalid');
AllValid := False;
end;
WebTimer1.Enabled := True;
if not AllValid then
Exit;
ShowConfirmationModal(
'Are you sure you want to save changes?',
'Save',
'Cancel',
procedure(confirmed: Boolean)
begin
if confirmed then
EditUser;
end
);
end;
end.
......@@ -477,13 +477,13 @@ begin
);
end
else
ShowToast('QB interface not currently active', 'info');
ShowNotificationModal('QuickBooks interface is not currently active.');
end;
procedure TFViewItems.btnCancelClick(Sender: TObject);
begin
ShowConfirmationModal(
'Are you sure you want to cancel all changes to the customer?',
'Are you sure you want to cancel?',
'Yes',
'No',
procedure(confirmed: Boolean)
......@@ -503,7 +503,7 @@ end;
procedure TFViewItems.btnDeleteClick(Sender: TObject);
begin
ShowToast('Deleting items is not yet implemented.', 'info');
ShowNotificationModal('Deleting items is not yet implemented.');
end;
procedure TFViewItems.btnEditClick(Sender: TObject);
......
object FViewLogin: TFViewLogin
Width = 1322
Height = 764
CSSLibrary = cssBootstrap
ElementFont = efCSS
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
OnShow = WebFormShow
object WebLabel1: TWebLabel
Left = 240
Top = 112
......@@ -46524,6 +46527,19 @@ object FViewLogin: TFViewLogin
15BCA2C7441041288CDA38EF006C6D7669C7FF01B763F67F594E0DF800000000
49454E44AE426082}
end
object lblClientVersion: TWebLabel
Left = 272
Top = 229
Width = 72
Height = 13
Caption = 'lblClientVersion'
ElementID = 'lbl_client_version'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtUsername: TWebEdit
Left = 240
Top = 136
<nav class="navbar navbar-light bg-light login-navbar">
<div class="container-fluid">
<a class="navbar-brand" href="#">Koehler-Gibson Orders</a>
<div class="container-fluid">
<a class="navbar-brand" href="#">Koehler-Gibson Orders</a>
</div>
</nav>
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-auto">
<img id="kgpicture" style="width: 250px; height: 250px;">
</div>
</nav>
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-auto">
<img id="kgpicture"style="width: 250px; height: 250px;">
</div>
<div class="col-md-6 col-lg-4">
<div class="card login-card">
<div class="card-header">
<h3 id="view.login.title" class="fs-6 card-title">Please Sign In</h3>
</div>
<div class="card-body">
<div role="form">
<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>
<fieldset>
<div class="mb-3">
<input id="view.login.edtusername" class="form-control" type="text" autofocus placeholder="Username">
</div>
<div class="mb-3">
<input id="view.login.edtpassword" class="form-control" type="password" placeholder="Password">
</div>
<div class="mb-3">
<button id="view.login.btnlogin" class="btn btn-primary w-100">Login</button>
</div>
</fieldset>
<div class="col-md-6 col-lg-4">
<div class="card login-card">
<div class="card-header">
<h3 id="view.login.title" class="fs-6 card-title">Please Sign In</h3>
</div>
<div class="card-body">
<div role="form">
<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>
<fieldset>
<div class="mb-3">
<input id="view.login.edtusername" class="form-control" type="text" autofocus placeholder="Username">
</div>
<div class="mb-3">
<input id="view.login.edtpassword" class="form-control" type="password" placeholder="Password">
</div>
<div class="mb-3">
<button id="view.login.btnlogin" class="btn btn-primary w-100">Login</button>
</div>
<div class="text-end text-muted small mt-1">
<span id="lbl_client_version"></span>
</div>
</fieldset>
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -19,9 +19,10 @@ type
btnCloseNotification: TWebButton;
XDataWebClient: TXDataWebClient;
WebImageControl1: TWebImageControl;
lblClientVersion: TWebLabel;
procedure btnLoginClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormCreate(Sender: TObject);
procedure WebFormShow(Sender: TObject);
private
FLoginProc: TSuccessProc;
FMessage: string;
......@@ -98,18 +99,20 @@ begin
end;
end;
procedure TFViewLogin.WebFormCreate(Sender: TObject);
procedure TFViewLogin.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification;
end;
procedure TFViewLogin.WebFormShow(Sender: TObject);
begin
console.log(DMConnection.clientVersion);
FViewLogin.lblClientVersion.Caption := 'v' + DMConnection.clientVersion;
if FMessage <> '' then
ShowNotification(FMessage)
else
HideNotification;
end;
procedure TFViewLogin.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification;
end;
end.
......@@ -116,6 +116,23 @@
</div>
</div>
<div class="modal fade" id="main_notification_modal" tabindex="-1" aria-labelledby="main_lblmodal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content shadow-lg">
<div class="modal-header">
<h5 class="modal-title" id="main_notification_modal">Error</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body fs-6 fw-bold" id="main_notification_modal_body">
Please contact EMSystems to solve the issue.
</div>
<div class="modal-footer justify-content-center">
<button type="button" id="btn_modal_close" class="btn btn-primary">Close</button>
</div>
</div>
</div>
</div>
......
......@@ -98,6 +98,7 @@ begin
if (not (JS.toString(AuthService.TokenPayload.Properties['user_access_type']) = 'ADMIN')) then
begin
lblUsers.enabled := false;
lblCustomers.Enabled := false;
end;
......@@ -333,5 +334,4 @@ begin
FChildForm := TFViewUsers.CreateForm(WebPanel1.ElementID, Info);
end;
end.
object FViewUserProfile: TFViewUserProfile
Width = 604
Height = 434
CSSLibrary = cssBootstrap
ElementFont = efCSS
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
......@@ -206,7 +208,7 @@ object FViewUserProfile: TFViewUserProfile
end
object btnConfirm: TWebButton
Left = 85
Top = 210
Top = 207
Width = 96
Height = 25
Caption = 'Confirm Changes'
......
......@@ -61,7 +61,7 @@
Confirm&nbsp;Changes
</button>
<button id="view.userprofile.form.btncancel"
class="btn btn-outline-secondary flex-grow-1"
class="btn btn-danger flex-grow-1"
type="button">
Cancel&nbsp;Changes
</button>
......
......@@ -51,11 +51,6 @@ var
FormEl: TJSHTMLFormElement;
begin
FormEl := TJSHTMLFormElement(document.querySelector('form'));
if not FormEl.checkValidity then
begin
FormEl.classList.add('was-validated');
Exit;
end;
ShowConfirmationModal(
'Are you sure you want to save changes to your profile?',
......
object FViewUsers: TFViewUsers
Width = 640
Height = 480
CSSLibrary = cssBootstrap
ElementFont = efCSS
OnShow = WebFormCreate
object lblEntries: TWebLabel
Left = 8
......@@ -21,7 +23,6 @@ object FViewUsers: TFViewUsers
Height = 25
Caption = 'Add User'
ChildOrder = 9
ElementClassName = 'btn btn-light'
ElementID = 'btnadduser'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
......@@ -30,6 +31,7 @@ object FViewUsers: TFViewUsers
Font.Style = []
HeightPercent = 100.000000000000000000
ParentFont = False
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnAddUserClick
end
......
......@@ -390,15 +390,3 @@ is-invalid .form-check-input {
transform: translate(-50%, -50%);
}
......@@ -1175,7 +1175,7 @@ begin
try
SQL := SQLQuery.SQL;
whereSQL := SQLQuery.whereSQL;
logger.Log(3, 'Getting orders with SQL query ' + SQL);
logger.Log(5, 'Getting orders with SQL query ' + SQL);
doQuery(ordersDB.UniQuery1, SQL);
......
......@@ -78,7 +78,7 @@ object FMain: TFMain
end
object initTimer: TTimer
OnTimer = initTimerTimer
Left = 58
Left = 60
Top = 398
end
object ExeInfo1: TExeInfo
......
......@@ -147,29 +147,35 @@ begin
Logger.Log(1, '--- Database ---');
iniStr := IniFile.ReadString( 'Database', 'Server', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Database->Server: Entry not found' )
Logger.Log( 1, '----Database->Server: Entry not found - ERROR: ini entry required!!!' )
else
Logger.Log( 1, '--Database->Server: ' + iniStr );
Logger.Log( 1, '----Database->Server: ' + iniStr );
iniStr := iniFile.ReadString('Database', 'Database', '');
if iniStr.IsEmpty then
Logger.Log( 1, '----Database->Database: Entry not found' )
Logger.Log( 1, '----Database->Database: ini entry not found - default: kg_order_entry' )
else
Logger.Log( 1, '----Database->Database: ' + iniStr );
Logger.Log( 1, '----Database->Database: ini entry: ' + iniStr );
iniStr := iniFile.ReadString('Database', 'Username', '');
if iniStr.IsEmpty then
Logger.Log( 1, '----Database->Username: Entry not found' )
Logger.Log( 1, '----Database->Username: Entry not found - default: root' )
else
Logger.Log( 1, '----Database->Username: ' + iniStr );
iniStr := iniFile.ReadString('Database', 'Password', '');
if iniStr.IsEmpty then
Logger.Log( 1, '----Database->Password: Entry not found' )
Logger.Log( 1, '----Database->Password: Entry not found - default: xxxxxx' )
else
Logger.Log( 1, '----Database->Password: xxxxxxxx' );
Logger.Log(1, '---Quickbooks---');
iniStr := IniFile.ReadString( 'Quickbooks', 'Enabled', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->Enabled: Entry not found - default: yes' )
else
Logger.Log( 1, '--Quickbooks->Enabled: ' + iniStr );
iniStr := IniFile.ReadString( 'Quickbooks', 'CompanyID', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->CompanyID: Entry not found' )
......
......@@ -22,10 +22,10 @@ var
begin
iniFile := TIniFile.Create( ExtractFilePath(Application.ExeName) + iniFilename );
try
uc.Server := iniFile.ReadString('Database', 'Server', uc.Server);
uc.Database := iniFile.ReadString('Database', 'Database', uc.Database);
uc.Username := iniFile.ReadString('Database', 'Username', uc.Username);
uc.Password := iniFile.ReadString('Database', 'Password', uc.Password);
uc.Server := iniFile.ReadString('Database', 'Server', '');
uc.Database := iniFile.ReadString('Database', 'Database', 'kg_order_entry');
uc.Username := iniFile.ReadString('Database', 'Username', 'root');
uc.Password := iniFile.ReadString('Database', 'Password', 'emsys01');
finally
iniFile.Free;
end;
......
[Settings]
MemoLogLevel=4
FileLogLevel=4
webClientVersion=1.0.0
LogFileNum=158
webClientVersion=0.9.11
LogFileNum=164
[Database]
--Server=192.168.116.138
--Server=192.168.102.130
Server=192.168.116.132
--Server=192.168.102.129
--Server=192.168.75.133
Server=192.168.159.10
Database=kg_order_entry
Username=root
Password=emsys01
--Server=192.168.159.10
--Database=kg_order_entry
--Username=root
--Password=emsys01
--Password=emsys!012
[Quickbooks]
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -114,7 +114,10 @@
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_ExeOutput>.\bin</DCC_ExeOutput>
<DCC_UnitSearchPath>C:\RADTOOLS\FastMM4;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_Keys>CompanyName=EM Systems;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=EM Systems;FileDescription=$(MSBuildProjectName);FileVersion=0.9.11.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.11;Comments=</VerInfo_Keys>
<VerInfo_MajorVer>0</VerInfo_MajorVer>
<VerInfo_MinorVer>9</VerInfo_MinorVer>
<VerInfo_Release>11</VerInfo_Release>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
......
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