Merge remote-tracking branch 'origin/develop'
This commit is contained in:
@@ -52,6 +52,8 @@ class AssetsController extends AdminController
|
||||
$assets->Requestable();
|
||||
} elseif (Input::get('Deployed')) {
|
||||
$assets->Deployed();
|
||||
} elseif (Input::get('Deleted')) {
|
||||
$assets->withTrashed()->Deleted();
|
||||
}
|
||||
|
||||
$assets = $assets->orderBy('asset_tag', 'ASC')->get();
|
||||
@@ -523,7 +525,7 @@ class AssetsController extends AdminController
|
||||
**/
|
||||
public function getView($assetId = null)
|
||||
{
|
||||
$asset = Asset::find($assetId);
|
||||
$asset = Asset::withTrashed()->find($assetId);
|
||||
|
||||
if (isset($asset->id)) {
|
||||
|
||||
@@ -542,7 +544,7 @@ class AssetsController extends AdminController
|
||||
$error = Lang::get('admin/hardware/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('assets')->with('error', $error);
|
||||
return Redirect::route('hardware')->with('error', $error);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -614,4 +616,28 @@ class AssetsController extends AdminController
|
||||
return View::make('backend/hardware/edit')->with('supplier_list',$supplier_list)->with('model_list',$model_list)->with('statuslabel_list',$statuslabel_list)->with('assigned_to',$assigned_to)->with('asset',$asset)->with('location_list',$location_list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getRestore($assetId = null)
|
||||
{
|
||||
|
||||
// Get user information
|
||||
$asset = Asset::withTrashed()->find($assetId);
|
||||
|
||||
if (isset($asset->id)) {
|
||||
|
||||
// Restore the user
|
||||
$asset->restore();
|
||||
|
||||
// Prepare the success message
|
||||
$success = Lang::get('admin/hardware/message.restore.success');
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('hardware')->with('success', $success);
|
||||
|
||||
} else {
|
||||
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.not_found'));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,12 +52,12 @@ class CategoriesController extends AdminController
|
||||
|
||||
// create a new model instance
|
||||
$category = new Category();
|
||||
|
||||
|
||||
$validator = Validator::make(Input::all(), $category->rules);
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
// The given data did not pass validation
|
||||
// The given data did not pass validation
|
||||
return Redirect::back()->withInput()->withErrors($validator->messages());
|
||||
}
|
||||
else{
|
||||
@@ -71,7 +71,7 @@ class CategoriesController extends AdminController
|
||||
// Redirect to the new category page
|
||||
return Redirect::to("admin/settings/categories")->with('success', Lang::get('admin/categories/message.create.success'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to the category create page
|
||||
return Redirect::to('admin/settings/categories/create')->with('error', Lang::get('admin/categories/message.create.error'));
|
||||
@@ -119,9 +119,9 @@ class CategoriesController extends AdminController
|
||||
// get the POST data
|
||||
$new = Input::all();
|
||||
|
||||
// attempt validation
|
||||
// attempt validation
|
||||
$validator = Validator::make(Input::all(), $category->validationRules($categoryId));
|
||||
|
||||
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
@@ -139,7 +139,7 @@ class CategoriesController extends AdminController
|
||||
// Redirect to the new category page
|
||||
return Redirect::to("admin/settings/categories")->with('success', Lang::get('admin/categories/message.update.success'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to the category management page
|
||||
return Redirect::to("admin/settings/categories/$categoryID/edit")->with('error', Lang::get('admin/categories/message.update.error'));
|
||||
@@ -179,7 +179,7 @@ class CategoriesController extends AdminController
|
||||
|
||||
|
||||
/**
|
||||
* Get the asset information to present to the model view page
|
||||
* Get the asset information to present to the category view page
|
||||
*
|
||||
* @param int $assetId
|
||||
* @return View
|
||||
|
||||
@@ -113,7 +113,7 @@ class ManufacturersController extends AdminController
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
// The given data did not pass validation
|
||||
// The given data did not pass validation
|
||||
return Redirect::back()->withInput()->withErrors($validator->messages());
|
||||
}
|
||||
// attempt validation
|
||||
@@ -126,7 +126,7 @@ class ManufacturersController extends AdminController
|
||||
// Redirect to the new manufacturer page
|
||||
return Redirect::to("admin/settings/manufacturers")->with('success', Lang::get('admin/manufacturers/message.update.success'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to the manufacturer management page
|
||||
return Redirect::to("admin/settings/manufacturers/$manufacturerId/edit")->with('error', Lang::get('admin/manufacturers/message.update.error'));
|
||||
@@ -169,5 +169,30 @@ class ManufacturersController extends AdminController
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the asset information to present to the category view page
|
||||
*
|
||||
* @param int $assetId
|
||||
* @return View
|
||||
**/
|
||||
public function getView($manufacturerID = null)
|
||||
{
|
||||
$manufacturer = Manufacturer::find($manufacturerID);
|
||||
|
||||
if (isset($manufacturer->id)) {
|
||||
return View::make('backend/manufacturers/view', compact('manufacturer'));
|
||||
} else {
|
||||
// Prepare the error message
|
||||
$error = Lang::get('admin/manufacturers/message.does_not_exist', compact('id'));
|
||||
|
||||
// Redirect to the user management page
|
||||
return Redirect::route('manufacturers')->with('error', $error);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ return array(
|
||||
'checkout' => 'Checkout Asset to User',
|
||||
'clone' => 'Clone Asset',
|
||||
'deployable' => 'Deployable',
|
||||
'deleted' => 'This asset has been deleted. <a href="/hardware/:asset_id/restore">Click here to restore it</a>.',
|
||||
'edit' => 'Edit Asset',
|
||||
'requestable' => 'Requestable',
|
||||
'restore' => 'Restore Asset',
|
||||
'pending' => 'Pending',
|
||||
'undeployable' => 'Undeployable',
|
||||
'view' => 'View Asset',
|
||||
|
||||
@@ -17,6 +17,11 @@ return array(
|
||||
'success' => 'Asset updated successfully.'
|
||||
),
|
||||
|
||||
'restore' => array(
|
||||
'error' => 'Asset was not restored, please try again',
|
||||
'success' => 'Asset restored successfully.'
|
||||
),
|
||||
|
||||
'delete' => array(
|
||||
'confirm' => 'Are you sure you wish to delete this asset?',
|
||||
'error' => 'There was an issue deleting the asset. Please try again.',
|
||||
|
||||
@@ -328,4 +328,17 @@ class Asset extends Elegant
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Query builder scope for Deleted assets
|
||||
*
|
||||
* @param Illuminate\Database\Query\Builder $query Query builder instance
|
||||
* @return Illuminate\Database\Query\Builder Modified query builder
|
||||
*/
|
||||
|
||||
public function scopeDeleted($query)
|
||||
{
|
||||
return $query->whereNotNull('deleted_at');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,4 +15,15 @@ class Manufacturer extends Elegant
|
||||
{
|
||||
return $this->hasMany('Model', 'manufacturer_id')->count();
|
||||
}
|
||||
|
||||
public function assetscount()
|
||||
{
|
||||
return $this->hasManyThrough('Asset', 'Model')->count();
|
||||
}
|
||||
|
||||
public function assets()
|
||||
{
|
||||
return $this->hasManyThrough('Asset', 'Model');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ Route::group(array('prefix' => 'hardware', 'namespace' => 'Controllers\Admin', '
|
||||
Route::post('{assetId}/checkin', 'AssetsController@postCheckin');
|
||||
Route::get('{assetId}/view', array('as' => 'view/hardware', 'uses' => 'AssetsController@getView'));
|
||||
Route::get('{assetId}/qr_code', array('as' => 'qr_code/hardware', 'uses' => 'AssetsController@getQrCode'));
|
||||
Route::get('{assetId}/restore', array('as' => 'restore/hardware', 'uses' => 'AssetsController@getRestore'));
|
||||
|
||||
|
||||
# Asset Model Management
|
||||
@@ -114,6 +115,7 @@ Route::group(array('prefix' => 'admin', 'before' => 'admin-auth', 'namespace' =>
|
||||
Route::get('{manufacturerId}/edit', array('as' => 'update/manufacturer', 'uses' => 'ManufacturersController@getEdit'));
|
||||
Route::post('{manufacturerId}/edit', 'ManufacturersController@postEdit');
|
||||
Route::get('{manufacturerId}/delete', array('as' => 'delete/manufacturer', 'uses' => 'ManufacturersController@getDelete'));
|
||||
Route::get('{manufacturerId}/view', array('as' => 'view/manufacturer', 'uses' => 'ManufacturersController@getView'));
|
||||
});
|
||||
|
||||
# Suppliers
|
||||
|
||||
@@ -20,12 +20,13 @@
|
||||
<div class="row profile">
|
||||
<div class="col-md-9 bio">
|
||||
|
||||
<table id="example">
|
||||
<div class="table-responsive">
|
||||
<table id="example">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="col-md-5">@lang('admin/categories/table.title')</th>
|
||||
<th class="col-md-5 actions">@lang('general.assets')</th>
|
||||
<th class="col-md-2 actions">@lang('table.actions')</th>
|
||||
<th class="col-md-5" bSortable="true">@lang('admin/categories/table.title')</th>
|
||||
<th class="col-md-5" bSortable="true">@lang('general.assets')</th>
|
||||
<th class="col-md-2 actions" bSortable="true">@lang('table.actions')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -47,6 +48,7 @@ data-title="@lang('general.delete')
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- side address column -->
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
<div class="user-profile">
|
||||
<div class="row profile">
|
||||
<div class="col-md-9 bio">
|
||||
<div class="col-md-12 bio">
|
||||
|
||||
|
||||
<!-- checked out categories table -->
|
||||
@@ -88,40 +88,4 @@
|
||||
</div>
|
||||
|
||||
|
||||
<!-- side address column -->
|
||||
<div class="col-md-3 col-xs-12 address pull-right">
|
||||
<h6>More Info:</h6>
|
||||
<ul>
|
||||
|
||||
|
||||
@if ($category->manufacturer)
|
||||
<li>@lang('general.manufacturer'):
|
||||
{{ $category->manufacturer->name }}</li>
|
||||
@endif
|
||||
|
||||
@if ($category->modelno)
|
||||
<li>@lang('general.model_no'):
|
||||
{{ $category->modelno }}</li>
|
||||
@endif
|
||||
|
||||
@if ($category->depreciation)
|
||||
<li>@lang('general.depreciation'):
|
||||
{{ $category->depreciation->name }} ({{ $category->depreciation->months }}
|
||||
@lang('general.months')
|
||||
)</li>
|
||||
@endif
|
||||
|
||||
@if ($category->eol)
|
||||
<li>@lang('general.eol'):
|
||||
{{ $category->eol }}
|
||||
@lang('general.months')</li>
|
||||
@endif
|
||||
|
||||
@if ($category->image)
|
||||
<li><br /><img src="/uploads/models/{{{ $category->image }}}" /></li>
|
||||
@endif
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@extends('backend/layouts/default')
|
||||
|
||||
@section('title0')
|
||||
@if (Input::get('Pending') || Input::get('Undeployable') || Input::get('Requestable') || Input::get('RTD') || Input::get('Deployed') || Input::get('Archived'))
|
||||
@if (Input::get('Pending') || Input::get('Undeployable') || Input::get('Deleted') || Input::get('Requestable') || Input::get('RTD') || Input::get('Deployed') || Input::get('Archived'))
|
||||
@if (Input::get('Pending'))
|
||||
@lang('general.pending')
|
||||
@elseif (Input::get('RTD'))
|
||||
@@ -14,6 +14,8 @@
|
||||
@lang('admin/hardware/general.requestable')
|
||||
@elseif (Input::get('Archived'))
|
||||
@lang('general.archived')
|
||||
@elseif (Input::get('Deleted'))
|
||||
@lang('general.deleted')
|
||||
@endif
|
||||
@else
|
||||
@lang('general.all')
|
||||
@@ -132,7 +134,7 @@
|
||||
@endif
|
||||
|
||||
<td>
|
||||
@if ($asset->assetstatus->deployable == 1 )
|
||||
@if (($asset->assetstatus->deployable == 1 ) && ($asset->deleted_at==''))
|
||||
@if (($asset->assigned_to !='') && ($asset->assigned_to > 0))
|
||||
<a href="{{ route('checkin/hardware', $asset->id) }}" class="btn btn-primary">@lang('general.checkin')</a>
|
||||
@else
|
||||
@@ -142,9 +144,15 @@
|
||||
</td>
|
||||
<td nowrap="nowrap">
|
||||
<a href="{{ route('update/hardware', $asset->id) }}" class="btn btn-warning"><i class="icon-pencil icon-white"></i></a>
|
||||
<a data-html="false" class="btn delete-asset btn-danger" data-toggle="modal" href="{{ route('delete/hardware', $asset->id) }}" data-content="@lang('admin/hardware/message.delete.confirm')"
|
||||
|
||||
@if ($asset->deleted_at=='')
|
||||
<a data-html="false" class="btn delete-asset btn-danger" data-toggle="modal" href="{{ route('delete/hardware', $asset->id) }}" data-content="@lang('admin/hardware/message.delete.confirm')"
|
||||
data-title="@lang('general.delete')
|
||||
{{ htmlspecialchars($asset->asset_tag) }}?" onClick="return false;"><i class="icon-trash icon-white"></i></a>
|
||||
@else
|
||||
<a href="{{ route('restore/hardware', $asset->id) }}" class="btn btn-warning"><i class="icon-share-alt icon-white"></i></a>
|
||||
@endif
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@@ -47,6 +47,14 @@
|
||||
<div class="row profile">
|
||||
<div class="col-md-9 bio">
|
||||
|
||||
@if ($asset->deleted_at!='')
|
||||
<div class="alert alert-warning alert-block">
|
||||
<i class="icon-warning-sign"></i>
|
||||
@lang('admin/hardware/general.deleted', array('asset_id' => $asset->id))
|
||||
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
@if ($asset->serial)
|
||||
<div class="col-md-12" style="padding-bottom: 5px;"><strong>@lang('admin/hardware/form.serial'): </strong>
|
||||
@@ -252,7 +260,7 @@
|
||||
</p>
|
||||
@endif
|
||||
|
||||
@if ((isset($asset->assigneduser) && ($asset->assigned_to > 0)))
|
||||
@if ((isset($asset->assigneduser) && ($asset->assigned_to > 0)) && ($asset->deleted_at==''))
|
||||
<h6><br>@lang('admin/hardware/form.checkedout_to')</h6>
|
||||
<ul>
|
||||
|
||||
@@ -293,11 +301,13 @@
|
||||
@lang('admin/hardware/general.asset')</h6>
|
||||
|
||||
<ul>
|
||||
@if (($asset->assetstatus->deployable=='1') && ($asset->assigned_to > 0))
|
||||
@if (($asset->assetstatus->deployable=='1') && ($asset->assigned_to > 0) && ($asset->deleted_at==''))
|
||||
<li><br /><a href="{{ route('checkin/hardware', $asset->id) }}" class="btn-flat large info ">@lang('admin/hardware/general.checkin')</a></li>
|
||||
@elseif (($asset->assetstatus->deployable=='1') && (($asset->assigned_to=='') || ($asset->assigned_to==0)))
|
||||
@elseif ((($asset->assetstatus->deployable=='1') && (($asset->assigned_to=='') || ($asset->assigned_to==0))) && ($asset->deleted_at==''))
|
||||
<li><br /><a href="{{ route('checkout/hardware', $asset->id) }}" class="btn-flat large info ">@lang('admin/hardware/general.checkout')</a></li>
|
||||
@elseif ($asset->deleted_at!='')
|
||||
|
||||
<li><br /><a href="{{ route('restore/hardware', $asset->id) }}" class="btn-flat large info ">@lang('admin/hardware/general.restore')</a></li>
|
||||
|
||||
@endif
|
||||
</ul>
|
||||
|
||||
@@ -243,11 +243,13 @@
|
||||
<li><a href="{{ URL::to('hardware?Undeployable=true') }}" {{{ (Request::query('Undeployable') ? ' class="active"' : '') }}} >@lang('general.undeployable')</a></li>
|
||||
<li><a href="{{ URL::to('hardware?Archived=true') }}" {{{ (Request::query('Archived') ? ' class="active"' : '') }}} >@lang('admin/hardware/general.archived')</a></li>
|
||||
<li><a href="{{ URL::to('hardware?Requestable=true') }}" {{{ (Request::query('Requestable') ? ' class="active"' : '') }}} >@lang('admin/hardware/general.requestable')</a></li>
|
||||
|
||||
<li><a href="{{ URL::to('hardware') }}">@lang('general.list_all')</a></li>
|
||||
|
||||
<li class="divider"> </li>
|
||||
<li><a href="{{ URL::to('hardware/models') }}" {{{ (Request::is('hardware/models*') ? ' class="active"' : '') }}} >@lang('general.asset_models')</a></li>
|
||||
<li><a href="{{ URL::to('admin/settings/categories') }}" {{{ (Request::is('admin/settings/categories*') ? ' class="active"' : '') }}} >@lang('general.categories')</a></li>
|
||||
<li><a href="{{ URL::to('hardware?Deleted=true') }}" {{{ (Request::query('Deleted') ? ' class="active"' : '') }}} >@lang('general.deleted')</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
<div class="col-md-9 bio">
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="example">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="col-md-7">@lang('admin/manufacturers/table.name')</th>
|
||||
<th class="col-md-7" bSortable="true">@lang('admin/manufacturers/table.name')</th>
|
||||
<th bSortable="true">@lang('general.assets')</th>
|
||||
<th class="col-md-2 actions">@lang('table.actions')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -32,6 +34,7 @@
|
||||
@foreach ($manufacturers as $manufacturer)
|
||||
<tr>
|
||||
<td>{{{ $manufacturer->name }}}</td>
|
||||
<td><a href="{{ route('view/manufacturer',$manufacturer->id) }}">{{ $manufacturer->assetscount() }}</a></td>
|
||||
<td>
|
||||
|
||||
<a href="{{ route('update/manufacturer', $manufacturer->id) }}" class="btn btn-warning"><i class="icon-pencil icon-white"></i></a>
|
||||
@@ -45,6 +48,7 @@
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- side address column -->
|
||||
|
||||
92
app/views/backend/manufacturers/view.blade.php
Normal file
92
app/views/backend/manufacturers/view.blade.php
Normal file
@@ -0,0 +1,92 @@
|
||||
@extends('backend/layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
|
||||
{{{ $manufacturer->name }}}
|
||||
@lang('general.manufacturer') ::
|
||||
@parent
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
|
||||
<div class="row header">
|
||||
<div class="col-md-12">
|
||||
<div class="btn-group pull-right">
|
||||
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">@lang('button.actions')
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ route('update/model', $manufacturer->id) }}">@lang('admin/categories/table.edit')</a></li>
|
||||
<li><a href="{{ route('clone/model', $manufacturer->id) }}">@lang('admin/categories/table.clone')</a></li>
|
||||
<li><a href="{{ route('create/hardware', $manufacturer->id) }}">@lang('admin/hardware/form.create')</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3>
|
||||
{{{ $manufacturer->name }}}
|
||||
@lang('general.manufacturer')
|
||||
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="user-profile">
|
||||
<div class="row profile">
|
||||
<div class="col-md-12 bio">
|
||||
|
||||
|
||||
<!-- checked out categories table -->
|
||||
@if (count($manufacturer->assets) > 0)
|
||||
<table id="example">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="col-md-3">@lang('general.name')</th>
|
||||
<th class="col-md-3">@lang('general.asset_tag')</th>
|
||||
<th class="col-md-3">@lang('general.user')</th>
|
||||
<th class="col-md-2">@lang('table.actions')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@foreach ($manufacturer->assets as $modelassets)
|
||||
<tr>
|
||||
<td><a href="{{ route('view/hardware', $modelassets->id) }}">{{{ $modelassets->name }}}</a></td>
|
||||
<td><a href="{{ route('view/hardware', $modelassets->id) }}">{{{ $modelassets->asset_tag }}}</a></td>
|
||||
<td>
|
||||
@if ($modelassets->assigneduser)
|
||||
<a href="{{ route('view/user', $modelassets->assigned_to) }}">
|
||||
{{{ $modelassets->assigneduser->fullName() }}}
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($modelassets->assigned_to != 0)
|
||||
<a href="{{ route('checkin/hardware', $modelassets->id) }}" class="btn-flat info">Checkin</a>
|
||||
@else
|
||||
<a href="{{ route('checkout/hardware', $modelassets->id) }}" class="btn-flat success">Checkout</a>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@else
|
||||
<div class="col-md-9">
|
||||
<div class="alert alert-info alert-block">
|
||||
<i class="icon-info-sign"></i>
|
||||
@lang('general.no_results')
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@stop
|
||||
Reference in New Issue
Block a user