Skip to content

Commit d8753a7

Browse files
committed
Use Ajax for activity report
1 parent 90af734 commit d8753a7

File tree

1 file changed

+32
-62
lines changed

1 file changed

+32
-62
lines changed

resources/views/reports/activity.blade.php

Lines changed: 32 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -17,67 +17,28 @@
1717
<div class="box box-default">
1818
<div class="box-body">
1919

20-
<div class="table-responsive">
21-
<table
22-
name="activityReport"
23-
id="table"
24-
class="table table-striped"
25-
data-cookie="true"
26-
data-click-to-select="true"
27-
data-cookie-id-table="activityReportTable">
28-
20+
<table
21+
name="activityReport"
22+
data-toolbar="#toolbar"
23+
class="table table-striped"
24+
id="table"
25+
data-url="{{ route('api.activity.list') }}"
26+
data-cookie="true"
27+
data-cookie-id-table="activityReportTable">
2928
<thead>
30-
<tr role="row">
31-
<th class="col-sm-1">{{ trans('general.admin') }}</th>
32-
<th class="col-sm-1"><span class="line"></span>{{ trans('general.action') }}</th>
33-
<th class="col-sm-1"><span class="line"></span>{{ trans('general.type') }}</th>
34-
<th class="col-sm-1"><span class="line"></span>{{ trans('general.item') }}</th>
35-
<th class="col-sm-1"><span class="line"></span>{{ trans('general.user') }}</th>
36-
<th class="col-sm-1"><span class="line"></span>{{ trans('general.date') }}</th
37-
</tr>
38-
</thead>
39-
<tbody>
40-
41-
@foreach ($log_actions as $log_action)
4229
<tr>
43-
<td>
44-
@if($log_action->user)
45-
<a href="../admin/users/{{ $log_action->user->id }}/view">{{ $log_action->user->fullName() }}</a>
46-
@endif
47-
</td>
48-
<td>{{ $log_action->action_type }}</td>
49-
<td>
50-
{{ title_case($log_action->itemType()) }}
51-
</td>
52-
53-
<td>
54-
55-
@if ($item = $log_action->item)
56-
@if ($log_action->itemType()=="asset")
57-
{{ $item->showAssetName() }}
58-
@else
59-
{{ $item->name }}
60-
@endif
61-
@else
62-
{{ trans('general.bad_data') }}
63-
@endif
64-
</td>
65-
<td>
66-
@if ($log_action->target)
67-
@if ($log_action->target instanceof \App\Models\User)
68-
<a href="../admin/users/{{ $log_action->target->id }}/view">{{ $log_action->target->fullName() }}</a>
69-
@elseif ($log_action->target instanceof \App\Models\Asset)
70-
<a href="../hardware/{{ $log_action->target->id }}/view">{{ $log_action->target->showAssetName() }}</a>
71-
@endif
72-
73-
@endif
74-
</td>
75-
76-
<td>{{ $log_action->created_at }}</td>
30+
<th class="col-sm-1" data-field="admin">{{ trans('general.admin') }}</th>
31+
<th class="col-sm-1" data-field="action_type">{{ trans('general.action') }}</th>
32+
<th class="col-sm-1" data-field="item_type">{{ trans('general.type') }}</th>
33+
<th class="col-sm-1" data-field="item">{{ trans('general.item') }}</th>
34+
<th class="col-sm-1" data-field="target">To</th>
35+
<th class="col-sm-1" data-field="created_at">{{ trans('general.date') }}</th>
36+
<th class="col-sm-1" data-field="note">{{ trans('general.notes') }}</th>
7737
</tr>
78-
@endforeach
79-
</tbody>
80-
</table>
38+
</thead>
39+
40+
</table>
41+
8142

8243
</div>
8344
</div>
@@ -99,30 +60,39 @@ classes: 'table table-responsive table-no-bordered',
9960
iconsPrefix: 'fa',
10061
showRefresh: true,
10162
search: true,
102-
pageSize: {{ \App\Models\Setting::getSettings()->per_page }},
63+
pageSize: 100,
10364
pagination: true,
104-
sidePagination: 'client',
65+
sidePagination: 'server',
10566
sortable: true,
67+
showMultiSort: true,
10668
cookie: true,
69+
cookieExpire: '2y',
10770
mobileResponsive: true,
10871
showExport: true,
10972
showColumns: true,
11073
exportDataType: 'all',
111-
exportTypes: ['csv', 'txt','json', 'xml'],
74+
exportTypes: ['csv', 'excel', 'txt','json', 'xml'],
11275
maintainSelected: true,
11376
paginationFirstText: "{{ trans('general.first') }}",
11477
paginationLastText: "{{ trans('general.last') }}",
11578
paginationPreText: "{{ trans('general.previous') }}",
11679
paginationNextText: "{{ trans('general.next') }}",
117-
pageList: ['10','25','50','100','150','200'],
80+
pageList: ['10','25','50','100','150','200','500','1000'],
81+
exportOptions: {
82+
fileName: 'assets-export-' + (new Date()).toISOString().slice(0,10),
83+
},
11884
icons: {
11985
paginationSwitchDown: 'fa-caret-square-o-down',
12086
paginationSwitchUp: 'fa-caret-square-o-up',
87+
sort: 'fa fa-sort-amount-desc',
88+
plus: 'fa fa-plus',
89+
minus: 'fa fa-minus',
12190
columns: 'fa-columns',
12291
refresh: 'fa-refresh'
12392
},
12493
12594
});
95+
12696
</script>
12797
@stop
12898

0 commit comments

Comments
 (0)