Commit 1eb5d96c by cam

EditUsers now autofills the users

parent 7a63b7a9
...@@ -2,17 +2,6 @@ object FViewEditUser: TFViewEditUser ...@@ -2,17 +2,6 @@ object FViewEditUser: TFViewEditUser
Width = 640 Width = 640
Height = 480 Height = 480
OnShow = WebFormCreate OnShow = WebFormCreate
object WebLabel1: TWebLabel
Left = 8
Top = 125
Width = 73
Height = 15
Caption = 'Make Admin?'
Color = clBtnFace
ElementID = 'lblAdmin'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 16 Left = 16
Top = 8 Top = 8
...@@ -35,19 +24,19 @@ object FViewEditUser: TFViewEditUser ...@@ -35,19 +24,19 @@ object FViewEditUser: TFViewEditUser
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel4: TWebLabel object lblQB: TWebLabel
Left = 6 Left = 256
Top = 62 Top = 65
Width = 84 Width = 80
Height = 15 Height = 15
Caption = 'Phone Number:' Caption = 'Quickbooks ID:'
Color = clBtnFace Color = clBtnFace
ElementID = 'lblphone' ElementID = 'lblQB'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel5: TWebLabel object WebLabel5: TWebLabel
Left = 256 Left = 284
Top = 8 Top = 8
Width = 56 Width = 56
Height = 15 Height = 15
...@@ -69,8 +58,8 @@ object FViewEditUser: TFViewEditUser ...@@ -69,8 +58,8 @@ object FViewEditUser: TFViewEditUser
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel7: TWebLabel object WebLabel7: TWebLabel
Left = 252 Left = 35
Top = 69 Top = 62
Width = 32 Width = 32
Height = 15 Height = 15
Caption = 'Email:' Caption = 'Email:'
...@@ -80,8 +69,8 @@ object FViewEditUser: TFViewEditUser ...@@ -80,8 +69,8 @@ object FViewEditUser: TFViewEditUser
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblactive: TWebLabel object lblactive: TWebLabel
Left = 291 Left = 45
Top = 125 Top = 163
Width = 38 Width = 38
Height = 15 Height = 15
Caption = 'Active?' Caption = 'Active?'
...@@ -90,23 +79,33 @@ object FViewEditUser: TFViewEditUser ...@@ -90,23 +79,33 @@ object FViewEditUser: TFViewEditUser
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblLocation: TWebLabel object lblRights: TWebLabel
Left = 3 Left = 3
Top = 96 Top = 96
Width = 87 Width = 74
Height = 15 Height = 15
Caption = 'Default Location' Caption = 'System Rights'
ElementID = 'lbllocation' ElementID = 'lblrights'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtPhoneNumber: TWebEdit object lblAccess: TWebLabel
Left = 96 Left = 272
Top = 62 Top = 96
Width = 121 Width = 66
Height = 22 Height = 15
ChildOrder = 7 Caption = 'Access Type:'
ElementID = 'edtphonenumber' ElementID = 'lblaccess'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object lblPerspective: TWebLabel
Left = 3
Top = 132
Width = 77
Height = 15
Caption = 'Perspective ID:'
ElementID = 'lblperspective'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
...@@ -121,7 +120,7 @@ object FViewEditUser: TFViewEditUser ...@@ -121,7 +120,7 @@ object FViewEditUser: TFViewEditUser
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtEmail: TWebEdit object edtEmail: TWebEdit
Left = 348 Left = 96
Top = 62 Top = 62
Width = 121 Width = 121
Height = 22 Height = 22
...@@ -140,26 +139,9 @@ object FViewEditUser: TFViewEditUser ...@@ -140,26 +139,9 @@ object FViewEditUser: TFViewEditUser
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbAdmin: TWebCheckBox
Left = 96
Top = 124
Width = 107
Height = 20
Caption = 'Make Admin?'
ChildOrder = 12
ElementID = 'cbadminuser'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object btnConfirm: TWebButton object btnConfirm: TWebButton
Left = 96 Left = 96
Top = 170 Top = 200
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Confirm'
...@@ -197,8 +179,8 @@ object FViewEditUser: TFViewEditUser ...@@ -197,8 +179,8 @@ object FViewEditUser: TFViewEditUser
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 237 Left = 221
Top = 170 Top = 200
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
...@@ -234,7 +216,7 @@ object FViewEditUser: TFViewEditUser ...@@ -234,7 +216,7 @@ object FViewEditUser: TFViewEditUser
Height = 33 Height = 33
ElementID = 'view.login.message' ElementID = 'view.login.message'
ChildOrder = 17 ChildOrder = 17
TabOrder = 10 TabOrder = 8
object lblMessage: TWebLabel object lblMessage: TWebLabel
Left = 16 Left = 16
Top = 11 Top = 11
...@@ -257,14 +239,14 @@ object FViewEditUser: TFViewEditUser ...@@ -257,14 +239,14 @@ object FViewEditUser: TFViewEditUser
OnClick = btnCloseNotificationClick OnClick = btnCloseNotificationClick
end end
end end
object cbActive: TWebCheckBox object cbStatus: TWebCheckBox
Left = 346 Left = 96
Top = 124 Top = 162
Width = 107 Width = 107
Height = 20 Height = 20
Caption = 'Active?' Caption = 'Active?'
ChildOrder = 12 ChildOrder = 12
ElementID = 'cbactive' ElementID = 'cbstatus'
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
Font.Height = -11 Font.Height = -11
...@@ -274,47 +256,63 @@ object FViewEditUser: TFViewEditUser ...@@ -274,47 +256,63 @@ object FViewEditUser: TFViewEditUser
ParentFont = False ParentFont = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object wcbLocation: TWebLookupComboBox object edtQB: TWebEdit
Left = 96 Left = 348
Top = 96 Top = 62
Width = 145 Width = 121
Height = 22 Height = 22
ElementID = 'wcblocation' ChildOrder = 7
ElementFont = efCSS ElementID = 'edtQB'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1
LookupValues = <
item
DisplayText = 'All'
end end
item object edtRights: TWebEdit
Value = '(716) 681-8820' Left = 96
DisplayText = 'Galleria' Top = 93
end Width = 121
item Height = 22
Value = '(716) 297-4654' ChildOrder = 19
DisplayText = 'NF Outlet' ElementID = 'edtrights'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end end
item object cbAccess: TWebComboBox
Value = '(585) 445-8911' Left = 352
DisplayText = 'Rochester' Top = 90
Width = 145
Height = 23
ElementID = 'cbaccess'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
'PLATE'
'MOUNT'
'SHIP'
'ART'
'ALL'
'ACTIVE')
end end
item object edtPerspective: TWebEdit
Value = '(315) 565-4138' Left = 96
DisplayText = 'Syracuse' Top = 129
end> Width = 121
Height = 22
ChildOrder = 23
ElementID = 'edtperspective'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 462 Left = 556
Top = 164 Top = 416
end end
object WebTimer1: TWebTimer object WebTimer1: TWebTimer
Enabled = False Enabled = False
Interval = 500 Interval = 500
OnTimer = WebTimer1Timer OnTimer = WebTimer1Timer
Left = 236 Left = 430
Top = 194 Top = 382
end end
end end
...@@ -39,30 +39,37 @@ ...@@ -39,30 +39,37 @@
<form class="form-inline"> <form class="form-inline">
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
<label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblphone">Phone Number:</label> <label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblemail">Email Address:</label>
<input id="edtphonenumber" class= "form-control input-sm" width='50%'/> <input id="edtemail" class= "form-control input-sm" width='50%'/>
</div> </div>
<div class="col-sm"> <div class="col-sm">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lblemail">Email Address:</label> <label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lblQB">Quickbook ID:</label>
<input class="form-control input-sm" id="edtemail"> <input class="form-control input-sm" id="edtQB">
</div> </div>
</div> </div>
</form> </form>
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lbllocation">Location:</label> <label class='pe-2' style="font-weight: 700;font-size: 15px;" id="lblrights">System Rights:</label>
<select class="custom-select-large" id="wcblocation" style="font-size: 1.00rem;"></select> <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">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lblaccess">Access Type:</label>
<select class="custom-select-large" id="cbaccess" style="font-size: 1.00rem;"></select>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm"> <div class="col-sm">
<form class='form-inline'> <form class='form-inline'>
<div class="col-sm"> <div class="col-sm">
<div class="form-cells"><input type="checkbox" id="cbadminuser"></div> <div class="form-cells"><input type="checkbox" id="cbstatus"></div>
<div class="form-cells ps-1 py-2"><label style="font-weight: 700;font-size: 15px" id="lblAdmin">Make Admin?</label></div>
</div>
<div class="col-sm">
<div class="form-cells"><input type="checkbox" id="cbactive"></div>
<div class="form-cells ps-1 py-2"><label style="font-weight: 700;font-size: 15px" id="lblactive">Active></label></div> <div class="form-cells ps-1 py-2"><label style="font-weight: 700;font-size: 15px" id="lblactive">Active></label></div>
</div> </div>
</form> </form>
......
...@@ -12,18 +12,15 @@ uses ...@@ -12,18 +12,15 @@ uses
type type
TFViewEditUser = class(TWebForm) TFViewEditUser = class(TWebForm)
WebLabel1: TWebLabel;
WebLabel2: TWebLabel; WebLabel2: TWebLabel;
WebLabel3: TWebLabel; WebLabel3: TWebLabel;
WebLabel4: TWebLabel; lblQB: TWebLabel;
WebLabel5: TWebLabel; WebLabel5: TWebLabel;
WebLabel6: TWebLabel; WebLabel6: TWebLabel;
WebLabel7: TWebLabel; WebLabel7: TWebLabel;
edtPhoneNumber: TWebEdit;
edtConfirmPassword: TWebEdit; edtConfirmPassword: TWebEdit;
edtEmail: TWebEdit; edtEmail: TWebEdit;
edtPassword: TWebEdit; edtPassword: TWebEdit;
cbAdmin: TWebCheckBox;
btnConfirm: TWebButton; btnConfirm: TWebButton;
edtFullname: TWebEdit; edtFullname: TWebEdit;
edtUsername: TWebEdit; edtUsername: TWebEdit;
...@@ -35,9 +32,14 @@ type ...@@ -35,9 +32,14 @@ type
lblMessage: TWebLabel; lblMessage: TWebLabel;
btnCloseNotification: TWebButton; btnCloseNotification: TWebButton;
lblactive: TWebLabel; lblactive: TWebLabel;
cbActive: TWebCheckBox; cbStatus: TWebCheckBox;
lblLocation: TWebLabel; lblRights: TWebLabel;
wcbLocation: TWebLookupComboBox; edtQB: TWebEdit;
edtRights: TWebEdit;
lblAccess: TWebLabel;
cbAccess: TWebComboBox;
lblPerspective: TWebLabel;
edtPerspective: TWebEdit;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
...@@ -49,12 +51,14 @@ type ...@@ -49,12 +51,14 @@ type
FMessage: string; FMessage: string;
Mode: string; Mode: string;
Username: string; Username: string;
Password: string;
FullName: string; FullName: string;
Phone: string; Status: string;
Email: string; Email: string;
Location: string; Access: string;
Admin: boolean; Rights: string;
Active: boolean; Perspective: string;
QB: string;
[async] procedure EditUser(); [async] procedure EditUser();
[async] function AddUser(): string; [async] function AddUser(): string;
procedure HideNotification(); procedure HideNotification();
...@@ -62,7 +66,8 @@ type ...@@ -62,7 +66,8 @@ type
public public
{ Public declarations } { Public declarations }
Info: string; Info: string;
class function CreateForm(AElementID, Mode, Username, FullName, Phone, Email, Location: string; Admin, Active: boolean): TWebForm; class function CreateForm(AElementID, Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string): TWebForm;
end; end;
var var
...@@ -111,10 +116,10 @@ begin ...@@ -111,10 +116,10 @@ begin
userInfo := '&username=' + string(edtUsername.Text).ToLower + userInfo := '&username=' + string(edtUsername.Text).ToLower +
'&password=' + edtPassword.Text + '&password=' + edtPassword.Text +
'&fullname=' + edtFullName.Text + '&fullname=' + edtFullName.Text +
'&phonenumber=' + edtPhoneNumber.Text + //'&phonenumber=' + edtPhoneNumber.Text +
'&email=' + edtEmail.Text + '&email=' + edtEmail.Text;
'&admin=' + BoolToStr(cbAdmin.Checked) + //'&admin=' + BoolToStr(cbAdmin.Checked) +
'&location=' + wcbLocation.Value; //'&location=' + wcbLocation.Value;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser',
[userInfo])); [userInfo]));
...@@ -146,13 +151,14 @@ begin ...@@ -146,13 +151,14 @@ begin
editOptions := 'username=' + Username + editOptions := 'username=' + Username +
'&fullname=' + edtFullName.Text + '&fullname=' + edtFullName.Text +
'&phonenumber=' + edtPhoneNumber.Text + '&password=' + edtPassword.Text +
'&status=' + BoolToStr(cbStatus.Checked) +
'&email=' + edtEmail.Text + '&email=' + edtEmail.Text +
'&admin=' + BoolToStr(cbAdmin.Checked) + '&access=' + cbAccess.Text +
'&newuser=' + edtUsername.Text + '&newuser=' + edtUsername.Text +
'&password=' + edtPassword.Text + '&rights=' + edtRights.Text +
'&active=' + BoolToStr(cbActive.Checked) + '&Perspective=' + '' +
'&location=' + wcbLocation.DisplayText; '&QB=' + edtQB.Text;
console.log(editOptions); console.log(editOptions);
...@@ -163,18 +169,20 @@ begin ...@@ -163,18 +169,20 @@ begin
end; end;
class function TFViewEditUser.CreateForm(AElementID, Mode, Username, FullName, Phone, Email, Location: string; Admin, Active: boolean): TWebForm; class function TFViewEditUser.CreateForm(AElementID, Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string): TWebForm;
// Autofills known information about a user on create // Autofills known information about a user on create
procedure AfterCreate(AForm: TObject); procedure AfterCreate(AForm: TObject);
begin begin
TFViewEditUser(AForm).Mode := Mode; TFViewEditUser(AForm).Mode := Mode;
TFViewEditUser(AForm).Username := Username; TFViewEditUser(AForm).Username := Username;
TFViewEditUser(AForm).FullName := FullName; TFViewEditUser(AForm).FullName := Name;
TFViewEditUser(AForm).Phone := Phone; TFViewEditUser(AForm).Status := Status;
TFViewEditUser(AForm).Email:= Email; TFViewEditUser(AForm).Email := Email;
TFViewEditUser(AForm).Location:= Location; TFViewEditUser(AForm).Access := Access;
TFViewEditUser(AForm).Admin := Admin; TFViewEditUser(AForm).Rights := Rights;
TFViewEditUser(AForm).Active := Active; TFViewEditUser(AForm).Perspective := Perspective;
TFViewEditUser(AForm).QB := QB;
end; end;
{$R *.dfm} {$R *.dfm}
...@@ -197,14 +205,14 @@ begin ...@@ -197,14 +205,14 @@ begin
begin begin
edtPassword.Text := 'hidden'; edtPassword.Text := 'hidden';
edtConfirmPassword.Text := 'hidden'; edtConfirmPassword.Text := 'hidden';
end end;
else
cbAdmin.Enabled := False;
wcbLocation.DisplayText := Location;
edtPhoneNumber.Text := Phone;
edtEmail.Text := Email; edtEmail.Text := Email;
cbAdmin.checked := Admin; cbAccess.Text := Access;
cbActive.Checked := Active; edtRights.Text := Rights;
edtQB.Text := QB;
if Status = 'ACTIVE' then
cbStatus.checked := true;
edtPerspective.Text := Perspective
end; end;
procedure TFViewEditUser.WebTimer1Timer(Sender: TObject); procedure TFViewEditUser.WebTimer1Timer(Sender: TObject);
...@@ -229,7 +237,7 @@ var ...@@ -229,7 +237,7 @@ var
charIndex: integer; charIndex: integer;
phoneNum: string; phoneNum: string;
begin begin
checkString := edtFullName.Text + edtUsername.Text + edtPassword.Text { checkString := edtFullName.Text + edtUsername.Text + edtPassword.Text
+ edtConfirmPassword.Text + edtPhoneNumber.Text + edtEmail.Text; + edtConfirmPassword.Text + edtPhoneNumber.Text + edtEmail.Text;
if string(edtFullName.Text).IsEmpty then if string(edtFullName.Text).IsEmpty then
begin begin
...@@ -334,9 +342,9 @@ begin ...@@ -334,9 +342,9 @@ begin
asm asm
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), { var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), {
keyboard: false }); keyboard: false }{);
confirmationModal.show(); confirmationModal.show();
end; end; }
end; end;
end. end.
...@@ -84,8 +84,8 @@ object FViewMain: TFViewMain ...@@ -84,8 +84,8 @@ object FViewMain: TFViewMain
Caption = 'Users' Caption = 'Users'
end end
object WebPanel1: TWebPanel object WebPanel1: TWebPanel
Left = 136 Left = 77
Top = 110 Top = 112
Width = 471 Width = 471
Height = 369 Height = 369
ElementID = 'main.webpanel' ElementID = 'main.webpanel'
...@@ -102,8 +102,8 @@ object FViewMain: TFViewMain ...@@ -102,8 +102,8 @@ object FViewMain: TFViewMain
Opacity = 0.200000000000000000 Opacity = 0.200000000000000000
end end
object WebMemo1: TWebMemo object WebMemo1: TWebMemo
Left = 136 Left = 77
Top = 467 Top = 479
Width = 471 Width = 471
Height = 83 Height = 83
ElementID = 'main.debugmemo' ElementID = 'main.debugmemo'
......
...@@ -42,7 +42,8 @@ type ...@@ -42,7 +42,8 @@ type
{ Public declarations } { Public declarations }
class procedure Display(LogoutProc: TLogoutProc); class procedure Display(LogoutProc: TLogoutProc);
procedure ShowForm( AFormClass: TWebFormClass ); procedure ShowForm( AFormClass: TWebFormClass );
procedure EditUser( Mode, FullName, Username, Phone, Email, Location: string; admin, active: boolean); procedure EditUser( Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string);
procedure ShowUserForm(Info: string); procedure ShowUserForm(Info: string);
end; end;
...@@ -151,11 +152,13 @@ begin ...@@ -151,11 +152,13 @@ begin
Application.CreateForm(AFormClass, WebPanel1.ElementID, FChildForm); Application.CreateForm(AFormClass, WebPanel1.ElementID, FChildForm);
end; end;
procedure TFViewMain.EditUser( Mode, FullName, Username, Phone, Email, Location: string; Admin, Active: boolean); procedure TFViewMain.EditUser( Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string);
begin begin
if Assigned(FChildForm) then if Assigned(FChildForm) then
FChildForm.Free; FChildForm.Free;
FChildForm := TFViewEditUser.CreateForm(WebPanel1.ElementID, Mode, FullName, Username, Phone, Email, Location, Admin, Active); FChildForm := TFViewEditUser.CreateForm(WebPanel1.ElementID, Mode, Username,
Password, Name, Status, Email, Access, Rights, Perspective, QB);
end; end;
procedure TFViewMain.ShowUserForm(Info: string); procedure TFViewMain.ShowUserForm(Info: string);
......
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Users</h1> <h1 class="page-header pt-3" id="view.calls.title" style="font-size: 24px;">Users</h1>
<div class="container mt-4"> <div class="container mt-4 px-0">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
<div class="row"> <div class="row">
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="row justify-content-center py-2"> <div class="row justify-content-center py-2">
<div class="col-sm"> <div class="col-sm">
<button id="btnadduser" class="btn btn-primary">Add User></button> <button id="btnadduser" class="btn btn-primary">Add User></button>
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
<th scope="col">System Rights</th> <th scope="col">System Rights</th>
<th scope="col">Perspective ID</th> <th scope="col">Perspective ID</th>
<th scope="col">QB ID</th> <th scope="col">QB ID</th>
<th scope="col">Edit</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -47,7 +49,7 @@ ...@@ -47,7 +49,7 @@
</div> </div>
</div> </div>
</div> </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 fade" id="confirmation_modal" tabindex="-1" aria-labelledby="confirmation_modal_label" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
......
...@@ -121,12 +121,14 @@ var ...@@ -121,12 +121,14 @@ var
cells: TJSHTMLCollection; cells: TJSHTMLCollection;
UserID: TJSNode; UserID: TJSNode;
Username: TJSNode; Username: TJSNode;
Password: TJSNode;
FullName: TJSNode; FullName: TJSNode;
PhoneNum: TJSNode; Status: TJSNode;
Email: TJSNode; Email: TJSNode;
Admin: TJSNode; Access: TJSNode;
Password: TJSNode; Rights: TJSNode;
Location: TJSNode; Perspective: TJSNode;
QB: TJSNode;
isAdmin: boolean; isAdmin: boolean;
isActive: boolean; isActive: boolean;
ButtonCancel: TJSHTMLElement; ButtonCancel: TJSHTMLElement;
...@@ -143,18 +145,16 @@ begin ...@@ -143,18 +145,16 @@ begin
Username := cells[1]; Username := cells[1];
Password := cells[2]; Password := cells[2];
FullName := cells[3]; FullName := cells[3];
PhoneNum := cells[4]; Status := cells[4];
Email := cells[5]; Email := cells[5];
Location := cells[6]; Access := cells[6];
if TJSHTMLElement(cells[7].childNodes.item(0).childNodes.item(0)).attributes.Attrs['checked'] = nil then Rights := cells[7];
isAdmin := false Perspective := cells[8];
else QB := cells[9];
isAdmin := true;
if TJSHTMLElement(cells[8].childNodes.item(0).childNodes.item(0)).attributes.Attrs['checked'] = nil then FViewMain.EditUser('Edit', Username.innerText, Password.innerText, FullName.innerText,
isActive := false Status.innerText, Email.innerText, Access.innerText,
else Rights.innerText, Perspective.innerText, QB.innerText);
isActive := true;
FViewMain.EditUser('Edit', Username.innerText, FullName.innerText, PhoneNum.innerText, Email.innerText, Location.innerText, isAdmin, isActive);
end; end;
...@@ -346,10 +346,9 @@ begin ...@@ -346,10 +346,9 @@ begin
XDataWebDataSet1.Open; XDataWebDataSet1.Open;
for i := 0 to data.Length - 1 do for i := 0 to data.Length - 1 do
begin begin
console.log(user);
user := TJSObject(data[i]); user := TJSObject(data[i]);
AddRowToTable(XDataWebDataSet1userID.AsString, XDataWebDataSet1username.AsString, AddRowToTable(XDataWebDataSet1userID.AsString, XDataWebDataSet1username.AsString,
XDataWebDataSet1full_name.AsString, XDataWebDataSet1password.AsString, XDataWebDataSet1password.AsString, XDataWebDataSet1full_name.AsString,
XDataWebDataSet1status.AsString, XDataWebDataSet1email_address.AsString, XDataWebDataSet1status.AsString, XDataWebDataSet1email_address.AsString,
XDataWebDataSet1Atype.AsString, XDataWebDataSet1perspectiveID.AsString, XDataWebDataSet1Atype.AsString, XDataWebDataSet1perspectiveID.AsString,
XDataWebDataSet1QBID.AsString, XDataWebDataSet1rights.AsInteger); XDataWebDataSet1QBID.AsString, XDataWebDataSet1rights.AsInteger);
...@@ -409,7 +408,7 @@ begin ...@@ -409,7 +408,7 @@ begin
Cell.innerText := Full_Name; Cell.innerText := Full_Name;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Phone Cell // Status Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Status'); Cell.setAttribute('data-label', 'Status');
Cell.innerText := Status; Cell.innerText := Status;
...@@ -446,6 +445,19 @@ begin ...@@ -446,6 +445,19 @@ begin
Cell.innerText := QBID; Cell.innerText := QBID;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Edit Cell
Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Edit');
Button := TJSHTMLElement(document.createElement('a'));
Button.className := 'btn btn-primary';
Button.innerHTML := '<i class="far fa-edit fa-fw"></i><span>Edit</span>';
Button.addEventListener('click', procedure(Event: TJSMouseEvent)
begin
EditUser(TJSHTMLElement(NewRow));
end);
Cell.appendChild(Button);
NewRow.appendChild(Cell);
// Appends new rows to the table body // Appends new rows to the table body
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow); TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow);
end; end;
...@@ -453,7 +465,7 @@ end; ...@@ -453,7 +465,7 @@ end;
procedure TFViewUsers.btnAddUserClick(Sender: TObject); procedure TFViewUsers.btnAddUserClick(Sender: TObject);
begin begin
//Info := ''; //Info := '';
FViewMain.EditUser('Add', '', '', '', '', 'All', false, true); FViewMain.EditUser('Add', '', '', '', '', '', '', '', '', '');
end; end;
procedure TFViewUsers.btnCloseNotificationClick(Sender: TObject); procedure TFViewUsers.btnCloseNotificationClick(Sender: TObject);
......
[Options] [Options]
LogFileNum=16 LogFileNum=17
UpdateTimerLength=0 UpdateTimerLength=0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment