Commit 1eb5d96c by cam

EditUsers now autofills the users

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