Added department to custom asset export

This commit is contained in:
snipe 2018-04-16 20:10:38 -07:00
parent a6fc7ba07a
commit 5948a0b235
2 changed files with 47 additions and 18 deletions

View file

@ -529,6 +529,10 @@ class ReportsController extends Controller
$header[] = 'Employee No.'; $header[] = 'Employee No.';
} }
if ($request->has('department')) {
$header[] = trans('general.department');
}
if ($request->has('status')) { if ($request->has('status')) {
$header[] = trans('general.status'); $header[] = trans('general.status');
} }
@ -729,6 +733,15 @@ class ReportsController extends Controller
} }
} }
if ($request->has('department')) {
if ($asset->checkedOutToUser()) {
$row[] = (($asset->assignedto) && ($asset->assignedto->department)) ? $asset->assignedto->department->name : '';
} else {
$row[] = ''; // Empty string if unassigned
}
}
if ($request->has('status')) { if ($request->has('status')) {
$row[] = ($asset->assetstatus) ? $asset->assetstatus->name.' ('.$asset->present()->statusMeta.')' : ''; $row[] = ($asset->assetstatus) ? $asset->assetstatus->name.' ('.$asset->present()->statusMeta.')' : '';
} }

View file

@ -135,25 +135,7 @@
</label> </label>
</div> </div>
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('assigned_to', '1', '1', ['class' => 'minimal']) }}
{{ trans('admin/licenses/table.assigned_to') }}
</label>
</div>
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('username', '1', '1', ['class' => 'minimal']) }}
{{ trans('admin/users/table.username') }}
</label>
</div>
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('employee_num', '1', '1', ['class' => 'minimal']) }}
{{ trans('admin/users/table.employee_num') }}
</label>
</div>
<div class="checkbox col-md-12"> <div class="checkbox col-md-12">
<label> <label>
{{ Form::checkbox('status', '1', '1', ['class' => 'minimal']) }} {{ Form::checkbox('status', '1', '1', ['class' => 'minimal']) }}
@ -215,6 +197,40 @@
</label> </label>
</div> </div>
<!-- User fields -->
<div class="checkbox col-md-12">
<h4>Checked Out To Fields:</h4>
</div>
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('assigned_to', '1', '1', ['class' => 'minimal']) }}
{{ trans('admin/licenses/table.assigned_to') }}
</label>
</div>
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('username', '1', '1', ['class' => 'minimal']) }}
{{ trans('admin/users/table.username') }}
</label>
</div>
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('employee_num', '1', '1', ['class' => 'minimal']) }}
{{ trans('admin/users/table.employee_num') }}
</label>
</div>
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('department', '1', '1', ['class' => 'minimal']) }}
{{ trans('general.department') }}
</label>
</div>
@if ($customfields->count() > 0) @if ($customfields->count() > 0)
<div class="checkbox col-md-12"> <div class="checkbox col-md-12">
<h4>Custom Fields:</h4> <h4>Custom Fields:</h4>