Merge pull request #11190 from inietov/fixes/requested_assets_models_workflow

Adjust requested assets and models workflow a little bit.
This commit is contained in:
snipe 2022-05-24 14:31:40 -07:00 committed by GitHub
commit a243823e5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View file

@ -1187,7 +1187,9 @@ class Asset extends Depreciable
public function scopeRequestableAssets($query) public function scopeRequestableAssets($query)
{ {
return Company::scopeCompanyables($query->where('requestable', '=', 1)) $table = $query->getModel()->getTable();
return Company::scopeCompanyables($query->where($table.'.requestable', '=', 1))
->whereHas('assetstatus', function ($query) { ->whereHas('assetstatus', function ($query) {
$query->where(function ($query) { $query->where(function ($query) {
$query->where('deployable', '=', 1) $query->where('deployable', '=', 1)

View file

@ -109,8 +109,14 @@
</td> </td>
<td>
@can('view', \App\Models\AssetModel::class)
<a href='{{ url("/models/{$requestableModel->id}") }}'>{{ $requestableModel->name }}</a>
@else
{{ $requestableModel->name }}
@endcan
</td>
<td>{{$requestableModel->name}}</td>
<td>{{$requestableModel->assets->where('requestable', '1')->count()}}</td> <td>{{$requestableModel->assets->where('requestable', '1')->count()}}</td>
<td> <td>

View file

@ -51,8 +51,7 @@
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th> <th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
<th class="col-md-3" data-sortable="true">{{ trans('admin/hardware/table.requesting_user') }}</th> <th class="col-md-3" data-sortable="true">{{ trans('admin/hardware/table.requesting_user') }}</th>
<th class="col-md-2">{{ trans('admin/hardware/table.requested_date') }}</th> <th class="col-md-2">{{ trans('admin/hardware/table.requested_date') }}</th>
<th class="col-md-1"></th> <th class="col-md-1">{{ trans('general.checkin').'/'.trans('general.checkout') }}</th>
<th class="col-md-1"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>