Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2016-07-29 12:15:45 -07:00
commit 3f54c034dd
7 changed files with 88 additions and 45 deletions

View file

@ -626,12 +626,12 @@ class AssetsController extends Controller
if ($asset->save()) {
if ($request->input('checkin_at') == Carbon::now()->format('Y-m-d')) {
$checkout_at = Carbon::now();
$checkin_at = Carbon::now();
} else {
$checkout_at = $request->input('checkin_at').' 00:00:00';
$checkin_at = $request->input('checkin_at').' 00:00:00';
}
//$checkout_at = e(Input::get('checkin_at'));
$logaction = $asset->createLogRecord('checkin', $asset, $admin, $user, null, e(Input::get('note')), $checkout_at);
//$checkin_at = e(Input::get('checkin_at'));
$logaction = $asset->createLogRecord('checkin', $asset, $admin, $user, null, e(Input::get('note')), $checkin_at);
$settings = Setting::getSettings();

View file

@ -55,7 +55,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
$user_permissions = json_decode($this->permissions, true);
//If the user is explicitly granted, return false
//If the user is explicitly granted, return true
if (($user_permissions!='') && ((array_key_exists($section, $user_permissions)) && ($user_permissions[$section]=='1'))) {
return true;
}

View file

@ -205,7 +205,7 @@ class AuthServiceProvider extends ServiceProvider
# Components
# -----------------------------------------
$gate->define('components.view', function ($user) {
if (($user->hasAccess('components.create')) || ($user->hasAccess('admin'))) {
if (($user->hasAccess('components.view')) || ($user->hasAccess('admin'))) {
return true;
}
});
@ -268,6 +268,12 @@ class AuthServiceProvider extends ServiceProvider
}
});
$gate->define('licenses.keys', function ($user) {
if (($user->hasAccess('licenses.keys')) || ($user->hasAccess('admin'))) {
return true;
}
});
}
}

View file

@ -30,6 +30,8 @@
<th class="col-md-3" bSortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
<th class="col-md-3" bSortable="true">{{ trans('admin/hardware/table.serial') }}</th>
<th class="col-md-2" bSortable="true">{{ trans('admin/hardware/table.location') }}</th>
<th class="col-md-2" bSortable="true">{{ trans('admin/hardware/table.status') }}</th>
<th class="col-md-2" bSortable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
<th class="col-md-1 actions" bSortable="false">{{ trans('table.actions') }}</th>
</tr>
</thead>
@ -44,6 +46,9 @@
@endif
<td>{{ $asset->serial }}</td>
<td>
@if ($asset->assigneduser && $asset->assetloc)
{{ $asset->assetloc->name }}
@ -53,6 +58,16 @@
@endif
</td>
@if ($asset->assigned_to != '' && $asset->assigned_to > 0)
<td>Checked out</td>
@else
<td>{{ trans('admin/hardware/general.requestable') }}</td>
@endif
<td>{{ $asset->expected_checkin }}</td>
<td>
<a href="{{ route('account/request-asset', $asset->id) }}" class="btn btn-info btn-sm" title="{{ trans('button.request') }}">{{ trans('button.request') }}</a>
</td>

View file

@ -102,12 +102,12 @@ View Assets for {{ $user->fullName() }}
<td>{{ $license->name }}</td>
<td>
@if (($user->hasAccess('admin')) || ($user->hasAccess('license_keys')))
@can('licenses.keys')
{{ mb_strimwidth($license->serial, 0, 50, "...") }}
@else
---
@endif
@endcan
</td>
</tr>
@endforeach

View file

@ -249,11 +249,11 @@
<td>{{ trans('admin/hardware/form.notes') }}</td>
<td> {!! nl2br(e($asset->notes)) !!}</td>
</tr>
@if ($asset->created_at)
@if ($asset->created_at!=''')
<tr>
<td>{{ trans('general.created_at') }}</td>
<td>
{{ $user->created_at->format('F j, Y h:iA') }}
{{ $asset->created_at->format('F j, Y h:iA') }}
</td>
</tr>
@endif

View file

@ -10,6 +10,7 @@
{{-- Right header --}}
@section('header_right')
<div class="btn-group pull-right">
@can('licenses.edit')
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
<span class="caret"></span>
</button>
@ -17,6 +18,7 @@
<li><a href="{{ route('update/license', $license->id) }}">{{ trans('admin/licenses/general.edit') }}</a></li>
<li><a href="{{ route('clone/license', $license->id) }}">{{ trans('admin/licenses/general.clone') }}</a></li>
</ul>
@endcan
</div>
@stop
@ -60,28 +62,45 @@
<td>Seat {{ $count }} </td>
<td>
@if (($licensedto->assigned_to) && ($licensedto->deleted_at == NULL))
@can('users.view')
<a href="{{ route('view/user', $licensedto->assigned_to) }}">
{{ $licensedto->user->fullName() }}
</a>
@else
{{ $licensedto->user->fullName() }}
@endcan
@elseif (($licensedto->assigned_to) && ($licensedto->deleted_at != NULL))
<del>{{ $licensedto->user->fullName() }}</del>
@elseif ($licensedto->asset_id)
@if ($licensedto->asset->assigned_to != 0)
@can('users.view')
<a href="{{ route('view/user', $licensedto->asset->assigned_to) }}">
{{ $licensedto->asset->assigneduser->fullName() }}
</a>
@else
{{ $licensedto->asset->assigneduser->fullName() }}
@endcan
@endif
@endif
</td>
<td>
@if ($licensedto->asset_id)
@can('assets.view')
<a href="{{ route('view/hardware', $licensedto->asset_id) }}">
{{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }}
</a>
@else
{{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }}
@endcan
@endif
</td>
<td>
@can('licenses.checkout')
@if (($licensedto->assigned_to) || ($licensedto->asset_id))
@if ($license->reassignable)
<a href="{{ route('checkin/license', $licensedto->id) }}" class="btn btn-primary btn-sm">
{{ trans('general.checkin') }}
@ -93,6 +112,7 @@
<a href="{{ route('checkout/license', $licensedto->id) }}" class="btn btn-info btn-sm">
{{ trans('general.checkout') }}</a>
@endif
@endcan
</td>
</tr>
@ -116,24 +136,26 @@
</tr>
@endif
@can('licenses.keys')
@if (!is_null($license->serial))
<tr>
<td>{{ trans('admin/licenses/form.license_key') }}</td>
<td style="word-wrap: break-word;overflow-wrap: break-word;word-break: break-word;">{{ nl2br(e($license->serial)) }}</td>
<td style="word-wrap: break-word;overflow-wrap: break-word;word-break: break-word;">{!! nl2br(e($license->serial)) !!}</td>
</tr>
@endif
@endcan
@if (!is_null($license->license_name))
<tr>
<td>{{ trans('admin/licenses/form.to_name') }}</td>
<td>{{ nl2br(e($license->license_name)) }}</td>
<td>{{ $license->license_name }}</td>
</tr>
@endif
@if (!is_null($license->license_email))
<tr>
<td>{{ trans('admin/licenses/form.to_email') }}</td>
<td>{{ nl2br(e($license->license_email)) }}</td>
<td>{{ $license->license_email }}</td>
</tr>
@endif
@ -270,7 +292,7 @@
</div>
</div>
</div>
</div>ey
</div>
<!-- /.tab-pane -->