Commit facf79ff by Mac Stephens

Quick update to fix button colors on view.items and add hover and highlight to the items table

parent 84caa500
...@@ -48,7 +48,6 @@ object FViewItems: TFViewItems ...@@ -48,7 +48,6 @@ object FViewItems: TFViewItems
Height = 25 Height = 25
Caption = 'Add' Caption = 'Add'
ChildOrder = 7 ChildOrder = 7
ElementClassName = 'btn btn-light'
ElementID = 'btnadd' ElementID = 'btnadd'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
...@@ -110,6 +109,7 @@ object FViewItems: TFViewItems ...@@ -110,6 +109,7 @@ object FViewItems: TFViewItems
ElementPosition = epRelative ElementPosition = epRelative
Role = 'null' Role = 'null'
TabOrder = 5 TabOrder = 5
Visible = False
object lblMessage: TWebLabel object lblMessage: TWebLabel
Left = 28 Left = 28
Top = 9 Top = 9
...@@ -148,7 +148,6 @@ object FViewItems: TFViewItems ...@@ -148,7 +148,6 @@ object FViewItems: TFViewItems
Height = 25 Height = 25
Caption = 'Save' Caption = 'Save'
ChildOrder = 79 ChildOrder = 79
ElementClassName = 'btn btn-light'
ElementID = 'btnconfirm' ElementID = 'btnconfirm'
ElementFont = efCSS ElementFont = efCSS
ElementPosition = epRelative ElementPosition = epRelative
...@@ -160,12 +159,11 @@ object FViewItems: TFViewItems ...@@ -160,12 +159,11 @@ object FViewItems: TFViewItems
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 565 Left = 565
Top = 259 Top = 256
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
ChildOrder = 79 ChildOrder = 79
ElementClassName = 'btn btn-light'
ElementID = 'btncancel' ElementID = 'btncancel'
ElementFont = efCSS ElementFont = efCSS
ElementPosition = epRelative ElementPosition = epRelative
...@@ -182,7 +180,6 @@ object FViewItems: TFViewItems ...@@ -182,7 +180,6 @@ object FViewItems: TFViewItems
Height = 25 Height = 25
Caption = 'Delete' Caption = 'Delete'
ChildOrder = 79 ChildOrder = 79
ElementClassName = 'btn btn-light'
ElementID = 'btndelete' ElementID = 'btndelete'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
...@@ -197,7 +194,6 @@ object FViewItems: TFViewItems ...@@ -197,7 +194,6 @@ object FViewItems: TFViewItems
Height = 25 Height = 25
Caption = 'Edit' Caption = 'Edit'
ChildOrder = 83 ChildOrder = 83
ElementClassName = 'btn btn-light'
ElementID = 'btnedit' ElementID = 'btnedit'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</div> </div>
</form> </form>
<table class="table table-responsive table-striped table-bordered" id="tblPhoneGrid"> <table class="table table-responsive table-striped table-hover table-bordered" id="tblPhoneGrid">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th scope="col">ID</th> <th scope="col">ID</th>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// to sort the entries, filter their search, and search for a specific person. // to sort the entries, filter their search, and search for a specific person.
// Authors: // Authors:
// Cameron Hayes // Cameron Hayes
// Mac ... // Mac Stephens
unit View.Items; unit View.Items;
...@@ -115,46 +115,74 @@ begin ...@@ -115,46 +115,74 @@ begin
cbStatus.enabled := true; cbStatus.enabled := true;
end; end;
procedure TFViewItems.AddRowToTable(ID, Name, Description, Status: string); procedure TFViewItems.AddRowToTable(ID, Name, Description, Status: string);
// Adds rows to the table // Adds one row to #tblPhoneGrid and lets Bootstrap 5.3 highlight the row
// ID: item ID // with its built-in `table-active` class when the user clicks it.
// Name: item name
// Description: item description
// Status: inactive or active
var var
NewRow, Cell, P, Button, Audio: TJSHTMLElement; NewRow, Cell: TJSHTMLElement;
begin begin
NewRow := TJSHTMLElement(document.createElement('tr')); NewRow := TJSHTMLElement(document.createElement('tr'));
// Item ID Cell // Row-select click handler
NewRow.addEventListener('click',
procedure(Event: TJSMouseEvent)
var
TBody : TJSHTMLElement;
Rows : TJSHTMLCollection;
I : Integer;
RowElem : TJSHTMLElement;
begin
// Grab the <tbody> once and cast it
TBody := TJSHTMLElement(
(document.getElementById('tblPhoneGrid') as TJSHTMLElement)
.getElementsByTagName('tbody')[0]
);
// Remove 'table-active' from every existing row
Rows := TBody.children;
for I := 0 to Rows.length - 1 do
begin
RowElem := TJSHTMLElement(Rows.item(I)); // ? cast Node ? HTMLElement
RowElem.classList.remove('table-primary');
end;
// Add highlight to the clicked row
TJSHTMLElement(Event.currentTarget).classList.add('table-primary');
end
);
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Item ID'); Cell.setAttribute('data-label', 'Item ID');
Cell.innerText := ID; Cell.innerText := ID;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Name Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Name'); Cell.setAttribute('data-label', 'Name');
Cell.innerText := Name; Cell.innerText := Name;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Description Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Description'); Cell.setAttribute('data-label', 'Description');
Cell.innerText := Description; Cell.innerText := Description;
NewRow.appendChild(Cell); NewRow.appendChild(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;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Appends new rows to the table body TJSHTMLElement(
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow); (document.getElementById('tblPhoneGrid') as TJSHTMLElement)
.getElementsByTagName('tbody')[0]
).appendChild(NewRow);
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
end; end;
procedure TFViewItems.GeneratePagination(TotalPages: Integer); procedure TFViewItems.GeneratePagination(TotalPages: Integer);
// Generates pagination for the table. // Generates pagination for the table.
// TotalPages: Total amount of pages generated by the search // TotalPages: Total amount of pages generated by the search
......
...@@ -208,7 +208,6 @@ ...@@ -208,7 +208,6 @@
<DCCReference Include="Utils.pas"/> <DCCReference Include="Utils.pas"/>
<DCCReference Include="View.AddItem.pas"> <DCCReference Include="View.AddItem.pas">
<Form>fViewAddItem</Form> <Form>fViewAddItem</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<None Include="index.html"/> <None Include="index.html"/>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
MemoLogLevel=3 MemoLogLevel=3
FileLogLevel=5 FileLogLevel=5
webClientVersion=0.9.4 webClientVersion=0.9.4
LogFileNum=719 LogFileNum=721
[Database] [Database]
--Server=192.168.159.131 --Server=192.168.159.131
......
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