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 , 'eol' => ($asset->purchase_date!='') ? Helper::getFormattedDateObject($asset->present()->eol_date(), 'date') : null ,
'status_label' => ($asset->assetstatus) ? [ 'status_label' => ($asset->assetstatus) ? [
'id' => (int) $asset->assetstatus->id, '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), 'status_meta' => e($asset->present()->statusMeta),
] : null, ] : null,
'category' => ($asset->model->category) ? [ 'category' => ($asset->model->category) ? [

View file

@ -417,6 +417,47 @@ class AssetPresenter extends Presenter
return $this->model->assetstatus->name; 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. * Date the warantee expires.
* @return false|string * @return false|string

View file

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

View file

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

View file

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

View file

@ -90,7 +90,12 @@
<td> <td>
@if (($asset->assignedTo) && ($asset->deleted_at=='')) @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() !!} {!! $asset->assignedTo->present()->nameUrl() !!}
@else @else
@if (($asset->assetstatus) && ($asset->assetstatus->deployable=='1')) @if (($asset->assetstatus) && ($asset->assetstatus->deployable=='1'))
@ -175,11 +180,34 @@
</td> </td>
</tr> </tr>
@endif @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> <tr>
<td> <td>
{{ trans('admin/hardware/form.model') }}</td> {{ trans('admin/hardware/form.model') }}</td>
<td> <td>
@can('view', \App\Models\AssetModel::class) @can('view', \App\Models\AssetModel::class)
<a href="{{ route('models.show', $asset->model->id) }}"> <a href="{{ route('models.show', $asset->model->id) }}">
{{ $asset->model->name }} {{ $asset->model->name }}
</a> </a>
@ -188,6 +216,8 @@
@endcan @endcan
</td> </td>
</tr> </tr>
<tr> <tr>
<td>{{ trans('admin/models/table.modelnumber') }}</td> <td>{{ trans('admin/models/table.modelnumber') }}</td>
<td> <td>
@ -555,13 +585,13 @@
<!-- checked out assets table --> <!-- checked out assets table -->
<div class="table-responsive"> <div class="table-responsive">
<table <table
name="assetAssets" name="assetAssetsTable"
data-toolbar="#toolbar" data-toolbar="#toolbar"
class="table table-striped snipe-table" class="table table-striped snipe-table"
id="assetAssets" id="assetAssetsTable"
data-search="false" data-search="false"
data-url="{{route('api.assets.index',['assigned_to' => $asset->id, 'assigned_type' => 'App\Models\Asset']) }}" 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-cookie="true"
data-show-footer="true" data-show-footer="true"
data-cookie-id-table="assetAssetsTable" data-cookie-id-table="assetAssetsTable"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -141,6 +141,25 @@
<td>{{ $user->username }}</td> <td>{{ $user->username }}</td>
</tr> </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) @if ($user->jobtitle)