Skip to content

Commit 6dc143d

Browse files
committed
Use Ajax activity report for dashboard to prevent data duplication
1 parent d8753a7 commit 6dc143d

File tree

1 file changed

+29
-68
lines changed

1 file changed

+29
-68
lines changed

resources/views/dashboard.blade.php

Lines changed: 29 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -88,84 +88,29 @@
8888
<div class="box-header with-border">
8989
<h3 class="box-title">{{ trans('general.recent_activity') }}</h3>
9090
<div class="box-tools pull-right">
91-
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
91+
<a href="{{ route('reports/activity') }}"><i class="fa fa-ellipsis-h"></i></a>
9292
</div>
9393
</div><!-- /.box-header -->
9494
<div class="box-body">
9595
<div class="row">
9696
<div class="col-md-12">
9797
<div class="table-responsive">
98-
<table class="table table-hover table-fixed break-word">
98+
<table
99+
class="table table-striped"
100+
name="activityReport"
101+
id="table"
102+
data-url="{{route('api.activity.list', ['limit' => 20]) }}">
99103
<thead>
100104
<tr>
101-
<th></th>
102-
<th class="col-md-2"><span class="line"></span>{{ trans('general.date') }}</th>
103-
<th class="col-md-2"><span class="line"></span>{{ trans('general.admin') }}</th>
104-
<th class="col-md-2"><span class="line"></span>{{ trans('table.actions') }}</th>
105-
<th class="col-md-3"><span class="line"></span>{{ trans('table.item') }}</th>
106-
<th class="col-md-3"><span class="line"></span>To</th>
105+
<th data-field="icon" style="width: 40px;" class="hidden-xs"></th>
106+
<th class="col-sm-2" data-field="created_at">{{ trans('general.date') }}</th>
107+
<th class="col-sm-2" data-field="admin">{{ trans('general.admin') }}</th>
108+
<th class="col-sm-2" data-field="action_type">{{ trans('general.action') }}</th>
109+
<th class="col-sm-4" data-field="item">{{ trans('general.item') }}</th>
110+
<th class="col-sm-2" data-field="target">To</th>
107111
</tr>
108112
</thead>
109-
<tbody>
110-
@if (count($recent_activity) > 0)
111-
@foreach ($recent_activity as $activity)
112-
<tr>
113-
<td>
114-
@if ($activity->itemType()=="asset")
115-
<i class="fa fa-barcode"></i>
116-
@elseif ($activity->itemType()=="accessory")
117-
<i class="fa fa-keyboard-o"></i>
118-
@elseif ($activity->itemType()=="consumable")
119-
<i class="fa fa-tint"></i>
120-
@elseif ($activity->itemType()=="license")
121-
<i class="fa fa-floppy-o"></i>
122-
@elseif ($activity->itemType()=="component")
123-
<i class="fa fa-hdd-o"></i>
124-
@else
125-
<i class="fa fa-paperclip"></i>
126-
@endif
127-
</td>
128-
<td>{{ date("M d, Y g:iA", strtotime($activity->created_at)) }}</td>
129-
<td>
130-
@if (($activity->action_type!='requested') && ($activity->action_type!="request_canceled"))
131-
@if ($activity->user)
132-
<a href="{{ route('view/user', $activity->user_id) }}">{{ $activity->user->fullName() }}</a>
133-
@else
134-
Deleted Admin
135-
@endif
136-
@endif
137-
138-
</td>
139-
<td>
140-
{{ strtolower(trans('general.'.str_replace(' ','_',$activity->action_type))) }}
141-
</td>
142-
<td>
143-
@if (($activity->item) && ($activity->itemType()=="asset"))
144-
<a href="{{ route('view/hardware', $activity->item_id) }}">{{ $activity->item->asset_tag }} - {{ $activity->item->showAssetName() }}</a>
145-
@elseif ($activity->item)
146-
<a href="{{ route('view/'. $activity->itemType(), $activity->item_id) }}">{{ $activity->item->name }}</a>
147-
@endif
148-
149-
</td>
150-
151-
<td>
152-
@if (($activity->userasassetlog) && ($activity->action_type=="uploaded") && ($activity->itemType()=="user"))
153-
<a href="{{ route('view/user', $activity->target_id) }}">{{ $activity->userasassetlog->fullName() }}</a>
154-
@elseif (($activity->item) && ($activity->target instanceof \App\Models\Asset))
155-
<a href="{{ route('view/hardware', $activity->target_id) }}">{{ $activity->target->showAssetName() }}</a>
156-
@elseif (($activity->item) && ($activity->target instanceof \App\Models\User))
157-
<a href="{{route('view/user', $activity->target_id) }}"> {{ $activity->target->fullName() }}</a>
158-
@elseif ($activity->action_type=='requested') <!--The user is who requested the item, not the target-->
159-
<a href="{{ route('view/user', $activity->user_id) }}">{{ $activity->user->fullName() }}</a>
160-
@endif
161-
162-
</td>
163-
164113

165-
</tr>
166-
@endforeach
167-
@endif
168-
</tbody>
169114
</table>
170115
</div><!-- /.responsive -->
171116
</div><!-- /.col -->
@@ -229,8 +174,24 @@
229174
230175
</script>
231176

177+
<script src="{{ asset('assets/js/bootstrap-table.js') }}"></script>
178+
<script src="{{ asset('assets/js/extensions/mobile/bootstrap-table-mobile.js') }}"></script>
179+
<script type="text/javascript">
180+
$('#table').bootstrapTable({
181+
classes: 'table table-responsive table-no-bordered',
182+
undefinedText: '',
183+
iconsPrefix: 'fa',
184+
showRefresh: false,
185+
search: false,
186+
pagination: false,
187+
sidePagination: 'server',
188+
sortable: false,
189+
showMultiSort: false,
190+
cookie: false,
191+
mobileResponsive: true,
192+
});
232193
233-
194+
</script>
234195
@stop
235196

236197

0 commit comments

Comments
 (0)