Skip to content

Commit d535adc

Browse files
committed
Merge branch 'refs/heads/develop'
2 parents 3420f3e + f62ce40 commit d535adc

File tree

8 files changed

+80
-53
lines changed

8 files changed

+80
-53
lines changed

app/controllers/admin/UsersController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,26 @@ public function getDelete($id = null)
353353
return Redirect::route('users')->with('error', $error);
354354
}
355355

356+
356357
// Do we have permission to delete this user?
357358
if ($user->isSuperUser() and ! Sentry::getUser()->isSuperUser())
358359
{
359360
// Redirect to the user management page
360361
return Redirect::route('users')->with('error', 'Insufficient permissions!');
361362
}
362363

364+
if (count($user->assets) > 0) {
365+
366+
// Redirect to the user management page
367+
return Redirect::route('users')->with('error', 'This user still has '.count($user->assets).' assets associated with them.');
368+
}
369+
370+
if (count($user->licenses) > 0) {
371+
372+
// Redirect to the user management page
373+
return Redirect::route('users')->with('error', 'This user still has '.count($user->licenses).' licenses associated with them.');
374+
}
375+
363376
// Delete the user
364377
$user->delete();
365378

app/models/Asset.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public function adminuser()
8383
public static function assetcount()
8484
{
8585
return DB::table('assets')
86-
8786
->where('physical', '=', '1')
8887
->whereNull('deleted_at','and')
8988
->count();

app/models/LicenseSeat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function license()
1111

1212
public function user()
1313
{
14-
return $this->belongsTo('User','assigned_to');
14+
return $this->belongsTo('User','assigned_to')->withTrashed();
1515
}
1616

1717
}

app/views/backend/licenses/index.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@
6262
</td>
6363
<td><a href="{{ route('view/license', $license->id) }}">{{ $license->serial }}</a></td>
6464
<td>
65-
@if ($licensedto->assigned_to)
65+
@if (($licensedto->assigned_to) && ($licensedto->deleted_at == NULL))
6666
<a href="{{ route('view/user', $licensedto->assigned_to) }}">
6767
{{ $licensedto->user->fullName() }}
6868
</a>
69+
@elseif (($licensedto->assigned_to) && ($licensedto->deleted_at != NULL))
70+
<del>{{ $licensedto->user->fullName() }}</del>
6971
@endif
7072
</td>
7173
<td>

app/views/backend/licenses/view.blade.php

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,35 @@
88

99
{{-- Page content --}}
1010
@section('content')
11-
<div id="pad-wrapper" class="user-profile">
12-
<!-- header -->
13-
<h3 class="name">History for ({{ $license->name }})
14-
15-
16-
<div class="btn-group pull-right">
17-
<button class="btn glow">Actions</button>
18-
<button class="btn glow dropdown-toggle" data-toggle="dropdown">
19-
<span class="caret"></span>
20-
</button>
21-
<ul class="dropdown-menu">
22-
23-
@if ($license->assigned_to != 0)
24-
<li><a href="{{ route('checkin/license', $license->id) }}" class="btn-flat info">Checkin</a></li>
25-
@else
26-
<li><a href="{{ route('checkout/license', $license->id) }}" class="btn-flat success">Checkout</a></li>
27-
@endif
28-
<li><a href="{{ route('update/license', $license->id) }}">Edit License</a></li>
29-
</ul>
30-
</div>
31-
</h3>
32-
33-
<div class="row-fluid profile">
34-
<!-- bio, new note & orders column -->
35-
<div class="col-md-9 bio">
36-
<div class="profile-box">
37-
<br>
38-
<!-- checked out assets table -->
3911

12+
<div class="row header">
13+
<div class="col-md-12">
14+
<div class="btn-group pull-right">
15+
<button class="btn glow">Actions</button>
16+
<button class="btn glow dropdown-toggle" data-toggle="dropdown">
17+
<span class="caret"></span>
18+
</button>
19+
<ul class="dropdown-menu">
20+
21+
@if ($license->assigned_to != 0)
22+
<li><a href="{{ route('checkin/license', $license->id) }}" class="btn-flat info">Checkin</a></li>
23+
@else
24+
<li><a href="{{ route('checkout/license', $license->id) }}" class="btn-flat success">Checkout</a></li>
25+
@endif
26+
<li><a href="{{ route('update/license', $license->id) }}">Edit License</a></li>
27+
</ul>
28+
</div>
29+
<h3 class="name">History for ({{ $license->name }})</h3>
30+
31+
</div>
32+
</div>
33+
34+
<div class="user-profile">
35+
<div class="row profile">
36+
<div class="col-md-9 bio">
37+
38+
39+
<!-- checked out assets table -->
4040
<h6>{{ $license->seats }} License Seats</h6>
4141
<table class="table table-hover">
4242
<thead>
@@ -141,13 +141,10 @@
141141
</tbody>
142142
</table>
143143

