Use Ajax for activity report

This commit is contained in:
snipe 2016-09-20 00:46:24 -07:00
parent 90af734f6b
commit d8753a7d86

View file

@ -17,67 +17,28 @@
<div class="box box-default"> <div class="box box-default">
<div class="box-body"> <div class="box-body">
<div class="table-responsive"> <table
<table name="activityReport"
name="activityReport" data-toolbar="#toolbar"
id="table" class="table table-striped"
class="table table-striped" id="table"
data-cookie="true" data-url="{{ route('api.activity.list') }}"
data-click-to-select="true" data-cookie="true"
data-cookie-id-table="activityReportTable"> data-cookie-id-table="activityReportTable">
<thead> <thead>
<tr role="row">
<th class="col-sm-1">{{ trans('general.admin') }}</th>
<th class="col-sm-1"><span class="line"></span>{{ trans('general.action') }}</th>
<th class="col-sm-1"><span class="line"></span>{{ trans('general.type') }}</th>
<th class="col-sm-1"><span class="line"></span>{{ trans('general.item') }}</th>
<th class="col-sm-1"><span class="line"></span>{{ trans('general.user') }}</th>
<th class="col-sm-1"><span class="line"></span>{{ trans('general.date') }}</th
</tr>
</thead>
<tbody>
@foreach ($log_actions as $log_action)
<tr> <tr>
<td> <th class="col-sm-1" data-field="admin">{{ trans('general.admin') }}</th>
@if($log_action->user) <th class="col-sm-1" data-field="action_type">{{ trans('general.action') }}</th>
<a href="../admin/users/{{ $log_action->user->id }}/view">{{ $log_action->user->fullName() }}</a> <th class="col-sm-1" data-field="item_type">{{ trans('general.type') }}</th>
@endif <th class="col-sm-1" data-field="item">{{ trans('general.item') }}</th>
</td> <th class="col-sm-1" data-field="target">To</th>
<td>{{ $log_action->action_type }}</td> <th class="col-sm-1" data-field="created_at">{{ trans('general.date') }}</th>
<td> <th class="col-sm-1" data-field="note">{{ trans('general.notes') }}</th>
{{ title_case($log_action->itemType()) }}
</td>
<td>
@if ($item = $log_action->item)
@if ($log_action->itemType()=="asset")
{{ $item->showAssetName() }}
@else
{{ $item->name }}
@endif
@else
{{ trans('general.bad_data') }}
@endif
</td>
<td>
@if ($log_action->target)
@if ($log_action->target instanceof \App\Models\User)
<a href="../admin/users/{{ $log_action->target->id }}/view">{{ $log_action->target->fullName() }}</a>
@elseif ($log_action->target instanceof \App\Models\Asset)
<a href="../hardware/{{ $log_action->target->id }}/view">{{ $log_action->target->showAssetName() }}</a>
@endif
@endif
</td>
<td>{{ $log_action->created_at }}</td>
</tr> </tr>
@endforeach </thead>
</tbody>
</table> </table>
</div> </div>
</div> </div>
@ -99,30 +60,39 @@
iconsPrefix: 'fa', iconsPrefix: 'fa',
showRefresh: true, showRefresh: true,
search: true, search: true,
pageSize: {{ \App\Models\Setting::getSettings()->per_page }}, pageSize: 100,
pagination: true, pagination: true,
sidePagination: 'client', sidePagination: 'server',
sortable: true, sortable: true,
showMultiSort: true,
cookie: true, cookie: true,
cookieExpire: '2y',
mobileResponsive: true, mobileResponsive: true,
showExport: true, showExport: true,
showColumns: true, showColumns: true,
exportDataType: 'all', exportDataType: 'all',
exportTypes: ['csv', 'txt','json', 'xml'], exportTypes: ['csv', 'excel', 'txt','json', 'xml'],
maintainSelected: true, maintainSelected: true,
paginationFirstText: "{{ trans('general.first') }}", paginationFirstText: "{{ trans('general.first') }}",
paginationLastText: "{{ trans('general.last') }}", paginationLastText: "{{ trans('general.last') }}",
paginationPreText: "{{ trans('general.previous') }}", paginationPreText: "{{ trans('general.previous') }}",
paginationNextText: "{{ trans('general.next') }}", paginationNextText: "{{ trans('general.next') }}",
pageList: ['10','25','50','100','150','200'], pageList: ['10','25','50','100','150','200','500','1000'],
exportOptions: {
fileName: 'assets-export-' + (new Date()).toISOString().slice(0,10),
},
icons: { icons: {
paginationSwitchDown: 'fa-caret-square-o-down', paginationSwitchDown: 'fa-caret-square-o-down',
paginationSwitchUp: 'fa-caret-square-o-up', paginationSwitchUp: 'fa-caret-square-o-up',
sort: 'fa fa-sort-amount-desc',
plus: 'fa fa-plus',
minus: 'fa fa-minus',
columns: 'fa-columns', columns: 'fa-columns',
refresh: 'fa-refresh' refresh: 'fa-refresh'
}, },
}); });
</script> </script>
@stop @stop