Skip to content

Commit 6008eec

Browse files
committed
Merge branch 'develop'
2 parents 3bc9d3f + 3343cf1 commit 6008eec

File tree

13 files changed

+336
-176
lines changed

13 files changed

+336
-176
lines changed

app/Http/Controllers/AssetsController.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use TCPDF;
3939
use Validator;
4040
use View;
41+
use App\Models\CheckoutRequest;
4142

4243
/**
4344
* This class controls all actions related to assets for
@@ -1243,4 +1244,14 @@ public function auditStore(Request $request, $id)
12431244
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.audit.success'));
12441245
}
12451246
}
1247+
1248+
public function getRequestedIndex($id = null)
1249+
{
1250+
if ($id) {
1251+
$requestedItems = CheckoutRequest::where('user_id', $id)->with('user', 'requestedItem')->get();
1252+
}
1253+
$requestedItems = CheckoutRequest::with('user', 'requestedItem')->get();
1254+
return view('hardware/requested', compact('requestedItems'));
1255+
}
1256+
12461257
}

app/Http/Controllers/ViewAssetsController.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ public function getRequestableIndex()
7474
return view('account/requestable-assets', compact('user', 'assets', 'models'));
7575
}
7676

77-
public function getRequestedIndex()
78-
{
79-
$requestedItems = CheckoutRequest::with('user', 'requestedItem')->get();
80-
return view('admin/requested-assets', compact('requestedItems'));
81-
}
8277

8378

8479
public function getRequestItem($itemType, $itemId = null)

app/Presenters/AssetModelPresenter.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ public function imageUrl()
7878
return '';
7979
}
8080

81+
/**
82+
* Generate img tag to this models image.
83+
* @return string
84+
*/
85+
public function imageSrc()
86+
{
87+
if (!empty($this->image)) {
88+
return url('/') . '/uploads/models/' . $this->image;
89+
}
90+
return '';
91+
}
92+
8193
/**
8294
* Url to view this item.
8395
* @return string

app/Presenters/AssetPresenter.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,26 @@ public function imageUrl()
280280
return $imagePath;
281281
}
282282

283+
/**
284+
* Generate img tag to this items image.
285+
* @return mixed|string
286+
*/
287+
public function imageSrc()
288+
{
289+
$imagePath = '';
290+
if ($this->image && !empty($this->image)) {
291+
$imagePath = $this->image;
292+
return 'poop';
293+
} elseif ($this->model && !empty($this->model->image)) {
294+
$imagePath = $this->model->image;
295+
return 'fart';
296+
}
297+
if (!empty($imagePath)) {
298+
return config('app.url').'/uploads/assets/'.$imagePath;
299+
}
300+
return $imagePath;
301+
}
302+
283303
/**
284304
* Get Displayable Name
285305
* @return string

config/version.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
return array (
33
'app_version' => 'v4.1.0',
4-
'build_version' => 'beta2',
5-
'hash_version' => 'g3b498ef',
6-
'full_hash' => 'v4.1.0-beta2-3-g3b498ef',
4+
'build_version' => '37',
5+
'hash_version' => 'g48207fc',
6+
'full_hash' => 'v4.1.0-37-g48207fc',
77
);

resources/views/account/requestable-assets.blade.php

Lines changed: 67 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,27 @@
3333
@if ($assets->count() > 0)
3434

3535
<div class="table-responsive">
36-
<table class="table table-striped">
36+
<table
37+
name="requested-assets"
38+
data-toolbar="#toolbar"
39+
class="table table-striped snipe-table"
40+
id="table"
41+
data-advanced-search="true"
42+
data-id-table="advancedTable"
43+
data-cookie-id-table="requestableAssets">
3744
<thead>
3845
<tr role="row">
39-
<th class="col-md-3" bSortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
46+
<th class="col-md-1" data-sortable="true">{{ trans('general.image') }}</th>
47+
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
48+
<th class="col-md-2" data-sortable="true">{{ trans('admin/models/table.modelnumber') }}</th>
4049
@if ($snipeSettings->display_asset_name)
41-
<th class="col-md-3" bSortable="true">{{ trans('admin/hardware/form.name') }}</th>
50+
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/form.name') }}</th>
4251
@endif
43-
<th class="col-md-3" bSortable="true">{{ trans('admin/hardware/table.serial') }}</th>
44-
<th class="col-md-2" bSortable="true">{{ trans('admin/hardware/table.location') }}</th>
45-
<th class="col-md-2" bSortable="true">{{ trans('admin/hardware/table.status') }}</th>
46-
<th class="col-md-2" bSortable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
47-
<th class="col-md-1 actions" bSortable="false">{{ trans('table.actions') }}</th>
52+
<th class="col-md-3" data-sortable="true">{{ trans('admin/hardware/table.serial') }}</th>
53+
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/table.location') }}</th>
54+
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/table.status') }}</th>
55+
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
56+
<th class="col-md-1 actions" data-sortable="false">{{ trans('table.actions') }}</th>
4857
</tr>
4958
</thead>
5059
<tbody>
@@ -53,17 +62,30 @@
5362
<tr>
5463
<form action="{{route('account/request-item', ['itemType' => 'asset', 'itemId' => $asset->id])}}" method="POST" accept-charset="utf-8">
5564
{{ csrf_field() }}
56-
<td>{!! $asset->model->present()->nameUrl() !!}</td>
65+
<td>
66+
@if ($asset->getImageUrl())
67+
<a href="{{ $asset->getImageUrl() }}" data-toggle="lightbox" data-type="image">
68+
<img src="{{ $asset->getImageUrl() }}" style="max-height: {{ $snipeSettings->thumbnail_max_h }}px; width: auto;" class="img-responsive">
69+
</a>
70+
@endif
71+
72+
</td>
73+
<td>{{ $asset->model->name }}
74+
75+
</td>
76+
<td>
77+
{{ $asset->model->model_number }}
78+
</td>
5779

5880
@if ($snipeSettings->display_asset_name)
5981
<td>{{ $asset->name }}</td>
6082
@endif
6183

62-
<td><a href="{{ $asset->present()->viewUrl() }}">{{ $asset->serial }}</a></td>
84+
<td>{{ $asset->serial }}</td>
6385

6486
<td>
6587
@if ($asset->location)
66-
{!! $asset->location->present()->nameUrl() !!}
88+
{{ $asset->location->name }}
6789
@endif
6890
</td>
6991
@if ($asset->assigned_to != '' && $asset->assigned_to > 0)
@@ -106,13 +128,21 @@
106128

107129
@if ($models->count() > 0)
108130
<h4>Requestable Models</h4>
109-
<table class="table table-striped">
131+
<table
132+
name="requested-assets"
133+
data-toolbar="#toolbar"
134+
class="table table-striped snipe-table"
135+
id="table"
136+
data-advanced-search="true"
137+
data-id-table="advancedTable"
138+
data-cookie-id-table="requestableAssets">
110139
<thead>
111140
<tr role="row">
112-
<th class="col-md-6" bSortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
113-
<th class="col-md-3" bSortable="true">{{ trans('admin/accessories/general.remaining') }}</th>
114-
<th class="col-md-2" bSortable="true">{{ trans('general.quantity') }}</th>
115-
<th class="col-md-1 actions" bSortable="false">{{ trans('table.actions') }}</th>
141+
<th class="col-md-1" data-sortable="true">{{ trans('general.image') }}</th>
142+
<th class="col-md-6" data-sortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
143+
<th class="col-md-3" data-sortable="true">{{ trans('admin/accessories/general.remaining') }}</th>
144+
<th class="col-md-2" data-sortable="true">{{ trans('general.quantity') }}</th>
145+
<th class="col-md-1 actions" data-sortable="false">{{ trans('table.actions') }}</th>
116146
</tr>
117147
</thead>
118148

@@ -121,9 +151,18 @@
121151
<tr>
122152
<form action="{{route('account/request-item', ['itemType' => 'asset_model', 'itemId' => $requestableModel->id])}}"
123153
method="POST"
124-
accept-charset="utf-8"
125-
>
154+
accept-charset="utf-8">
126155
{{ csrf_field() }}
156+
<td>
157+
@if ($requestableModel->image)
158+
<a href="{{ url('/') }}/uploads/models/{{ $requestableModel->image }}" data-toggle="lightbox" data-type="image">
159+
<img src="{{ url('/') }}/uploads/models/{{ $requestableModel->image }}" style="max-height: {{ $snipeSettings->thumbnail_max_h }}px; width: auto;" class="img-responsive">
160+
</a>
161+
@endif
162+
163+
</td>
164+
165+
127166
<td>{{$requestableModel->name}}</td>
128167
<td>{{$requestableModel->assets->where('requestable', '1')->count()}}</td>
129168
<td><input type="text" name="request-quantity" value=""></td>
@@ -158,7 +197,14 @@
158197

159198

160199
@section('moar_scripts')
161-
<script nonce="{{ csrf_token() }}">
200+
@include ('partials.bootstrap-table', [
201+
'exportFile' => 'requested-export',
202+
'search' => true,
203+
'clientSearch' => true,
204+
])
205+
206+
207+
<script nonce="{{ csrf_token() }}">
162208
163209
$( "a[name='Request']").click(function(event) {
164210
// event.preventDefault();
@@ -169,3 +215,5 @@
169215
});
170216
</script>
171217
@stop
218+
219+

resources/views/admin/requested-assets.blade.php

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)