Skip to content

Commit

Permalink
feat: search by member email in member register and directory
Browse files Browse the repository at this point in the history
  • Loading branch information
azend committed Sep 20, 2024
1 parent 45e43f2 commit d4dc8ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
14 changes: 13 additions & 1 deletion resources/views/members/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<table class="table table-striped" id="data-table">
<thead><tr>
<th>Name</th>
<th>Email</th>
<th>Joined</th>
<th>Status</th>
<th>Team(s)</th>
Expand All @@ -25,6 +26,7 @@
@foreach($users as $user)
<tr>
<td>{{ $user->get_name() }}</td>
<td>{{ $user->email }}</td>
<td nowrap>@isset($user->date_admitted) {{ $user->date_admitted->toDateString() }} @endisset</td>
<td>@include('users.status')
@php ($roles = $user->roles()->get())
Expand Down Expand Up @@ -73,8 +75,18 @@
iDisplayLength: {{ config('kwartzlabos.results_per_page.default') }},
"language": {
"emptyTable": "No results???"
}
},
// Enable member search by email without displaying the email address.
columnDefs: [{
targets: 1, // Email column
visible: false
}]
});
// Hiding a column with data tables gives the table a goofy behaviour where the table itself shrinks in width.
// This is a known issue where the "fix" is to reset the table back to full width once the column has been
// hidden.
$('#data-table').width('100%');
});
</script>
@stop
9 changes: 5 additions & 4 deletions resources/views/users/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<thead><tr>
<th scope="col">First Name</th>
<th scope="col">Last Name</th>
<th scope="col">Email</th>
<th scope="col">Status / Role</th>
<th scope="col">Team(s)</th>
<th scope="col"># Keys</th>
Expand All @@ -35,6 +36,7 @@
<tr>
<td>{{ $user->get_name('first') }}</td>
<td>{{ $user->get_name('last') }}</td>
<td>{{ $user->email }}</td>
<td>@include('users.status')
@foreach($user->roles()->get() as $role)
@if($role->id>1)
Expand Down Expand Up @@ -73,15 +75,14 @@
@section('js')
<script>
$(document).ready(function () {
$('#data-table').dataTable({
$('#data-table').dataTable({
ordering: false,
pagingType: "simple_numbers",
iDisplayLength: {{ config('kwartzlabos.results_per_page.default') }},
"language": {
"emptyTable": "No results."
"emptyTable": "No results."
}
});
});
});
function modal_do_stuff_success(data) {
Expand Down

0 comments on commit d4dc8ea

Please sign in to comment.