Merge branch 'develop'
This commit is contained in:
commit
6008eec205
13 changed files with 335 additions and 175 deletions
|
@ -38,6 +38,7 @@ use Symfony\Component\HttpFoundation\File\Exception\FileException;
|
|||
use TCPDF;
|
||||
use Validator;
|
||||
use View;
|
||||
use App\Models\CheckoutRequest;
|
||||
|
||||
/**
|
||||
* This class controls all actions related to assets for
|
||||
|
@ -1243,4 +1244,14 @@ class AssetsController extends Controller
|
|||
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.audit.success'));
|
||||
}
|
||||
}
|
||||
|
||||
public function getRequestedIndex($id = null)
|
||||
{
|
||||
if ($id) {
|
||||
$requestedItems = CheckoutRequest::where('user_id', $id)->with('user', 'requestedItem')->get();
|
||||
}
|
||||
$requestedItems = CheckoutRequest::with('user', 'requestedItem')->get();
|
||||
return view('hardware/requested', compact('requestedItems'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -74,11 +74,6 @@ class ViewAssetsController extends Controller
|
|||
return view('account/requestable-assets', compact('user', 'assets', 'models'));
|
||||
}
|
||||
|
||||
public function getRequestedIndex()
|
||||
{
|
||||
$requestedItems = CheckoutRequest::with('user', 'requestedItem')->get();
|
||||
return view('admin/requested-assets', compact('requestedItems'));
|
||||
}
|
||||
|
||||
|
||||
public function getRequestItem($itemType, $itemId = null)
|
||||
|
|
|
@ -78,6 +78,18 @@ class AssetModelPresenter extends Presenter
|
|||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate img tag to this models image.
|
||||
* @return string
|
||||
*/
|
||||
public function imageSrc()
|
||||
{
|
||||
if (!empty($this->image)) {
|
||||
return url('/') . '/uploads/models/' . $this->image;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Url to view this item.
|
||||
* @return string
|
||||
|
|
|
@ -280,6 +280,26 @@ class AssetPresenter extends Presenter
|
|||
return $imagePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate img tag to this items image.
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function imageSrc()
|
||||
{
|
||||
$imagePath = '';
|
||||
if ($this->image && !empty($this->image)) {
|
||||
$imagePath = $this->image;
|
||||
return 'poop';
|
||||
} elseif ($this->model && !empty($this->model->image)) {
|
||||
$imagePath = $this->model->image;
|
||||
return 'fart';
|
||||
}
|
||||
if (!empty($imagePath)) {
|
||||
return config('app.url').'/uploads/assets/'.$imagePath;
|
||||
}
|
||||
return $imagePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Displayable Name
|
||||
* @return string
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
return array (
|
||||
'app_version' => 'v4.1.0',
|
||||
'build_version' => 'beta2',
|
||||
'hash_version' => 'g3b498ef',
|
||||
'full_hash' => 'v4.1.0-beta2-3-g3b498ef',
|
||||
'build_version' => '37',
|
||||
'hash_version' => 'g48207fc',
|
||||
'full_hash' => 'v4.1.0-37-g48207fc',
|
||||
);
|
||||
|
|
|
@ -33,18 +33,27 @@
|
|||
@if ($assets->count() > 0)
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<table
|
||||
name="requested-assets"
|
||||
data-toolbar="#toolbar"
|
||||
class="table table-striped snipe-table"
|
||||
id="table"
|
||||
data-advanced-search="true"
|
||||
data-id-table="advancedTable"
|
||||
data-cookie-id-table="requestableAssets">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="col-md-3" bSortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
|
||||
<th class="col-md-1" data-sortable="true">{{ trans('general.image') }}</th>
|
||||
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
|
||||
<th class="col-md-2" data-sortable="true">{{ trans('admin/models/table.modelnumber') }}</th>
|
||||
@if ($snipeSettings->display_asset_name)
|
||||
<th class="col-md-3" bSortable="true">{{ trans('admin/hardware/form.name') }}</th>
|
||||
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/form.name') }}</th>
|
||||
@endif
|
||||
<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>
|
||||
<th class="col-md-3" data-sortable="true">{{ trans('admin/hardware/table.serial') }}</th>
|
||||
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/table.location') }}</th>
|
||||
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/table.status') }}</th>
|
||||
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
|
||||
<th class="col-md-1 actions" data-sortable="false">{{ trans('table.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -53,17 +62,30 @@
|
|||
<tr>
|
||||
<form action="{{route('account/request-item', ['itemType' => 'asset', 'itemId' => $asset->id])}}" method="POST" accept-charset="utf-8">
|
||||
{{ csrf_field() }}
|
||||
<td>{!! $asset->model->present()->nameUrl() !!}</td>
|
||||
<td>
|
||||
@if ($asset->getImageUrl())
|
||||
<a href="{{ $asset->getImageUrl() }}" data-toggle="lightbox" data-type="image">
|
||||
<img src="{{ $asset->getImageUrl() }}" style="max-height: {{ $snipeSettings->thumbnail_max_h }}px; width: auto;" class="img-responsive">
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</td>
|
||||
<td>{{ $asset->model->name }}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
{{ $asset->model->model_number }}
|
||||
</td>
|
||||
|
||||
@if ($snipeSettings->display_asset_name)
|
||||
<td>{{ $asset->name }}</td>
|
||||
@endif
|
||||
|
||||
<td><a href="{{ $asset->present()->viewUrl() }}">{{ $asset->serial }}</a></td>
|
||||
<td>{{ $asset->serial }}</td>
|
||||
|
||||
<td>
|
||||
@if ($asset->location)
|
||||
{!! $asset->location->present()->nameUrl() !!}
|
||||
{{ $asset->location->name }}
|
||||
@endif
|
||||
</td>
|
||||
@if ($asset->assigned_to != '' && $asset->assigned_to > 0)
|
||||
|
@ -106,13 +128,21 @@
|
|||
|
||||
@if ($models->count() > 0)
|
||||
<h4>Requestable Models</h4>
|
||||
<table class="table table-striped">
|
||||
<table
|
||||
name="requested-assets"
|
||||
data-toolbar="#toolbar"
|
||||
class="table table-striped snipe-table"
|
||||
id="table"
|
||||
data-advanced-search="true"
|
||||
data-id-table="advancedTable"
|
||||
data-cookie-id-table="requestableAssets">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="col-md-6" bSortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
|
||||
<th class="col-md-3" bSortable="true">{{ trans('admin/accessories/general.remaining') }}</th>
|
||||
<th class="col-md-2" bSortable="true">{{ trans('general.quantity') }}</th>
|
||||
<th class="col-md-1 actions" bSortable="false">{{ trans('table.actions') }}</th>
|
||||
<th class="col-md-1" data-sortable="true">{{ trans('general.image') }}</th>
|
||||
<th class="col-md-6" data-sortable="true">{{ trans('admin/hardware/table.asset_model') }}</th>
|
||||
<th class="col-md-3" data-sortable="true">{{ trans('admin/accessories/general.remaining') }}</th>
|
||||
<th class="col-md-2" data-sortable="true">{{ trans('general.quantity') }}</th>
|
||||
<th class="col-md-1 actions" data-sortable="false">{{ trans('table.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
@ -121,9 +151,18 @@
|
|||
<tr>
|
||||
<form action="{{route('account/request-item', ['itemType' => 'asset_model', 'itemId' => $requestableModel->id])}}"
|
||||
method="POST"
|
||||
accept-charset="utf-8"
|
||||
>
|
||||
accept-charset="utf-8">
|
||||
{{ csrf_field() }}
|
||||
<td>
|
||||
@if ($requestableModel->image)
|
||||
<a href="{{ url('/') }}/uploads/models/{{ $requestableModel->image }}" data-toggle="lightbox" data-type="image">
|
||||
<img src="{{ url('/') }}/uploads/models/{{ $requestableModel->image }}" style="max-height: {{ $snipeSettings->thumbnail_max_h }}px; width: auto;" class="img-responsive">
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td>{{$requestableModel->name}}</td>
|
||||
<td>{{$requestableModel->assets->where('requestable', '1')->count()}}</td>
|
||||
<td><input type="text" name="request-quantity" value=""></td>
|
||||
|
@ -158,7 +197,14 @@
|
|||
|
||||
|
||||
@section('moar_scripts')
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
@include ('partials.bootstrap-table', [
|
||||
'exportFile' => 'requested-export',
|
||||
'search' => true,
|
||||
'clientSearch' => true,
|
||||
])
|
||||
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
|
||||
$( "a[name='Request']").click(function(event) {
|
||||
// event.preventDefault();
|
||||
|
@ -169,3 +215,5 @@
|
|||
});
|
||||
</script>
|
||||
@stop
|
||||
|
||||
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
@extends('layouts/default')
|
||||
|
||||
@section('title0')
|
||||
{{ trans('admin/hardware/general.requested') }}
|
||||
{{ trans('general.assets') }}
|
||||
@stop
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
@yield('title0') @parent
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@if ($requestedItems->count() > 0)
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="col-md-1">Item Type</th>
|
||||
<th class="col-md-1">Item Name</th>
|
||||
<th class="col-md-1" bSortable="true">{{ trans('admin/hardware/table.location') }}</th>
|
||||
<th class="col-md-1" bSortable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
|
||||
<th class="col-md-1" bSortable="true">Requesting User</th>
|
||||
<th class="col-md-1">Requested Date</th>
|
||||
<th class="col-md-1 actions" bSortable="false">{{ trans('table.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($requestedItems as $request)
|
||||
<tr>
|
||||
<form action="#" method="POST" accept-charset="utf-8">
|
||||
{{ csrf_field() }}
|
||||
<td>{{ $request->itemType() }}</td>
|
||||
<td>{{ $request->name() }}</td>
|
||||
@if ($request->location())
|
||||
<td>{{ $request->location()->name }}</td>
|
||||
@else
|
||||
<td></td>
|
||||
@endif
|
||||
|
||||
<td>
|
||||
@if ($request->itemType() == "asset")
|
||||
{{ $request->itemRequested()->expected_checkin }}
|
||||
@else
|
||||
"N/A"
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $request->requestingUser()->present()->fullName() }}</td>
|
||||
<td>{{$request->created_at}}</td>
|
||||
<td>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@else
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-info alert-block">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
{{ trans('general.no_results') }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div> <!-- .col-md-12> -->
|
||||
</div> <!-- .row -->
|
||||
@stop
|
134
resources/views/hardware/requested.blade.php
Normal file
134
resources/views/hardware/requested.blade.php
Normal file
|
@ -0,0 +1,134 @@
|
|||
@extends('layouts/default')
|
||||
|
||||
@section('title0')
|
||||
{{ trans('admin/hardware/general.requested') }}
|
||||
{{ trans('general.assets') }}
|
||||
@stop
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
@yield('title0') @parent
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-body">
|
||||
{{ Form::open([
|
||||
'method' => 'POST',
|
||||
'route' => ['hardware/bulkedit'],
|
||||
'class' => 'form-inline',
|
||||
'id' => 'bulkForm']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@if ($requestedItems->count() > 0)
|
||||
<div class="table-responsive">
|
||||
<table
|
||||
name="requested-assets"
|
||||
data-toolbar="#toolbar"
|
||||
class="table table-striped snipe-table"
|
||||
id="table"
|
||||
data-advanced-search="true"
|
||||
data-id-table="advancedTable"
|
||||
data-cookie-id-table="requestedAssets">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="col-md-1">Image</th>
|
||||
<th class="col-md-2">Item Name</th>
|
||||
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/table.location') }}</th>
|
||||
<th class="col-md-2" data-sortable="true">{{ trans('admin/hardware/form.expected_checkin') }}</th>
|
||||
<th class="col-md-3" data-sortable="true">Requesting User</th>
|
||||
<th class="col-md-2">Requested Date</th>
|
||||
<th class="col-md-1"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($requestedItems as $request)
|
||||
<tr>
|
||||
{{ csrf_field() }}
|
||||
<td>
|
||||
@if ($request->itemType() == "asset")
|
||||
<a href="{{ $request->requestable->getImageUrl() }}" data-toggle="lightbox" data-type="image"><img src="{{ $request->requestable->getImageUrl() }}" style="max-height: {{ $snipeSettings->thumbnail_max_h }}px; width: auto;" class="img-responsive"></a>
|
||||
@else
|
||||
<a href="{{ url('/') }}/uploads/models/{{ $request->requestable->image }}" data-toggle="lightbox" data-type="image"><img src="{{ url('/') }}/uploads/models/{{ $request->requestable->image }}" style="max-height: {{ $snipeSettings->thumbnail_max_h }}px; width: auto;" class="img-responsive"></a>
|
||||
@endif
|
||||
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@if ($request->itemType() == "asset")
|
||||
<a href="{{ url('/') }}/hardware/{{ $request->requestable->id }}">
|
||||
{{ $request->name() }}
|
||||
</a>
|
||||
@elseif ($request->itemType() == "asset_model")
|
||||
<a href="{{ url('/') }}/models/{{ $request->requestable->id }}">
|
||||
{{ $request->name() }}
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</td>
|
||||
@if ($request->location())
|
||||
<td>{{ $request->location()->name }}</td>
|
||||
@else
|
||||
<td></td>
|
||||
@endif
|
||||
|
||||
<td>
|
||||
@if ($request->itemType() == "asset")
|
||||
{{ App\Helpers\Helper::getFormattedDateObject($request->requestable->expected_checkin, 'datetime', false) }}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url('/') }}/users/{{ $request->requestingUser()->id }}">
|
||||
{{ $request->requestingUser()->present()->fullName() }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ App\Helpers\Helper::getFormattedDateObject($request->created_at, 'datetime', false) }}</td>
|
||||
<td>
|
||||
@if ($request->itemType() == "asset")
|
||||
@if ($request->requestable->assigned_to=='')
|
||||
<a href="{{ url('/') }}/hardware/{{ $request->requestable->id }}/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="Check this item out to a user">{{ trans('general.checkout') }}</a>
|
||||
@else
|
||||
<a href="{{ url('/') }}/hardware/{{ $request->requestable->id }}/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="Check this itemi">{{ trans('general.checkin') }}</a>
|
||||
@endif
|
||||
|
||||
@endif
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@else
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-info alert-block">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
{{ trans('general.no_results') }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- .col-md-12> -->
|
||||
</div> <!-- .row -->
|
||||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
@include ('partials.bootstrap-table', [
|
||||
'exportFile' => 'requested-export',
|
||||
'search' => true,
|
||||
'clientSearch' => true,
|
||||
])
|
||||
|
||||
@stop
|
|
@ -397,13 +397,12 @@
|
|||
<a href="{{ route('hardware/bulkcheckout') }}">
|
||||
{{ trans('general.bulk_checkout') }}</a>
|
||||
</li>
|
||||
<li{!! (Request::is('hardware/requested') ? ' class="active>"' : '') !!}>
|
||||
<a href="{{ route('assets.requested') }}">
|
||||
{{ trans('general.requested') }}</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('view', \App\Models\Assetmodel::class)
|
||||
<li{!! (Request::is('hardware/models*') ? ' class="active"' : '') !!}><a href="{{ route('models.index') }}">@lang('general.asset_models')</a></li>
|
||||
@endcan
|
||||
@can('view', \App\Models\Category::class)
|
||||
<li><a href="{{ url('categories') }}" {!! (Request::is('settings/categories*') ? ' class="active"' : '') !!} >@lang('general.categories')</a></li>
|
||||
@endcan
|
||||
|
||||
@can('create', \App\Models\Asset::class)
|
||||
<li{!! (Request::query('Deleted') ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Deleted') }}">@lang('general.deleted')</a></li>
|
||||
<li><a href="{{ route('maintenances.index') }}">@lang('general.asset_maintenances') </a></li>
|
||||
|
|
|
@ -35,7 +35,9 @@
|
|||
@if ($model->id)
|
||||
<div class="box-header with-border">
|
||||
<div class="box-heading">
|
||||
<h3 class="box-title"> {{ $model->name }}</h3>
|
||||
<h3 class="box-title"> {{ $model->name }}
|
||||
{{ ($model->model_number) ? '(#'.$model->model_number.')' : '' }}
|
||||
</h3>
|
||||
</div>
|
||||
</div><!-- /.box-header -->
|
||||
@endif
|
||||
|
@ -67,8 +69,20 @@
|
|||
|
||||
<!-- side address column -->
|
||||
<div class="col-md-3">
|
||||
<h4>More Info:</h4>
|
||||
<ul class="list-unstyled">
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<div class="box-heading">
|
||||
<h3 class="box-title"> More Info:</h3>
|
||||
</div>
|
||||
</div><!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
|
||||
@if ($model->image)
|
||||
<img src="{{ url('/') }}/uploads/models/{{ $model->image }}" class="img-responsive"></li>
|
||||
@endif
|
||||
|
||||
|
||||
<ul class="list-unstyled" style="line-height: 25px;">
|
||||
@if ($model->manufacturer)
|
||||
<li>
|
||||
{{ trans('general.manufacturer') }}:
|
||||
|
@ -131,9 +145,7 @@
|
|||
</li>
|
||||
@endif
|
||||
|
||||
@if ($model->image)
|
||||
<li><br /><img src="{{ url('/') }}/uploads/models/{{ $model->image }}" class="img-responsive"></li>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($model->deleted_at!='')
|
||||
<li><br /><a href="{{ route('restore/model', $model->id) }}" class="btn-flat large info ">{{ trans('admin/models/general.restore') }}</a></li>
|
||||
|
@ -147,6 +159,9 @@
|
|||
</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ $('.snipe-table').bootstrapTable('destroy').bootstrapTable({
|
|||
|
||||
|
||||
paginationVAlign: 'both',
|
||||
sidePagination: 'server',
|
||||
sidePagination: '{{ (isset($clientSearch)) ? 'client' : 'server' }}',
|
||||
sortable: true,
|
||||
|
||||
|
||||
|
|
|
@ -187,8 +187,6 @@ Route::group([ 'prefix' => 'admin','middleware' => ['authorize:superuser']], fun
|
|||
});
|
||||
|
||||
|
||||
Route::get('requests', [ 'as' => 'requests', 'middleware' => 'authorize:admin', 'uses' => 'ViewAssetsController@getRequestedIndex']);
|
||||
|
||||
|
||||
Route::resource('groups', 'GroupsController', [
|
||||
'middleware' => ['auth'],
|
||||
|
|
|
@ -22,6 +22,8 @@ Route::group(
|
|||
'parameters' => ['maintenance' => 'maintenance_id', 'asset' => 'asset_id']
|
||||
]);
|
||||
|
||||
Route::get('requested', [ 'as' => 'assets.requested', 'uses' => 'AssetsController@getRequestedIndex']);
|
||||
|
||||
Route::get('scan', [
|
||||
'as' => 'asset.scan',
|
||||
'uses' => 'AssetsController@scan'
|
||||
|
|
Loading…
Add table
Reference in a new issue