mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Fixes #4495 - missing field in Download CSV, added filter options on custom report
This commit is contained in:
parent
ff793f1cb5
commit
14874d8e8a
|
@ -145,6 +145,7 @@ class ReportsController extends Controller
|
||||||
trans('general.company'),
|
trans('general.company'),
|
||||||
trans('admin/hardware/table.asset_tag'),
|
trans('admin/hardware/table.asset_tag'),
|
||||||
trans('admin/hardware/form.manufacturer'),
|
trans('admin/hardware/form.manufacturer'),
|
||||||
|
trans('general.category'),
|
||||||
trans('admin/hardware/form.model'),
|
trans('admin/hardware/form.model'),
|
||||||
trans('general.model_no'),
|
trans('general.model_no'),
|
||||||
trans('general.name'),
|
trans('general.name'),
|
||||||
|
@ -175,6 +176,7 @@ class ReportsController extends Controller
|
||||||
($asset->company) ? $asset->company->name : '',
|
($asset->company) ? $asset->company->name : '',
|
||||||
$asset->asset_tag,
|
$asset->asset_tag,
|
||||||
($asset->model->manufacturer) ? $asset->model->manufacturer->name : '',
|
($asset->model->manufacturer) ? $asset->model->manufacturer->name : '',
|
||||||
|
($asset->model->category) ? $asset->model->category->name : '',
|
||||||
($asset->model) ? $asset->model->name : '',
|
($asset->model) ? $asset->model->name : '',
|
||||||
($asset->model->model_number) ? $asset->model->model_number : '',
|
($asset->model->model_number) ? $asset->model->model_number : '',
|
||||||
($asset->name) ? $asset->name : '',
|
($asset->name) ? $asset->name : '',
|
||||||
|
@ -519,7 +521,7 @@ class ReportsController extends Controller
|
||||||
|
|
||||||
fputcsv($handle, $header);
|
fputcsv($handle, $header);
|
||||||
|
|
||||||
$assets = Asset::orderBy('created_at', 'DESC')->with('company', 'assignedTo', 'location', 'defaultLoc', 'model', 'supplier', 'assetstatus', 'model.manufacturer');
|
$assets = Asset::with('company', 'assignedTo', 'location', 'defaultLoc', 'model', 'supplier', 'assetstatus', 'model.manufacturer');
|
||||||
|
|
||||||
if ($request->has('by_location_id')) {
|
if ($request->has('by_location_id')) {
|
||||||
$assets->where('assets.location_id', $request->input('by_location_id'));
|
$assets->where('assets.location_id', $request->input('by_location_id'));
|
||||||
|
|
|
@ -30,146 +30,199 @@
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|
||||||
|
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('company', '1') }}
|
<input type="checkbox" class="all minimal" checked="checked">
|
||||||
|
Select All
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox col-md-12">
|
||||||
|
<label>
|
||||||
|
{{ Form::checkbox('company', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.company') }}
|
{{ trans('general.company') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('asset_tag', '1') }}
|
{{ Form::checkbox('asset_tag', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.asset_tag') }}
|
{{ trans('general.asset_tag') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('asset_name', '1') }}
|
{{ Form::checkbox('asset_name', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/hardware/form.name') }}
|
{{ trans('admin/hardware/form.name') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('manufacturer', '1') }}
|
{{ Form::checkbox('manufacturer', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.manufacturer') }}
|
{{ trans('general.manufacturer') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('model', '1') }}
|
{{ Form::checkbox('model', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.asset_models') }}
|
{{ trans('general.asset_models') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('category', '1') }}
|
{{ Form::checkbox('category', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.category') }}
|
{{ trans('general.category') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('serial', '1') }}
|
{{ Form::checkbox('serial', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/hardware/table.serial') }}
|
{{ trans('admin/hardware/table.serial') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('purchase_date', '1') }}
|
{{ Form::checkbox('purchase_date', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/licenses/table.purchase_date') }}
|
{{ trans('admin/licenses/table.purchase_date') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('purchase_cost', '1') }}
|
{{ Form::checkbox('purchase_cost', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/hardware/form.cost') }}
|
{{ trans('admin/hardware/form.cost') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('eol', '1') }}
|
{{ Form::checkbox('eol', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/hardware/table.eol') }}
|
{{ trans('admin/hardware/table.eol') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('order', '1') }}
|
{{ Form::checkbox('order', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/hardware/form.order') }}
|
{{ trans('admin/hardware/form.order') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('supplier', '1') }}
|
{{ Form::checkbox('supplier', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.suppliers') }}
|
{{ trans('general.suppliers') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('location', '1') }}
|
{{ Form::checkbox('location', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.location') }}
|
{{ trans('general.location') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('assigned_to', '1') }}
|
{{ Form::checkbox('assigned_to', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/licenses/table.assigned_to') }}
|
{{ trans('admin/licenses/table.assigned_to') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('username', '1') }}
|
{{ Form::checkbox('username', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/users/table.username') }}
|
{{ trans('admin/users/table.username') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('employee_num', '1') }}
|
{{ Form::checkbox('employee_num', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/users/table.employee_num') }}
|
{{ trans('admin/users/table.employee_num') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('status', '1') }}
|
{{ Form::checkbox('status', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.status') }}
|
{{ trans('general.status') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('warranty', '1') }}
|
{{ Form::checkbox('warranty', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/hardware/form.warranty') }}
|
{{ trans('admin/hardware/form.warranty') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('depreciation', '1') }}
|
{{ Form::checkbox('depreciation', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.depreciation') }}
|
{{ trans('general.depreciation') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('expected_checkin', '1') }}
|
{{ Form::checkbox('expected_checkin', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('admin/hardware/form.expected_checkin') }}
|
{{ trans('admin/hardware/form.expected_checkin') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox('notes', '1') }}
|
{{ Form::checkbox('notes', '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ trans('general.notes') }}
|
{{ trans('general.notes') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if ($customfields->count() > 0)
|
||||||
|
<div class="checkbox col-md-12">
|
||||||
|
<h4>Custom Fields:</h4>
|
||||||
|
</div>
|
||||||
@foreach ($customfields as $customfield)
|
@foreach ($customfields as $customfield)
|
||||||
<div class="checkbox col-md-12">
|
<div class="checkbox col-md-12">
|
||||||
<label>
|
<label>
|
||||||
{{ Form::checkbox($customfield->db_column_name(), '1') }}
|
{{ Form::checkbox($customfield->db_column_name(), '1', '1', ['class' => 'minimal']) }}
|
||||||
{{ $customfield->name }}
|
{{ $customfield->name }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@endif
|
||||||
|
|
||||||
</div> <!-- /.col-md-3-->
|
</div> <!-- /.col-md-3-->
|
||||||
|
|
||||||
<div class="col-md-7">
|
<div class="col-md-9">
|
||||||
<p>Select the fields you'd like to include in your custom report, and click Generate. The file (YYYY-mm-dd-his-custom-asset-report.csv) will download automatically, and you can open it in Excel.</p>
|
|
||||||
|
<p>Select the fields you'd like to include in your custom report, and click Generate. The file (custom-asset-report-YYYY-mm-dd.csv) will download automatically, and you can open it in Excel.</p>
|
||||||
|
<p>If you'd like to export only certain assets, use the options below to fine-tune your results.</p>
|
||||||
|
|
||||||
|
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'by_company_id', 'hide_new' => 'true'])
|
||||||
|
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'by_location_id', 'hide_new' => 'true'])
|
||||||
|
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'by_supplier_id', 'hide_new' => 'true'])
|
||||||
|
@include ('partials.forms.edit.model-select', ['translated_name' => trans('general.asset_model'), 'fieldname' => 'by_model_id', 'hide_new' => 'true'])
|
||||||
|
@include ('partials.forms.edit.category-select', ['translated_name' => trans('general.category'), 'fieldname' => 'by_category_id', 'hide_new' => 'true', 'category_type' => 'asset'])
|
||||||
|
|
||||||
|
<!-- Order Number -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="order_number" class="col-md-3 control-label">{{ trans('general.order_number') }}</label>
|
||||||
|
<div class="col-md-5 col-sm-8">
|
||||||
|
<input class="form-control" type="text" name="by_order_number" value="">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Purchase Date -->
|
||||||
|
<div class="form-group" id="purchase-range">
|
||||||
|
<label for="purchase_date" class="col-md-3 control-label">{{ trans('general.purchase_date') }} Range</label>
|
||||||
|
<div class="input-daterange input-group col-md-6" id="datepicker">
|
||||||
|
<input type="text" class="input-sm form-control" name="start" />
|
||||||
|
<span class="input-group-addon">to</span>
|
||||||
|
<input type="text" class="input-sm form-control" name="end" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-md-9 col-md-offset-3">
|
||||||
|
<label>
|
||||||
|
{{ Form::checkbox('use_bom', '1') }}
|
||||||
|
Add a BOM (byte-order mark) to this CSV
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div> <!-- /.box-body-->
|
</div> <!-- /.box-body-->
|
||||||
<div class="box-footer text-right">
|
<div class="box-footer text-right">
|
||||||
|
@ -181,3 +234,39 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
|
@section('moar_scripts')
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$('#purchase-range .input-daterange').datepicker({
|
||||||
|
clearBtn: true,
|
||||||
|
todayHighlight: true,
|
||||||
|
endDate: '0d',
|
||||||
|
format: 'yyyy-mm-dd'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check-all / Uncheck all
|
||||||
|
$(function () {
|
||||||
|
var checkAll = $('input.all');
|
||||||
|
var checkboxes = $('input.minimal');
|
||||||
|
|
||||||
|
|
||||||
|
checkAll.on('ifChecked ifUnchecked', function(event) {
|
||||||
|
if (event.type == 'ifChecked') {
|
||||||
|
checkboxes.iCheck('check');
|
||||||
|
} else {
|
||||||
|
checkboxes.iCheck('uncheck');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
checkboxes.on('ifChanged', function(event){
|
||||||
|
if(checkboxes.filter(':checked').length == checkboxes.length) {
|
||||||
|
checkAll.prop('checked', 'checked');
|
||||||
|
} else {
|
||||||
|
checkAll.removeProp('checked');
|
||||||
|
}
|
||||||
|
checkAll.iCheck('update');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@stop
|
||||||
|
|
Loading…
Reference in a new issue