Force Model Restore before Asset Restore

This commit is contained in:
madd15
2015-02-27 07:33:48 +10:30
parent 62cb1daefd
commit 15a7e205be
3 changed files with 12 additions and 8 deletions
+4 -4
View File
@@ -252,17 +252,17 @@ class ModelsController extends AdminController
if (isset($model->id)) {
// Restore the user
// Restore the model
$model->restore();
// Prepare the success message
$success = Lang::get('admin/models/message.restore.success');
// Redirect to the user management page
return Redirect::to('hardware/models')->with('success', $success);
// Redirect back
return Redirect::back()->with('success', $success);
} else {
return Redirect::to('hardware/models')->with('error', Lang::get('admin/models/message.not_found'));
return Redirect::back()->with('error', Lang::get('admin/models/message.not_found'));
}
}
+1
View File
@@ -9,6 +9,7 @@ return array(
'deployable' => 'Deployable',
'deleted' => 'This asset has been deleted. <a href="/hardware/:asset_id/restore">Click here to restore it</a>.',
'edit' => 'Edit Asset',
'model_deleted' => 'This Assets model has been deleted. You must restore the model before you can restore the Asset.<br/> <a href="/hardware/models/:model_id/restore">Click here to restore the model</a>.',
'requestable' => 'Requestable',
'restore' => 'Restore Asset',
'pending' => 'Pending',
+7 -4
View File
@@ -47,13 +47,16 @@
<div class="row profile">
<div class="col-md-9 bio">
@if ($asset->deleted_at!='')
@if ($asset->model->deleted_at!='')
<div class="alert alert-warning alert-block">
<i class="fa fa-warning"></i>
@lang('admin/hardware/general.model_deleted', array('model_id' => $asset->model->id))
</div>
@elseif ($asset->deleted_at!='')
<div class="alert alert-warning alert-block">
<i class="fa fa-warning"></i>
@lang('admin/hardware/general.deleted', array('asset_id' => $asset->id))
</div>
@endif
@if ($asset->serial)
@@ -375,7 +378,7 @@
<li><br /><a href="{{ route('checkin/hardware', $asset->id) }}" class="btn btn-primary btn-sm">@lang('admin/hardware/general.checkin')</a></li>
@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 btn-info btn-sm">@lang('admin/hardware/general.checkout')</a></li>
@elseif ($asset->deleted_at!='')
@elseif (($asset->deleted_at!='') && ($asset->model->deleted_at==''))
<li><br /><a href="{{ route('restore/hardware', $asset->id) }}" class="btn-flat large info ">@lang('admin/hardware/general.restore')</a></li>