Commit cc8b2b36 by Mac Stephens

additional confirmation modal updates to users and main, also set status updated

parent bae0384f
......@@ -47,7 +47,6 @@ type
function GetUserInfo: string;
procedure setActive(page: string);
procedure ConfirmLogout;
procedure OnConfirmLogout(Event: TJSEvent);
public
{ Public declarations }
class procedure Display(LogoutProc: TLogoutProc);
......@@ -209,47 +208,22 @@ begin
ConfirmLogout;
end;
procedure TFViewMain.ConfirmLogout;
var
yesBtn: TJSElement;
begin
document.getElementById('modal_body').innerHTML := 'Are you sure you want to log out?';
document.getElementById('btn_confirm_cancel').innerText := 'No';
document.getElementById('btn_confirm_delete').innerText := 'Yes';
asm
var modal = document.getElementById('confirmation_modal');
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
end;
// Detach any existing click handler (optional cleanup if reused often)
yesBtn := document.getElementById('btn_confirm_delete');
if Assigned(yesBtn) then
begin
TJSElement(yesBtn).removeEventListener('click', @OnConfirmLogout);
TJSElement(yesBtn).addEventListener('click', @OnConfirmLogout);
end;
asm
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), {
keyboard: false
});
confirmationModal.show();
end;
end;
procedure TFViewMain.OnConfirmLogout(Event: TJSEvent);
procedure TFViewMain.ConfirmLogout;
begin
if Assigned(FLogoutProc) then
FLogoutProc('');
ShowConfirmationModal(
'Are you sure you want to log out?',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed and Assigned(FLogoutProc) then
FLogoutProc('');
end
);
end;
procedure TFViewMain.wllblUserProfileClick(Sender: TObject);
begin
ShowCrudForm(TFViewUserProfile);
......
object FSetStatus: TFSetStatus
Width = 640
Height = 361
Height = 278
OnShow = WebFormShow
object lblStatus1: TWebLabel
Left = 326
Top = 80
Left = 328
Top = 32
Width = 38
Height = 14
Caption = 'Status:'
......@@ -18,8 +18,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object WebLabel1: TWebLabel
Left = 484
Top = 80
Left = 486
Top = 32
Width = 91
Height = 14
Caption = 'Date Completed:'
......@@ -33,8 +33,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 14
Top = 80
Left = 16
Top = 32
Width = 48
Height = 14
Caption = 'Order ID:'
......@@ -48,8 +48,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 172
Top = 78
Left = 174
Top = 30
Width = 57
Height = 14
Caption = 'Job Name:'
......@@ -63,8 +63,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 11
Top = 142
Left = 13
Top = 94
Width = 51
Height = 14
Caption = 'Ship Due:'
......@@ -78,8 +78,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 169
Top = 142
Left = 171
Top = 94
Width = 78
Height = 14
Caption = 'New Due Date:'
......@@ -93,8 +93,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object lblMount: TWebLabel
Left = 324
Top = 200
Left = 326
Top = 152
Width = 62
Height = 14
Caption = 'Mount Due:'
......@@ -108,8 +108,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object lblMountNew: TWebLabel
Left = 482
Top = 200
Left = 484
Top = 152
Width = 78
Height = 14
Caption = 'New Due Date:'
......@@ -123,8 +123,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object lblPlate: TWebLabel
Left = 11
Top = 200
Left = 13
Top = 152
Width = 54
Height = 14
Caption = 'Plate Due:'
......@@ -138,8 +138,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object lblPlateNew: TWebLabel
Left = 169
Top = 200
Left = 171
Top = 152
Width = 78
Height = 14
Caption = 'New Due Date:'
......@@ -153,8 +153,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object lblArt: TWebLabel
Left = 324
Top = 142
Left = 326
Top = 94
Width = 44
Height = 14
Caption = 'Art Due:'
......@@ -168,8 +168,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object lblArtNew: TWebLabel
Left = 482
Top = 142
Left = 484
Top = 94
Width = 78
Height = 14
Caption = 'New Due Date:'
......@@ -183,8 +183,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object wlcbStatus: TWebLookupComboBox
Left = 326
Top = 100
Left = 328
Top = 52
Width = 145
Height = 22
ElementClassName = 'custom-select'
......@@ -194,8 +194,8 @@ object FSetStatus: TFSetStatus
LookupValues = <>
end
object dtpDate: TWebDateTimePicker
Left = 484
Top = 100
Left = 486
Top = 52
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -206,8 +206,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object btnConfirm: TWebButton
Left = 14
Top = 273
Left = 16
Top = 225
Width = 96
Height = 25
Caption = 'Confirm'
......@@ -222,8 +222,8 @@ object FSetStatus: TFSetStatus
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 125
Top = 273
Left = 127
Top = 225
Width = 96
Height = 25
Caption = 'Cancel'
......@@ -238,8 +238,8 @@ object FSetStatus: TFSetStatus
OnClick = btnCancelClick
end
object edtOrderID: TWebEdit
Left = 14
Top = 100
Left = 16
Top = 52
Width = 145
Height = 22
HelpType = htKeyword
......@@ -259,31 +259,9 @@ object FSetStatus: TFSetStatus
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtNotification: TWebEdit
Left = 14
Top = 24
Width = 303
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtJobName: TWebEdit
Left = 172
Top = 100
Left = 174
Top = 52
Width = 145
Height = 22
HelpType = htKeyword
......@@ -304,8 +282,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000
end
object dtpShipDue: TWebDateTimePicker
Left = 11
Top = 162
Left = 13
Top = 114
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -317,8 +295,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpNewShipDue: TWebDateTimePicker
Left = 169
Top = 162
Left = 171
Top = 114
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -329,8 +307,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpMountDue: TWebDateTimePicker
Left = 324
Top = 220
Left = 326
Top = 172
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -342,8 +320,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpNewMountDue: TWebDateTimePicker
Left = 482
Top = 220
Left = 484
Top = 172
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -354,8 +332,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpPlateDue: TWebDateTimePicker
Left = 11
Top = 220
Left = 13
Top = 172
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -367,8 +345,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpNewPlateDue: TWebDateTimePicker
Left = 169
Top = 220
Left = 171
Top = 172
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -379,8 +357,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpArtDue: TWebDateTimePicker
Left = 324
Top = 162
Left = 326
Top = 114
Width = 145
Height = 22
BorderStyle = bsSingle
......@@ -392,8 +370,8 @@ object FSetStatus: TFSetStatus
Text = ''
end
object dtpNewArtDue: TWebDateTimePicker
Left = 482
Top = 162
Left = 484
Top = 114
Width = 145
Height = 22
BorderStyle = bsSingle
......
......@@ -17,7 +17,6 @@ type
btnCancel: TWebButton;
WebLabel2: TWebLabel;
edtOrderID: TWebEdit;
edtNotification: TWebEdit;
edtJobName: TWebEdit;
WebLabel3: TWebLabel;
WebLabel4: TWebLabel;
......
......@@ -57,35 +57,19 @@ begin
Exit;
end;
asm
var modal = document.getElementById('confirmation_modal');
var btnCancel = document.getElementById('btn_confirm_cancel');
var btnConfirm = document.getElementById('btn_confirm_delete');
var modalBody = document.getElementById('modal_body');
var self = this;
if (modal && btnCancel && btnConfirm && modalBody) {
modalBody.innerText = 'Are you sure you want to save changes to your profile?';
btnCancel.innerText = 'Cancel';
btnConfirm.innerText = 'Save';
if (modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
var bsModal = new bootstrap.Modal(modal, { keyboard: false });
bsModal.show();
btnConfirm.onclick = function () {
self.EditUser();
bsModal.hide();
};
}
end;
ShowConfirmationModal(
'Are you sure you want to save changes to your profile?',
'Save',
'Cancel',
procedure(confirmed: Boolean)
begin
if confirmed then
EditUser;
end
);
end;
[async] procedure TFViewUserProfile.EditUser;
var
xdcResponse: TXDataClientResponse;
......@@ -114,28 +98,33 @@ begin
end;
procedure TFViewUserProfile.btnCancelClick(Sender: TObject);
var
xdcResponse: TXDataClientResponse;
userList: TJSObject;
data: TJSArray;
user: TJSObject;
begin
GetUser();
showToast('Failure: Changes discarded');
ShowConfirmationModal(
'Are you sure you want to cancel all your changes?',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed then
begin
GetUser();
ShowToast('Changes discarded', 'danger');
end;
end
);
end;
procedure TFViewUserProfile.WebFormShow(Sender: TObject);
begin
GetUser();
//edtJwt.Text := TJSJSON.stringify(AuthService.TokenPayload);
// View.UserProfile.WebFormShow
chkAdminUser.Checked := SameText(string(AuthService.TokenPayload.Properties['user_admin']), 'true');
end;
procedure TFViewUserProfile.GetUser;
var
xdcResponse: TXDataClientResponse;
......
......@@ -43,22 +43,5 @@
</div>
</div>
</div>
<!--</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">
Are you sure you want to make these changes?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="btn_confirm_delete" >Confirm</button>
</div>
</div>
</div>
</div>
......@@ -87,6 +87,7 @@ uses
System.Generics.Collections,
XData.Sys.Exceptions, uLibrary, rOrderWeb, rOrderCutting;
procedure TLookupService.AfterConstruction;
begin
inherited;
......@@ -94,12 +95,14 @@ begin
end;
procedure TLookupService.BeforeDestruction;
begin
ordersDB.Free;
inherited;
end;
function TLookupService.DelShippingAddress(AddressID, CustomerID: string): TJSONObject;
var
SQL: string;
......@@ -300,7 +303,6 @@ begin
end;
function TLookupService.AddShippingAddress(AddressInfo: string): TJSONObject;
var
JSONData: TJSONObject;
......
......@@ -2,7 +2,7 @@
MemoLogLevel=3
FileLogLevel=5
webClientVersion=0.9.6
LogFileNum=783
LogFileNum=787
[Database]
--Server=192.168.159.153
......@@ -18,5 +18,5 @@ CompanyID=9341454272655710
ClientID=ABgO14uvjh8XqLud7spQ8lkb98AUpcdA7HbyMJfCAtl65sQ5yy
ClientSecret=bQ06TRemHeAGFzVHRaTUvUoBU9jpU9itK6MOMgqN
RefreshToken=RT1-55-H0-1760199851kjdi3btbxslf7tq8m7cl
AccessToken=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwieC5vcmciOiJIMCJ9..O3e979eZoknEyMWs1-5Q5w.-z37ae8MYhIzRcekkINv43asF8sdeAzWmwRNHjt5btSaQGgK9yIK-ClhdmUaDUBuUyHYVu-rJyqTZ_2BjZUQZEDHNxC43iTtZGPNawcjJMEmVR6PdftSizoqz_ITuTVeyBCa0eKNFOcodeROFXVN0gW2Iu8fWiRbAk08vwGfuHoWR5B6v4Wipmc3EzVVFYHfzgifsomn3EwavpK33n6g4TrZ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G4ro5SAALoTihuBewH57fKFGAkZK6XYOjm21al-Me2zf_PWQkO_S59XFQsgbbmB9l4j5qdr4xhdBnYin3O7T9hYo9UdP-qjIULEG0sQ-UIFoxFA5k3FQWEYTBZ337yJ3Qq7GATokzot6G.9FP-Ggly-5gd7suf8iM00w
LastRefresh=7/3/2025 9:23:39 AM
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