144-
145-
146-
</div>
147144
</div>
148145

149146
<!-- side address column -->
150-
<div class="col-md-3 address pull-right">
147+
<div class="col-md-3 col-xs-12 address pull-right">
151148
<h6><br>License Info:</h6>
152149
<ul>
153150
@if ($license->serial)

app/views/backend/users/index.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<td>{{ $user->licenses->count() }}</td>
5959
<td>{{ $user->isActivated() ? '<i class="icon-ok"></i>' : ''}}</td>
6060
<td>
61-
@if ($user->id > 3)
61+
@if ($user->id > 2)
6262
@if ( ! is_null($user->deleted_at))
6363
<a href="{{ route('restore/user', $user->id) }}" class="btn btn-warning"><i class="icon-share-alt icon-white"></i></a>
6464
@else
@@ -67,7 +67,7 @@
6767
<a data-html="false" class="btn delete-asset btn-danger" data-toggle="modal" href="{{ route('delete/user', $user->id) }}" data-content="Are you sure you wish to delete this user?" data-title="Delete {{ htmlspecialchars($user->first_name) }}?" onClick="return false;"><i class="icon-trash icon-white"></i></a>
6868

6969
@else
70-
<span class="btn-flat danger disabled"><i class="icon-remove icon-white"></i> @lang('button.delete')</span>
70+
<span class="btn-flat danger disabled"><i class="icon-trash icon-white"></i></span>
7171
@endif
7272
@endif
7373
@endif

app/views/backend/users/view.blade.php

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,41 @@
88

99
{{-- Page content --}}
1010
@section('content')
11-
<div id="pad-wrapper" class="user-profile">
12-
<!-- header -->
13-
<div class="row-fluid header">
14-
<div class="col-md-8">
15-
<img src="{{ $user->gravatar() }}" class="avatar img-circle">
16-
<h3 class="name">{{ $user->fullName() }}</h3>
17-
<span class="area">{{ $user->jobtitle }}</span>
18-
</div>
1911

20-
<a href="{{ route('update/user', $user->id) }}" class="btn-flat white large pull-right edit"><i class="icon-pencil"></i> @lang('button.edit') This User</a>
12+
<div class="user-profile">
13+
<!-- header -->
14+
<div class="row header">
15+
<div class="col-md-8">
16+
<img src="{{ $user->gravatar() }}" class="avatar img-circle">
17+
<h3 class="name">{{ $user->fullName() }}</h3>
18+
<span class="area">{{ $user->jobtitle }}</span>
2119
</div>
20+
@if ($user->deleted_at != NULL)
21+
<a href="{{ route('restore/user', $user->id) }}" class="btn btn-warning pull-right edit"><i class="icon-pencil"></i> Restore This User</a>
22+
23+
@else
24+
<a href="{{ route('update/user', $user->id) }}" class="btn-flat white large pull-right edit"><i class="icon-pencil"></i> @lang('button.edit') This User</a>
25+
26+
@endif
27+
</div>
28+
29+
<div class="row profile">
2230

23-
<div class="row-fluid profile">
2431
<!-- bio, new note & orders column -->
2532
<div class="col-md-9 bio">
2633
<div class="profile-box">
2734

35+
@if ($user->deleted_at != NULL)
36+
37+
<div class="col-md-12">
38+
<div class="alert alert-danger">
39+
<i class="icon-exclamation-sign"></i>
40+
<strong>Warning: </strong>
41+
This user has been deleted. You will have to restore this user to edit them or assign them new assets.
42+
</div>
43+
</div>
44+
45+
@endif
2846

2947
<h6>Assets Checked Out to {{ $user->first_name }}</h6>
3048
<br>
@@ -59,7 +77,7 @@
5977
</table>
6078
@else
6179

62-
<div class="col-md-6">
80+
<div class="col-md-12">
6381
<div class="alert alert-warning alert-block">
6482
<i class="icon-warning-sign"></i>
6583
@lang('admin/users/table.noresults')
@@ -100,7 +118,7 @@
100118
</table>
101119
@else
102120

103-
<div class="col-md-6">
121+
<div class="col-md-12">
104122
<div class="alert alert-warning alert-block">
105123
<i class="icon-warning-sign"></i>
106124
@lang('admin/users/table.noresults')
@@ -144,7 +162,8 @@
144162
</table>
145163
@else
146164

147-
<div class="col-md-6">
165+
166+
<div class="col-md-12">
148167
<div class="alert alert-warning alert-block">
149168
<i class="icon-warning-sign"></i>
150169
@lang('admin/users/table.noresults')

composer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
]
2121
},
2222
"scripts": {
23-
"post-install-cmd": [
24-
"php artisan optimize"
25-
],
2623
"pre-update-cmd": [
2724
"php artisan clear-compiled"
2825
],

0 commit comments

Comments
 (0)