Merge branch 'develop'

This commit is contained in:
snipe 2018-01-17 03:27:03 -08:00
commit e2a8f9b790
13 changed files with 128 additions and 20 deletions

View file

@ -34,7 +34,8 @@ class AssetsTransformer
'eol' => ($asset->purchase_date!='') ? Helper::getFormattedDateObject($asset->present()->eol_date(), 'date') : null ,
'status_label' => ($asset->assetstatus) ? [
'id' => (int) $asset->assetstatus->id,
'name'=> e($asset->present()->statusText),
'name'=> e($asset->assetstatus->name),
'status_type'=> e($asset->assetstatus->getStatuslabelType()),
'status_meta' => e($asset->present()->statusMeta),
] : null,
'category' => ($asset->model->category) ? [

View file

@ -417,6 +417,47 @@ class AssetPresenter extends Presenter
return $this->model->assetstatus->name;
}
/**
* @return string
* This handles the status label "meta" status of "deployed" if
* it's assigned. Results look like:
*
* (if assigned and the status label is "Ready to Deploy"):
* (Deployed)
*
* (f assigned and status label is not "Ready to Deploy":)
* Deployed (Another Status Label)
*
* (if not deployed:)
* Another Status Label
*/
public function fullStatusText() {
// Make sure the status is valid
if ($this->assetstatus) {
// If the status is assigned to someone or something...
if ($this->model->assigned) {
// If it's assigned and not set to the default "ready to deploy" status
if ($this->assetstatus->name != trans('general.ready_to_deploy')) {
return trans('general.deployed'). ' (' . $this->model->assetstatus->name.')';
}
// If it's assigned to the default "ready to deploy" status, just
// say it's deployed - otherwise it's confusing to have a status that is
// both "ready to deploy" and deployed at the same time.
return trans('general.deployed');
}
// Return just the status name
return $this->model->assetstatus->name;
}
// This status doesn't seem valid - either data has been manually edited or
// the status label was deleted.
return 'Invalid status';
}
/**
* Date the warantee expires.
* @return false|string

View file

@ -44,6 +44,7 @@ class AssetSeeder extends Seeder
unlink($del_file); // delete file
}
DB::table('checkout_requests')->truncate();
}
}

View file

@ -152,6 +152,7 @@
id="table"
data-sort-order="desc"
data-height="400"
data-show-export="false"
data-url="{{ route('api.activity.index', ['limit' => 25]) }}">
<thead>
<tr>
@ -248,7 +249,7 @@
@stop
@section('moar_scripts')
@include ('partials.bootstrap-table', ['simple_view' => true])
@include ('partials.bootstrap-table', ['simple_view' => true, 'nopages' => true])
@if ($snipeSettings->load_remote=='1')
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>

View file

@ -79,6 +79,7 @@
class="table table-striped snipe-table"
id="table"
data-advanced-search="true"
data-show-export="true"
data-id-table="advancedTable"
data-url="{{ route('api.assets.index',
array('status' => e(Input::get('status')),

View file

@ -86,9 +86,13 @@
@endif
</td>
<td>
@if ($request->requestingUser())
<a href="{{ url('/') }}/users/{{ $request->requestingUser()->id }}">
{{ $request->requestingUser()->present()->fullName() }}
</a>
@else
(deleted user)
@endif
</td>
<td>{{ App\Helpers\Helper::getFormattedDateObject($request->created_at, 'datetime', false) }}</td>
<td>

View file

@ -90,7 +90,12 @@
<td>
@if (($asset->assignedTo) && ($asset->deleted_at==''))
<i class="fa fa-circle text-blue"></i> {{ trans('general.deployed') }} <i class="fa fa-long-arrow-right" aria-hidden="true"></i> {!! $asset->assignedTo->present()->glyph() !!}
<i class="fa fa-circle text-blue"></i>
{{ $asset->assetstatus->name }}
<label class="label label-default">{{ trans('general.deployed') }}</label>
<i class="fa fa-long-arrow-right" aria-hidden="true"></i>
{!! $asset->assignedTo->present()->glyph() !!}
{!! $asset->assignedTo->present()->nameUrl() !!}
@else
@if (($asset->assetstatus) && ($asset->assetstatus->deployable=='1'))
@ -175,11 +180,34 @@
</td>
</tr>
@endif
<tr>
<td>
{{ trans('general.category') }}</td>
<td>
@if ($asset->model->category)
@can('view', \App\Models\Category::class)
<a href="{{ route('categories.show', $asset->model->category->id) }}">
{{ $asset->model->category->name }}
</a>
@else
{{ $asset->model->category->name }}
@endcan
@else
Invalid category
@endif
</td>
</tr>
<tr>
<td>
{{ trans('admin/hardware/form.model') }}</td>
<td>
@can('view', \App\Models\AssetModel::class)
@can('view', \App\Models\AssetModel::class)
<a href="{{ route('models.show', $asset->model->id) }}">
{{ $asset->model->name }}
</a>
@ -188,6 +216,8 @@
@endcan
</td>
</tr>
<tr>
<td>{{ trans('admin/models/table.modelnumber') }}</td>
<td>
@ -555,13 +585,13 @@
<!-- checked out assets table -->
<div class="table-responsive">
<table
name="assetAssets"
name="assetAssetsTable"
data-toolbar="#toolbar"
class="table table-striped snipe-table"
id="assetAssets"
id="assetAssetsTable"
data-search="false"
data-url="{{route('api.assets.index',['assigned_to' => $asset->id, 'assigned_type' => 'App\Models\Asset']) }}"
data-export-options='{"fileName": "asset-assets"}'
data-show-export="true"
data-cookie="true"
data-show-footer="true"
data-cookie-id-table="assetAssetsTable"

View file

@ -29,6 +29,7 @@
data-url="{{ route('api.licenses.index') }}"
class="table table-striped snipe-table"
data-cookie="true"
data-show-export="true"
data-click-to-select="true"
data-cookie-id-table="licenseTable">
</table>

View file

@ -23,6 +23,7 @@
id="table"
data-url="{{ route('api.locations.index') }}"
data-cookie="true"
data-show-export="true"
data-click-to-select="true"
data-cookie-id-table="locationsTable-{{ config('version.hash_version') }}">
<thead>

View file

@ -23,11 +23,12 @@
<table
name="manufacturers"
class="table table-striped snipe-table"
id="table"
id="manufacturersTable"
data-url="{{route('api.manufacturers.index') }}"
data-cookie="true"
data-show-export="true"
data-click-to-select="true"
data-cookie-id-table="manufacturersTable-{{ config('version.hash_version') }}">
data-cookie-id-table="manufacturersTable">
</table>
</div>

View file

@ -50,8 +50,10 @@
paginationVAlign: 'both',
sidePagination: '{{ (isset($clientSearch)) ? 'client' : 'server' }}',
sortable: true,
@if (!isset($nopages))
pageSize: 20,
pagination: true,
@endif
cookie: true,
cookieExpire: '2y',
cookieIdTable: '{{ Route::currentRouteName() }}',
@ -72,14 +74,13 @@
paginationSwitchDown: 'fa-caret-square-o-down',
paginationSwitchUp: 'fa-caret-square-o-up',
columns: 'fa-columns',
@if( isset($multiSort))
@if (isset($multiSort))
sort: 'fa fa-sort-amount-desc',
plus: 'fa fa-plus',
minus: 'fa fa-minus',
@endif
refresh: 'fa-refresh'
},
showExport: true,
exportDataType: 'all',
exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'],
exportOptions: {
@ -173,26 +174,31 @@
var text_color;
var icon_style;
var text_help;
switch (value.status_meta) {
case 'deployed':
case '{{ strtolower(trans('general.deployed')) }}':
text_color = 'blue';
icon_style = 'fa-circle';
text_help = '<label class="label label-default">{{ trans('general.deployed') }}</label>';
break;
case 'deployable':
case '{{ strtolower(trans('admin/hardware/general.deployable')) }}':
text_color = 'green';
icon_style = 'fa-circle';
text_help = '';
break;
case 'pending':
case '{{ strtolower(trans('general.pending')) }}':
text_color = 'orange';
icon_style = 'fa-circle';
text_help = '';
break;
default:
text_color = 'red';
icon_style = 'fa-times';
text_help = '';
}
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + value.id + '" data-tooltip="true" title="'+ value.status_meta + '"> <i class="fa ' + icon_style + ' text-' + text_color + '"></i> ' + value.name + '</a></nobr>';
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + value.id + '" data-tooltip="true" title="'+ value.status_meta + '"> <i class="fa ' + icon_style + ' text-' + text_color + '"></i> ' + value.name + ' ' + text_help + ' </a> </nobr>';
} else if ((value) && (value.name)) {
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + value.id + '"> ' + value.name + '</a></span>';
}

View file

@ -74,13 +74,14 @@
@endif
</td>
<td>
@if ($asset->assignedTo)
@if ($asset->assignedTo->deleted_at!='')
<del>{{ $asset->assignedTo->present()->name() }}</del>
@if ($asset->checkedOutToUser())
{{ $asset->assigned->getFullNameAttribute() }}
@else
{!! $asset->assignedTo->present()->nameUrl() !!}
@if ($asset->assigned)
{{ $asset->assigned->name }}
@endif
@endif
@endif
</td>
<td>
@if ($asset->location)

View file

@ -141,6 +141,25 @@
<td>{{ $user->username }}</td>
</tr>
<tr>
<td>{{ trans('general.groups') }}</td>
<td>
@if ($user->groups->count() > 0)
@foreach ($user->groups as $group)
@can('superadmin')
<a href="{{ route('groups.show', $group->id) }}" class="label label-default">{{ $group->name }}</a>
@else
{{ $group->name }}
@endcan
@endforeach
@else
--
@endif
</td>
</tr>
@if ($user->jobtitle)