Skip to content

Commit 893e688

Browse files
committed
Member ajax blade
1 parent d4037d7 commit 893e688

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
@foreach($users as $user)
2+
<tr class="select member" id="{{ $user->id }}" >
3+
<td><img src="{{ $user->photo }}" width="32" height="32" class="rounded-circle my-n1" alt="[Photo]" onerror="this.onerror=null; this.src='/logo/KChat.svg';"></td>
4+
<td>{{ $user->first_name }} {{ $user->last_name }}</td>
5+
<td>{{ $user->department }}</td>
6+
<td>{{ $user->email }}</td>
7+
<td><span class="badge bg-{{ $user->status }}">{{ $user->status }}</span></td>
8+
</tr>
9+
@endforeach
10+
<script>
11+
12+
json = @json($jsonusers);
13+
14+
$('.select').on('click', function() {
15+
//$(document).on('click', '.select', function() {
16+
17+
id = localStorage.getItem('selected').split(",");
18+
19+
id.sort();
20+
21+
id = $.unique(id);
22+
23+
id = $.grep(id, function(value) {
24+
return $.trim(value).length > 0;
25+
});
26+
27+
if (control) {
28+
if($(this).hasClass( "selected" )){
29+
$(this).removeClass("selected");
30+
unset(id,$(this).prop('id'));
31+
}else{
32+
$(this).addClass("selected");
33+
id.push($(this).prop('id'));
34+
}
35+
} else {
36+
// ?
37+
}
38+
id.sort();
39+
id = $.unique(id);
40+
localStorage.setItem('selected', id.join(","));
41+
setSelectedCount();
42+
43+
});
44+
45+
//Select all ids selected by user using cookie
46+
$('.select[id]').each(function() {
47+
selected = localStorage.getItem('selected').split(",");
48+
selected = $.grep(selected, function(value) {
49+
return $.trim(value).length > 0;
50+
});
51+
if ($.inArray($(this).attr('id'), selected) !== -1) {
52+
$(this).addClass("selected");
53+
}
54+
55+
});
56+
57+
</script>

0 commit comments

Comments
 (0)